Profile.template.php 126 KB

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