Profile.template.php 122 KB

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