Profile.template.php 125 KB

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