Profile.template.php 124 KB

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