Profile.template.php 120 KB

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