Profile.template.php 121 KB

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