Profile.template.php 127 KB

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