Profile.template.php 120 KB

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