Profile.template.php 122 KB

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