Profile.template.php 121 KB

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