Profile.template.php 121 KB

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