Profile.template.php 122 KB

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