Profile.template.php 123 KB

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