Profile.template.php 122 KB

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