Profile.template.php 126 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. // Template for the profile side bar - goes before any other profile template.
  13. function template_profile_above()
  14. {
  15. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  16. echo '
  17. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/profile.js"></script>';
  18. // Prevent Chrome from auto completing fields when viewing/editing other members profiles
  19. if (isBrowser('is_chrome') && !$context['user']['is_owner'])
  20. echo '
  21. <script type="text/javascript"><!-- // --><![CDATA[
  22. disableAutoComplete();
  23. // ]]></script>';
  24. // If an error occurred while trying to save previously, give the user a clue!
  25. if (!empty($context['post_errors']))
  26. echo '
  27. ', template_error_message();
  28. // If the profile was update successfully, let the user know this.
  29. if (!empty($context['profile_updated']))
  30. echo '
  31. <div class="infobox">
  32. ', $context['profile_updated'], '
  33. </div>';
  34. }
  35. // Template for closing off table started in profile_above.
  36. function template_profile_below()
  37. {
  38. }
  39. // This template displays users details without any option to edit them.
  40. function template_summary()
  41. {
  42. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  43. // Display the basic information about the user
  44. echo '
  45. <div id="profileview" class="flow_auto">
  46. <div class="cat_bar">
  47. <h3 class="catbg">
  48. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['summary'], '</span>
  49. </h3>
  50. </div>
  51. <div id="basicinfo">
  52. <div class="windowbg">
  53. <span class="topslice"><span></span></span>
  54. <div class="content flow_auto">
  55. <div class="username"><h4>', $context['member']['name'], ' <span class="position">', (!empty($context['member']['group']) ? $context['member']['group'] : $context['member']['post_group']), '</span></h4></div>
  56. ', $context['member']['avatar']['image'], '
  57. <ul class="reset">';
  58. // What about if we allow email only via the forum??
  59. if ($context['member']['show_email'] === 'yes' || $context['member']['show_email'] === 'no_through_forum' || $context['member']['show_email'] === 'yes_permission_override')
  60. echo '
  61. <li><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '" title="', $context['member']['show_email'] == 'yes' || $context['member']['show_email'] == 'yes_permission_override' ? $context['member']['email'] : '', '" rel="nofollow"><img src="', $settings['images_url'], '/email_sm.png" alt="', $txt['email'], '" /></a></li>';
  62. // Don't show an icon if they haven't specified a website.
  63. if ($context['member']['website']['url'] !== '' && !isset($context['disabled_fields']['website']))
  64. echo '
  65. <li><a href="', $context['member']['website']['url'], '" title="' . $context['member']['website']['title'] . '" target="_blank" class="new_win">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/www_sm.png" alt="' . $context['member']['website']['title'] . '" />' : $txt['www']), '</a></li>';
  66. // Are there any custom profile fields for the summary?
  67. if (!empty($context['custom_fields']))
  68. {
  69. foreach ($context['custom_fields'] as $field)
  70. if (($field['placement'] == 1 || empty($field['output_html'])) && !empty($field['value']))
  71. echo '
  72. <li class="custom_field">', $field['output_html'], '</li>';
  73. }
  74. echo '
  75. ', !isset($context['disabled_fields']['icq']) && !empty($context['member']['icq']['link']) ? '<li>' . $context['member']['icq']['link'] . '</li>' : '', '
  76. ', !isset($context['disabled_fields']['msn']) && !empty($context['member']['msn']['link']) ? '<li>' . $context['member']['msn']['link'] . '</li>' : '', '
  77. ', !isset($context['disabled_fields']['aim']) && !empty($context['member']['aim']['link']) ? '<li>' . $context['member']['aim']['link'] . '</li>' : '', '
  78. ', !isset($context['disabled_fields']['yim']) && !empty($context['member']['yim']['link']) ? '<li>' . $context['member']['yim']['link'] . '</li>' : '', '
  79. </ul>
  80. <span id="userstatus">', $context['can_send_pm'] ? '<a href="' . $context['member']['online']['href'] . '" title="' . $context['member']['online']['label'] . '" rel="nofollow">' : '', $settings['use_image_buttons'] ? '<img src="' . $context['member']['online']['image_href'] . '" alt="' . $context['member']['online']['text'] . '" align="middle" />' : $context['member']['online']['text'], $context['can_send_pm'] ? '</a>' : '', $settings['use_image_buttons'] ? '<span class="smalltext"> ' . $context['member']['online']['text'] . '</span>' : '';
  81. // Can they add this member as a buddy?
  82. if (!empty($context['can_have_buddy']) && !$context['user']['is_owner'])
  83. echo '
  84. <br /><a href="', $scripturl, '?action=buddy;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">[', $txt['buddy_' . ($context['member']['is_buddy'] ? 'remove' : 'add')], ']</a>';
  85. echo '
  86. </span>';
  87. echo '
  88. <p id="infolinks">';
  89. if (!$context['user']['is_owner'] && $context['can_send_pm'])
  90. echo '
  91. <a href="', $scripturl, '?action=pm;sa=send;u=', $context['id_member'], '">', $txt['profile_sendpm_short'], '</a><br />';
  92. echo '
  93. <a href="', $scripturl, '?action=profile;area=showposts;u=', $context['id_member'], '">', $txt['showPosts'], '</a><br />
  94. <a href="', $scripturl, '?action=profile;area=statistics;u=', $context['id_member'], '">', $txt['statPanel'], '</a>
  95. </p>';
  96. echo '
  97. </div>
  98. <span class="botslice"><span></span></span>
  99. </div>
  100. </div>
  101. <div id="detailedinfo">
  102. <div class="windowbg2">
  103. <span class="topslice"><span></span></span>
  104. <div class="content">
  105. <dl>';
  106. if ($context['user']['is_owner'] || $context['user']['is_admin'])
  107. echo '
  108. <dt>', $txt['username'], ': </dt>
  109. <dd>', $context['member']['username'], '</dd>';
  110. if (!isset($context['disabled_fields']['posts']))
  111. echo '
  112. <dt>', $txt['profile_posts'], ': </dt>
  113. <dd>', $context['member']['posts'], ' (', $context['member']['posts_per_day'], ' ', $txt['posts_per_day'], ')</dd>';
  114. // Only show the email address fully if it's not hidden - and we reveal the email.
  115. if ($context['member']['show_email'] == 'yes')
  116. echo '
  117. <dt>', $txt['email'], ': </dt>
  118. <dd><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></dd>';
  119. // ... Or if the one looking at the profile is an admin they can see it anyway.
  120. elseif ($context['member']['show_email'] == 'yes_permission_override')
  121. echo '
  122. <dt>', $txt['email'], ': </dt>
  123. <dd><em><a href="', $scripturl, '?action=emailuser;sa=email;uid=', $context['member']['id'], '">', $context['member']['email'], '</a></em></dd>';
  124. if (!empty($modSettings['titlesEnable']) && !empty($context['member']['title']))
  125. echo '
  126. <dt>', $txt['custom_title'], ': </dt>
  127. <dd>', $context['member']['title'], '</dd>';
  128. if (!empty($context['member']['blurb']))
  129. echo '
  130. <dt>', $txt['personal_text'], ': </dt>
  131. <dd>', $context['member']['blurb'], '</dd>';
  132. // If karma enabled show the members karma.
  133. if ($modSettings['karmaMode'] == '1')
  134. echo '
  135. <dt>', $modSettings['karmaLabel'], ' </dt>
  136. <dd>', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</dd>';
  137. elseif ($modSettings['karmaMode'] == '2')
  138. echo '
  139. <dt>', $modSettings['karmaLabel'], ' </dt>
  140. <dd>+', $context['member']['karma']['good'], '/-', $context['member']['karma']['bad'], '</dd>';
  141. if (!isset($context['disabled_fields']['gender']) && !empty($context['member']['gender']['name']))
  142. echo '
  143. <dt>', $txt['gender'], ': </dt>
  144. <dd>', $context['member']['gender']['name'], '</dd>';
  145. echo '
  146. <dt>', $txt['age'], ':</dt>
  147. <dd>', $context['member']['age'] . ($context['member']['today_is_birthday'] ? ' &nbsp; <img src="' . $settings['images_url'] . '/cake.png" alt="" />' : ''), '</dd>';
  148. if (!isset($context['disabled_fields']['location']) && !empty($context['member']['location']))
  149. echo '
  150. <dt>', $txt['location'], ':</dt>
  151. <dd>', $context['member']['location'], '</dd>';
  152. echo '
  153. </dl>';
  154. // Any custom fields for standard placement?
  155. if (!empty($context['custom_fields']))
  156. {
  157. $shown = false;
  158. foreach ($context['custom_fields'] as $field)
  159. {
  160. if ($field['placement'] != 0 || empty($field['output_html']))
  161. continue;
  162. if (empty($shown))
  163. {
  164. echo '
  165. <dl>';
  166. $shown = true;
  167. }
  168. echo '
  169. <dt>', $field['name'], ':</dt>
  170. <dd>', $field['output_html'], '</dd>';
  171. }
  172. if (!empty($shown))
  173. echo '
  174. </dl>';
  175. }
  176. echo '
  177. <dl class="noborder">';
  178. // Can they view/issue a warning?
  179. if ($context['can_view_warning'] && $context['member']['warning'])
  180. {
  181. echo '
  182. <dt>', $txt['profile_warning_level'], ': </dt>
  183. <dd>
  184. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=', $context['can_issue_warning'] ? 'issuewarning' : 'viewwarning', '">', $context['member']['warning'], '%</a>';
  185. // Can we provide information on what this means?
  186. if (!empty($context['warning_status']))
  187. echo '
  188. <span class="smalltext">(', $context['warning_status'], ')</span>';
  189. echo '
  190. </dd>';
  191. }
  192. // Is this member requiring activation and/or banned?
  193. if (!empty($context['activate_message']) || !empty($context['member']['bans']))
  194. {
  195. // If the person looking at the summary has permission, and the account isn't activated, give the viewer the ability to do it themselves.
  196. if (!empty($context['activate_message']))
  197. echo '
  198. <dt class="clear"><span class="alert">', $context['activate_message'], '</span>&nbsp;(<a href="' . $scripturl . '?action=profile;save;area=activateaccount;u=' . $context['id_member'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '"', ($context['activate_type'] == 4 ? ' onclick="return confirm(\'' . $txt['profileConfirm'] . '\');"' : ''), '>', $context['activate_link_text'], '</a>)</dt>';
  199. // If the current member is banned, show a message and possibly a link to the ban.
  200. if (!empty($context['member']['bans']))
  201. {
  202. echo '
  203. <dt class="clear"><span class="alert">', $txt['user_is_banned'], '</span>&nbsp;[<a href="#" onclick="document.getElementById(\'ban_info\').style.display = document.getElementById(\'ban_info\').style.display == \'none\' ? \'\' : \'none\';return false;">' . $txt['view_ban'] . '</a>]</dt>
  204. <dt class="clear" id="ban_info" style="display: none;">
  205. <strong>', $txt['user_banned_by_following'], ':</strong>';
  206. foreach ($context['member']['bans'] as $ban)
  207. echo '
  208. <br /><span class="smalltext">', $ban['explanation'], '</span>';
  209. echo '
  210. </dt>';
  211. }
  212. }
  213. echo '
  214. <dt>', $txt['date_registered'], ': </dt>
  215. <dd>', $context['member']['registered'], '</dd>';
  216. // If the person looking is allowed, they can check the members IP address and hostname.
  217. if ($context['can_see_ip'])
  218. {
  219. if (!empty($context['member']['ip']))
  220. echo '
  221. <dt>', $txt['ip'], ': </dt>
  222. <dd><a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['member']['ip'], ';u=', $context['member']['id'], '">', $context['member']['ip'], '</a></dd>';
  223. if (empty($modSettings['disableHostnameLookup']) && !empty($context['member']['ip']))
  224. echo '
  225. <dt>', $txt['hostname'], ': </dt>
  226. <dd>', $context['member']['hostname'], '</dd>';
  227. }
  228. echo '
  229. <dt>', $txt['local_time'], ':</dt>
  230. <dd>', $context['member']['local_time'], '</dd>';
  231. if (!empty($modSettings['userLanguage']) && !empty($context['member']['language']))
  232. echo '
  233. <dt>', $txt['language'], ':</dt>
  234. <dd>', $context['member']['language'], '</dd>';
  235. echo '
  236. <dt>', $txt['lastLoggedIn'], ': </dt>
  237. <dd>', $context['member']['last_login'], '</dd>
  238. </dl>';
  239. // Are there any custom profile fields for the summary?
  240. if (!empty($context['custom_fields']))
  241. {
  242. $shown = false;
  243. foreach ($context['custom_fields'] as $field)
  244. {
  245. if ($field['placement'] != 2 || empty($field['output_html']))
  246. continue;
  247. if (empty($shown))
  248. {
  249. $shown = true;
  250. echo '
  251. <div class="custom_fields_above_signature">
  252. <ul class="reset nolist">';
  253. }
  254. echo '
  255. <li>', $field['output_html'], '</li>';
  256. }
  257. if ($shown)
  258. echo '
  259. </ul>
  260. </div>';
  261. }
  262. // Show the users signature.
  263. if ($context['signature_enabled'] && !empty($context['member']['signature']))
  264. echo '
  265. <div class="signature">
  266. <h5>', $txt['signature'], ':</h5>
  267. ', $context['member']['signature'], '
  268. </div>';
  269. echo '
  270. </div>
  271. <span class="botslice"><span></span></span>
  272. </div>
  273. </div>
  274. <div class="clear"></div>
  275. </div>';
  276. }
  277. // Template for showing all the posts of the user, in chronological order.
  278. function template_showPosts()
  279. {
  280. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  281. echo '
  282. <div class="cat_bar">
  283. <h3 class="catbg">
  284. ', (!isset($context['attachments']) && empty($context['is_topics']) ? $txt['showMessages'] : (!empty($context['is_topics']) ? $txt['showTopics'] : $txt['showAttachments'])), ' - ', $context['member']['name'], '
  285. </h3>
  286. </div>
  287. <div class="pagesection">
  288. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  289. </div>';
  290. // Button shortcuts
  291. $quote_button = create_button('quote.png', 'reply_quote', 'quote', 'align="middle"');
  292. $reply_button = create_button('reply_sm.png', 'reply', 'reply', 'align="middle"');
  293. $remove_button = create_button('delete.png', 'remove_message', 'remove', 'align="middle"');
  294. $notify_button = create_button('notify_sm.png', 'notify_replies', 'notify', 'align="middle"');
  295. // Are we displaying posts or attachments?
  296. if (!isset($context['attachments']))
  297. {
  298. // For every post to be displayed, give it its own div, and show the important details of the post.
  299. foreach ($context['posts'] as $post)
  300. {
  301. echo '
  302. <div class="topic">
  303. <div class="', $post['alternate'] == 0 ? 'windowbg2' : 'windowbg', ' core_posts">
  304. <span class="topslice"><span></span></span>
  305. <div class="content">
  306. <div class="counter">', $post['counter'], '</div>
  307. <div class="topic_details">
  308. <h5><strong><a href="', $scripturl, '?board=', $post['board']['id'], '.0">', $post['board']['name'], '</a> / <a href="', $scripturl, '?topic=', $post['topic'], '.', $post['start'], '#msg', $post['id'], '">', $post['subject'], '</a></strong></h5>
  309. <span class="smalltext">&#171;&nbsp;<strong>', $txt['on'], ':</strong> ', $post['time'], '&nbsp;&#187;</span>
  310. </div>
  311. <div class="list_posts">';
  312. if (!$post['approved'])
  313. echo '
  314. <div class="approve_post">
  315. <em>', $txt['post_awaiting_approval'], '</em>
  316. </div>';
  317. echo '
  318. ', $post['body'], '
  319. </div>
  320. </div>';
  321. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  322. echo '
  323. <div class="floatright">
  324. <ul class="reset smalltext quickbuttons">';
  325. // If they *can* reply?
  326. if ($post['can_reply'])
  327. echo '
  328. <li class="reply_button"><a href="', $scripturl, '?action=post;topic=', $post['topic'], '.', $post['start'], '"><span>', $txt['reply'], '</span></a></li>';
  329. // If they *can* quote?
  330. if ($post['can_quote'])
  331. echo '
  332. <li class="quote_button"><a href="', $scripturl . '?action=post;topic=', $post['topic'], '.', $post['start'], ';quote=', $post['id'], '"><span>', $txt['quote'], '</span></a></li>';
  333. // Can we request notification of topics?
  334. if ($post['can_mark_notify'])
  335. echo '
  336. <li class="notify_button"><a href="', $scripturl, '?action=notify;topic=', $post['topic'], '.', $post['start'], '"><span>', $txt['notify'], '</span></a></li>';
  337. // How about... even... remove it entirely?!
  338. if ($post['can_delete'])
  339. echo '
  340. <li class="remove_button"><a href="', $scripturl, '?action=deletemsg;msg=', $post['id'], ';topic=', $post['topic'], ';profile;u=', $context['member']['id'], ';start=', $context['start'], ';', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'', $txt['remove_message'], '?\');"><span>', $txt['remove'], '</span></a></li>';
  341. if ($post['can_reply'] || $post['can_mark_notify'] || $post['can_delete'])
  342. echo '
  343. </ul>
  344. </div>';
  345. echo '
  346. <br class="clear" />
  347. <span class="botslice"><span></span></span>
  348. </div>
  349. </div>';
  350. }
  351. }
  352. else
  353. {
  354. echo '
  355. <table border="0" width="100%" cellspacing="1" cellpadding="2" class="table_grid" align="center">
  356. <thead>
  357. <tr class="titlebg">
  358. <th class="first_th lefttext" scope="col" width="25%">
  359. <a href="', $scripturl, '?action=profile;u=', $context['current_member'], ';area=showposts;sa=attach;sort=filename', ($context['sort_direction'] == 'down' && $context['sort_order'] == 'filename' ? ';asc' : ''), '">
  360. ', $txt['show_attach_filename'], '
  361. ', ($context['sort_order'] == 'filename' ? '<img src="' . $settings['images_url'] . '/sort_' . ($context['sort_direction'] == 'down' ? 'down' : 'up') . '.png" alt="" />' : ''), '
  362. </a>
  363. </th>
  364. <th scope="col" width="12%">
  365. <a href="', $scripturl, '?action=profile;u=', $context['current_member'], ';area=showposts;sa=attach;sort=downloads', ($context['sort_direction'] == 'down' && $context['sort_order'] == 'downloads' ? ';asc' : ''), '">
  366. ', $txt['show_attach_downloads'], '
  367. ', ($context['sort_order'] == 'downloads' ? '<img src="' . $settings['images_url'] . '/sort_' . ($context['sort_direction'] == 'down' ? 'down' : 'up') . '.png" alt="" />' : ''), '
  368. </a>
  369. </th>
  370. <th class="lefttext" scope="col" width="30%">
  371. <a href="', $scripturl, '?action=profile;u=', $context['current_member'], ';area=showposts;sa=attach;sort=subject', ($context['sort_direction'] == 'down' && $context['sort_order'] == 'subject' ? ';asc' : ''), '">
  372. ', $txt['message'], '
  373. ', ($context['sort_order'] == 'subject' ? '<img src="' . $settings['images_url'] . '/sort_' . ($context['sort_direction'] == 'down' ? 'down' : 'up') . '.png" alt="" />' : ''), '
  374. </a>
  375. </th>
  376. <th class="last_th lefttext" scope="col">
  377. <a href="', $scripturl, '?action=profile;u=', $context['current_member'], ';area=showposts;sa=attach;sort=posted', ($context['sort_direction'] == 'down' && $context['sort_order'] == 'posted' ? ';asc' : ''), '">
  378. ', $txt['show_attach_posted'], '
  379. ', ($context['sort_order'] == 'posted' ? '<img src="' . $settings['images_url'] . '/sort_' . ($context['sort_direction'] == 'down' ? 'down' : 'up') . '.png" alt="" />' : ''), '
  380. </a>
  381. </th>
  382. </tr>
  383. </thead>
  384. <tbody>';
  385. // Looks like we need to do all the attachments instead!
  386. $alternate = false;
  387. foreach ($context['attachments'] as $attachment)
  388. {
  389. echo '
  390. <tr class="', $attachment['approved'] ? ($alternate ? 'windowbg' : 'windowbg2') : 'approvebg', '">
  391. <td><a href="', $scripturl, '?action=dlattach;topic=', $attachment['topic'], '.0;attach=', $attachment['id'], '">', $attachment['filename'], '</a>', !$attachment['approved'] ? '&nbsp;<em>(' . $txt['awaiting_approval'] . ')</em>' : '', '</td>
  392. <td align="center">', $attachment['downloads'], '</td>
  393. <td><a href="', $scripturl, '?topic=', $attachment['topic'], '.msg', $attachment['msg'], '#msg', $attachment['msg'], '" rel="nofollow">', $attachment['subject'], '</a></td>
  394. <td>', $attachment['posted'], '</td>
  395. </tr>';
  396. $alternate = !$alternate;
  397. }
  398. // No posts? Just end the table with a informative message.
  399. if ((isset($context['attachments']) && empty($context['attachments'])) || (!isset($context['attachments']) && empty($context['posts'])))
  400. echo '
  401. <tr>
  402. <td class="tborder windowbg2 padding centertext" colspan="4">
  403. ', isset($context['attachments']) ? $txt['show_attachments_none'] : ($context['is_topics'] ? $txt['show_topics_none'] : $txt['show_posts_none']), '
  404. </td>
  405. </tr>';
  406. echo '
  407. </tbody>
  408. </table>';
  409. }
  410. // Show more page numbers.
  411. echo '
  412. <div class="pagesection" style="margin-bottom: 0;">
  413. <span>', $txt['pages'], ': ', $context['page_index'], '</span>
  414. </div>';
  415. }
  416. // Template for showing all the buddies of the current user.
  417. function template_editBuddies()
  418. {
  419. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  420. $disabled_fields = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
  421. $buddy_fields = array('icq', 'aim', 'yim', 'msn');
  422. echo '
  423. <div class="title_bar">
  424. <h3 class="titlebg">
  425. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/online.png" alt="" class="icon" />', $txt['editBuddies'], '</span>
  426. </h3>
  427. </div>
  428. <table border="0" width="100%" cellspacing="1" cellpadding="4" class="table_grid" align="center">
  429. <tr class="catbg">
  430. <th class="first_th" scope="col" width="20%">', $txt['name'], '</th>
  431. <th scope="col">', $txt['status'], '</th>
  432. <th scope="col">', $txt['email'], '</th>';
  433. // don't show them if they are sdisabled
  434. foreach ($buddy_fields as $key => $column)
  435. {
  436. if (!isset($disabled_fields[$column]))
  437. echo '
  438. <th scope="col">', $txt[$column], '</th>';
  439. }
  440. echo '
  441. <th class="last_th" scope="col"></th>
  442. </tr>';
  443. // If they don't have any buddies don't list them!
  444. if (empty($context['buddies']))
  445. echo '
  446. <tr class="windowbg2">
  447. <td colspan="8" align="center"><strong>', $txt['no_buddies'], '</strong></td>
  448. </tr>';
  449. // Now loop through each buddy showing info on each.
  450. $alternate = false;
  451. foreach ($context['buddies'] as $buddy)
  452. {
  453. echo '
  454. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  455. <td>', $buddy['link'], '</td>
  456. <td align="center"><a href="', $buddy['online']['href'], '"><img src="', $buddy['online']['image_href'], '" alt="', $buddy['online']['label'], '" title="', $buddy['online']['label'], '" /></a></td>
  457. <td align="center">', ($buddy['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $buddy['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $buddy['name'] . '" /></a>'), '</td>';
  458. // If these are off, don't show them
  459. foreach ($buddy_fields as $key => $column)
  460. {
  461. if (!isset($disabled_fields[$column]))
  462. echo '
  463. <td align="center">', $buddy[$column]['link'], '</td>';
  464. }
  465. echo '
  466. <td align="center"><a href="', $scripturl, '?action=profile;area=lists;sa=buddies;u=', $context['id_member'], ';remove=', $buddy['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['images_url'], '/icons/delete.png" alt="', $txt['buddy_remove'], '" title="', $txt['buddy_remove'], '" /></a></td>
  467. </tr>';
  468. $alternate = !$alternate;
  469. }
  470. echo '
  471. </table>';
  472. // Add a new buddy?
  473. echo '
  474. <br />
  475. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=buddies" method="post" accept-charset="', $context['character_set'], '">
  476. <div class="tborder add_buddy">
  477. <div class="title_bar">
  478. <h3 class="titlebg">', $txt['buddy_add'], '</h3>
  479. </div>
  480. <span class="upperframe"><span></span></span>
  481. <div class="roundframe">
  482. <dl class="settings">
  483. <dt>
  484. <label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
  485. </dt>
  486. <dd>
  487. <input type="text" name="new_buddy" id="new_buddy" size="30" class="input_text" />
  488. </dd>
  489. </dl>';
  490. if (!empty($context['token_check']))
  491. echo '
  492. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  493. echo '
  494. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  495. <input type="submit" value="', $txt['buddy_add_button'], '" class="button_submit" />
  496. <br class="clear_right" />
  497. </div>
  498. <span class="lowerframe"><span></span></span>
  499. </div>
  500. </form>
  501. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  502. <script type="text/javascript"><!-- // --><![CDATA[
  503. var oAddBuddySuggest = new smc_AutoSuggest({
  504. sSelf: \'oAddBuddySuggest\',
  505. sSessionId: smf_session_id,
  506. sSessionVar: smf_session_var,
  507. sSuggestId: \'new_buddy\',
  508. sControlId: \'new_buddy\',
  509. sSearchType: \'member\',
  510. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  511. bItemList: false
  512. });
  513. // ]]></script>';
  514. }
  515. // Template for showing the ignore list of the current user.
  516. function template_editIgnoreList()
  517. {
  518. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  519. echo '
  520. <div class="title_bar">
  521. <h3 class="titlebg">
  522. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['editIgnoreList'], '</span>
  523. </h3>
  524. </div>
  525. <table border="0" width="100%" cellspacing="1" cellpadding="4" class="table_grid" align="center">
  526. <tr class="catbg">
  527. <th class="first_th" scope="col" width="20%">', $txt['name'], '</th>
  528. <th scope="col">', $txt['status'], '</th>
  529. <th scope="col">', $txt['email'], '</th>
  530. <th scope="col">', $txt['icq'], '</th>
  531. <th scope="col">', $txt['aim'], '</th>
  532. <th scope="col">', $txt['yim'], '</th>
  533. <th scope="col">', $txt['msn'], '</th>
  534. <th class="last_th" scope="col"></th>
  535. </tr>';
  536. // If they don't have anyone on their ignore list, don't list it!
  537. if (empty($context['ignore_list']))
  538. echo '
  539. <tr class="windowbg2">
  540. <td colspan="8" align="center"><strong>', $txt['no_ignore'], '</strong></td>
  541. </tr>';
  542. // Now loop through each buddy showing info on each.
  543. $alternate = false;
  544. foreach ($context['ignore_list'] as $member)
  545. {
  546. echo '
  547. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  548. <td>', $member['link'], '</td>
  549. <td align="center"><a href="', $member['online']['href'], '"><img src="', $member['online']['image_href'], '" alt="', $member['online']['label'], '" title="', $member['online']['label'], '" /></a></td>
  550. <td align="center">', ($member['show_email'] == 'no' ? '' : '<a href="' . $scripturl . '?action=emailuser;sa=email;uid=' . $member['id'] . '" rel="nofollow"><img src="' . $settings['images_url'] . '/email_sm.png" alt="' . $txt['email'] . '" title="' . $txt['email'] . ' ' . $member['name'] . '" /></a>'), '</td>
  551. <td align="center">', $member['icq']['link'], '</td>
  552. <td align="center">', $member['aim']['link'], '</td>
  553. <td align="center">', $member['yim']['link'], '</td>
  554. <td align="center">', $member['msn']['link'], '</td>
  555. <td align="center"><a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore;remove=', $member['id'], ';', $context['session_var'], '=', $context['session_id'], '"><img src="', $settings['images_url'], '/icons/delete.png" alt="', $txt['ignore_remove'], '" title="', $txt['ignore_remove'], '" /></a></td>
  556. </tr>';
  557. $alternate = !$alternate;
  558. }
  559. echo '
  560. </table>';
  561. // Add to the ignore list?
  562. echo '
  563. <br />
  564. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=lists;sa=ignore" method="post" accept-charset="', $context['character_set'], '">
  565. <div class="tborder add_buddy">
  566. <div class="title_bar">
  567. <h3 class="titlebg">', $txt['ignore_add'], '</h3>
  568. </div>
  569. <span class="upperframe"><span></span></span>
  570. <div class="roundframe">
  571. <dl class="settings">
  572. <dt>
  573. <label for="new_buddy"><strong>', $txt['who_member'], ':</strong></label>
  574. </dt>
  575. <dd>
  576. <input type="text" name="new_ignore" id="new_ignore" size="25" class="input_text" />
  577. </dd>
  578. </dl>';
  579. if (!empty($context['token_check']))
  580. echo '
  581. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  582. echo '
  583. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  584. <input type="submit" value="', $txt['ignore_add_button'], '" class="button_submit" />
  585. <br class="clear_right" />
  586. </div>
  587. <span class="lowerframe"><span></span></span>
  588. </div>
  589. </form>
  590. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/suggest.js?fin20"></script>
  591. <script type="text/javascript"><!-- // --><![CDATA[
  592. var oAddIgnoreSuggest = new smc_AutoSuggest({
  593. sSelf: \'oAddIgnoreSuggest\',
  594. sSessionId: \'', $context['session_id'], '\',
  595. sSessionVar: \'', $context['session_var'], '\',
  596. sSuggestId: \'new_ignore\',
  597. sControlId: \'new_ignore\',
  598. sSearchType: \'member\',
  599. sTextDeleteItem: \'', $txt['autosuggest_delete_item'], '\',
  600. bItemList: false
  601. });
  602. // ]]></script>';
  603. }
  604. // This template shows an admin information on a users IP addresses used and errors attributed to them.
  605. function template_trackActivity()
  606. {
  607. global $context, $settings, $options, $scripturl, $txt;
  608. // The first table shows IP information about the user.
  609. echo '
  610. <div class="title_bar">
  611. <h3 class="titlebg"><strong>', $txt['view_ips_by'], ' ', $context['member']['name'], '</strong></h3>
  612. </div>';
  613. // The last IP the user used.
  614. echo '
  615. <div id="tracking" class="windowbg2">
  616. <span class="topslice"><span></span></span>
  617. <div class="content">
  618. <dl class="noborder">
  619. <dt>', $txt['most_recent_ip'], ':
  620. ', (empty($context['last_ip2']) ? '' : '<br />
  621. <span class="smalltext">(<a href="' . $scripturl . '?action=helpadmin;help=whytwoip" onclick="return reqWin(this.href);">' . $txt['why_two_ip_address'] . '</a>)</span>'), '
  622. </dt>
  623. <dd>
  624. <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip'], ';u=', $context['member']['id'], '">', $context['last_ip'], '</a>';
  625. // Second address detected?
  626. if (!empty($context['last_ip2']))
  627. echo '
  628. , <a href="', $scripturl, '?action=profile;area=tracking;sa=ip;searchip=', $context['last_ip2'], ';u=', $context['member']['id'], '">', $context['last_ip2'], '</a>';
  629. echo '
  630. </dd>';
  631. // Lists of IP addresses used in messages / error messages.
  632. echo '
  633. <dt>', $txt['ips_in_messages'], ':</dt>
  634. <dd>
  635. ', (count($context['ips']) > 0 ? implode(', ', $context['ips']) : '(' . $txt['none'] . ')'), '
  636. </dd>
  637. <dt>', $txt['ips_in_errors'], ':</dt>
  638. <dd>
  639. ', (count($context['ips']) > 0 ? implode(', ', $context['error_ips']) : '(' . $txt['none'] . ')'), '
  640. </dd>';
  641. // List any members that have used the same IP addresses as the current member.
  642. echo '
  643. <dt>', $txt['members_in_range'], ':</dt>
  644. <dd>
  645. ', (count($context['members_in_range']) > 0 ? implode(', ', $context['members_in_range']) : '(' . $txt['none'] . ')'), '
  646. </dd>
  647. </dl>
  648. </div>
  649. <span class="botslice"><span></span></span>
  650. </div>
  651. <br />';
  652. // Show the track user list.
  653. template_show_list('track_user_list');
  654. }
  655. // The template for trackIP, allowing the admin to see where/who a certain IP has been used.
  656. function template_trackIP()
  657. {
  658. global $context, $settings, $options, $scripturl, $txt;
  659. // This function always defaults to the last IP used by a member but can be set to track any IP.
  660. // The first table in the template gives an input box to allow the admin to enter another IP to track.
  661. echo '
  662. <div class="tborder">
  663. <div class="cat_bar">
  664. <h3 class="catbg">', $txt['trackIP'], '</h3>
  665. </div>
  666. <span class="upperframe"><span></span></span>
  667. <div class="roundframe">
  668. <form action="', $context['base_url'], '" method="post" accept-charset="', $context['character_set'], '">
  669. <dl class="settings">
  670. <dt>
  671. <label for="searchip"><strong>', $txt['enter_ip'], ':</strong></label>
  672. </dt>
  673. <dd>
  674. <input type="text" name="searchip" value="', $context['ip'], '" class="input_text" />
  675. </dd>
  676. </dl>
  677. <input type="submit" value="', $txt['trackIP'], '" class="button_submit" />
  678. <br class="clear_right" />
  679. </form>
  680. </div>
  681. <span class="lowerframe"><span></span></span>
  682. </div>
  683. <br />';
  684. // The table inbetween the first and second table shows links to the whois server for every region.
  685. if ($context['single_ip'])
  686. {
  687. echo '
  688. <div class="title_bar">
  689. <h3 class="titlebg">', $txt['whois_title'], ' ', $context['ip'], '</h3>
  690. </div>
  691. <div class="windowbg2">
  692. <span class="topslice"><span></span></span>
  693. <div class="padding">';
  694. foreach ($context['whois_servers'] as $server)
  695. echo '
  696. <a href="', $server['url'], '" target="_blank" class="new_win"', isset($context['auto_whois_server']) && $context['auto_whois_server']['name'] == $server['name'] ? ' style="font-weight: bold;"' : '', '>', $server['name'], '</a><br />';
  697. echo '
  698. </div>
  699. <span class="botslice"><span></span></span>
  700. </div>
  701. <br />';
  702. }
  703. // The second table lists all the members who have been logged as using this IP address.
  704. echo '
  705. <div class="title_bar">
  706. <h3 class="titlebg">', $txt['members_from_ip'], ' ', $context['ip'], '</h3>
  707. </div>';
  708. if (empty($context['ips']))
  709. echo '
  710. <p class="windowbg2 description"><em>', $txt['no_members_from_ip'], '</em></p>';
  711. else
  712. {
  713. echo '
  714. <table class="table_grid" cellspacing="0" width="100%">
  715. <thead>
  716. <tr class="catbg">
  717. <th class="first_th" scope="col">', $txt['ip_address'], '</th>
  718. <th class="last_th" scope="col">', $txt['display_name'], '</th>
  719. </tr>
  720. </thead>
  721. <tbody>';
  722. // Loop through each of the members and display them.
  723. foreach ($context['ips'] as $ip => $memberlist)
  724. echo '
  725. <tr>
  726. <td class="windowbg2"><a href="', $context['base_url'], ';searchip=', $ip, '">', $ip, '</a></td>
  727. <td class="windowbg2">', implode(', ', $memberlist), '</td>
  728. </tr>';
  729. echo '
  730. </tbody>
  731. </table>
  732. <br />';
  733. }
  734. template_show_list('track_message_list');
  735. echo '<br />';
  736. template_show_list('track_user_list');
  737. }
  738. function template_showPermissions()
  739. {
  740. global $context, $settings, $options, $scripturl, $txt;
  741. echo '
  742. <div class="cat_bar">
  743. <h3 class="catbg">
  744. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['showPermissions'], '</span>
  745. </h3>
  746. </div>';
  747. if ($context['member']['has_all_permissions'])
  748. {
  749. echo '
  750. <p class="windowbg description">', $txt['showPermissions_all'], '</p>';
  751. }
  752. else
  753. {
  754. echo '
  755. <p class="description">',$txt['showPermissions_help'],'</p>
  756. <div id="permissions" class="flow_hidden">';
  757. if (!empty($context['no_access_boards']))
  758. {
  759. echo '
  760. <div class="cat_bar">
  761. <h3 class="catbg">', $txt['showPermissions_restricted_boards'], '</h3>
  762. </div>
  763. <div class="windowbg smalltext">
  764. <span class="topslice"><span></span></span>
  765. <div class="content">', $txt['showPermissions_restricted_boards_desc'], ':<br />';
  766. foreach ($context['no_access_boards'] as $no_access_board)
  767. echo '
  768. <a href="', $scripturl, '?board=', $no_access_board['id'], '.0">', $no_access_board['name'], '</a>', $no_access_board['is_last'] ? '' : ', ';
  769. echo '
  770. </div>
  771. <span class="botslice"><span></span></span>
  772. </div>';
  773. }
  774. // General Permissions section.
  775. echo '
  776. <div class="tborder">
  777. <div class="cat_bar">
  778. <h3 class="catbg">', $txt['showPermissions_general'], '</h3>
  779. </div>';
  780. if (!empty($context['member']['permissions']['general']))
  781. {
  782. echo '
  783. <table class="table_grid" width="100%" cellspacing="0">
  784. <thead>
  785. <tr class="titlebg">
  786. <th class="lefttext first_th" scope="col" width="50%">', $txt['showPermissions_permission'], '</th>
  787. <th class="lefttext last_th" scope="col" width="50%">', $txt['showPermissions_status'], '</th>
  788. </tr>
  789. </thead>
  790. <tbody>';
  791. foreach ($context['member']['permissions']['general'] as $permission)
  792. {
  793. echo '
  794. <tr>
  795. <td class="windowbg" title="', $permission['id'], '">
  796. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  797. </td>
  798. <td class="windowbg2 smalltext">';
  799. if ($permission['is_denied'])
  800. echo '
  801. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']),'</span>';
  802. else
  803. echo '
  804. ', $txt['showPermissions_given'], ':&nbsp;', implode(', ', $permission['groups']['allowed']);
  805. echo '
  806. </td>
  807. </tr>';
  808. }
  809. echo '
  810. </tbody>
  811. </table>
  812. </div><br />';
  813. }
  814. else
  815. echo '
  816. <p class="windowbg2 description">', $txt['showPermissions_none_general'], '</p>';
  817. // Board permission section.
  818. echo '
  819. <div class="tborder">
  820. <form action="' . $scripturl . '?action=profile;u=', $context['id_member'], ';area=permissions#board_permissions" method="post" accept-charset="', $context['character_set'], '">
  821. <div class="cat_bar">
  822. <h3 class="catbg"><span class="ie6_header floatleft">
  823. <a id="board_permissions"></a>', $txt['showPermissions_select'], ':
  824. <select name="board" onchange="if (this.options[this.selectedIndex].value) this.form.submit();">
  825. <option value="0"', $context['board'] == 0 ? ' selected="selected"' : '', '>', $txt['showPermissions_global'], '&nbsp;</option>';
  826. if (!empty($context['boards']))
  827. echo '
  828. <option value="" disabled="disabled">---------------------------</option>';
  829. // Fill the box with any local permission boards.
  830. foreach ($context['boards'] as $board)
  831. echo '
  832. <option value="', $board['id'], '"', $board['selected'] ? ' selected="selected"' : '', '>', $board['name'], ' (', $board['profile_name'], ')</option>';
  833. echo '
  834. </select></span>
  835. </h3>
  836. </div>
  837. </form>';
  838. if (!empty($context['member']['permissions']['board']))
  839. {
  840. echo '
  841. <table class="table_grid" width="100%" cellspacing="0">
  842. <thead>
  843. <tr class="titlebg">
  844. <th class="lefttext first_th" scope="col" width="50%">', $txt['showPermissions_permission'], '</th>
  845. <th class="lefttext last_th" scope="col" width="50%">', $txt['showPermissions_status'], '</th>
  846. </tr>
  847. </thead>
  848. <tbody>';
  849. foreach ($context['member']['permissions']['board'] as $permission)
  850. {
  851. echo '
  852. <tr>
  853. <td class="windowbg" title="', $permission['id'], '">
  854. ', $permission['is_denied'] ? '<del>' . $permission['name'] . '</del>' : $permission['name'], '
  855. </td>
  856. <td class="windowbg2 smalltext">';
  857. if ($permission['is_denied'])
  858. {
  859. echo '
  860. <span class="alert">', $txt['showPermissions_denied'], ':&nbsp;', implode(', ', $permission['groups']['denied']), '</span>';
  861. }
  862. else
  863. {
  864. echo '
  865. ', $txt['showPermissions_given'], ': &nbsp;', implode(', ', $permission['groups']['allowed']);
  866. }
  867. echo '
  868. </td>
  869. </tr>';
  870. }
  871. echo '
  872. </tbody>
  873. </table>';
  874. }
  875. else
  876. echo '
  877. <p class="windowbg2 description">', $txt['showPermissions_none_board'], '</p>';
  878. echo '
  879. </div>
  880. </div>';
  881. }
  882. }
  883. // Template for user statistics, showing graphs and the like.
  884. function template_statPanel()
  885. {
  886. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  887. // First, show a few text statistics such as post/topic count.
  888. echo '
  889. <div id="profileview">
  890. <div id="generalstats">
  891. <div class="cat_bar">
  892. <h3 class="catbg">
  893. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/stats_info.png" alt="" class="icon" />
  894. ', $txt['statPanel_generalStats'], ' - ', $context['member']['name'], '
  895. </span>
  896. </h3>
  897. </div>
  898. <div class="windowbg2">
  899. <span class="topslice"><span></span></span>
  900. <div class="content">
  901. <dl>
  902. <dt>', $txt['statPanel_total_time_online'], ':</dt>
  903. <dd>', $context['time_logged_in'], '</dd>
  904. <dt>', $txt['statPanel_total_posts'], ':</dt>
  905. <dd>', $context['num_posts'], ' ', $txt['statPanel_posts'], '</dd>
  906. <dt>', $txt['statPanel_total_topics'], ':</dt>
  907. <dd>', $context['num_topics'], ' ', $txt['statPanel_topics'], '</dd>
  908. <dt>', $txt['statPanel_users_polls'], ':</dt>
  909. <dd>', $context['num_polls'], ' ', $txt['statPanel_polls'], '</dd>
  910. <dt>', $txt['statPanel_users_votes'], ':</dt>
  911. <dd>', $context['num_votes'], ' ', $txt['statPanel_votes'], '</dd>
  912. </dl>
  913. </div>
  914. <span class="botslice"><span></span></span>
  915. </div>
  916. </div>';
  917. // This next section draws a graph showing what times of day they post the most.
  918. echo '
  919. <div id="activitytime" class="flow_hidden">
  920. <div class="cat_bar">
  921. <h3 class="catbg">
  922. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/stats_history.png" alt="" class="icon" />', $txt['statPanel_activityTime'], '</span>
  923. </h3>
  924. </div>
  925. <div class="windowbg2">
  926. <span class="topslice"><span></span></span>
  927. <div class="content">';
  928. // If they haven't post at all, don't draw the graph.
  929. if (empty($context['posts_by_time']))
  930. echo '
  931. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  932. // Otherwise do!
  933. else
  934. {
  935. echo '
  936. <ul class="activity_stats flow_hidden">';
  937. // The labels.
  938. foreach ($context['posts_by_time'] as $time_of_day)
  939. {
  940. echo '
  941. <li', $time_of_day['is_last'] ? ' class="last"' : '', '>
  942. <div class="bar" style="padding-top: ', ((int) (100 - $time_of_day['relative_percent'])), 'px;" title="', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '">
  943. <div style="height: ', (int) $time_of_day['relative_percent'], 'px;">
  944. <span>', sprintf($txt['statPanel_activityTime_posts'], $time_of_day['posts'], $time_of_day['posts_percent']), '</span>
  945. </div>
  946. </div>
  947. <span class="stats_hour">', $time_of_day['hour_format'], '</span>
  948. </li>';
  949. }
  950. echo '
  951. </ul>';
  952. }
  953. echo '
  954. <span class="clear" />
  955. </div>
  956. <span class="botslice"><span></span></span>
  957. </div>
  958. </div>';
  959. // Two columns with the most popular boards by posts and activity (activity = users posts / total posts).
  960. echo '
  961. <div class="flow_hidden">
  962. <div id="popularposts">
  963. <div class="cat_bar">
  964. <h3 class="catbg">
  965. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoards'], '</span>
  966. </h3>
  967. </div>
  968. <div class="windowbg2">
  969. <span class="topslice"><span></span></span>
  970. <div class="content">';
  971. if (empty($context['popular_boards']))
  972. echo '
  973. <span class="centertext">', $txt['statPanel_noPosts'], '</span>';
  974. else
  975. {
  976. echo '
  977. <dl>';
  978. // Draw a bar for every board.
  979. foreach ($context['popular_boards'] as $board)
  980. {
  981. echo '
  982. <dt>', $board['link'], '</dt>
  983. <dd>
  984. <div class="profile_pie" style="background-position: -', ((int) ($board['posts_percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '">
  985. ', sprintf($txt['statPanel_topBoards_memberposts'], $board['posts'], $board['total_posts_member'], $board['posts_percent']), '
  986. </div>
  987. <span>', empty($context['hide_num_posts']) ? $board['posts'] : '', '</span>
  988. </dd>';
  989. }
  990. echo '
  991. </dl>';
  992. }
  993. echo '
  994. </div>
  995. <span class="botslice"><span></span></span>
  996. </div>
  997. </div>';
  998. echo '
  999. <div id="popularactivity">
  1000. <div class="cat_bar">
  1001. <h3 class="catbg">
  1002. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/stats_replies.png" alt="" class="icon" />', $txt['statPanel_topBoardsActivity'], '</span>
  1003. </h3>
  1004. </div>
  1005. <div class="windowbg2">
  1006. <span class="topslice"><span></span></span>
  1007. <div class="content">';
  1008. if (empty($context['board_activity']))
  1009. echo '
  1010. <span>', $txt['statPanel_noPosts'], '</span>';
  1011. else
  1012. {
  1013. echo '
  1014. <dl>';
  1015. // Draw a bar for every board.
  1016. foreach ($context['board_activity'] as $activity)
  1017. {
  1018. echo '
  1019. <dt>', $activity['link'], '</dt>
  1020. <dd>
  1021. <div class="profile_pie" style="background-position: -', ((int) ($activity['percent'] / 5) * 20), 'px 0;" title="', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '">
  1022. ', sprintf($txt['statPanel_topBoards_posts'], $activity['posts'], $activity['total_posts'], $activity['posts_percent']), '
  1023. </div>
  1024. <span>', $activity['percent'], '%</span>
  1025. </dd>';
  1026. }
  1027. echo '
  1028. </dl>';
  1029. }
  1030. echo '
  1031. </div>
  1032. <span class="botslice"><span></span></span>
  1033. </div>
  1034. </div>
  1035. </div>';
  1036. echo '
  1037. </div>
  1038. <br class="clear" />';
  1039. }
  1040. // Template for editing profile options.
  1041. function template_edit_options()
  1042. {
  1043. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1044. // The main header!
  1045. echo '
  1046. <form action="', (!empty($context['profile_custom_submit_url']) ? $context['profile_custom_submit_url'] : $scripturl . '?action=profile;area=' . $context['menu_item_selected'] . ';u=' . $context['id_member'] . ';save'), '" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data" onsubmit="return checkProfileSubmit();">
  1047. <div class="cat_bar">
  1048. <h3 class="catbg">
  1049. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />';
  1050. // Don't say "Profile" if this isn't the profile...
  1051. if (!empty($context['profile_header_text']))
  1052. echo '
  1053. ', $context['profile_header_text'];
  1054. else
  1055. echo '
  1056. ', $txt['profile'];
  1057. echo '
  1058. </span>
  1059. </h3>
  1060. </div>';
  1061. // Have we some description?
  1062. if ($context['page_desc'])
  1063. echo '
  1064. <p class="windowbg description">', $context['page_desc'], '</p>';
  1065. echo '
  1066. <div class="windowbg2">
  1067. <span class="topslice"><span></span></span>
  1068. <div class="content">';
  1069. // Any bits at the start?
  1070. if (!empty($context['profile_prehtml']))
  1071. echo '
  1072. <div>', $context['profile_prehtml'], '</div>';
  1073. if (!empty($context['profile_fields']))
  1074. echo '
  1075. <dl>';
  1076. // Start the big old loop 'of love.
  1077. $lastItem = 'hr';
  1078. foreach ($context['profile_fields'] as $key => $field)
  1079. {
  1080. // We add a little hack to be sure we never get more than one hr in a row!
  1081. if ($lastItem == 'hr' && $field['type'] == 'hr')
  1082. continue;
  1083. $lastItem = $field['type'];
  1084. if ($field['type'] == 'hr')
  1085. {
  1086. echo '
  1087. </dl>
  1088. <hr width="100%" size="1" class="hrcolor clear" />
  1089. <dl>';
  1090. }
  1091. elseif ($field['type'] == 'callback')
  1092. {
  1093. if (isset($field['callback_func']) && function_exists('template_profile_' . $field['callback_func']))
  1094. {
  1095. $callback_func = 'template_profile_' . $field['callback_func'];
  1096. $callback_func();
  1097. }
  1098. }
  1099. else
  1100. {
  1101. echo '
  1102. <dt>
  1103. <strong', !empty($field['is_error']) ? ' class="error"' : '', '>', $field['label'], '</strong>';
  1104. // Does it have any subtext to show?
  1105. if (!empty($field['subtext']))
  1106. echo '
  1107. <br />
  1108. <span class="smalltext">', $field['subtext'], '</span>';
  1109. echo '
  1110. </dt>
  1111. <dd>';
  1112. // Want to put something infront of the box?
  1113. if (!empty($field['preinput']))
  1114. echo '
  1115. ', $field['preinput'];
  1116. // What type of data are we showing?
  1117. if ($field['type'] == 'label')
  1118. echo '
  1119. ', $field['value'];
  1120. // Maybe it's a text box - very likely!
  1121. elseif (in_array($field['type'], array('int', 'float', 'text', 'password')))
  1122. echo '
  1123. <input type="', $field['type'] == 'password' ? 'password' : 'text', '" name="', $key, '" id="', $key, '" size="', empty($field['size']) ? 30 : $field['size'], '" value="', $field['value'], '" ', $field['input_attr'], ' class="input_', $field['type'] == 'password' ? 'password' : 'text', '" />';
  1124. // You "checking" me out? ;)
  1125. elseif ($field['type'] == 'check')
  1126. echo '
  1127. <input type="hidden" name="', $key, '" value="0" /><input type="checkbox" name="', $key, '" id="', $key, '" ', !empty($field['value']) ? ' checked="checked"' : '', ' value="1" class="input_check" ', $field['input_attr'], ' />';
  1128. // Always fun - select boxes!
  1129. elseif ($field['type'] == 'select')
  1130. {
  1131. echo '
  1132. <select name="', $key, '" id="', $key, '">';
  1133. if (isset($field['options']))
  1134. {
  1135. // Is this some code to generate the options?
  1136. if (!is_array($field['options']))
  1137. $field['options'] = eval($field['options']);
  1138. // Assuming we now have some!
  1139. if (is_array($field['options']))
  1140. foreach ($field['options'] as $value => $name)
  1141. echo '
  1142. <option value="', $value, '" ', $value == $field['value'] ? 'selected="selected"' : '', '>', $name, '</option>';
  1143. }
  1144. echo '
  1145. </select>';
  1146. }
  1147. // Something to end with?
  1148. if (!empty($field['postinput']))
  1149. echo '
  1150. ', $field['postinput'];
  1151. echo '
  1152. </dd>';
  1153. }
  1154. }
  1155. if (!empty($context['profile_fields']))
  1156. echo '
  1157. </dl>';
  1158. // Are there any custom profile fields - if so print them!
  1159. if (!empty($context['custom_fields']))
  1160. {
  1161. if ($lastItem != 'hr')
  1162. echo '
  1163. <hr width="100%" size="1" class="hrcolor clear" />';
  1164. echo '
  1165. <dl>';
  1166. foreach ($context['custom_fields'] as $field)
  1167. {
  1168. echo '
  1169. <dt>
  1170. <strong>', $field['name'], ': </strong><br />
  1171. <span class="smalltext">', $field['desc'], '</span>
  1172. </dt>
  1173. <dd>
  1174. ', $field['input_html'], '
  1175. </dd>';
  1176. }
  1177. echo '
  1178. </dl>';
  1179. }
  1180. // Any closing HTML?
  1181. if (!empty($context['profile_posthtml']))
  1182. echo '
  1183. <div>', $context['profile_posthtml'], '</div>';
  1184. // Only show the password box if it's actually needed.
  1185. if ($context['require_password'])
  1186. echo '
  1187. <dl>
  1188. <dt>
  1189. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  1190. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  1191. </dt>
  1192. <dd>
  1193. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  1194. </dd>
  1195. </dl>';
  1196. echo '
  1197. <hr class="hrcolor">';
  1198. // The button shouldn't say "Change profile" unless we're changing the profile...
  1199. if (!empty($context['submit_button_text']))
  1200. echo '
  1201. <input type="submit" value="', $context['submit_button_text'], '" class="button_submit" />';
  1202. else
  1203. echo '
  1204. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />';
  1205. if (!empty($context['token_check']))
  1206. echo '
  1207. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1208. echo '
  1209. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1210. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1211. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1212. <br class="clear_right" />
  1213. </div>
  1214. <span class="botslice"><span></span></span>
  1215. </div>
  1216. <br />
  1217. </form>';
  1218. // Some javascript!
  1219. echo '
  1220. <script type="text/javascript"><!-- // --><![CDATA[
  1221. function checkProfileSubmit()
  1222. {';
  1223. // If this part requires a password, make sure to give a warning.
  1224. if ($context['require_password'])
  1225. echo '
  1226. // Did you forget to type your password?
  1227. if (document.forms.creator.oldpasswrd.value == "")
  1228. {
  1229. alert("', $txt['required_security_reasons'], '");
  1230. return false;
  1231. }';
  1232. // Any onsubmit javascript?
  1233. if (!empty($context['profile_onsubmit_javascript']))
  1234. echo '
  1235. ', $context['profile_javascript'];
  1236. echo '
  1237. }';
  1238. // Any totally custom stuff?
  1239. if (!empty($context['profile_javascript']))
  1240. echo '
  1241. ', $context['profile_javascript'];
  1242. echo '
  1243. // ]]></script>';
  1244. // Any final spellchecking stuff?
  1245. if (!empty($context['show_spellchecking']))
  1246. echo '
  1247. <form name="spell_form" id="spell_form" method="post" accept-charset="', $context['character_set'], '" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spellstring" value="" /></form>';
  1248. }
  1249. // Personal Message settings.
  1250. function template_profile_pm_settings()
  1251. {
  1252. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1253. echo '
  1254. <dt>
  1255. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1256. </dt>
  1257. <dd>
  1258. <select name="pm_prefs" id="pm_prefs" onchange="if (this.value == 2 &amp;&amp; !document.getElementById(\'copy_to_outbox\').checked) alert(\'', $txt['pm_recommend_enable_outbox'], '\');">
  1259. <option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
  1260. <option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
  1261. <option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
  1262. </select>
  1263. </dd>
  1264. <dt>
  1265. <label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label>
  1266. </dt>
  1267. <dd>
  1268. <input type="hidden" name="default_options[view_newest_pm_first]" value="0" />
  1269. <input type="checkbox" name="default_options[view_newest_pm_first]" id="view_newest_pm_first" value="1"', !empty($context['member']['options']['view_newest_pm_first']) ? ' checked="checked"' : '', ' class="input_check" />
  1270. </dd>
  1271. </dl>
  1272. <hr />
  1273. <dl>
  1274. <dt>
  1275. <label for="pm_receive_from">', $txt['pm_receive_from'], '</label>
  1276. </dt>
  1277. <dd>
  1278. <select name="pm_receive_from" id="pm_receive_from">
  1279. <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected="selected"' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
  1280. if (!empty($modSettings['enable_buddylist']))
  1281. echo '
  1282. <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_ignore'], '</option>
  1283. <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
  1284. echo '
  1285. <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_admins'], '</option>
  1286. </select>
  1287. </dd>
  1288. <dt>
  1289. <label for="pm_email_notify">', $txt['email_notify'], '</label>
  1290. </dt>
  1291. <dd>
  1292. <select name="pm_email_notify" id="pm_email_notify">
  1293. <option value="0"', empty($context['send_email']) ? ' selected="selected"' : '', '>', $txt['email_notify_never'], '</option>
  1294. <option value="1"', !empty($context['send_email']) && ($context['send_email'] == 1 || (empty($modSettings['enable_buddylist']) && $context['send_email'] > 1)) ? ' selected="selected"' : '', '>', $txt['email_notify_always'], '</option>';
  1295. if (!empty($modSettings['enable_buddylist']))
  1296. echo '
  1297. <option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected="selected"' : '', '>', $txt['email_notify_buddies'], '</option>';
  1298. echo '
  1299. </select>
  1300. </dd>
  1301. <dt>
  1302. <label for="popup_messages">', $txt['popup_messages'], '</label>
  1303. </dt>
  1304. <dd>
  1305. <input type="hidden" name="default_options[popup_messages]" value="0" />
  1306. <input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked="checked"' : '', ' class="input_check" />
  1307. </dd>
  1308. </dl>
  1309. <hr />
  1310. <dl>
  1311. <dt>
  1312. <label for="copy_to_outbox"> ', $txt['copy_to_outbox'], '</label>
  1313. </dt>
  1314. <dd>
  1315. <input type="hidden" name="default_options[copy_to_outbox]" value="0" />
  1316. <input type="checkbox" name="default_options[copy_to_outbox]" id="copy_to_outbox" value="1"', !empty($context['member']['options']['copy_to_outbox']) ? ' checked="checked"' : '', ' class="input_check" />
  1317. </dd>
  1318. <dt>
  1319. <label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
  1320. </dt>
  1321. <dd>
  1322. <input type="hidden" name="default_options[pm_remove_inbox_label]" value="0" />
  1323. <input type="checkbox" name="default_options[pm_remove_inbox_label]" id="pm_remove_inbox_label" value="1"', !empty($context['member']['options']['pm_remove_inbox_label']) ? ' checked="checked"' : '', ' class="input_check" />
  1324. </dd>';
  1325. }
  1326. // Template for showing theme settings. Note: template_options() actually adds the theme specific options.
  1327. function template_profile_theme_settings()
  1328. {
  1329. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1330. echo '
  1331. <dt>
  1332. <label for="show_board_desc">', $txt['board_desc_inside'], '</label>
  1333. </dt>
  1334. <dd>
  1335. <input type="hidden" name="default_options[show_board_desc]" value="0" />
  1336. <input type="checkbox" name="default_options[show_board_desc]" id="show_board_desc" value="1"', !empty($context['member']['options']['show_board_desc']) ? ' checked="checked"' : '', ' class="input_check" />
  1337. </dd>
  1338. <dt>
  1339. <label for="show_children">', $txt['show_children'], '</label>
  1340. </dt>
  1341. <dd>
  1342. <input type="hidden" name="default_options[show_children]" value="0" />
  1343. <input type="checkbox" name="default_options[show_children]" id="show_children" value="1"', !empty($context['member']['options']['show_children']) ? ' checked="checked"' : '', ' class="input_check" />
  1344. </dd>
  1345. <dt>
  1346. <label for="use_sidebar_menu">', $txt['use_sidebar_menu'], '</label>
  1347. </dt>
  1348. <dd>
  1349. <input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
  1350. <input type="checkbox" name="default_options[use_sidebar_menu]" id="use_sidebar_menu" value="1"', !empty($context['member']['options']['use_sidebar_menu']) ? ' checked="checked"' : '', ' class="input_check" />
  1351. </dd>
  1352. <dt>
  1353. <label for="show_no_avatars">', $txt['show_no_avatars'], '</label>
  1354. </dt>
  1355. <dd>
  1356. <input type="hidden" name="default_options[show_no_avatars]" value="0" />
  1357. <input type="checkbox" name="default_options[show_no_avatars]" id="show_no_avatars" value="1"', !empty($context['member']['options']['show_no_avatars']) ? ' checked="checked"' : '', ' class="input_check" />
  1358. </dd>
  1359. <dt>
  1360. <label for="show_no_signatures">', $txt['show_no_signatures'], '</label>
  1361. </dt>
  1362. <dd>
  1363. <input type="hidden" name="default_options[show_no_signatures]" value="0" />
  1364. <input type="checkbox" name="default_options[show_no_signatures]" id="show_no_signatures" value="1"', !empty($context['member']['options']['show_no_signatures']) ? ' checked="checked"' : '', ' class="input_check" />
  1365. </dd>';
  1366. if ($settings['allow_no_censored'])
  1367. echo '
  1368. <dt>
  1369. <label for="show_no_censored">' . $txt['show_no_censored'] . '</label>
  1370. </dt>
  1371. <dd>
  1372. <input type="hidden" name="default_options[show_no_censored]" value="0" />
  1373. <input type="checkbox" name="default_options[show_no_censored]" id="show_no_censored" value="1"' . (!empty($context['member']['options']['show_no_censored']) ? ' checked="checked"' : '') . ' class="input_check" />
  1374. </dd>';
  1375. echo '
  1376. <dt>
  1377. <label for="return_to_post">', $txt['return_to_post'], '</label>
  1378. </dt>
  1379. <dd>
  1380. <input type="hidden" name="default_options[return_to_post]" value="0" />
  1381. <input type="checkbox" name="default_options[return_to_post]" id="return_to_post" value="1"', !empty($context['member']['options']['return_to_post']) ? ' checked="checked"' : '', ' class="input_check" />
  1382. </dd>
  1383. <dt>
  1384. <label for="no_new_reply_warning">', $txt['no_new_reply_warning'], '</label>
  1385. </dt>
  1386. <dd>
  1387. <input type="hidden" name="default_options[no_new_reply_warning]" value="0" />
  1388. <input type="checkbox" name="default_options[no_new_reply_warning]" id="no_new_reply_warning" value="1"', !empty($context['member']['options']['no_new_reply_warning']) ? ' checked="checked"' : '', ' class="input_check" />
  1389. </dd>';
  1390. if (!empty($modSettings['enable_buddylist']))
  1391. echo '
  1392. <dt>
  1393. <label for="posts_apply_ignore_list">', $txt['posts_apply_ignore_list'], '</label>
  1394. </dt>
  1395. <dd>
  1396. <input type="hidden" name="default_options[posts_apply_ignore_list]" value="0" />
  1397. <input type="checkbox" name="default_options[posts_apply_ignore_list]" id="posts_apply_ignore_list" value="1"', !empty($context['member']['options']['posts_apply_ignore_list']) ? ' checked="checked"' : '', ' class="input_check" />
  1398. </dd>';
  1399. echo '
  1400. <dt>
  1401. <label for="view_newest_first">', $txt['recent_posts_at_top'], '</label>
  1402. </dt>
  1403. <dd>
  1404. <input type="hidden" name="default_options[view_newest_first]" value="0" />
  1405. <input type="checkbox" name="default_options[view_newest_first]" id="view_newest_first" value="1"', !empty($context['member']['options']['view_newest_first']) ? ' checked="checked"' : '', ' class="input_check" />
  1406. </dd>';
  1407. // Choose WYSIWYG settings?
  1408. if (empty($modSettings['disable_wysiwyg']))
  1409. echo '
  1410. <dt>
  1411. <label for="wysiwyg_default">', $txt['wysiwyg_default'], '</label>
  1412. </dt>
  1413. <dd>
  1414. <input type="hidden" name="default_options[wysiwyg_default]" value="0" />
  1415. <input type="checkbox" name="default_options[wysiwyg_default]" id="wysiwyg_default" value="1"', !empty($context['member']['options']['wysiwyg_default']) ? ' checked="checked"' : '', ' class="input_check" />
  1416. </dd>';
  1417. if (empty($modSettings['disableCustomPerPage']))
  1418. {
  1419. echo '
  1420. <dt>
  1421. <label for="topics_per_page">', $txt['topics_per_page'], '</label>
  1422. </dt>
  1423. <dd>
  1424. <select name="default_options[topics_per_page]" id="topics_per_page">
  1425. <option value="0"', empty($context['member']['options']['topics_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxTopics'], ')</option>
  1426. <option value="5"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1427. <option value="10"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1428. <option value="25"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1429. <option value="50"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1430. </select>
  1431. </dd>
  1432. <dt>
  1433. <label for="messages_per_page">', $txt['messages_per_page'], '</label>
  1434. </dt>
  1435. <dd>
  1436. <select name="default_options[messages_per_page]" id="messages_per_page">
  1437. <option value="0"', empty($context['member']['options']['messages_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxMessages'], ')</option>
  1438. <option value="5"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1439. <option value="10"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1440. <option value="25"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1441. <option value="50"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1442. </select>
  1443. </dd>';
  1444. }
  1445. if (!empty($modSettings['cal_enabled']))
  1446. echo '
  1447. <dt>
  1448. <label for="calendar_start_day">', $txt['calendar_start_day'], ':</label>
  1449. </dt>
  1450. <dd>
  1451. <select name="default_options[calendar_start_day]" id="calendar_start_day">
  1452. <option value="0"', empty($context['member']['options']['calendar_start_day']) ? ' selected="selected"' : '', '>', $txt['days'][0], '</option>
  1453. <option value="1"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 1 ? ' selected="selected"' : '', '>', $txt['days'][1], '</option>
  1454. <option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected="selected"' : '', '>', $txt['days'][6], '</option>
  1455. </select>
  1456. </dd>';
  1457. echo '
  1458. <dt>
  1459. <label for="display_quick_reply">', $txt['display_quick_reply'], '</label>
  1460. </dt>
  1461. <dd>
  1462. <select name="default_options[display_quick_reply]" id="display_quick_reply">
  1463. <option value="0"', empty($context['member']['options']['display_quick_reply']) ? ' selected="selected"' : '', '>', $txt['display_quick_reply1'], '</option>
  1464. <option value="1"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_reply2'], '</option>
  1465. <option value="2"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 2 ? ' selected="selected"' : '', '>', $txt['display_quick_reply3'], '</option>
  1466. </select>
  1467. </dd>
  1468. <dt>
  1469. <label for="display_quick_mod">', $txt['display_quick_mod'], '</label>
  1470. </dt>
  1471. <dd>
  1472. <select name="default_options[display_quick_mod]" id="display_quick_mod">
  1473. <option value="0"', empty($context['member']['options']['display_quick_mod']) ? ' selected="selected"' : '', '>', $txt['display_quick_mod_none'], '</option>
  1474. <option value="1"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_mod_check'], '</option>
  1475. <option value="2"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] != 1 ? ' selected="selected"' : '', '>', $txt['display_quick_mod_image'], '</option>
  1476. </select>
  1477. </dd>';
  1478. }
  1479. function template_notification()
  1480. {
  1481. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  1482. // The main containing header.
  1483. echo '
  1484. <form action="', $scripturl, '?action=profile;area=notification;save" method="post" accept-charset="', $context['character_set'], '" id="notify_options" class="flow_hidden">
  1485. <div class="cat_bar">
  1486. <h3 class="catbg">
  1487. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '</span>
  1488. </h3>
  1489. </div>
  1490. <p class="windowbg description">', $txt['notification_info'], '</p>
  1491. <div class="windowbg2">
  1492. <span class="topslice"><span></span></span>
  1493. <div class="content">
  1494. <dl class="settings">';
  1495. // Allow notification on announcements to be disabled?
  1496. if (!empty($modSettings['allow_disableAnnounce']))
  1497. echo '
  1498. <dt>
  1499. <label for="notify_announcements">', $txt['notify_important_email'], '</label>
  1500. </dt>
  1501. <dd>
  1502. <input type="hidden" name="notify_announcements" value="0" />
  1503. <input type="checkbox" id="notify_announcements" name="notify_announcements"', !empty($context['member']['notify_announcements']) ? ' checked="checked"' : '', ' class="input_check" />
  1504. </dd>';
  1505. // More notification options.
  1506. echo '
  1507. <dt>
  1508. <label for="auto_notify">', $txt['auto_notify'], '</label>
  1509. </dt>
  1510. <dd>
  1511. <input type="hidden" name="default_options[auto_notify]" value="0" />
  1512. <input type="checkbox" id="auto_notify" name="default_options[auto_notify]" value="1"', !empty($context['member']['options']['auto_notify']) ? ' checked="checked"' : '', ' class="input_check" />
  1513. </dd>';
  1514. if (empty($modSettings['disallow_sendBody']))
  1515. echo '
  1516. <dt>
  1517. <label for="notify_send_body">', $txt['notify_send_body'], '</label>
  1518. </dt>
  1519. <dd>
  1520. <input type="hidden" name="notify_send_body" value="0" />
  1521. <input type="checkbox" id="notify_send_body" name="notify_send_body"', !empty($context['member']['notify_send_body']) ? ' checked="checked"' : '', ' class="input_check" />
  1522. </dd>';
  1523. echo '
  1524. <dt>
  1525. <label for="notify_regularity">', $txt['notify_regularity'], ':</label>
  1526. </dt>
  1527. <dd>
  1528. <select name="notify_regularity" id="notify_regularity">
  1529. <option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected="selected"' : '', '>', $txt['notify_regularity_instant'], '</option>
  1530. <option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_regularity_first_only'], '</option>
  1531. <option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_regularity_daily'], '</option>
  1532. <option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_regularity_weekly'], '</option>
  1533. </select>
  1534. </dd>
  1535. <dt>
  1536. <label for="notify_types">', $txt['notify_send_types'], ':</label>
  1537. </dt>
  1538. <dd>
  1539. <select name="notify_types" id="notify_types">
  1540. <option value="1"', $context['member']['notify_types'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything'], '</option>
  1541. <option value="2"', $context['member']['notify_types'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything_own'], '</option>
  1542. <option value="3"', $context['member']['notify_types'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_send_type_only_replies'], '</option>
  1543. <option value="4"', $context['member']['notify_types'] == 4 ? ' selected="selected"' : '', '>', $txt['notify_send_type_nothing'], '</option>
  1544. </select>
  1545. </dd>
  1546. </dl>
  1547. <hr class="hrcolor" />
  1548. <div>
  1549. <input id="notify_submit" type="submit" value="', $txt['notify_save'], '" class="button_submit" />
  1550. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1551. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1552. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1553. </div>
  1554. <br class="clear_right" />
  1555. </div>
  1556. <span class="botslice"><span></span></span>
  1557. </div>
  1558. </form>
  1559. <br />';
  1560. template_show_list('topic_notification_list');
  1561. echo '
  1562. <br />';
  1563. template_show_list('board_notification_list');
  1564. }
  1565. // Template for choosing group membership.
  1566. function template_groupMembership()
  1567. {
  1568. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1569. // The main containing header.
  1570. echo '
  1571. <form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1572. <div class="cat_bar">
  1573. <h3 class="catbg">
  1574. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '</span>
  1575. </h3>
  1576. </div>
  1577. <p class="description">', $txt['groupMembership_info'], '</p>';
  1578. // Do we have an update message?
  1579. if (!empty($context['update_message']))
  1580. echo '
  1581. <div class="infobox">
  1582. ', $context['update_message'], '.
  1583. </div>';
  1584. // Requesting membership to a group?
  1585. if (!empty($context['group_request']))
  1586. {
  1587. echo '
  1588. <div class="groupmembership">
  1589. <div class="cat_bar">
  1590. <h3 class="catbg">', $txt['request_group_membership'], '</h3>
  1591. </div>
  1592. <span class="upperframe"><span></span></span>
  1593. <div class="roundframe"><div class="innerframe">
  1594. ', $txt['request_group_membership_desc'], ':
  1595. <textarea name="reason" rows="4" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
  1596. <div class="righttext" style="margin: 0.5em 0.5% 0 0.5%;">
  1597. <input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
  1598. <input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
  1599. </div>
  1600. </div></div>
  1601. <span class="lowerframe"><span></span></span>
  1602. </div>';
  1603. }
  1604. else
  1605. {
  1606. echo '
  1607. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1608. <thead>
  1609. <tr class="catbg">
  1610. <th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
  1611. <th class="last_th" scope="col"></th>
  1612. </tr>
  1613. </thead>
  1614. <tbody>';
  1615. $alternate = true;
  1616. foreach ($context['groups']['member'] as $group)
  1617. {
  1618. echo '
  1619. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
  1620. if ($context['can_edit_primary'])
  1621. echo '
  1622. <td width="4%">
  1623. <input type="radio" name="primary" id="primary_', $group['id'], '" value="', $group['id'], '" ', $group['is_primary'] ? 'checked="checked"' : '', ' onclick="highlightSelected(\'primdiv_' . $group['id'] . '\');" ', $group['can_be_primary'] ? '' : 'disabled="disabled"', ' class="input_radio" />
  1624. </td>';
  1625. echo '
  1626. <td>
  1627. <label for="primary_', $group['id'], '"><strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : ''), '</label>
  1628. </td>
  1629. <td width="15%" class="righttext">';
  1630. // Can they leave their group?
  1631. if ($group['can_leave'])
  1632. echo '
  1633. <a href="' . $scripturl . '?action=profile;save;u=' . $context['id_member'] . ';area=groupmembership;' . $context['session_var'] . '=' . $context['session_id'] . ';gid=' . $group['id'] . ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">' . $txt['leave_group'] . '</a>';
  1634. echo '
  1635. </td>
  1636. </tr>';
  1637. $alternate = !$alternate;
  1638. }
  1639. echo '
  1640. </tbody>
  1641. </table>';
  1642. if ($context['can_edit_primary'])
  1643. echo '
  1644. <div class="padding righttext">
  1645. <input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
  1646. </div>';
  1647. // Any groups they can join?
  1648. if (!empty($context['groups']['available']))
  1649. {
  1650. echo '
  1651. <br />
  1652. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1653. <thead>
  1654. <tr class="catbg">
  1655. <th class="first_th" scope="col">
  1656. ', $txt['available_groups'], '
  1657. </th>
  1658. <th class="last_th" scope="col"></th>
  1659. </tr>
  1660. </thead>
  1661. <tbody>';
  1662. $alternate = true;
  1663. foreach ($context['groups']['available'] as $group)
  1664. {
  1665. echo '
  1666. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  1667. <td>
  1668. <strong>', (empty($group['color']) ? $group['name'] : '<span style="color: ' . $group['color'] . '">' . $group['name'] . '</span>'), '</strong>', (!empty($group['desc']) ? '<br /><span class="smalltext">' . $group['desc'] . '</span>' : ''), '
  1669. </td>
  1670. <td width="15%" class="lefttext">';
  1671. if ($group['type'] == 3)
  1672. echo '
  1673. <a href="', $scripturl, '?action=profile;save;u=', $context['id_member'], ';area=groupmembership;', $context['session_var'], '=', $context['session_id'], ';gid=', $group['id'], ';', $context[$context['token_check'] . '_token_var'], '=', $context[$context['token_check'] . '_token'], '">', $txt['join_group'], '</a>';
  1674. elseif ($group['type'] == 2 && $group['pending'])
  1675. echo '
  1676. ', $txt['approval_pending'];
  1677. elseif ($group['type'] == 2)
  1678. echo '
  1679. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '">', $txt['request_group'], '</a>';
  1680. // <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1681. echo '
  1682. </td>
  1683. </tr>';
  1684. $alternate = !$alternate;
  1685. }
  1686. echo '
  1687. </tbody>
  1688. </table>';
  1689. }
  1690. // Javascript for the selector stuff.
  1691. echo '
  1692. <script type="text/javascript"><!-- // --><![CDATA[
  1693. var prevClass = "";
  1694. var prevDiv = "";
  1695. function highlightSelected(box)
  1696. {
  1697. if (prevClass != "")
  1698. {
  1699. prevDiv.className = prevClass;
  1700. }
  1701. prevDiv = document.getElementById(box);
  1702. prevClass = prevDiv.className;
  1703. prevDiv.className = "highlight2";
  1704. }';
  1705. if (isset($context['groups']['member'][$context['primary_group']]))
  1706. echo '
  1707. highlightSelected("primdiv_' . $context['primary_group'] . '");';
  1708. echo '
  1709. // ]]></script>';
  1710. }
  1711. if (!empty($context['token_check']))
  1712. echo '
  1713. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1714. echo '
  1715. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1716. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1717. </form>';
  1718. }
  1719. function template_ignoreboards()
  1720. {
  1721. global $context, $txt, $settings, $scripturl;
  1722. // The main containing header.
  1723. echo '
  1724. <form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1725. <div class="cat_bar">
  1726. <h3 class="catbg">
  1727. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['profile'], '</span>
  1728. </h3>
  1729. </div>
  1730. <p class="description">', $txt['ignoreboards_info'], '</p>
  1731. <div class="windowbg2">
  1732. <span class="topslice"><span></span></span>
  1733. <div class="content flow_hidden">
  1734. <ul class="ignoreboards floatleft">';
  1735. $i = 0;
  1736. $limit = ceil($context['num_boards'] / 2);
  1737. foreach ($context['categories'] as $category)
  1738. {
  1739. if ($i == $limit)
  1740. {
  1741. echo '
  1742. </ul>
  1743. <ul class="ignoreboards floatright">';
  1744. $i++;
  1745. }
  1746. echo '
  1747. <li class="category">
  1748. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), ']); return false;">', $category['name'], '</a>
  1749. <ul>';
  1750. foreach ($category['boards'] as $board)
  1751. {
  1752. if ($i == $limit)
  1753. echo '
  1754. </ul>
  1755. </li>
  1756. </ul>
  1757. <ul class="ignoreboards floatright">
  1758. <li class="category">
  1759. <ul>';
  1760. echo '
  1761. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  1762. <label for="ignore_brd', $board['id'], '"><input type="checkbox" id="ignore_brd', $board['id'], '" name="ignore_brd[', $board['id'], ']" value="', $board['id'], '"', $board['selected'] ? ' checked="checked"' : '', ' class="input_check" /> ', $board['name'], '</label>
  1763. </li>';
  1764. $i++;
  1765. }
  1766. echo '
  1767. </ul>
  1768. </li>';
  1769. }
  1770. echo '
  1771. </ul>
  1772. <br class="clear" />';
  1773. // Show the standard "Save Settings" profile button.
  1774. template_profile_save();
  1775. echo '
  1776. </div>
  1777. <span class="botslice"><span></span></span>
  1778. </div>
  1779. </form>
  1780. <br />';
  1781. }
  1782. // Simple load some theme variables common to several warning templates.
  1783. function template_load_warning_variables()
  1784. {
  1785. global $modSettings, $context;
  1786. $context['warningBarWidth'] = 200;
  1787. // Setup the colors - this is a little messy for theming.
  1788. $context['colors'] = array(
  1789. 0 => 'green',
  1790. $modSettings['warning_watch'] => 'darkgreen',
  1791. $modSettings['warning_moderate'] => 'orange',
  1792. $modSettings['warning_mute'] => 'red',
  1793. );
  1794. // Work out the starting color.
  1795. $context['current_color'] = $context['colors'][0];
  1796. foreach ($context['colors'] as $limit => $color)
  1797. if ($context['member']['warning'] >= $limit)
  1798. $context['current_color'] = $color;
  1799. }
  1800. // Show all warnings of a user?
  1801. function template_viewWarning()
  1802. {
  1803. global $context, $txt, $scripturl, $settings;
  1804. template_load_warning_variables();
  1805. echo '
  1806. <div class="title_bar">
  1807. <h3 class="titlebg">
  1808. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />
  1809. ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '
  1810. </span>
  1811. </h3>
  1812. </div>
  1813. <div class="windowbg">
  1814. <span class="topslice"><span></span></span>
  1815. <div class="content">
  1816. <dl class="settings">
  1817. <dt>
  1818. <strong>', $txt['profile_warning_name'], ':</strong>
  1819. </dt>
  1820. <dd>
  1821. ', $context['member']['name'], '
  1822. </dd>
  1823. <dt>
  1824. <strong>', $txt['profile_warning_level'], ':</strong>
  1825. </dt>
  1826. <dd>
  1827. <div>
  1828. <div>
  1829. <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  1830. <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div>
  1831. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1832. </div>
  1833. </div>
  1834. </div>
  1835. </dd>';
  1836. // There's some impact of this?
  1837. if (!empty($context['level_effects'][$context['current_level']]))
  1838. echo '
  1839. <dt>
  1840. <strong>', $txt['profile_viewwarning_impact'], ':</strong>
  1841. </dt>
  1842. <dd>
  1843. ', $context['level_effects'][$context['current_level']], '
  1844. </dd>';
  1845. echo '
  1846. </dl>
  1847. </div>
  1848. <span class="botslice"><span></span></span>
  1849. </div>';
  1850. template_show_list('view_warnings');
  1851. }
  1852. // Show a lovely interface for issuing warnings.
  1853. function template_issueWarning()
  1854. {
  1855. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1856. template_load_warning_variables();
  1857. echo '
  1858. <script type="text/javascript"><!-- // --><![CDATA[
  1859. function setWarningBarPos(curEvent, isMove, changeAmount)
  1860. {
  1861. barWidth = ', $context['warningBarWidth'], ';
  1862. // Are we passing the amount to change it by?
  1863. if (changeAmount)
  1864. {
  1865. if (document.getElementById(\'warning_level\').value == \'SAME\')
  1866. percent = ', $context['member']['warning'], ' + changeAmount;
  1867. else
  1868. percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount;
  1869. }
  1870. // If not then it\'s a mouse thing.
  1871. else
  1872. {
  1873. if (!curEvent)
  1874. var curEvent = window.event;
  1875. // If it\'s a movement check the button state first!
  1876. if (isMove)
  1877. {
  1878. if (!curEvent.button || curEvent.button != 1)
  1879. return false
  1880. }
  1881. // Get the position of the container.
  1882. contain = document.getElementById(\'warning_contain\');
  1883. position = 0;
  1884. while (contain != null)
  1885. {
  1886. position += contain.offsetLeft;
  1887. contain = contain.offsetParent;
  1888. }
  1889. // Where is the mouse?
  1890. if (curEvent.pageX)
  1891. {
  1892. mouse = curEvent.pageX;
  1893. }
  1894. else
  1895. {
  1896. mouse = curEvent.clientX;
  1897. mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft;
  1898. }
  1899. // Is this within bounds?
  1900. if (mouse < position || mouse > position + barWidth)
  1901. return;
  1902. percent = Math.round(((mouse - position) / barWidth) * 100);
  1903. // Round percent to the nearest 5 - by kinda cheating!
  1904. percent = Math.round(percent / 5) * 5;
  1905. }
  1906. // What are the limits?
  1907. minLimit = ', $context['min_allowed'], ';
  1908. maxLimit = ', $context['max_allowed'], ';
  1909. percent = Math.max(percent, minLimit);
  1910. percent = Math.min(percent, maxLimit);
  1911. size = barWidth * (percent/100);
  1912. setInnerHTML(document.getElementById(\'warning_text\'), percent + "%");
  1913. document.getElementById(\'warning_level\').value = percent;
  1914. document.getElementById(\'warning_progress\').style.width = size + "px";
  1915. // Get the right color.
  1916. color = "black"';
  1917. foreach ($context['colors'] as $limit => $color)
  1918. echo '
  1919. if (percent >= ', $limit, ')
  1920. color = "', $color, '";';
  1921. echo '
  1922. document.getElementById(\'warning_progress\').style.backgroundColor = color;
  1923. // Also set the right effect.
  1924. effectText = "";';
  1925. foreach ($context['level_effects'] as $limit => $text)
  1926. echo '
  1927. if (percent >= ', $limit, ')
  1928. effectText = "', $text, '";';
  1929. echo '
  1930. setInnerHTML(document.getElementById(\'cur_level_div\'), effectText);
  1931. }
  1932. // Disable notification boxes as required.
  1933. function modifyWarnNotify()
  1934. {
  1935. disable = !document.getElementById(\'warn_notify\').checked;
  1936. document.getElementById(\'warn_sub\').disabled = disable;
  1937. document.getElementById(\'warn_body\').disabled = disable;
  1938. document.getElementById(\'warn_temp\').disabled = disable;
  1939. document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\';
  1940. }
  1941. function changeWarnLevel(amount)
  1942. {
  1943. setWarningBarPos(false, false, amount);
  1944. }
  1945. // Warn template.
  1946. function populateNotifyTemplate()
  1947. {
  1948. index = document.getElementById(\'warn_temp\').value;
  1949. if (index == -1)
  1950. return false;
  1951. // Otherwise see what we can do...';
  1952. foreach ($context['notification_templates'] as $k => $type)
  1953. echo '
  1954. if (index == ', $k, ')
  1955. document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
  1956. echo '
  1957. }
  1958. // ]]></script>';
  1959. echo '
  1960. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  1961. <div class="cat_bar">
  1962. <h3 class="catbg">
  1963. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />
  1964. ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '
  1965. </span>
  1966. </h3>
  1967. </div>';
  1968. if (!$context['user']['is_owner'])
  1969. echo '
  1970. <p class="description">', $txt['profile_warning_desc'], '</p>';
  1971. echo '
  1972. <div class="windowbg">
  1973. <span class="topslice"><span></span></span>
  1974. <div class="content">
  1975. <dl class="settings">';
  1976. if (!$context['user']['is_owner'])
  1977. echo '
  1978. <dt>
  1979. <strong>', $txt['profile_warning_name'], ':</strong>
  1980. </dt>
  1981. <dd>
  1982. <strong>', $context['member']['name'], '</strong>
  1983. </dd>';
  1984. echo '
  1985. <dt>
  1986. <strong>', $txt['profile_warning_level'], ':</strong>';
  1987. // Is there only so much they can apply?
  1988. if ($context['warning_limit'])
  1989. echo '
  1990. <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
  1991. echo '
  1992. </dt>
  1993. <dd>
  1994. <div id="warndiv1" style="display: none;">
  1995. <div>
  1996. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span>
  1997. <div class="floatleft" id="warning_contain" style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;" onmousedown="setWarningBarPos(event, true);" onmousemove="setWarningBarPos(event, true);" onclick="setWarningBarPos(event);">
  1998. <div id="warning_text" style="padding-top: 1pt; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['member']['warning'], '%</div>
  1999. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  2000. </div>
  2001. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span>
  2002. <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div>
  2003. </div>
  2004. <input type="hidden" name="warning_level" id="warning_level" value="SAME" />
  2005. </div>
  2006. <div id="warndiv2">
  2007. <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" />&nbsp;', $txt['profile_warning_max'], '
  2008. <div class="smalltext">', $txt['profile_warning_impact'], ':<br />';
  2009. // For non-javascript give a better list.
  2010. foreach ($context['level_effects'] as $limit => $effect)
  2011. echo '
  2012. ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />';
  2013. echo '
  2014. </div>
  2015. </div>
  2016. </dd>';
  2017. if (!$context['user']['is_owner'])
  2018. {
  2019. echo '
  2020. <dt>
  2021. <strong>', $txt['profile_warning_reason'], ':</strong><br />
  2022. <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span>
  2023. </dt>
  2024. <dd>
  2025. <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" />
  2026. </dd>
  2027. </dl>
  2028. <hr />
  2029. <dl class="settings">
  2030. <dt>
  2031. <strong>', $txt['profile_warning_notify'], ':</strong>
  2032. </dt>
  2033. <dd>
  2034. <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" />
  2035. </dd>
  2036. <dt>
  2037. <strong>', $txt['profile_warning_notify_subject'], ':</strong>
  2038. </dt>
  2039. <dd>
  2040. <input type="text" name="warn_sub" id="warn_sub" value="', empty($context['warning_data']['notify_subject']) ? $txt['profile_warning_notify_template_subject'] : $context['warning_data']['notify_subject'], '" size="50" style="width: 80%;" class="input_text" />
  2041. </dd>
  2042. <dt>
  2043. <strong>', $txt['profile_warning_notify_body'], ':</strong>
  2044. </dt>
  2045. <dd>
  2046. <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;">
  2047. <option value="-1">', $txt['profile_warning_notify_template'], '</option>
  2048. <option value="-1">------------------------------</option>';
  2049. foreach ($context['notification_templates'] as $id_template => $template)
  2050. echo '
  2051. <option value="', $id_template, '">', $template['title'], '</option>';
  2052. echo '
  2053. </select>
  2054. <span class="smalltext" id="new_template_link" style="display: none;">[<a href="', $scripturl, '?action=moderate;area=warnings;sa=templateedit;tid=0" target="_blank" class="new_win">', $txt['profile_warning_new_template'], '</a>]</span><br />
  2055. <textarea name="warn_body" id="warn_body" cols="40" rows="8" style="min-width: 50%; max-width: 99%;">', $context['warning_data']['notify_body'], '</textarea>
  2056. </dd>';
  2057. }
  2058. echo '
  2059. </dl>
  2060. <div class="righttext">';
  2061. if (!empty($context['token_check']))
  2062. echo '
  2063. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2064. echo '
  2065. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2066. <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" />
  2067. </div>
  2068. </div>
  2069. <span class="botslice"><span></span></span>
  2070. </div>
  2071. </form>';
  2072. // Previous warnings?
  2073. echo '<br />
  2074. <div class="cat_bar">
  2075. <h3 class="catbg">
  2076. ', $txt['profile_warning_previous'], '
  2077. </h3>
  2078. </div>
  2079. <table border="0" width="100%" cellspacing="0" cellpadding="5" class="table_grid">
  2080. <thead>
  2081. <tr class="titlebg lefttext">
  2082. <th class="first_th" scope="col" width="20%">', $txt['profile_warning_previous_issued'], '</th>
  2083. <th scope="col" width="30%">', $txt['profile_warning_previous_time'], '</th>
  2084. <th scope="col">', $txt['profile_warning_previous_reason'], '</th>
  2085. <th class="last_th" scope="col" width="6%">', $txt['profile_warning_previous_level'], '</th>
  2086. </tr>
  2087. </thead>
  2088. <tbody>';
  2089. // Print the warnings.
  2090. $alternate = 0;
  2091. foreach ($context['previous_warnings'] as $warning)
  2092. {
  2093. $alternate = !$alternate;
  2094. echo '
  2095. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  2096. <td class="smalltext">', $warning['issuer']['link'], '</td>
  2097. <td class="smalltext">', $warning['time'], '</td>
  2098. <td class="smalltext">
  2099. <div class="floatleft">
  2100. ', $warning['reason'], '
  2101. </div>';
  2102. if (!empty($warning['id_notice']))
  2103. echo '
  2104. <div class="floatright">
  2105. <a href="', $scripturl, '?action=moderate;area=notice;nid=', $warning['id_notice'], '" onclick="window.open(this.href, \'\', \'scrollbars=yes,resizable=yes,width=400,height=250\');return false;" target="_blank" class="new_win" title="', $txt['profile_warning_previous_notice'], '"><img src="', $settings['images_url'], '/filter.png" alt="" /></a>
  2106. </div>';
  2107. echo '
  2108. </td>
  2109. <td class="smalltext">', $warning['counter'], '</td>
  2110. </tr>';
  2111. }
  2112. if (empty($context['previous_warnings']))
  2113. echo '
  2114. <tr class="windowbg2">
  2115. <td align="center" colspan="4">
  2116. ', $txt['profile_warning_previous_none'], '
  2117. </td>
  2118. </tr>';
  2119. echo '
  2120. </tbody>
  2121. </table>
  2122. <div class="pagesection">', $txt['pages'], ': ', $context['page_index'], '</div>';
  2123. // Do our best to get pretty javascript enabled.
  2124. echo '
  2125. <script type="text/javascript"><!-- // --><![CDATA[
  2126. document.getElementById(\'warndiv1\').style.display = "";
  2127. document.getElementById(\'warndiv2\').style.display = "none";';
  2128. if (!$context['user']['is_owner'])
  2129. echo '
  2130. modifyWarnNotify();';
  2131. echo '
  2132. // ]]></script>';
  2133. }
  2134. // Template to show for deleting a users account - now with added delete post capability!
  2135. function template_deleteAccount()
  2136. {
  2137. global $context, $settings, $options, $scripturl, $txt, $scripturl;
  2138. // The main containing header.
  2139. echo '
  2140. <form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  2141. <div class="title_bar">
  2142. <h3 class="titlebg">
  2143. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['deleteAccount'], '</span>
  2144. </h3>
  2145. </div>';
  2146. // If deleting another account give them a lovely info box.
  2147. if (!$context['user']['is_owner'])
  2148. echo '
  2149. <p class="windowbg2 description">', $txt['deleteAccount_desc'], '</p>';
  2150. echo '
  2151. <div class="windowbg2">
  2152. <span class="topslice"><span></span></span>
  2153. <div class="content">';
  2154. // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
  2155. if ($context['needs_approval'])
  2156. echo '
  2157. <div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
  2158. // If the user is deleting their own account warn them first - and require a password!
  2159. if ($context['user']['is_owner'])
  2160. {
  2161. echo '
  2162. <div class="alert">', $txt['own_profile_confirm'], '</div>
  2163. <div>
  2164. <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
  2165. <input type="password" name="oldpasswrd" size="20" class="input_password" />&nbsp;&nbsp;&nbsp;&nbsp;
  2166. <input type="submit" value="', $txt['yes'], '" class="button_submit" />';
  2167. if (!empty($context['token_check']))
  2168. echo '
  2169. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2170. echo '
  2171. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2172. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2173. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2174. </div>';
  2175. }
  2176. // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
  2177. else
  2178. {
  2179. echo '
  2180. <div class="alert">', $txt['deleteAccount_warning'], '</div>';
  2181. // Only actually give these options if they are kind of important.
  2182. if ($context['can_delete_posts'])
  2183. echo '
  2184. <div>
  2185. ', $txt['deleteAccount_posts'], ':
  2186. <select name="remove_type">
  2187. <option value="none">', $txt['deleteAccount_none'], '</option>
  2188. <option value="posts">', $txt['deleteAccount_all_posts'], '</option>
  2189. <option value="topics">', $txt['deleteAccount_topics'], '</option>
  2190. </select>
  2191. </div>';
  2192. echo '
  2193. <div>
  2194. <label for="deleteAccount"><input type="checkbox" name="deleteAccount" id="deleteAccount" value="1" class="input_check" onclick="if (this.checked) return confirm(\'', $txt['deleteAccount_confirm'], '\');" /> ', $txt['deleteAccount_member'], '.</label>
  2195. </div>
  2196. <div>
  2197. <input type="submit" value="', $txt['delete'], '" class="button_submit" />';
  2198. if (!empty($context['token_check']))
  2199. echo '
  2200. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2201. echo '
  2202. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2203. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2204. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2205. </div>';
  2206. }
  2207. echo '
  2208. </div>
  2209. <span class="botslice"><span></span></span>
  2210. </div>
  2211. <br />
  2212. </form>';
  2213. }
  2214. // Template for the password box/save button stuck at the bottom of every profile page.
  2215. function template_profile_save()
  2216. {
  2217. global $context, $settings, $options, $txt;
  2218. echo '
  2219. <hr width="100%" size="1" class="hrcolor clear" />';
  2220. // Only show the password box if it's actually needed.
  2221. if ($context['require_password'])
  2222. echo '
  2223. <dl>
  2224. <dt>
  2225. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2226. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2227. </dt>
  2228. <dd>
  2229. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2230. </dd>
  2231. </dl>';
  2232. echo '
  2233. <div class="righttext">
  2234. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2235. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2236. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2237. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2238. </div>';
  2239. }
  2240. // Small template for showing an error message upon a save problem in the profile.
  2241. function template_error_message()
  2242. {
  2243. global $context, $txt;
  2244. echo '
  2245. <div class="errorbox">
  2246. <span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], '</span>
  2247. <ul class="reset">';
  2248. // Cycle through each error and display an error message.
  2249. foreach ($context['post_errors'] as $error)
  2250. echo '
  2251. <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
  2252. echo '
  2253. </ul>
  2254. </div>';
  2255. }
  2256. // Display a load of drop down selectors for allowing the user to change group.
  2257. function template_profile_group_manage()
  2258. {
  2259. global $context, $txt, $scripturl;
  2260. echo '
  2261. <dt>
  2262. <strong>', $txt['primary_membergroup'], ': </strong><br />
  2263. <span class="smalltext">[<a href="', $scripturl, '?action=helpadmin;help=moderator_why_missing" onclick="return reqWin(this.href);">', $txt['moderator_why_missing'], '</a>]</span>
  2264. </dt>
  2265. <dd>
  2266. <select name="id_group" ', ($context['user']['is_owner'] && $context['member']['group_id'] == 1 ? 'onchange="if (this.value != 1 &amp;&amp; !confirm(\'' . $txt['deadmin_confirm'] . '\')) this.value = 1;"' : ''), '>';
  2267. // Fill the select box with all primary member groups that can be assigned to a member.
  2268. foreach ($context['member_groups'] as $member_group)
  2269. if (!empty($member_group['can_be_primary']))
  2270. echo '
  2271. <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected="selected"' : '', '>
  2272. ', $member_group['name'], '
  2273. </option>';
  2274. echo '
  2275. </select>
  2276. </dd>
  2277. <dt>
  2278. <strong>', $txt['additional_membergroups'], ':</strong>
  2279. </dt>
  2280. <dd>
  2281. <span id="additional_groupsList">
  2282. <input type="hidden" name="additional_groups[]" value="0" />';
  2283. // For each membergroup show a checkbox so members can be assigned to more than one group.
  2284. foreach ($context['member_groups'] as $member_group)
  2285. if ($member_group['can_be_additional'])
  2286. echo '
  2287. <label for="additional_groups-', $member_group['id'], '"><input type="checkbox" name="additional_groups[]" value="', $member_group['id'], '" id="additional_groups-', $member_group['id'], '"', $member_group['is_additional'] ? ' checked="checked"' : '', ' class="input_check" /> ', $member_group['name'], '</label><br />';
  2288. echo '
  2289. </span>
  2290. <a href="javascript:void(0);" onclick="document.getElementById(\'additional_groupsList\').style.display = \'block\'; document.getElementById(\'additional_groupsLink\').style.display = \'none\'; return false;" id="additional_groupsLink" style="display: none;">', $txt['additional_membergroups_show'], '</a>
  2291. <script type="text/javascript"><!-- // --><![CDATA[
  2292. document.getElementById("additional_groupsList").style.display = "none";
  2293. document.getElementById("additional_groupsLink").style.display = "";
  2294. // ]]></script>
  2295. </dd>';
  2296. }
  2297. // Callback function for entering a birthdate!
  2298. function template_profile_birthdate()
  2299. {
  2300. global $txt, $context;
  2301. // Just show the pretty box!
  2302. echo '
  2303. <dt>
  2304. <strong>', $txt['dob'], ':</strong><br />
  2305. <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
  2306. </dt>
  2307. <dd>
  2308. <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '" class="input_text" /> -
  2309. <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '" class="input_text" /> -
  2310. <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '" class="input_text" />
  2311. </dd>';
  2312. }
  2313. // Show the signature editing box?
  2314. function template_profile_signature_modify()
  2315. {
  2316. global $txt, $context, $settings;
  2317. echo '
  2318. <dt>
  2319. <strong>', $txt['signature'], ':</strong><br />
  2320. <span class="smalltext">', $txt['sig_info'], '</span><br />
  2321. <br />';
  2322. if ($context['show_spellchecking'])
  2323. echo '
  2324. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit" />';
  2325. echo '
  2326. </dt>
  2327. <dd>
  2328. <textarea class="editor" onkeyup="calcCharLeft();" name="signature" rows="5" cols="50" style="min-width: 50%; max-width: 99%;">', $context['member']['signature'], '</textarea><br />';
  2329. // If there is a limit at all!
  2330. if (!empty($context['signature_limits']['max_length']))
  2331. echo '
  2332. <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br />';
  2333. if ($context['signature_warning'])
  2334. echo '
  2335. <span class="smalltext">', $context['signature_warning'], '</span>';
  2336. // Load the spell checker?
  2337. if ($context['show_spellchecking'])
  2338. echo '
  2339. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>';
  2340. // Some javascript used to count how many characters have been used so far in the signature.
  2341. echo '
  2342. <script type="text/javascript"><!-- // --><![CDATA[
  2343. function tick()
  2344. {
  2345. if (typeof(document.forms.creator) != "undefined")
  2346. {
  2347. calcCharLeft();
  2348. setTimeout("tick()", 1000);
  2349. }
  2350. else
  2351. setTimeout("tick()", 800);
  2352. }
  2353. function calcCharLeft()
  2354. {
  2355. var maxLength = ', $context['signature_limits']['max_length'], ';
  2356. var oldSignature = "", currentSignature = document.forms.creator.signature.value;
  2357. if (!document.getElementById("signatureLeft"))
  2358. return;
  2359. if (oldSignature != currentSignature)
  2360. {
  2361. oldSignature = currentSignature;
  2362. if (currentSignature.replace(/\r/, "").length > maxLength)
  2363. document.forms.creator.signature.value = currentSignature.replace(/\r/, "").substring(0, maxLength);
  2364. currentSignature = document.forms.creator.signature.value.replace(/\r/, "");
  2365. }
  2366. setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentSignature.length);
  2367. }
  2368. addLoadEvent(tick);
  2369. // ]]></script>
  2370. </dd>';
  2371. }
  2372. function template_profile_avatar_select()
  2373. {
  2374. global $context, $txt, $modSettings;
  2375. // Start with the upper menu
  2376. echo '
  2377. <dt>
  2378. <strong id="personal_picture">', $txt['personal_picture'], '</strong>
  2379. <input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_none" value="none"' . ($context['member']['avatar']['choice'] == 'none' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_none"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['no_avatar'] . '</label><br />
  2380. ', !empty($context['member']['avatar']['allow_server_stored']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_server_stored" value="server_stored"' . ($context['member']['avatar']['choice'] == 'server_stored' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_server_stored"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['choose_avatar_gallery'] . '</label><br />' : '', '
  2381. ', !empty($context['member']['avatar']['allow_external']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_external" value="external"' . ($context['member']['avatar']['choice'] == 'external' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_external"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['my_own_pic'] . '</label><br />' : '', '
  2382. ', !empty($context['member']['avatar']['allow_upload']) ? '<input type="radio" onclick="swap_avatar(this); return true;" name="avatar_choice" id="avatar_choice_upload" value="upload"' . ($context['member']['avatar']['choice'] == 'upload' ? ' checked="checked"' : '') . ' class="input_radio" /><label for="avatar_choice_upload"' . (isset($context['modify_error']['bad_avatar']) ? ' class="error"' : '') . '>' . $txt['avatar_will_upload'] . '</label>' : '', '
  2383. </dt>
  2384. <dd>';
  2385. // If users are allowed to choose avatars stored on the server show selection boxes to choice them from.
  2386. if (!empty($context['member']['avatar']['allow_server_stored']))
  2387. {
  2388. echo '
  2389. <div id="avatar_server_stored">
  2390. <div>
  2391. <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
  2392. // This lists all the file catergories.
  2393. foreach ($context['avatars'] as $avatar)
  2394. echo '
  2395. <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected="selected"' : ''), '>', $avatar['name'], '</option>';
  2396. echo '
  2397. </select>
  2398. </div>
  2399. <div>
  2400. <select name="file" id="file" size="10" style="display: none;" onchange="showAvatar()" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');" disabled="disabled"><option></option></select>
  2401. </div>
  2402. <div><img name="avatar" id="avatar" src="', !empty($context['member']['avatar']['allow_external']) && $context['member']['avatar']['choice'] == 'external' ? $context['member']['avatar']['external'] : $modSettings['avatar_url'] . '/blank.png', '" alt="Do Nothing" /></div>
  2403. <script type="text/javascript"><!-- // --><![CDATA[
  2404. var files = ["' . implode('", "', $context['avatar_list']) . '"];
  2405. var avatar = document.getElementById("avatar");
  2406. var cat = document.getElementById("cat");
  2407. var selavatar = "' . $context['avatar_selected'] . '";
  2408. var avatardir = "' . $modSettings['avatar_url'] . '/";
  2409. var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116);
  2410. var file = document.getElementById("file");
  2411. if (avatar.src.indexOf("blank.png") > -1)
  2412. changeSel(selavatar);
  2413. else
  2414. previewExternalAvatar(avatar.src)
  2415. function changeSel(selected)
  2416. {
  2417. if (cat.selectedIndex == -1)
  2418. return;
  2419. if (cat.options[cat.selectedIndex].value.indexOf("/") > 0)
  2420. {
  2421. var i;
  2422. var count = 0;
  2423. file.style.display = "inline";
  2424. file.disabled = false;
  2425. for (i = file.length; i >= 0; i = i - 1)
  2426. file.options[i] = null;
  2427. for (i = 0; i < files.length; i++)
  2428. if (files[i].indexOf(cat.options[cat.selectedIndex].value) == 0)
  2429. {
  2430. var filename = files[i].substr(files[i].indexOf("/") + 1);
  2431. var showFilename = filename.substr(0, filename.lastIndexOf("."));
  2432. showFilename = showFilename.replace(/[_]/g, " ");
  2433. file.options[count] = new Option(showFilename, files[i]);
  2434. if (filename == selected)
  2435. {
  2436. if (file.options.defaultSelected)
  2437. file.options[count].defaultSelected = true;
  2438. else
  2439. file.options[count].selected = true;
  2440. }
  2441. count++;
  2442. }
  2443. if (file.selectedIndex == -1 && file.options[0])
  2444. file.options[0].selected = true;
  2445. showAvatar();
  2446. }
  2447. else
  2448. {
  2449. file.style.display = "none";
  2450. file.disabled = true;
  2451. document.getElementById("avatar").src = avatardir + cat.options[cat.selectedIndex].value;
  2452. document.getElementById("avatar").style.width = "";
  2453. document.getElementById("avatar").style.height = "";
  2454. }
  2455. }
  2456. function showAvatar()
  2457. {
  2458. if (file.selectedIndex == -1)
  2459. return;
  2460. document.getElementById("avatar").src = avatardir + file.options[file.selectedIndex].value;
  2461. document.getElementById("avatar").alt = file.options[file.selectedIndex].text;
  2462. document.getElementById("avatar").alt += file.options[file.selectedIndex].text == size ? "!" : "";
  2463. document.getElementById("avatar").style.width = "";
  2464. document.getElementById("avatar").style.height = "";
  2465. }
  2466. function previewExternalAvatar(src)
  2467. {
  2468. if (!document.getElementById("avatar"))
  2469. return;
  2470. var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, ';
  2471. var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, ';
  2472. var tempImage = new Image();
  2473. tempImage.src = src;
  2474. if (maxWidth != 0 && tempImage.width > maxWidth)
  2475. {
  2476. document.getElementById("avatar").style.height = parseInt((maxWidth * tempImage.height) / tempImage.width) + "px";
  2477. document.getElementById("avatar").style.width = maxWidth + "px";
  2478. }
  2479. else if (maxHeight != 0 && tempImage.height > maxHeight)
  2480. {
  2481. document.getElementById("avatar").style.width = parseInt((maxHeight * tempImage.width) / tempImage.height) + "px";
  2482. document.getElementById("avatar").style.height = maxHeight + "px";
  2483. }
  2484. document.getElementById("avatar").src = src;
  2485. }
  2486. // ]]></script>
  2487. </div>';
  2488. }
  2489. // If the user can link to an off server avatar, show them a box to input the address.
  2490. if (!empty($context['member']['avatar']['allow_external']))
  2491. {
  2492. echo '
  2493. <div id="avatar_external">
  2494. <div class="smalltext">', $txt['avatar_by_url'], '</div>
  2495. <input type="text" name="userpicpersonal" size="45" value="', $context['member']['avatar']['external'], '" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'external\');" onchange="if (typeof(previewExternalAvatar) != \'undefined\') previewExternalAvatar(this.value);" class="input_text" />
  2496. </div>';
  2497. }
  2498. // If the user is able to upload avatars to the server show them an upload box.
  2499. if (!empty($context['member']['avatar']['allow_upload']))
  2500. {
  2501. echo '
  2502. <div id="avatar_upload">
  2503. <input type="file" size="44" name="attachment" value="" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" class="input_file" />
  2504. ', ($context['member']['avatar']['id_attach'] > 0 ? '<br /><br /><img src="' . $context['member']['avatar']['href'] . (strpos($context['member']['avatar']['href'], '?') === false ? '?' : '&amp;') . 'time=' . time() . '" alt="" /><input type="hidden" name="id_attach" value="' . $context['member']['avatar']['id_attach'] . '" />' : ''), '
  2505. </div>';
  2506. }
  2507. echo '
  2508. <script type="text/javascript"><!-- // --><![CDATA[
  2509. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', '
  2510. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', '
  2511. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', '
  2512. function swap_avatar(type)
  2513. {
  2514. switch(type.id)
  2515. {
  2516. case "avatar_choice_server_stored":
  2517. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', '
  2518. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2519. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2520. break;
  2521. case "avatar_choice_external":
  2522. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2523. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', '
  2524. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2525. break;
  2526. case "avatar_choice_upload":
  2527. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2528. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2529. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', '
  2530. break;
  2531. case "avatar_choice_none":
  2532. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2533. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2534. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2535. break;
  2536. }
  2537. }
  2538. // ]]></script>
  2539. </dd>';
  2540. }
  2541. // Callback for modifying karam.
  2542. function template_profile_karma_modify()
  2543. {
  2544. global $context, $modSettings, $txt;
  2545. echo '
  2546. <dt>
  2547. <strong>', $modSettings['karmaLabel'], '</strong>
  2548. </dt>
  2549. <dd>
  2550. ', $modSettings['karmaApplaudLabel'], ' <input type="text" name="karma_good" size="4" value="', $context['member']['karma']['good'], '" onchange="setInnerHTML(document.getElementById(\'karmaTotal\'), this.value - this.form.karma_bad.value);" style="margin-right: 2ex;" class="input_text" /> ', $modSettings['karmaSmiteLabel'], ' <input type="text" name="karma_bad" size="4" value="', $context['member']['karma']['bad'], '" onchange="this.form.karma_good.onchange();" class="input_text" /><br />
  2551. (', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
  2552. </dd>';
  2553. }
  2554. // Select the time format!
  2555. function template_profile_timeformat_modify()
  2556. {
  2557. global $context, $modSettings, $txt, $scripturl, $settings;
  2558. echo '
  2559. <dt>
  2560. <strong>', $txt['time_format'], ':</strong><br />
  2561. <a href="', $scripturl, '?action=helpadmin;help=time_format" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" class="floatleft" /></a>
  2562. <span class="smalltext">&nbsp;', $txt['date_format'], '</span>
  2563. </dt>
  2564. <dd>
  2565. <select name="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
  2566. // Help the user by showing a list of common time formats.
  2567. foreach ($context['easy_timeformats'] as $time_format)
  2568. echo '
  2569. <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected="selected"' : '', '>', $time_format['title'], '</option>';
  2570. echo '
  2571. </select><br />
  2572. <input type="text" name="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text" />
  2573. </dd>';
  2574. }
  2575. // Time offset?
  2576. function template_profile_timeoffset_modify()
  2577. {
  2578. global $txt, $context;
  2579. echo '
  2580. <dt>
  2581. <strong', (isset($context['modify_error']['bad_offset']) ? ' class="error"' : ''), '>', $txt['time_offset'], ':</strong><br />
  2582. <span class="smalltext">', $txt['personal_time_offset'], '</span>
  2583. </dt>
  2584. <dd>
  2585. <input type="text" name="time_offset" id="time_offset" size="5" maxlength="5" value="', $context['member']['time_offset'], '" class="input_text" /> ', $txt['hours'], ' [<a href="javascript:void(0);" onclick="currentDate = new Date(', $context['current_forum_time_js'], '); document.getElementById(\'time_offset\').value = autoDetectTimeOffset(currentDate); return false;">', $txt['timeoffset_autodetect'], '</a>]<br />', $txt['current_time'], ': <em>', $context['current_forum_time'], '</em>
  2586. </dd>';
  2587. }
  2588. // Theme?
  2589. function template_profile_theme_pick()
  2590. {
  2591. global $txt, $context, $scripturl;
  2592. echo '
  2593. <dt>
  2594. <strong>', $txt['current_theme'], ':</strong>
  2595. </dt>
  2596. <dd>
  2597. ', $context['member']['theme']['name'], ' [<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>]
  2598. </dd>';
  2599. }
  2600. // Smiley set picker.
  2601. function template_profile_smiley_pick()
  2602. {
  2603. global $txt, $context, $modSettings, $settings;
  2604. echo '
  2605. <dt>
  2606. <strong>', $txt['smileys_current'], ':</strong>
  2607. </dt>
  2608. <dd>
  2609. <select name="smiley_set" onchange="document.getElementById(\'smileypr\').src = this.selectedIndex == 0 ? \'', $settings['images_url'], '/blank.png\' : \'', $modSettings['smileys_url'], '/\' + (this.selectedIndex != 1 ? this.options[this.selectedIndex].value : \'', !empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'], '\') + \'/smiley.png\';">';
  2610. foreach ($context['smiley_sets'] as $set)
  2611. echo '
  2612. <option value="', $set['id'], '"', $set['selected'] ? ' selected="selected"' : '', '>', $set['name'], '</option>';
  2613. echo '
  2614. </select> <img id="smileypr" src="', $context['member']['smiley_set']['id'] != 'none' ? $modSettings['smileys_url'] . '/' . ($context['member']['smiley_set']['id'] != '' ? $context['member']['smiley_set']['id'] : (!empty($settings['smiley_sets_default']) ? $settings['smiley_sets_default'] : $modSettings['smiley_sets_default'])) . '/smiley.png' : $settings['images_url'] . '/blank.png', '" alt=":)" align="top" style="padding-left: 20px;" />
  2615. </dd>';
  2616. }
  2617. // Change the way you login to the forum.
  2618. function template_authentication_method()
  2619. {
  2620. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  2621. // The main header!
  2622. echo '
  2623. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/register.js"></script>
  2624. <form action="', $scripturl, '?action=profile;area=authentication;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data">
  2625. <div class="cat_bar">
  2626. <h3 class="catbg">
  2627. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.png" alt="" class="icon" />', $txt['authentication'], '</span>
  2628. </h3>
  2629. </div>
  2630. <p class="windowbg description">', $txt['change_authentication'], '</p>
  2631. <div class="windowbg2">
  2632. <span class="topslice"><span></span></span>
  2633. <div class="content">
  2634. <dl>
  2635. <dt>
  2636. <input type="radio" onclick="updateAuthMethod();" name="authenticate" value="openid" id="auth_openid"', $context['auth_method'] == 'openid' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_openid"><strong>', $txt['authenticate_openid'], '</strong></label>&nbsp;<em><a href="', $scripturl, '?action=helpadmin;help=register_openid" onclick="return reqWin(this.href);" class="help">(?)</a></em><br />
  2637. <input type="radio" onclick="updateAuthMethod();" name="authenticate" value="passwd" id="auth_pass"', $context['auth_method'] == 'password' ? ' checked="checked"' : '', ' class="input_radio" /><label for="auth_pass"><strong>', $txt['authenticate_password'], '</strong></label>
  2638. </dt>
  2639. <dd>
  2640. <dl id="auth_openid_div">
  2641. <dt>
  2642. <em>', $txt['authenticate_openid_url'], ':</em>
  2643. </dt>
  2644. <dd>
  2645. <input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', $context['member']['openid_uri'], '" class="input_text openid_login" />
  2646. </dd>
  2647. </dl>
  2648. <dl id="auth_pass_div">
  2649. <dt>
  2650. <em>', $txt['choose_pass'], ':</em>
  2651. </dt>
  2652. <dd>
  2653. <input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2654. <span id="smf_autov_pwmain_div" style="display: none;"><img id="smf_autov_pwmain_img" src="', $settings['images_url'], '/icons/field_invalid.png" alt="*" /></span>
  2655. </dd>
  2656. <dt>
  2657. <em>', $txt['verify_pass'], ':</em>
  2658. </dt>
  2659. <dd>
  2660. <input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2661. <span id="smf_autov_pwverify_div" style="display: none;"><img id="smf_autov_pwverify_img" src="', $settings['images_url'], '/icons/field_valid.png" alt="*" /></span>
  2662. </dd>
  2663. </dl>
  2664. </dd>
  2665. </dl>';
  2666. if ($context['require_password'])
  2667. echo '
  2668. <hr width="100%" size="1" class="hrcolor clear" />
  2669. <dl>
  2670. <dt>
  2671. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2672. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2673. </dt>
  2674. <dd>
  2675. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2676. </dd>
  2677. </dl>';
  2678. echo '
  2679. <div class="righttext">';
  2680. if (!empty($context['token_check']))
  2681. echo '
  2682. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2683. echo '
  2684. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2685. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2686. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2687. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2688. </div>
  2689. </div>
  2690. <span class="botslice"><span></span></span>
  2691. </div>
  2692. </form>';
  2693. // The password stuff.
  2694. echo '
  2695. <script type="text/javascript"><!-- // --><![CDATA[
  2696. var regTextStrings = {
  2697. "password_short": "', $txt['registration_password_short'], '",
  2698. "password_reserved": "', $txt['registration_password_reserved'], '",
  2699. "password_numbercase": "', $txt['registration_password_numbercase'], '",
  2700. "password_no_match": "', $txt['registration_password_no_match'], '",
  2701. "password_valid": "', $txt['registration_password_valid'], '"
  2702. };
  2703. var verificationHandle = new smfRegister("creator", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
  2704. var currentAuthMethod = \'passwd\';
  2705. function updateAuthMethod()
  2706. {
  2707. // What authentication method is being used?
  2708. if (!document.getElementById(\'auth_openid\') || !document.getElementById(\'auth_openid\').checked)
  2709. currentAuthMethod = \'passwd\';
  2710. else
  2711. currentAuthMethod = \'openid\';
  2712. // No openID?
  2713. if (!document.getElementById(\'auth_openid\'))
  2714. return true;
  2715. document.forms.creator.openid_url.disabled = currentAuthMethod == \'openid\' ? false : true;
  2716. document.forms.creator.smf_autov_pwmain.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2717. document.forms.creator.smf_autov_pwverify.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2718. document.getElementById(\'smf_autov_pwmain_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2719. document.getElementById(\'smf_autov_pwverify_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2720. if (currentAuthMethod == \'passwd\')
  2721. {
  2722. verificationHandle.refreshMainPassword();
  2723. verificationHandle.refreshVerifyPassword();
  2724. document.forms.creator.openid_url.style.backgroundColor = \'\';
  2725. document.getElementById("auth_openid_div").style.display = "none";
  2726. document.getElementById("auth_pass_div").style.display = "";
  2727. }
  2728. else
  2729. {
  2730. document.forms.creator.smf_autov_pwmain.style.backgroundColor = \'\';
  2731. document.forms.creator.smf_autov_pwverify.style.backgroundColor = \'\';
  2732. document.forms.creator.openid_url.style.backgroundColor = \'#FCE184\';
  2733. document.getElementById("auth_openid_div").style.display = "";
  2734. document.getElementById("auth_pass_div").style.display = "none";
  2735. }
  2736. }
  2737. updateAuthMethod();
  2738. // ]]></script>';
  2739. }
  2740. ?>