Profile.template.php 125 KB

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