Profile.template.php 122 KB

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