Profile.template.php 125 KB

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