Profile.template.php 124 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239
  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="titlebg">
  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="titlebg">
  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="cat_bar">
  1022. <h3 class="catbg">
  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="cat_bar">
  1063. <h3 class="catbg">
  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="cat_bar">
  1098. <h3 class="catbg">
  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" onsubmit="return checkProfileSubmit();">
  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. // Some javascript!
  1313. echo '
  1314. <script><!-- // --><![CDATA[
  1315. function checkProfileSubmit()
  1316. {';
  1317. // If this part requires a password, make sure to give a warning.
  1318. if ($context['require_password'])
  1319. echo '
  1320. // Did you forget to type your password?
  1321. if (document.forms.creator.oldpasswrd.value == "")
  1322. {
  1323. alert("', $txt['required_security_reasons'], '");
  1324. return false;
  1325. }';
  1326. // Any onsubmit javascript?
  1327. if (!empty($context['profile_onsubmit_javascript']))
  1328. echo '
  1329. ', $context['profile_javascript'];
  1330. echo '
  1331. }';
  1332. // Any totally custom stuff?
  1333. if (!empty($context['profile_javascript']))
  1334. echo '
  1335. ', $context['profile_javascript'];
  1336. echo '
  1337. // ]]></script>';
  1338. // Any final spellchecking stuff?
  1339. if (!empty($context['show_spellchecking']))
  1340. echo '
  1341. <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>';
  1342. }
  1343. // Personal Message settings.
  1344. function template_profile_pm_settings()
  1345. {
  1346. global $context, $scripturl, $modSettings, $txt;
  1347. echo '
  1348. <dt>
  1349. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1350. </dt>
  1351. <dd>
  1352. <select name="pm_prefs" id="pm_prefs">
  1353. <option value="0"', $context['display_mode'] == 0 ? ' selected' : '', '>', $txt['pm_display_mode_all'], '</option>
  1354. <option value="1"', $context['display_mode'] == 1 ? ' selected' : '', '>', $txt['pm_display_mode_one'], '</option>
  1355. <option value="2"', $context['display_mode'] == 2 ? ' selected' : '', '>', $txt['pm_display_mode_linked'], '</option>
  1356. </select>
  1357. </dd>
  1358. <dt>
  1359. <label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label>
  1360. </dt>
  1361. <dd>
  1362. <input type="hidden" name="default_options[view_newest_pm_first]" value="0">
  1363. <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">
  1364. </dd>
  1365. </dl>
  1366. <hr>
  1367. <dl>
  1368. <dt>
  1369. <label for="pm_receive_from">', $txt['pm_receive_from'], '</label>
  1370. </dt>
  1371. <dd>
  1372. <select name="pm_receive_from" id="pm_receive_from">
  1373. <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
  1374. if (!empty($modSettings['enable_buddylist']))
  1375. echo '
  1376. <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected' : '', '>', $txt['pm_receive_from_ignore'], '</option>
  1377. <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
  1378. echo '
  1379. <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected' : '', '>', $txt['pm_receive_from_admins'], '</option>
  1380. </select>
  1381. </dd>
  1382. <dt>
  1383. <label for="pm_email_notify">', $txt['email_notify'], '</label>
  1384. </dt>
  1385. <dd>
  1386. <select name="pm_email_notify" id="pm_email_notify">
  1387. <option value="0"', empty($context['send_email']) ? ' selected' : '', '>', $txt['email_notify_never'], '</option>
  1388. <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>';
  1389. if (!empty($modSettings['enable_buddylist']))
  1390. echo '
  1391. <option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected' : '', '>', $txt['email_notify_buddies'], '</option>';
  1392. echo '
  1393. </select>
  1394. </dd>
  1395. <dt>
  1396. <label for="popup_messages">', $txt['popup_messages'], '</label>
  1397. </dt>
  1398. <dd>
  1399. <input type="hidden" name="default_options[popup_messages]" value="0">
  1400. <input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked' : '', ' class="input_check">
  1401. </dd>
  1402. </dl>
  1403. <hr>
  1404. <dl>
  1405. <dt>
  1406. <label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
  1407. </dt>
  1408. <dd>
  1409. <input type="hidden" name="default_options[pm_remove_inbox_label]" value="0">
  1410. <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">
  1411. </dd>';
  1412. }
  1413. // Template for showing theme settings. Note: template_options() actually adds the theme specific options.
  1414. function template_profile_theme_settings()
  1415. {
  1416. global $context, $scripturl, $modSettings, $txt;
  1417. echo '
  1418. <dt>
  1419. <label for="show_children">', $txt['show_children'], '</label>
  1420. </dt>
  1421. <dd>
  1422. <input type="hidden" name="default_options[show_children]" value="0">
  1423. <input type="checkbox" name="default_options[show_children]" id="show_children" value="1"', !empty($context['member']['options']['show_children']) ? ' checked' : '', ' class="input_check">
  1424. </dd>
  1425. <dt>
  1426. <label for="show_no_avatars">', $txt['show_no_avatars'], '</label>
  1427. </dt>
  1428. <dd>
  1429. <input type="hidden" name="default_options[show_no_avatars]" value="0">
  1430. <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">
  1431. </dd>
  1432. <dt>
  1433. <label for="show_no_signatures">', $txt['show_no_signatures'], '</label>
  1434. </dt>
  1435. <dd>
  1436. <input type="hidden" name="default_options[show_no_signatures]" value="0">
  1437. <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">
  1438. </dd>';
  1439. if (!empty($modSettings['allow_no_censored']))
  1440. echo '
  1441. <dt>
  1442. <label for="show_no_censored">' . $txt['show_no_censored'] . '</label>
  1443. </dt>
  1444. <dd>
  1445. <input type="hidden" name="default_options[show_no_censored]" value="0">
  1446. <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">
  1447. </dd>';
  1448. echo '
  1449. <dt>
  1450. <label for="return_to_post">', $txt['return_to_post'], '</label>
  1451. </dt>
  1452. <dd>
  1453. <input type="hidden" name="default_options[return_to_post]" value="0">
  1454. <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">
  1455. </dd>';
  1456. if (!empty($modSettings['enable_buddylist']))
  1457. echo '
  1458. <dt>
  1459. <label for="posts_apply_ignore_list">', $txt['posts_apply_ignore_list'], '</label>
  1460. </dt>
  1461. <dd>
  1462. <input type="hidden" name="default_options[posts_apply_ignore_list]" value="0">
  1463. <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">
  1464. </dd>';
  1465. echo '
  1466. <dt>
  1467. <label for="view_newest_first">', $txt['recent_posts_at_top'], '</label>
  1468. </dt>
  1469. <dd>
  1470. <input type="hidden" name="default_options[view_newest_first]" value="0">
  1471. <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">
  1472. </dd>';
  1473. // Choose WYSIWYG settings?
  1474. if (empty($modSettings['disable_wysiwyg']))
  1475. echo '
  1476. <dt>
  1477. <label for="wysiwyg_default">', $txt['wysiwyg_default'], '</label>
  1478. </dt>
  1479. <dd>
  1480. <input type="hidden" name="default_options[wysiwyg_default]" value="0">
  1481. <input type="checkbox" name="default_options[wysiwyg_default]" id="wysiwyg_default" value="1"', !empty($context['member']['options']['wysiwyg_default']) ? ' checked' : '', ' class="input_check">
  1482. </dd>';
  1483. if (empty($modSettings['disableCustomPerPage']))
  1484. {
  1485. echo '
  1486. <dt>
  1487. <label for="topics_per_page">', $txt['topics_per_page'], '</label>
  1488. </dt>
  1489. <dd>
  1490. <select name="default_options[topics_per_page]" id="topics_per_page">
  1491. <option value="0"', empty($context['member']['options']['topics_per_page']) ? ' selected' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxTopics'], ')</option>
  1492. <option value="5"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 5 ? ' selected' : '', '>5</option>
  1493. <option value="10"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 10 ? ' selected' : '', '>10</option>
  1494. <option value="25"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 25 ? ' selected' : '', '>25</option>
  1495. <option value="50"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 50 ? ' selected' : '', '>50</option>
  1496. </select>
  1497. </dd>
  1498. <dt>
  1499. <label for="messages_per_page">', $txt['messages_per_page'], '</label>
  1500. </dt>
  1501. <dd>
  1502. <select name="default_options[messages_per_page]" id="messages_per_page">
  1503. <option value="0"', empty($context['member']['options']['messages_per_page']) ? ' selected' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxMessages'], ')</option>
  1504. <option value="5"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 5 ? ' selected' : '', '>5</option>
  1505. <option value="10"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 10 ? ' selected' : '', '>10</option>
  1506. <option value="25"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 25 ? ' selected' : '', '>25</option>
  1507. <option value="50"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 50 ? ' selected' : '', '>50</option>
  1508. </select>
  1509. </dd>';
  1510. }
  1511. if (!empty($modSettings['cal_enabled']))
  1512. echo '
  1513. <dt>
  1514. <label for="calendar_start_day">', $txt['calendar_start_day'], ':</label>
  1515. </dt>
  1516. <dd>
  1517. <select name="default_options[calendar_start_day]" id="calendar_start_day">
  1518. <option value="0"', empty($context['member']['options']['calendar_start_day']) ? ' selected' : '', '>', $txt['days'][0], '</option>
  1519. <option value="1"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 1 ? ' selected' : '', '>', $txt['days'][1], '</option>
  1520. <option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected' : '', '>', $txt['days'][6], '</option>
  1521. </select>
  1522. </dd>';
  1523. if ((!empty($modSettings['drafts_post_enabled']) || !empty($modSettings['drafts_pm_enabled'])) && !empty($modSettings['drafts_autosave_enabled']))
  1524. echo '
  1525. <dt>
  1526. <label for="drafts_autosave_enabled">', $txt['drafts_autosave_enabled'], '</label>
  1527. </dt>
  1528. <dd>
  1529. <input type="hidden" name="default_options[drafts_autosave_enabled]" value="0">
  1530. <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>
  1531. </dd>';
  1532. if ((!empty($modSettings['drafts_post_enabled']) || !empty($modSettings['drafts_pm_enabled'])) && !empty($modSettings['drafts_show_saved_enabled']))
  1533. echo '
  1534. <dt>
  1535. <label for="drafts_show_saved_enabled">', $txt['drafts_show_saved_enabled'], '</label>
  1536. </dt>
  1537. <dd>
  1538. <input type="hidden" name="default_options[drafts_show_saved_enabled]" value="0">
  1539. <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>
  1540. </dd>';
  1541. echo '
  1542. <dt>
  1543. <label for="use_editor_quick_reply">', $txt['use_editor_quick_reply'], '</label>
  1544. </dt>
  1545. <dd>
  1546. <input type="hidden" name="default_options[use_editor_quick_reply]" value="0">
  1547. <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>
  1548. </dd>
  1549. <dt>
  1550. <label for="display_quick_mod">', $txt['display_quick_mod'], '</label>
  1551. </dt>
  1552. <dd>
  1553. <select name="default_options[display_quick_mod]" id="display_quick_mod">
  1554. <option value="0"', empty($context['member']['options']['display_quick_mod']) ? ' selected' : '', '>', $txt['display_quick_mod_none'], '</option>
  1555. <option value="1"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] == 1 ? ' selected' : '', '>', $txt['display_quick_mod_check'], '</option>
  1556. <option value="2"', !empty($context['member']['options']['display_quick_mod']) && $context['member']['options']['display_quick_mod'] != 1 ? ' selected' : '', '>', $txt['display_quick_mod_image'], '</option>
  1557. </select>
  1558. </dd>';
  1559. }
  1560. function template_alert_configuration()
  1561. {
  1562. global $context, $settings, $txt, $scripturl, $modSettings;
  1563. echo '
  1564. <div class="cat_bar">
  1565. <h3 class="catbg">
  1566. ', $txt['alert_prefs'], '
  1567. </h3>
  1568. </div>
  1569. <p class="description">', $txt['alert_prefs_desc'], '</p>
  1570. <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">
  1571. <div class="title_bar">
  1572. <h3 class="titlebg">
  1573. ', $txt['notification_general'], '
  1574. </h3>
  1575. </div>
  1576. <div class="windowbg2">
  1577. <div class="content">
  1578. <dl class="settings">';
  1579. // Allow notification on announcements to be disabled?
  1580. if (!empty($modSettings['allow_disableAnnounce']))
  1581. echo '
  1582. <dt>
  1583. <label for="notify_announcements">', $txt['notify_important_email'], '</label>
  1584. </dt>
  1585. <dd>
  1586. <input type="hidden" name="notify_announcements" value="0">
  1587. <input type="checkbox" id="notify_announcements" name="notify_announcements"', !empty($context['member']['notify_announcements']) ? ' checked' : '', ' class="input_check">
  1588. </dd>';
  1589. // More notification options.
  1590. echo '
  1591. <dt>
  1592. <label for="auto_notify">', $txt['auto_notify'], '</label>
  1593. </dt>
  1594. <dd>
  1595. <input type="hidden" name="default_options[auto_notify]" value="0">
  1596. <input type="checkbox" id="auto_notify" name="default_options[auto_notify]" value="1"', !empty($context['member']['options']['auto_notify']) ? ' checked' : '', ' class="input_check">
  1597. </dd>';
  1598. if (empty($modSettings['disallow_sendBody']))
  1599. echo '
  1600. <dt>
  1601. <label for="notify_send_body">', $txt['notify_send_body'], '</label>
  1602. </dt>
  1603. <dd>
  1604. <input type="hidden" name="notify_send_body" value="0">
  1605. <input type="checkbox" id="notify_send_body" name="notify_send_body"', !empty($context['member']['notify_send_body']) ? ' checked' : '', ' class="input_check">
  1606. </dd>';
  1607. echo '
  1608. <dt>
  1609. <label for="notify_regularity">', $txt['notify_regularity'], ':</label>
  1610. </dt>
  1611. <dd>
  1612. <select name="notify_regularity" id="notify_regularity">
  1613. <option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected' : '', '>', $txt['notify_regularity_instant'], '</option>
  1614. <option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected' : '', '>', $txt['notify_regularity_first_only'], '</option>
  1615. <option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected' : '', '>', $txt['notify_regularity_daily'], '</option>
  1616. <option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected' : '', '>', $txt['notify_regularity_weekly'], '</option>
  1617. </select>
  1618. </dd>
  1619. <dt>
  1620. <label for="notify_types">', $txt['notify_send_types'], ':</label>
  1621. </dt>
  1622. <dd>
  1623. <select name="notify_types" id="notify_types">
  1624. <option value="1"', $context['member']['notify_types'] == 1 ? ' selected' : '', '>', $txt['notify_send_type_everything'], '</option>
  1625. <option value="2"', $context['member']['notify_types'] == 2 ? ' selected' : '', '>', $txt['notify_send_type_everything_own'], '</option>
  1626. <option value="3"', $context['member']['notify_types'] == 3 ? ' selected' : '', '>', $txt['notify_send_type_only_replies'], '</option>
  1627. <option value="4"', $context['member']['notify_types'] == 4 ? ' selected' : '', '>', $txt['notify_send_type_nothing'], '</option>
  1628. </select>
  1629. </dd>
  1630. </dl>
  1631. </div>
  1632. </div>
  1633. <div class="title_bar">
  1634. <h3 class="titlebg">
  1635. ', $txt['notify_what_how'], '
  1636. </h3>
  1637. </div>
  1638. <table class="table_grid" style="width: 100%">
  1639. <tr class="titlebg">
  1640. <td></td>
  1641. <td>', $txt['receive_alert'], '</td>
  1642. <td>', $txt['receive_mail'], '</td>
  1643. </tr>';
  1644. $use_bg2 = true;
  1645. foreach ($context['alert_types'] as $alert_group => $alerts)
  1646. {
  1647. echo '
  1648. <tr class="catbg">
  1649. <th colspan="3">
  1650. ', $txt['alert_group_' . $alert_group];
  1651. if (isset($context['alert_group_options'][$alert_group]))
  1652. {
  1653. foreach ($context['alert_group_options'][$alert_group] as $opts)
  1654. {
  1655. echo '
  1656. <div class="smalltext">';
  1657. $label = $txt['alert_opt_' . $opts[1]];
  1658. $label_pos = isset($opts['label']) ? $opts['label'] : '';
  1659. if ($label_pos == 'before')
  1660. echo '
  1661. <label for="opt_', $opts[1], '">', $label, '</label>';
  1662. $this_value = isset($context['alert_prefs'][$opts[1]]) ? $context['alert_prefs'][$opts[1]] : 0;
  1663. switch ($opts[0])
  1664. {
  1665. case 'check':
  1666. echo '
  1667. <input type="checkbox" name="opt_', $opts[1], '" id="opt_', $opts[1], '"', $this_value ? ' checked' : '', '>';
  1668. break;
  1669. case 'select':
  1670. echo '
  1671. <select name="opt_', $opts[1], '" id="opt_', $opts[1], '">';
  1672. foreach ($opts['opts'] as $k => $v)
  1673. echo '
  1674. <option value="', $k, '"', $this_value == $k ? ' selected' : '', '>', $v, '</option>';
  1675. echo '
  1676. </select>';
  1677. break;
  1678. }
  1679. if ($label_pos == 'after')
  1680. echo '
  1681. <label for="opt_', $opts[1], '">', $label, '</label>';
  1682. echo '
  1683. </div>';
  1684. }
  1685. }
  1686. echo '
  1687. </th>
  1688. </tr>';
  1689. foreach ($alerts as $alert_id => $alert_details)
  1690. {
  1691. echo '
  1692. <tr class="windowbg', $use_bg2 ? '2' : '', '">
  1693. <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>';
  1694. foreach ($context['alert_bits'] as $type => $bitmask)
  1695. {
  1696. echo '
  1697. <td class="centercol">';
  1698. $this_value = isset($context['alert_prefs'][$alert_id]) ? $context['alert_prefs'][$alert_id] : 0;
  1699. switch ($alert_details[$type])
  1700. {
  1701. case 'always':
  1702. echo '
  1703. <input type="checkbox" checked disabled>';
  1704. break;
  1705. case 'yes':
  1706. echo '
  1707. <input type="checkbox" name="', $type, '_', $alert_id, '"', ($this_value & $bitmask) ? ' checked' : '', '>';
  1708. break;
  1709. case 'never':
  1710. echo '
  1711. <input type="checkbox" disabled>';
  1712. break;
  1713. }
  1714. echo '
  1715. </td>';
  1716. }
  1717. echo '
  1718. </tr>';
  1719. $use_bg2 = !$use_bg2;
  1720. }
  1721. }
  1722. echo '
  1723. </table>
  1724. <br>
  1725. <div>
  1726. <input id="notify_submit" type="submit" name="notify_submit" value="', $txt['notify_save'], '" class="button_submit">
  1727. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">', !empty($context['token_check']) ? '
  1728. <input type="hidden" name="' . $context[$context['token_check'] . '_token_var'] . '" value="' . $context[$context['token_check'] . '_token'] . '">' : '', '
  1729. <input type="hidden" name="u" value="', $context['id_member'], '">
  1730. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
  1731. </div>
  1732. </form>
  1733. <br>';
  1734. }
  1735. function template_alert_notifications_topics()
  1736. {
  1737. global $txt;
  1738. // The main containing header.
  1739. echo '
  1740. <div class="cat_bar">
  1741. <h3 class="catbg">
  1742. ', $txt['watched_topics'], '
  1743. </h3>
  1744. </div>
  1745. <p class="description">', $txt['watched_topics_desc'], '</p>
  1746. <br>';
  1747. template_show_list('topic_notification_list');
  1748. }
  1749. function template_alert_notifications_boards()
  1750. {
  1751. global $txt;
  1752. echo '
  1753. <div class="cat_bar">
  1754. <h3 class="catbg">
  1755. ', $txt['watched_boards'], '
  1756. </h3>
  1757. </div>
  1758. <p class="description">', $txt['watched_boards_desc'], '</p>
  1759. <br>';
  1760. template_show_list('board_notification_list');
  1761. }
  1762. // Template for choosing group membership.
  1763. function template_groupMembership()
  1764. {
  1765. global $context, $settings, $scripturl, $modSettings, $txt;
  1766. // The main containing header.
  1767. echo '
  1768. <form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1769. <div class="cat_bar">
  1770. <h3 class="catbg">
  1771. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">', $txt['profile'], '
  1772. </h3>
  1773. </div>
  1774. <p class="description">', $txt['groupMembership_info'], '</p>';
  1775. // Do we have an update message?
  1776. if (!empty($context['update_message']))
  1777. echo '
  1778. <div class="infobox">
  1779. ', $context['update_message'], '.
  1780. </div>';
  1781. // Requesting membership to a group?
  1782. if (!empty($context['group_request']))
  1783. {
  1784. echo '
  1785. <div class="groupmembership">
  1786. <div class="cat_bar">
  1787. <h3 class="catbg">', $txt['request_group_membership'], '</h3>
  1788. </div>
  1789. <div class="roundframe">
  1790. ', $txt['request_group_membership_desc'], ':
  1791. <textarea name="reason" rows="4" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
  1792. <div class="righttext" style="margin: 0.5em 0.5% 0 0.5%;">
  1793. <input type="hidden" name="gid" value="', $context['group_request']['id'], '">
  1794. <input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit">
  1795. </div>
  1796. </div>
  1797. </div>';
  1798. }
  1799. else
  1800. {
  1801. echo '
  1802. <table border="0" cellspacing="0" cellpadding="4" class="table_grid">
  1803. <thead>
  1804. <tr class="catbg">
  1805. <th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
  1806. <th class="last_th" scope="col"></th>
  1807. </tr>
  1808. </thead>
  1809. <tbody>';
  1810. $alternate = true;
  1811. foreach ($context['groups']['member'] as $group)
  1812. {
  1813. echo '
  1814. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
  1815. if ($context['can_edit_primary'])
  1816. echo '
  1817. <td width="4%">
  1818. <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">
  1819. </td>';
  1820. echo '
  1821. <td>
  1822. <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>
  1823. </td>
  1824. <td width="15%" class="righttext">';
  1825. // Can they leave their group?
  1826. if ($group['can_leave'])
  1827. echo '
  1828. <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>';
  1829. echo '
  1830. </td>
  1831. </tr>';
  1832. $alternate = !$alternate;
  1833. }
  1834. echo '
  1835. </tbody>
  1836. </table>';
  1837. if ($context['can_edit_primary'])
  1838. echo '
  1839. <div class="padding righttext">
  1840. <input type="submit" value="', $txt['make_primary'], '" class="button_submit">
  1841. </div>';
  1842. // Any groups they can join?
  1843. if (!empty($context['groups']['available']))
  1844. {
  1845. echo '
  1846. <br>
  1847. <table border="0" cellspacing="0" cellpadding="4" class="table_grid">
  1848. <thead>
  1849. <tr class="catbg">
  1850. <th class="first_th" scope="col">
  1851. ', $txt['available_groups'], '
  1852. </th>
  1853. <th class="last_th" scope="col"></th>
  1854. </tr>
  1855. </thead>
  1856. <tbody>';
  1857. $alternate = true;
  1858. foreach ($context['groups']['available'] as $group)
  1859. {
  1860. echo '
  1861. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  1862. <td>
  1863. <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>' : ''), '
  1864. </td>
  1865. <td width="15%" class="lefttext">';
  1866. if ($group['type'] == 3)
  1867. echo '
  1868. <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>';
  1869. elseif ($group['type'] == 2 && $group['pending'])
  1870. echo '
  1871. ', $txt['approval_pending'];
  1872. elseif ($group['type'] == 2)
  1873. echo '
  1874. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '">', $txt['request_group'], '</a>';
  1875. // <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  1876. echo '
  1877. </td>
  1878. </tr>';
  1879. $alternate = !$alternate;
  1880. }
  1881. echo '
  1882. </tbody>
  1883. </table>';
  1884. }
  1885. // Javascript for the selector stuff.
  1886. echo '
  1887. <script><!-- // --><![CDATA[
  1888. var prevClass = "";
  1889. var prevDiv = "";
  1890. function highlightSelected(box)
  1891. {
  1892. if (prevClass != "")
  1893. {
  1894. prevDiv.className = prevClass;
  1895. }
  1896. prevDiv = document.getElementById(box);
  1897. prevClass = prevDiv.className;
  1898. prevDiv.className = "highlight2";
  1899. }';
  1900. if (isset($context['groups']['member'][$context['primary_group']]))
  1901. echo '
  1902. highlightSelected("primdiv_' . $context['primary_group'] . '");';
  1903. echo '
  1904. // ]]></script>';
  1905. }
  1906. if (!empty($context['token_check']))
  1907. echo '
  1908. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  1909. echo '
  1910. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  1911. <input type="hidden" name="u" value="', $context['id_member'], '">
  1912. </form>';
  1913. }
  1914. function template_ignoreboards()
  1915. {
  1916. global $context, $txt, $settings, $scripturl;
  1917. // The main containing header.
  1918. echo '
  1919. <form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1920. <div class="cat_bar">
  1921. <h3 class="catbg">
  1922. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">', $txt['profile'], '
  1923. </h3>
  1924. </div>
  1925. <p class="description">', $txt['ignoreboards_info'], '</p>
  1926. <div class="windowbg2">
  1927. <div class="content flow_hidden">
  1928. <ul class="ignoreboards floatleft">';
  1929. $i = 0;
  1930. $limit = ceil($context['num_boards'] / 2);
  1931. foreach ($context['categories'] as $category)
  1932. {
  1933. if ($i == $limit)
  1934. {
  1935. echo '
  1936. </ul>
  1937. <ul class="ignoreboards floatright">';
  1938. $i++;
  1939. }
  1940. echo '
  1941. <li class="category">
  1942. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), '], \'creator\'); return false;">', $category['name'], '</a>
  1943. <ul>';
  1944. foreach ($category['boards'] as $board)
  1945. {
  1946. if ($i == $limit)
  1947. echo '
  1948. </ul>
  1949. </li>
  1950. </ul>
  1951. <ul class="ignoreboards floatright">
  1952. <li class="category">
  1953. <ul>';
  1954. echo '
  1955. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  1956. <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>
  1957. </li>';
  1958. $i++;
  1959. }
  1960. echo '
  1961. </ul>
  1962. </li>';
  1963. }
  1964. echo '
  1965. </ul>';
  1966. // Show the standard "Save Settings" profile button.
  1967. template_profile_save();
  1968. echo '
  1969. </div>
  1970. </div>
  1971. </form>
  1972. <br>';
  1973. }
  1974. // Simple load some theme variables common to several warning templates.
  1975. function template_load_warning_variables()
  1976. {
  1977. global $modSettings, $context;
  1978. $context['warningBarWidth'] = 200;
  1979. // Setup the colors - this is a little messy for theming.
  1980. $context['colors'] = array(
  1981. 0 => 'green',
  1982. $modSettings['warning_watch'] => 'darkgreen',
  1983. $modSettings['warning_moderate'] => 'orange',
  1984. $modSettings['warning_mute'] => 'red',
  1985. );
  1986. // Work out the starting color.
  1987. $context['current_color'] = $context['colors'][0];
  1988. foreach ($context['colors'] as $limit => $color)
  1989. if ($context['member']['warning'] >= $limit)
  1990. $context['current_color'] = $color;
  1991. }
  1992. // Show all warnings of a user?
  1993. function template_viewWarning()
  1994. {
  1995. global $context, $txt, $scripturl, $settings;
  1996. template_load_warning_variables();
  1997. echo '
  1998. <div class="cat_bar">
  1999. <h3 class="catbg">
  2000. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">
  2001. ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '
  2002. </h3>
  2003. </div>
  2004. <p class="description">', $txt['viewWarning_help'], '</p>
  2005. <div class="windowbg">
  2006. <div class="content">
  2007. <dl class="settings">
  2008. <dt>
  2009. <strong>', $txt['profile_warning_name'], ':</strong>
  2010. </dt>
  2011. <dd>
  2012. ', $context['member']['name'], '
  2013. </dd>
  2014. <dt>
  2015. <strong>', $txt['profile_warning_level'], ':</strong>
  2016. </dt>
  2017. <dd>
  2018. <div>
  2019. <div>
  2020. <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  2021. <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>
  2022. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  2023. </div>
  2024. </div>
  2025. </div>
  2026. </dd>';
  2027. // There's some impact of this?
  2028. if (!empty($context['level_effects'][$context['current_level']]))
  2029. echo '
  2030. <dt>
  2031. <strong>', $txt['profile_viewwarning_impact'], ':</strong>
  2032. </dt>
  2033. <dd>
  2034. ', $context['level_effects'][$context['current_level']], '
  2035. </dd>';
  2036. echo '
  2037. </dl>
  2038. </div>
  2039. </div>';
  2040. template_show_list('view_warnings');
  2041. }
  2042. // Show a lovely interface for issuing warnings.
  2043. function template_issueWarning()
  2044. {
  2045. global $context, $settings, $scripturl, $modSettings, $txt;
  2046. template_load_warning_variables();
  2047. echo '
  2048. <script><!-- // --><![CDATA[
  2049. function setWarningBarPos(curEvent, isMove, changeAmount)
  2050. {
  2051. barWidth = ', $context['warningBarWidth'], ';
  2052. // Are we passing the amount to change it by?
  2053. if (changeAmount)
  2054. {
  2055. if (document.getElementById(\'warning_level\').value == \'SAME\')
  2056. percent = ', $context['member']['warning'], ' + changeAmount;
  2057. else
  2058. percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount;
  2059. }
  2060. // If not then it\'s a mouse thing.
  2061. else
  2062. {
  2063. if (!curEvent)
  2064. var curEvent = window.event;
  2065. // If it\'s a movement check the button state first!
  2066. if (isMove)
  2067. {
  2068. if (!curEvent.button || curEvent.button != 1)
  2069. return false
  2070. }
  2071. // Get the position of the container.
  2072. contain = document.getElementById(\'warning_contain\');
  2073. position = 0;
  2074. while (contain != null)
  2075. {
  2076. position += contain.offsetLeft;
  2077. contain = contain.offsetParent;
  2078. }
  2079. // Where is the mouse?
  2080. if (curEvent.pageX)
  2081. {
  2082. mouse = curEvent.pageX;
  2083. }
  2084. else
  2085. {
  2086. mouse = curEvent.clientX;
  2087. mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft;
  2088. }
  2089. // Is this within bounds?
  2090. if (mouse < position || mouse > position + barWidth)
  2091. return;
  2092. percent = Math.round(((mouse - position) / barWidth) * 100);
  2093. // Round percent to the nearest 5 - by kinda cheating!
  2094. percent = Math.round(percent / 5) * 5;
  2095. }
  2096. // What are the limits?
  2097. minLimit = ', $context['min_allowed'], ';
  2098. maxLimit = ', $context['max_allowed'], ';
  2099. percent = Math.max(percent, minLimit);
  2100. percent = Math.min(percent, maxLimit);
  2101. size = barWidth * (percent/100);
  2102. setInnerHTML(document.getElementById(\'warning_text\'), percent + "%");
  2103. document.getElementById(\'warning_text\').innerHTML = percent + "%";
  2104. document.getElementById(\'warning_level\').value = percent;
  2105. document.getElementById(\'warning_progress\').style.width = size + "px";
  2106. // Get the right color.
  2107. color = "black"';
  2108. foreach ($context['colors'] as $limit => $color)
  2109. echo '
  2110. if (percent >= ', $limit, ')
  2111. color = "', $color, '";';
  2112. echo '
  2113. document.getElementById(\'warning_progress\').style.backgroundColor = color;
  2114. // Also set the right effect.
  2115. effectText = "";';
  2116. foreach ($context['level_effects'] as $limit => $text)
  2117. echo '
  2118. if (percent >= ', $limit, ')
  2119. effectText = "', $text, '";';
  2120. echo '
  2121. setInnerHTML(document.getElementById(\'cur_level_div\'), effectText);
  2122. }
  2123. // Disable notification boxes as required.
  2124. function modifyWarnNotify()
  2125. {
  2126. disable = !document.getElementById(\'warn_notify\').checked;
  2127. document.getElementById(\'warn_sub\').disabled = disable;
  2128. document.getElementById(\'warn_body\').disabled = disable;
  2129. document.getElementById(\'warn_temp\').disabled = disable;
  2130. document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\';
  2131. document.getElementById(\'preview_button\').style.display = disable ? \'none\' : \'\';
  2132. }
  2133. function changeWarnLevel(amount)
  2134. {
  2135. setWarningBarPos(false, false, amount);
  2136. }
  2137. // Warn template.
  2138. function populateNotifyTemplate()
  2139. {
  2140. index = document.getElementById(\'warn_temp\').value;
  2141. if (index == -1)
  2142. return false;
  2143. // Otherwise see what we can do...';
  2144. foreach ($context['notification_templates'] as $k => $type)
  2145. echo '
  2146. if (index == ', $k, ')
  2147. document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
  2148. echo '
  2149. }
  2150. // ]]></script>';
  2151. echo '
  2152. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  2153. <div class="cat_bar">
  2154. <h3 class="catbg">
  2155. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">
  2156. ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '
  2157. </h3>
  2158. </div>';
  2159. if (!$context['user']['is_owner'])
  2160. echo '
  2161. <p class="description">', $txt['profile_warning_desc'], '</p>';
  2162. echo '
  2163. <div class="windowbg">
  2164. <div class="content">
  2165. <dl class="settings">';
  2166. if (!$context['user']['is_owner'])
  2167. echo '
  2168. <dt>
  2169. <strong>', $txt['profile_warning_name'], ':</strong>
  2170. </dt>
  2171. <dd>
  2172. <strong>', $context['member']['name'], '</strong>
  2173. </dd>';
  2174. echo '
  2175. <dt>
  2176. <strong>', $txt['profile_warning_level'], ':</strong>';
  2177. // Is there only so much they can apply?
  2178. if ($context['warning_limit'])
  2179. echo '
  2180. <br><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
  2181. echo '
  2182. </dt>
  2183. <dd>
  2184. <div id="warndiv1" style="display: none;">
  2185. <div>
  2186. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span>
  2187. <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);">
  2188. <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>
  2189. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  2190. </div>
  2191. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span>
  2192. <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div>
  2193. </div>
  2194. <input type="hidden" name="warning_level" id="warning_level" value="SAME">
  2195. </div>
  2196. <div id="warndiv2">
  2197. <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text">&nbsp;', $txt['profile_warning_max'], '
  2198. <div class="smalltext">', $txt['profile_warning_impact'], ':<br>';
  2199. // For non-javascript give a better list.
  2200. foreach ($context['level_effects'] as $limit => $effect)
  2201. echo '
  2202. ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br>';
  2203. echo '
  2204. </div>
  2205. </div>
  2206. </dd>';
  2207. if (!$context['user']['is_owner'])
  2208. {
  2209. echo '
  2210. <dt>
  2211. <strong>', $txt['profile_warning_reason'], ':</strong><br>
  2212. <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span>
  2213. </dt>
  2214. <dd>
  2215. <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text">
  2216. </dd>
  2217. </dl>
  2218. <hr>
  2219. <div id="box_preview"', !empty($context['warning_data']['body_preview']) ? '' : ' style="display:none"', '>
  2220. <dl class="settings">
  2221. <dt>
  2222. <strong>', $txt['preview'] , '</strong>
  2223. </dt>
  2224. <dd id="body_preview">
  2225. ', !empty($context['warning_data']['body_preview']) ? $context['warning_data']['body_preview'] : '', '
  2226. </dd>
  2227. </dl>
  2228. <hr>
  2229. </div>
  2230. <dl class="settings">
  2231. <dt>
  2232. <strong><label for="warn_notify">', $txt['profile_warning_notify'], ':</label></strong>
  2233. </dt>
  2234. <dd>
  2235. <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();"', $context['warning_data']['notify'] ? ' checked' : '', ' class="input_check">
  2236. </dd>
  2237. <dt>
  2238. <strong><label for="warn_sub">', $txt['profile_warning_notify_subject'], ':</label></strong>
  2239. </dt>
  2240. <dd>
  2241. <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">
  2242. </dd>
  2243. <dt>
  2244. <strong><label for="warn_temp">', $txt['profile_warning_notify_body'], ':</label></strong>
  2245. </dt>
  2246. <dd>
  2247. <select name="warn_temp" id="warn_temp" disabled onchange="populateNotifyTemplate();" style="font-size: x-small;">
  2248. <option value="-1">', $txt['profile_warning_notify_template'], '</option>
  2249. <option value="-1">------------------------------</option>';
  2250. foreach ($context['notification_templates'] as $id_template => $template)
  2251. echo '
  2252. <option value="', $id_template, '">', $template['title'], '</option>';
  2253. echo '
  2254. </select>
  2255. <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>
  2256. <textarea name="warn_body" id="warn_body" cols="40" rows="8" style="min-width: 50%; max-width: 99%;">', $context['warning_data']['notify_body'], '</textarea>
  2257. </dd>';
  2258. }
  2259. echo '
  2260. </dl>
  2261. <div class="righttext">';
  2262. if (!empty($context['token_check']))
  2263. echo '
  2264. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  2265. echo '
  2266. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  2267. <input type="button" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit">
  2268. <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit">
  2269. </div>
  2270. </div>
  2271. </div>
  2272. </form>';
  2273. // Previous warnings?
  2274. template_show_list('view_warnings');
  2275. // Do our best to get pretty javascript enabled.
  2276. echo '
  2277. <script><!-- // --><![CDATA[
  2278. document.getElementById(\'warndiv1\').style.display = "";
  2279. document.getElementById(\'preview_button\').style.display = "none";
  2280. document.getElementById(\'warndiv2\').style.display = "none";';
  2281. if (!$context['user']['is_owner'])
  2282. echo '
  2283. modifyWarnNotify();
  2284. $(document).ready(function() {
  2285. $("#preview_button").click(function() {
  2286. return ajax_getTemplatePreview();
  2287. });
  2288. });
  2289. function ajax_getTemplatePreview ()
  2290. {
  2291. $.ajax({
  2292. type: "POST",
  2293. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  2294. data: {item: "warning_preview", title: $("#warn_sub").val(), body: $("#warn_body").val(), issuing: true},
  2295. context: document.body,
  2296. success: function(request){
  2297. $("#box_preview").css({display:""});
  2298. $("#body_preview").html($(request).find(\'body\').text());
  2299. if ($(request).find("error").text() != \'\')
  2300. {
  2301. $("#profile_error").css({display:""});
  2302. var errors_html = \'<ul class="list_errors" class="reset">\';
  2303. var errors = $(request).find(\'error\').each(function() {
  2304. errors_html += \'<li>\' + $(this).text() + \'</li>\';
  2305. });
  2306. errors_html += \'</ul>\';
  2307. $("#profile_error").html(errors_html);
  2308. }
  2309. else
  2310. {
  2311. $("#profile_error").css({display:"none"});
  2312. $("#error_list").html(\'\');
  2313. }
  2314. return false;
  2315. },
  2316. });
  2317. return false;
  2318. }';
  2319. echo '
  2320. // ]]></script>';
  2321. }
  2322. // Template to show for deleting a users account - now with added delete post capability!
  2323. function template_deleteAccount()
  2324. {
  2325. global $context, $settings, $scripturl, $txt;
  2326. // The main containing header.
  2327. echo '
  2328. <form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  2329. <div class="cat_bar">
  2330. <h3 class="catbg">
  2331. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">', $txt['deleteAccount'], '
  2332. </h3>
  2333. </div>';
  2334. // If deleting another account give them a lovely info box.
  2335. if (!$context['user']['is_owner'])
  2336. echo '
  2337. <p class="information">', $txt['deleteAccount_desc'], '</p>';
  2338. echo '
  2339. <div class="windowbg2">
  2340. <div class="content">';
  2341. // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
  2342. if ($context['needs_approval'])
  2343. echo '
  2344. <div class="errorbox">', $txt['deleteAccount_approval'], '</div>';
  2345. // If the user is deleting their own account warn them first - and require a password!
  2346. if ($context['user']['is_owner'])
  2347. {
  2348. echo '
  2349. <div class="alert">', $txt['own_profile_confirm'], '</div>
  2350. <div>
  2351. <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
  2352. <input type="password" name="oldpasswrd" size="20" class="input_password">&nbsp;&nbsp;&nbsp;&nbsp;
  2353. <input type="submit" value="', $txt['yes'], '" class="button_submit">';
  2354. if (!empty($context['token_check']))
  2355. echo '
  2356. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  2357. echo '
  2358. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  2359. <input type="hidden" name="u" value="', $context['id_member'], '">
  2360. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
  2361. </div>';
  2362. }
  2363. // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
  2364. else
  2365. {
  2366. echo '
  2367. <div class="alert">', $txt['deleteAccount_warning'], '</div>';
  2368. // Only actually give these options if they are kind of important.
  2369. if ($context['can_delete_posts'])
  2370. echo '
  2371. <div>
  2372. <label for="deletePosts"><input type="checkbox" name="deletePosts" id="deletePosts" value="1" class="input_check"> ', $txt['deleteAccount_posts'], ':</label>
  2373. <select name="remove_type">
  2374. <option value="posts">', $txt['deleteAccount_all_posts'], '</option>
  2375. <option value="topics">', $txt['deleteAccount_topics'], '</option>
  2376. </select>
  2377. </div>';
  2378. echo '
  2379. <div>
  2380. <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>
  2381. </div>
  2382. <div>
  2383. <input type="submit" value="', $txt['delete'], '" class="button_submit">';
  2384. if (!empty($context['token_check']))
  2385. echo '
  2386. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  2387. echo '
  2388. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  2389. <input type="hidden" name="u" value="', $context['id_member'], '">
  2390. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
  2391. </div>';
  2392. }
  2393. echo '
  2394. </div>
  2395. </div>
  2396. <br>
  2397. </form>';
  2398. }
  2399. // Template for the password box/save button stuck at the bottom of every profile page.
  2400. function template_profile_save()
  2401. {
  2402. global $context, $txt;
  2403. echo '
  2404. <hr width="100%" size="1" class="hrcolor clear">';
  2405. // Only show the password box if it's actually needed.
  2406. if ($context['require_password'])
  2407. echo '
  2408. <dl>
  2409. <dt>
  2410. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
  2411. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2412. </dt>
  2413. <dd>
  2414. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password">
  2415. </dd>
  2416. </dl>';
  2417. echo '
  2418. <div class="righttext">';
  2419. if (!empty($context['token_check']))
  2420. echo '
  2421. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  2422. echo '
  2423. <input type="submit" value="', $txt['change_profile'], '" class="button_submit">
  2424. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  2425. <input type="hidden" name="u" value="', $context['id_member'], '">
  2426. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
  2427. </div>';
  2428. }
  2429. // Small template for showing an error message upon a save problem in the profile.
  2430. function template_error_message()
  2431. {
  2432. global $context, $txt;
  2433. echo '
  2434. <div class="errorbox" ', empty($context['post_errors']) ? 'style="display:none" ' : '', 'id="profile_error">';
  2435. if (!empty($context['post_errors']))
  2436. {
  2437. echo '
  2438. <span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ':</span>
  2439. <ul id="list_errors">';
  2440. // Cycle through each error and display an error message.
  2441. foreach ($context['post_errors'] as $error)
  2442. echo '
  2443. <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '</li>';
  2444. echo '
  2445. </ul>';
  2446. }
  2447. echo '
  2448. </div>';
  2449. }
  2450. // Display a load of drop down selectors for allowing the user to change group.
  2451. function template_profile_group_manage()
  2452. {
  2453. global $context, $txt, $scripturl;
  2454. echo '
  2455. <dt>
  2456. <strong>', $txt['primary_membergroup'], ': </strong><br>
  2457. <span class="smalltext">[<a href="', $scripturl, '?action=helpadmin;help=moderator_why_missing" onclick="return reqOverlayDiv(this.href);">', $txt['moderator_why_missing'], '</a>]</span>
  2458. </dt>
  2459. <dd>
  2460. <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;"' : ''), '>';
  2461. // Fill the select box with all primary member groups that can be assigned to a member.
  2462. foreach ($context['member_groups'] as $member_group)
  2463. if (!empty($member_group['can_be_primary']))
  2464. echo '
  2465. <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected' : '', '>
  2466. ', $member_group['name'], '
  2467. </option>';
  2468. echo '
  2469. </select>
  2470. </dd>
  2471. <dt>
  2472. <strong>', $txt['additional_membergroups'], ':</strong>
  2473. </dt>
  2474. <dd>
  2475. <span id="additional_groupsList">
  2476. <input type="hidden" name="additional_groups[]" value="0">';
  2477. // For each membergroup show a checkbox so members can be assigned to more than one group.
  2478. foreach ($context['member_groups'] as $member_group)
  2479. if ($member_group['can_be_additional'])
  2480. echo '
  2481. <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>';
  2482. echo '
  2483. </span>
  2484. <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>
  2485. <script><!-- // --><![CDATA[
  2486. document.getElementById("additional_groupsList").style.display = "none";
  2487. document.getElementById("additional_groupsLink").style.display = "";
  2488. // ]]></script>
  2489. </dd>';
  2490. }
  2491. // Callback function for entering a birthdate!
  2492. function template_profile_birthdate()
  2493. {
  2494. global $txt, $context;
  2495. // Just show the pretty box!
  2496. echo '
  2497. <dt>
  2498. <strong>', $txt['dob'], ':</strong><br>
  2499. <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
  2500. </dt>
  2501. <dd>
  2502. <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '" class="input_text"> -
  2503. <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '" class="input_text"> -
  2504. <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '" class="input_text">
  2505. </dd>';
  2506. }
  2507. // Show the signature editing box?
  2508. function template_profile_signature_modify()
  2509. {
  2510. global $txt, $context, $settings, $scripturl;
  2511. echo '
  2512. <dt id="current_signature" style="display:none">
  2513. <strong>', $txt['current_signature'], ':</strong>
  2514. </dt>
  2515. <dd id="current_signature_display" style="display:none">
  2516. <hr>
  2517. </dd>';
  2518. echo '
  2519. <dt id="preview_signature" style="display:none">
  2520. <strong>', $txt['signature_preview'], ':</strong>
  2521. </dt>
  2522. <dd id="preview_signature_display" style="display:none">
  2523. <hr>
  2524. </dd>';
  2525. echo '
  2526. <dt>
  2527. <strong>', $txt['signature'], ':</strong><br>
  2528. <span class="smalltext">', $txt['sig_info'], '</span><br>
  2529. <br>';
  2530. if ($context['show_spellchecking'])
  2531. echo '
  2532. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit">';
  2533. echo '
  2534. </dt>
  2535. <dd>
  2536. <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>';
  2537. // If there is a limit at all!
  2538. if (!empty($context['signature_limits']['max_length']))
  2539. echo '
  2540. <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br>';
  2541. if (!empty($context['show_preview_button']))
  2542. echo '
  2543. <input type="submit" name="preview_signature" id="preview_button" value="', $txt['preview_signature'], '" class="button_submit">';
  2544. if ($context['signature_warning'])
  2545. echo '
  2546. <span class="smalltext">', $context['signature_warning'], '</span>';
  2547. // Load the spell checker?
  2548. if ($context['show_spellchecking'])
  2549. echo '
  2550. <script src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>';
  2551. // Some javascript used to count how many characters have been used so far in the signature.
  2552. echo '
  2553. <script><!-- // --><![CDATA[
  2554. var maxLength = ', $context['signature_limits']['max_length'], ';
  2555. $(document).ready(function() {
  2556. calcCharLeft();
  2557. $("#preview_button").click(function() {
  2558. return ajax_getSignaturePreview(true);
  2559. });
  2560. });
  2561. // ]]></script>
  2562. </dd>';
  2563. }
  2564. function template_profile_avatar_select()
  2565. {
  2566. global $context, $txt, $modSettings;
  2567. // Start with the upper menu
  2568. echo '
  2569. <dt>
  2570. <strong id="personal_picture"><label for="avatar_upload_box">', $txt['personal_picture'], '</label></strong>
  2571. <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>
  2572. ', !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>' : '', '
  2573. ', !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>' : '', '
  2574. ', !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>' : '', '
  2575. </dt>
  2576. <dd>';
  2577. // If users are allowed to choose avatars stored on the server show selection boxes to choice them from.
  2578. if (!empty($context['member']['avatar']['allow_server_stored']))
  2579. {
  2580. echo '
  2581. <div id="avatar_server_stored">
  2582. <div>
  2583. <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
  2584. // This lists all the file catergories.
  2585. foreach ($context['avatars'] as $avatar)
  2586. echo '
  2587. <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected' : ''), '>', $avatar['name'], '</option>';
  2588. echo '
  2589. </select>
  2590. </div>
  2591. <div>
  2592. <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>
  2593. </div>
  2594. <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>
  2595. <script><!-- // --><![CDATA[
  2596. var files = ["' . implode('", "', $context['avatar_list']) . '"];
  2597. var avatar = document.getElementById("avatar");
  2598. var cat = document.getElementById("cat");
  2599. var selavatar = "' . $context['avatar_selected'] . '";
  2600. var avatardir = "' . $modSettings['avatar_url'] . '/";
  2601. var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116);
  2602. var file = document.getElementById("file");
  2603. var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, ';
  2604. var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, ';
  2605. if (avatar.src.indexOf("blank.png") > -1)
  2606. changeSel(selavatar);
  2607. else
  2608. previewExternalAvatar(avatar.src)
  2609. // ]]></script>
  2610. </div>';
  2611. }
  2612. // If the user can link to an off server avatar, show them a box to input the address.
  2613. if (!empty($context['member']['avatar']['allow_external']))
  2614. {
  2615. echo '
  2616. <div id="avatar_external">
  2617. <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') : '', '
  2618. <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">
  2619. </div>';
  2620. }
  2621. // If the user is able to upload avatars to the server show them an upload box.
  2622. if (!empty($context['member']['avatar']['allow_upload']))
  2623. {
  2624. echo '
  2625. <div id="avatar_upload">
  2626. <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'), '
  2627. ', ($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'] . '">' : ''), '
  2628. </div>';
  2629. }
  2630. echo '
  2631. <script><!-- // --><![CDATA[
  2632. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', '
  2633. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', '
  2634. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', '
  2635. function swap_avatar(type)
  2636. {
  2637. switch(type.id)
  2638. {
  2639. case "avatar_choice_server_stored":
  2640. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', '
  2641. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2642. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2643. break;
  2644. case "avatar_choice_external":
  2645. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2646. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', '
  2647. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2648. break;
  2649. case "avatar_choice_upload":
  2650. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2651. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2652. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', '
  2653. break;
  2654. case "avatar_choice_none":
  2655. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2656. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2657. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2658. break;
  2659. }
  2660. }
  2661. // ]]></script>
  2662. </dd>';
  2663. }
  2664. // This is just a really little helper to avoid duplicating code unnecessarily
  2665. function template_max_size($type)
  2666. {
  2667. global $modSettings, $txt;
  2668. $w = !empty($modSettings['avatar_max_width_' . $type]) ? comma_format($modSettings['avatar_max_width_' . $type]) : 0;
  2669. $h = !empty($modSettings['avatar_max_height_' . $type]) ? comma_format($modSettings['avatar_max_height_' . $type]) : 0;
  2670. $suffix = (!empty($w) ? 'w' : '') . (!empty($h) ? 'h' : '');
  2671. if (empty($suffix))
  2672. return;
  2673. echo '
  2674. <div class="smalltext">', sprintf($txt['avatar_max_size_' . $suffix], $w, $h), '</div>';
  2675. }
  2676. // Callback for modifying karam.
  2677. function template_profile_karma_modify()
  2678. {
  2679. global $context, $modSettings, $txt;
  2680. echo '
  2681. <dt>
  2682. <strong>', $modSettings['karmaLabel'], '</strong>
  2683. </dt>
  2684. <dd>
  2685. ', $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>
  2686. (', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
  2687. </dd>';
  2688. }
  2689. // Select the time format!
  2690. function template_profile_timeformat_modify()
  2691. {
  2692. global $context, $modSettings, $txt, $scripturl, $settings;
  2693. echo '
  2694. <dt>
  2695. <strong><label for="easyformat">', $txt['time_format'], ':</label></strong><br>
  2696. <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>
  2697. <span class="smalltext">&nbsp;<label for="time_format">', $txt['date_format'], '</label></span>
  2698. </dt>
  2699. <dd>
  2700. <select name="easyformat" id="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
  2701. // Help the user by showing a list of common time formats.
  2702. foreach ($context['easy_timeformats'] as $time_format)
  2703. echo '
  2704. <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected' : '', '>', $time_format['title'], '</option>';
  2705. echo '
  2706. </select><br>
  2707. <input type="text" name="time_format" id="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text">
  2708. </dd>';
  2709. }
  2710. // Time offset?
  2711. function template_profile_timeoffset_modify()
  2712. {
  2713. global $txt, $context;
  2714. echo '
  2715. <dt>
  2716. <strong', (isset($context['modify_error']['bad_offset']) ? ' class="error"' : ''), '><label for="time_offset">', $txt['time_offset'], ':</label></strong><br>
  2717. <span class="smalltext">', $txt['personal_time_offset'], '</span>
  2718. </dt>
  2719. <dd>
  2720. <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>
  2721. </dd>';
  2722. }
  2723. // Theme?
  2724. function template_profile_theme_pick()
  2725. {
  2726. global $txt, $context, $scripturl;
  2727. echo '
  2728. <dt>
  2729. <strong>', $txt['current_theme'], ':</strong>
  2730. </dt>
  2731. <dd>
  2732. ', $context['member']['theme']['name'], ' [<a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>]
  2733. </dd>';
  2734. }
  2735. // Smiley set picker.
  2736. function template_profile_smiley_pick()
  2737. {
  2738. global $txt, $context, $modSettings, $settings;
  2739. echo '
  2740. <dt>
  2741. <strong><label for="smiley_set">', $txt['smileys_current'], ':</label></strong>
  2742. </dt>
  2743. <dd>
  2744. <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\';">';
  2745. foreach ($context['smiley_sets'] as $set)
  2746. echo '
  2747. <option value="', $set['id'], '"', $set['selected'] ? ' selected' : '', '>', $set['name'], '</option>';
  2748. echo '
  2749. </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;">
  2750. </dd>';
  2751. }
  2752. // Change the way you login to the forum.
  2753. function template_authentication_method()
  2754. {
  2755. global $context, $settings, $scripturl, $modSettings, $txt;
  2756. // The main header!
  2757. echo '
  2758. <script src="', $settings['default_theme_url'], '/scripts/register.js"></script>
  2759. <form action="', $scripturl, '?action=profile;area=authentication;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data">
  2760. <div class="cat_bar">
  2761. <h3 class="catbg">
  2762. <img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon">', $txt['authentication'], '
  2763. </h3>
  2764. </div>
  2765. <p class="description">', $txt['change_authentication'], '</p>
  2766. <div class="windowbg2">
  2767. <div class="content">
  2768. <dl>
  2769. <dt>
  2770. <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>
  2771. <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>
  2772. </dt>
  2773. <dd>
  2774. <dl id="auth_openid_div">
  2775. <dt>
  2776. <em>', $txt['authenticate_openid_url'], ':</em>
  2777. </dt>
  2778. <dd>
  2779. <input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', $context['member']['openid_uri'], '" class="input_text openid_login">
  2780. </dd>
  2781. </dl>
  2782. <dl id="auth_pass_div">
  2783. <dt>
  2784. <em>', $txt['choose_pass'], ':</em>
  2785. </dt>
  2786. <dd>
  2787. <input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
  2788. <span id="smf_autov_pwmain_div" style="display: none;"><span id="smf_autov_pwmain_img" class="field_icons invalid centericon"></span></span>
  2789. </dd>
  2790. <dt>
  2791. <em>', $txt['verify_pass'], ':</em>
  2792. </dt>
  2793. <dd>
  2794. <input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password">
  2795. <span id="smf_autov_pwverify_div" style="display: none;"><span id="smf_autov_pwverify_img" class="field_icons valid"></span></span>
  2796. </dd>
  2797. </dl>
  2798. </dd>
  2799. </dl>';
  2800. if ($context['require_password'])
  2801. echo '
  2802. <hr width="100%" size="1" class="hrcolor clear">
  2803. <dl>
  2804. <dt>
  2805. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br>
  2806. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2807. </dt>
  2808. <dd>
  2809. <input type="password" name="oldpasswrd" tabindex="', $context['tabindex']++, '" size="20" style="margin-right: 4ex;" class="input_password">
  2810. </dd>
  2811. </dl>';
  2812. echo '
  2813. <hr class="hrcolor">';
  2814. if (!empty($context['token_check']))
  2815. echo '
  2816. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '">';
  2817. echo '
  2818. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
  2819. <input type="hidden" name="u" value="', $context['id_member'], '">
  2820. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '">
  2821. <input type="submit" value="', $txt['change_profile'], '" class="button_submit">
  2822. </div>
  2823. </div>
  2824. </form>';
  2825. // The password stuff.
  2826. echo '
  2827. <script><!-- // --><![CDATA[
  2828. var regTextStrings = {
  2829. "password_short": "', $txt['registration_password_short'], '",
  2830. "password_reserved": "', $txt['registration_password_reserved'], '",
  2831. "password_numbercase": "', $txt['registration_password_numbercase'], '",
  2832. "password_no_match": "', $txt['registration_password_no_match'], '",
  2833. "password_valid": "', $txt['registration_password_valid'], '"
  2834. };
  2835. var verificationHandle = new smfRegister("creator", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
  2836. var currentAuthMethod = \'passwd\';
  2837. updateAuthMethod();
  2838. // ]]></script>';
  2839. }
  2840. ?>