Profile.template.php 121 KB

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