Profile.template.php 128 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110
  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. // The button shouldn't say "Change profile" unless we're changing the profile...
  1170. if (!empty($context['submit_button_text']))
  1171. echo '
  1172. <input type="submit" name="save" value="', $context['submit_button_text'], '" class="button_submit" />';
  1173. else
  1174. echo '
  1175. <input type="submit" name="save" value="', $txt['change_profile'], '" class="button_submit" />';
  1176. if (!empty($context['token_check']))
  1177. echo '
  1178. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1179. echo '
  1180. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1181. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1182. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1183. </div>
  1184. </div>
  1185. <span class="botslice"><span></span></span>
  1186. </div>
  1187. <br />
  1188. </form>';
  1189. // Some javascript!
  1190. echo '
  1191. <script type="text/javascript"><!-- // --><![CDATA[
  1192. function checkProfileSubmit()
  1193. {';
  1194. // If this part requires a password, make sure to give a warning.
  1195. if ($context['require_password'])
  1196. echo '
  1197. // Did you forget to type your password?
  1198. if (document.forms.creator.oldpasswrd.value == "")
  1199. {
  1200. alert("', $txt['required_security_reasons'], '");
  1201. return false;
  1202. }';
  1203. // Any onsubmit javascript?
  1204. if (!empty($context['profile_onsubmit_javascript']))
  1205. echo '
  1206. ', $context['profile_javascript'];
  1207. echo '
  1208. }';
  1209. // Any totally custom stuff?
  1210. if (!empty($context['profile_javascript']))
  1211. echo '
  1212. ', $context['profile_javascript'];
  1213. echo '
  1214. // ]]></script>';
  1215. // Any final spellchecking stuff?
  1216. if (!empty($context['show_spellchecking']))
  1217. echo '
  1218. <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>';
  1219. }
  1220. // Personal Message settings.
  1221. function template_profile_pm_settings()
  1222. {
  1223. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1224. echo '
  1225. <dt>
  1226. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1227. </dt>
  1228. <dd>
  1229. <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'], '\');">
  1230. <option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
  1231. <option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
  1232. <option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
  1233. </select>
  1234. </dd>
  1235. <dt>
  1236. <label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label>
  1237. </dt>
  1238. <dd>
  1239. <input type="hidden" name="default_options[view_newest_pm_first]" value="0" />
  1240. <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" />
  1241. </dd>
  1242. </dl>
  1243. <hr />
  1244. <dl>
  1245. <dt>
  1246. <label for="pm_receive_from">', $txt['pm_receive_from'], '</label>
  1247. </dt>
  1248. <dd>
  1249. <select name="pm_receive_from" id="pm_receive_from">
  1250. <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected="selected"' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
  1251. if (!empty($modSettings['enable_buddylist']))
  1252. echo '
  1253. <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_ignore'], '</option>
  1254. <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
  1255. echo '
  1256. <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_admins'], '</option>
  1257. </select>
  1258. </dd>
  1259. <dt>
  1260. <label for="pm_email_notify">', $txt['email_notify'], '</label>
  1261. </dt>
  1262. <dd>
  1263. <select name="pm_email_notify" id="pm_email_notify">
  1264. <option value="0"', empty($context['send_email']) ? ' selected="selected"' : '', '>', $txt['email_notify_never'], '</option>
  1265. <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>';
  1266. if (!empty($modSettings['enable_buddylist']))
  1267. echo '
  1268. <option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected="selected"' : '', '>', $txt['email_notify_buddies'], '</option>';
  1269. echo '
  1270. </select>
  1271. </dd>
  1272. <dt>
  1273. <label for="popup_messages">', $txt['popup_messages'], '</label>
  1274. </dt>
  1275. <dd>
  1276. <input type="hidden" name="default_options[popup_messages]" value="0" />
  1277. <input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked="checked"' : '', ' class="input_check" />
  1278. </dd>
  1279. </dl>
  1280. <hr />
  1281. <dl>
  1282. <dt>
  1283. <label for="copy_to_outbox"> ', $txt['copy_to_outbox'], '</label>
  1284. </dt>
  1285. <dd>
  1286. <input type="hidden" name="default_options[copy_to_outbox]" value="0" />
  1287. <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" />
  1288. </dd>
  1289. <dt>
  1290. <label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
  1291. </dt>
  1292. <dd>
  1293. <input type="hidden" name="default_options[pm_remove_inbox_label]" value="0" />
  1294. <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" />
  1295. </dd>';
  1296. }
  1297. // Template for showing theme settings. Note: template_options() actually adds the theme specific options.
  1298. function template_profile_theme_settings()
  1299. {
  1300. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1301. echo '
  1302. <dd></dd>
  1303. </dl>
  1304. <ul id="theme_settings">
  1305. <li>
  1306. <input type="hidden" name="default_options[show_board_desc]" value="0" />
  1307. <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>
  1308. </li>
  1309. <li>
  1310. <input type="hidden" name="default_options[show_children]" value="0" />
  1311. <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>
  1312. </li>
  1313. <li>
  1314. <input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
  1315. <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>
  1316. </li>
  1317. <li>
  1318. <input type="hidden" name="default_options[show_no_avatars]" value="0" />
  1319. <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>
  1320. </li>
  1321. <li>
  1322. <input type="hidden" name="default_options[show_no_signatures]" value="0" />
  1323. <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>
  1324. </li>';
  1325. if ($context['allow_no_censored'])
  1326. echo '
  1327. <li>
  1328. <input type="hidden" name="default_options[show_no_censored]" value="0" />
  1329. <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>
  1330. </li>';
  1331. echo '
  1332. <li>
  1333. <input type="hidden" name="default_options[return_to_post]" value="0" />
  1334. <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>
  1335. </li>
  1336. <li>
  1337. <input type="hidden" name="default_options[no_new_reply_warning]" value="0" />
  1338. <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>
  1339. </li>';
  1340. if (!empty($modSettings['enable_buddylist']))
  1341. echo '
  1342. <li>
  1343. <input type="hidden" name="default_options[posts_apply_ignore_list]" value="0" />
  1344. <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>
  1345. </li>';
  1346. echo '
  1347. <li>
  1348. <input type="hidden" name="default_options[view_newest_first]" value="0" />
  1349. <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>
  1350. </li>';
  1351. // Choose WYSIWYG settings?
  1352. if (empty($modSettings['disable_wysiwyg']))
  1353. echo '
  1354. <li>
  1355. <input type="hidden" name="default_options[wysiwyg_default]" value="0" />
  1356. <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>
  1357. </li>';
  1358. if (empty($modSettings['disableCustomPerPage']))
  1359. {
  1360. echo '
  1361. <li>
  1362. <label for="topics_per_page">', $txt['topics_per_page'], '</label>
  1363. <select name="default_options[topics_per_page]" id="topics_per_page">
  1364. <option value="0"', empty($context['member']['options']['topics_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxTopics'], ')</option>
  1365. <option value="5"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1366. <option value="10"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1367. <option value="25"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1368. <option value="50"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1369. </select>
  1370. </li>
  1371. <li>
  1372. <label for="messages_per_page">', $txt['messages_per_page'], '</label>
  1373. <select name="default_options[messages_per_page]" id="messages_per_page">
  1374. <option value="0"', empty($context['member']['options']['messages_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxMessages'], ')</option>
  1375. <option value="5"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1376. <option value="10"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1377. <option value="25"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1378. <option value="50"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1379. </select>
  1380. </li>';
  1381. }
  1382. if (!empty($modSettings['cal_enabled']))
  1383. echo '
  1384. <li>
  1385. <label for="calendar_start_day">', $txt['calendar_start_day'], ':</label>
  1386. <select name="default_options[calendar_start_day]" id="calendar_start_day">
  1387. <option value="0"', empty($context['member']['options']['calendar_start_day']) ? ' selected="selected"' : '', '>', $txt['days'][0], '</option>
  1388. <option value="1"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 1 ? ' selected="selected"' : '', '>', $txt['days'][1], '</option>
  1389. <option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected="selected"' : '', '>', $txt['days'][6], '</option>
  1390. </select>
  1391. </li>';
  1392. echo '
  1393. <li>
  1394. <label for="display_quick_reply">', $txt['display_quick_reply'], '</label>
  1395. <select name="default_options[display_quick_reply]" id="display_quick_reply">
  1396. <option value="0"', empty($context['member']['options']['display_quick_reply']) ? ' selected="selected"' : '', '>', $txt['display_quick_reply1'], '</option>
  1397. <option value="1"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_reply2'], '</option>
  1398. <option value="2"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 2 ? ' selected="selected"' : '', '>', $txt['display_quick_reply3'], '</option>
  1399. </select>
  1400. </li>
  1401. <li>
  1402. <label for="display_quick_mod">', $txt['display_quick_mod'], '</label>
  1403. <select name="default_options[display_quick_mod]" id="display_quick_mod">
  1404. <option value="0"', empty($context['member']['options']['display_quick_mod']) ? ' selected="selected"' : '', '>', $txt['display_quick_mod_none'], '</option>
  1405. <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>
  1406. <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>
  1407. </select>
  1408. </li>
  1409. </ul>
  1410. <dl>
  1411. <dd></dd>';
  1412. }
  1413. function template_notification()
  1414. {
  1415. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  1416. // The main containing header.
  1417. echo '
  1418. <div class="cat_bar">
  1419. <h3 class="catbg">
  1420. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1421. </h3>
  1422. </div>
  1423. <p class="windowbg description">', $txt['notification_info'], '</p>
  1424. <div class="windowbg2">
  1425. <span class="topslice"><span></span></span>
  1426. <div class="content">
  1427. <form action="', $scripturl, '?action=profile;area=notification;save" method="post" accept-charset="', $context['character_set'], '" id="notify_options" class="flow_hidden">';
  1428. // Allow notification on announcements to be disabled?
  1429. if (!empty($modSettings['allow_disableAnnounce']))
  1430. echo '
  1431. <input type="hidden" name="notify_announcements" value="0" />
  1432. <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 />';
  1433. // More notification options.
  1434. echo '
  1435. <input type="hidden" name="default_options[auto_notify]" value="0" />
  1436. <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 />';
  1437. if (empty($modSettings['disallow_sendBody']))
  1438. echo '
  1439. <input type="hidden" name="notify_send_body" value="0" />
  1440. <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 />';
  1441. echo '
  1442. <br />
  1443. <label for="notify_regularity">', $txt['notify_regularity'], ':</label>
  1444. <select name="notify_regularity" id="notify_regularity">
  1445. <option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected="selected"' : '', '>', $txt['notify_regularity_instant'], '</option>
  1446. <option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_regularity_first_only'], '</option>
  1447. <option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_regularity_daily'], '</option>
  1448. <option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_regularity_weekly'], '</option>
  1449. </select>
  1450. <br /><br />
  1451. <label for="notify_types">', $txt['notify_send_types'], ':</label>
  1452. <select name="notify_types" id="notify_types">
  1453. <option value="1"', $context['member']['notify_types'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything'], '</option>
  1454. <option value="2"', $context['member']['notify_types'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything_own'], '</option>
  1455. <option value="3"', $context['member']['notify_types'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_send_type_only_replies'], '</option>
  1456. <option value="4"', $context['member']['notify_types'] == 4 ? ' selected="selected"' : '', '>', $txt['notify_send_type_nothing'], '</option>
  1457. </select><br class="clear" />
  1458. <div>
  1459. <input id="notify_submit" type="submit" value="', $txt['notify_save'], '" class="button_submit floatright" />';
  1460. if (!empty($context['token_check']))
  1461. echo '
  1462. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1463. echo '
  1464. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1465. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1466. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1467. </div><br class="clear" />
  1468. </form>
  1469. </div>
  1470. <span class="botslice"><span></span></span>
  1471. </div>
  1472. <br />';
  1473. template_show_list('topic_notification_list');
  1474. echo '
  1475. <br />';
  1476. template_show_list('board_notification_list');
  1477. }
  1478. // Template for choosing group membership.
  1479. function template_groupMembership()
  1480. {
  1481. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1482. // The main containing header.
  1483. echo '
  1484. <form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1485. <div class="cat_bar">
  1486. <h3 class="catbg">
  1487. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1488. </h3>
  1489. </div>
  1490. <p class="description">', $txt['groupMembership_info'], '</p>';
  1491. // Do we have an update message?
  1492. if (!empty($context['update_message']))
  1493. echo '
  1494. <div id="profile_success">
  1495. ', $context['update_message'], '.
  1496. </div>';
  1497. // Requesting membership to a group?
  1498. if (!empty($context['group_request']))
  1499. {
  1500. echo '
  1501. <div class="groupmembership">
  1502. <div class="cat_bar">
  1503. <h3 class="catbg">', $txt['request_group_membership'], '</h3>
  1504. </div>
  1505. <span class="upperframe"><span></span></span>
  1506. <div class="roundframe"><div class="innerframe">
  1507. ', $txt['request_group_membership_desc'], ':
  1508. <textarea name="reason" rows="4" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
  1509. <div class="righttext" style="margin: 0.5em 0.5% 0 0.5%;">
  1510. <input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
  1511. <input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
  1512. </div>
  1513. </div></div>
  1514. <span class="lowerframe"><span></span></span>
  1515. </div>';
  1516. }
  1517. else
  1518. {
  1519. echo '
  1520. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1521. <thead>
  1522. <tr class="catbg">
  1523. <th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
  1524. <th class="last_th" scope="col"></th>
  1525. </tr>
  1526. </thead>
  1527. <tbody>';
  1528. $alternate = true;
  1529. foreach ($context['groups']['member'] as $group)
  1530. {
  1531. echo '
  1532. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
  1533. if ($context['can_edit_primary'])
  1534. echo '
  1535. <td width="4%">
  1536. <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" />
  1537. </td>';
  1538. echo '
  1539. <td>
  1540. <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>
  1541. </td>
  1542. <td width="15%" class="righttext">';
  1543. // Can they leave their group?
  1544. if ($group['can_leave'])
  1545. echo '
  1546. <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>';
  1547. echo '
  1548. </td>
  1549. </tr>';
  1550. $alternate = !$alternate;
  1551. }
  1552. echo '
  1553. </tbody>
  1554. </table>';
  1555. if ($context['can_edit_primary'])
  1556. echo '
  1557. <div class="padding righttext">
  1558. <input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
  1559. </div>';
  1560. // Any groups they can join?
  1561. if (!empty($context['groups']['available']))
  1562. {
  1563. echo '
  1564. <br />
  1565. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1566. <thead>
  1567. <tr class="catbg">
  1568. <th class="first_th" scope="col">
  1569. ', $txt['available_groups'], '
  1570. </th>
  1571. <th class="last_th" scope="col"></th>
  1572. </tr>
  1573. </thead>
  1574. <tbody>';
  1575. $alternate = true;
  1576. foreach ($context['groups']['available'] as $group)
  1577. {
  1578. echo '
  1579. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  1580. <td>
  1581. <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>' : ''), '
  1582. </td>
  1583. <td width="15%" class="lefttext">';
  1584. if ($group['type'] == 3)
  1585. echo '
  1586. <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>';
  1587. elseif ($group['type'] == 2 && $group['pending'])
  1588. echo '
  1589. ', $txt['approval_pending'];
  1590. elseif ($group['type'] == 2)
  1591. echo '
  1592. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '">', $txt['request_group'], '</a>';
  1593. // <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1594. echo '
  1595. </td>
  1596. </tr>';
  1597. $alternate = !$alternate;
  1598. }
  1599. echo '
  1600. </tbody>
  1601. </table>';
  1602. }
  1603. // Javascript for the selector stuff.
  1604. echo '
  1605. <script type="text/javascript"><!-- // --><![CDATA[
  1606. var prevClass = "";
  1607. var prevDiv = "";
  1608. function highlightSelected(box)
  1609. {
  1610. if (prevClass != "")
  1611. {
  1612. prevDiv.className = prevClass;
  1613. }
  1614. prevDiv = document.getElementById(box);
  1615. prevClass = prevDiv.className;
  1616. prevDiv.className = "highlight2";
  1617. }';
  1618. if (isset($context['groups']['member'][$context['primary_group']]))
  1619. echo '
  1620. highlightSelected("primdiv_' . $context['primary_group'] . '");';
  1621. echo '
  1622. // ]]></script>';
  1623. }
  1624. if (!empty($context['token_check']))
  1625. echo '
  1626. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1627. echo '
  1628. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1629. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1630. </form>';
  1631. }
  1632. function template_ignoreboards()
  1633. {
  1634. global $context, $txt, $settings, $scripturl;
  1635. // The main containing header.
  1636. echo '
  1637. <form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1638. <div class="cat_bar">
  1639. <h3 class="catbg">
  1640. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1641. </h3>
  1642. </div>
  1643. <p class="description">', $txt['ignoreboards_info'], '</p>
  1644. <div class="windowbg2">
  1645. <span class="topslice"><span></span></span>
  1646. <div class="content flow_hidden">
  1647. <ul class="ignoreboards floatleft">';
  1648. $i = 0;
  1649. $limit = ceil($context['num_boards'] / 2);
  1650. foreach ($context['categories'] as $category)
  1651. {
  1652. if ($i == $limit)
  1653. {
  1654. echo '
  1655. </ul>
  1656. <ul class="ignoreboards floatright">';
  1657. $i++;
  1658. }
  1659. echo '
  1660. <li class="category">
  1661. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), ']); return false;">', $category['name'], '</a>
  1662. <ul>';
  1663. foreach ($category['boards'] as $board)
  1664. {
  1665. if ($i == $limit)
  1666. echo '
  1667. </ul>
  1668. </li>
  1669. </ul>
  1670. <ul class="ignoreboards floatright">
  1671. <li class="category">
  1672. <ul>';
  1673. echo '
  1674. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  1675. <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>
  1676. </li>';
  1677. $i++;
  1678. }
  1679. echo '
  1680. </ul>
  1681. </li>';
  1682. }
  1683. echo '
  1684. </ul>
  1685. <br class="clear" />';
  1686. // Show the standard "Save Settings" profile button.
  1687. template_profile_save();
  1688. echo '
  1689. </div>
  1690. <span class="botslice"><span></span></span>
  1691. </div>
  1692. </form>
  1693. <br />';
  1694. }
  1695. // Simple load some theme variables common to several warning templates.
  1696. function template_load_warning_variables()
  1697. {
  1698. global $modSettings, $context;
  1699. $context['warningBarWidth'] = 200;
  1700. // Setup the colors - this is a little messy for theming.
  1701. $context['colors'] = array(
  1702. 0 => 'green',
  1703. $modSettings['warning_watch'] => 'darkgreen',
  1704. $modSettings['warning_moderate'] => 'orange',
  1705. $modSettings['warning_mute'] => 'red',
  1706. );
  1707. // Work out the starting color.
  1708. $context['current_color'] = $context['colors'][0];
  1709. foreach ($context['colors'] as $limit => $color)
  1710. if ($context['member']['warning'] >= $limit)
  1711. $context['current_color'] = $color;
  1712. }
  1713. // Show all warnings of a user?
  1714. function template_viewWarning()
  1715. {
  1716. global $context, $txt, $scripturl, $settings;
  1717. template_load_warning_variables();
  1718. echo '
  1719. <div class="title_bar">
  1720. <h3 class="titlebg">
  1721. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />
  1722. ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '
  1723. </span>
  1724. </h3>
  1725. </div>
  1726. <div class="windowbg">
  1727. <span class="topslice"><span></span></span>
  1728. <div class="content">
  1729. <dl class="settings">
  1730. <dt>
  1731. <strong>', $txt['profile_warning_name'], ':</strong>
  1732. </dt>
  1733. <dd>
  1734. ', $context['member']['name'], '
  1735. </dd>
  1736. <dt>
  1737. <strong>', $txt['profile_warning_level'], ':</strong>
  1738. </dt>
  1739. <dd>
  1740. <div>
  1741. <div>
  1742. <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  1743. <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>
  1744. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1745. </div>
  1746. </div>
  1747. </div>
  1748. </dd>';
  1749. // There's some impact of this?
  1750. if (!empty($context['level_effects'][$context['current_level']]))
  1751. echo '
  1752. <dt>
  1753. <strong>', $txt['profile_viewwarning_impact'], ':</strong>
  1754. </dt>
  1755. <dd>
  1756. ', $context['level_effects'][$context['current_level']], '
  1757. </dd>';
  1758. echo '
  1759. </dl>
  1760. </div>
  1761. <span class="botslice"><span></span></span>
  1762. </div>';
  1763. template_show_list('view_warnings');
  1764. }
  1765. // Show a lovely interface for issuing warnings.
  1766. function template_issueWarning()
  1767. {
  1768. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1769. template_load_warning_variables();
  1770. echo '
  1771. <script type="text/javascript"><!-- // --><![CDATA[
  1772. function setWarningBarPos(curEvent, isMove, changeAmount)
  1773. {
  1774. barWidth = ', $context['warningBarWidth'], ';
  1775. // Are we passing the amount to change it by?
  1776. if (changeAmount)
  1777. {
  1778. if (document.getElementById(\'warning_level\').value == \'SAME\')
  1779. percent = ', $context['member']['warning'], ' + changeAmount;
  1780. else
  1781. percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount;
  1782. }
  1783. // If not then it\'s a mouse thing.
  1784. else
  1785. {
  1786. if (!curEvent)
  1787. var curEvent = window.event;
  1788. // If it\'s a movement check the button state first!
  1789. if (isMove)
  1790. {
  1791. if (!curEvent.button || curEvent.button != 1)
  1792. return false
  1793. }
  1794. // Get the position of the container.
  1795. contain = document.getElementById(\'warning_contain\');
  1796. position = 0;
  1797. while (contain != null)
  1798. {
  1799. position += contain.offsetLeft;
  1800. contain = contain.offsetParent;
  1801. }
  1802. // Where is the mouse?
  1803. if (curEvent.pageX)
  1804. {
  1805. mouse = curEvent.pageX;
  1806. }
  1807. else
  1808. {
  1809. mouse = curEvent.clientX;
  1810. mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft;
  1811. }
  1812. // Is this within bounds?
  1813. if (mouse < position || mouse > position + barWidth)
  1814. return;
  1815. percent = Math.round(((mouse - position) / barWidth) * 100);
  1816. // Round percent to the nearest 5 - by kinda cheating!
  1817. percent = Math.round(percent / 5) * 5;
  1818. }
  1819. // What are the limits?
  1820. minLimit = ', $context['min_allowed'], ';
  1821. maxLimit = ', $context['max_allowed'], ';
  1822. percent = Math.max(percent, minLimit);
  1823. percent = Math.min(percent, maxLimit);
  1824. size = barWidth * (percent/100);
  1825. setInnerHTML(document.getElementById(\'warning_text\'), percent + "%");
  1826. document.getElementById(\'warning_level\').value = percent;
  1827. document.getElementById(\'warning_progress\').style.width = size + "px";
  1828. // Get the right color.
  1829. color = "black"';
  1830. foreach ($context['colors'] as $limit => $color)
  1831. echo '
  1832. if (percent >= ', $limit, ')
  1833. color = "', $color, '";';
  1834. echo '
  1835. document.getElementById(\'warning_progress\').style.backgroundColor = color;
  1836. // Also set the right effect.
  1837. effectText = "";';
  1838. foreach ($context['level_effects'] as $limit => $text)
  1839. echo '
  1840. if (percent >= ', $limit, ')
  1841. effectText = "', $text, '";';
  1842. echo '
  1843. setInnerHTML(document.getElementById(\'cur_level_div\'), effectText);
  1844. }
  1845. // Disable notification boxes as required.
  1846. function modifyWarnNotify()
  1847. {
  1848. disable = !document.getElementById(\'warn_notify\').checked;
  1849. document.getElementById(\'warn_sub\').disabled = disable;
  1850. document.getElementById(\'warn_body\').disabled = disable;
  1851. document.getElementById(\'warn_temp\').disabled = disable;
  1852. document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\';
  1853. }
  1854. function changeWarnLevel(amount)
  1855. {
  1856. setWarningBarPos(false, false, amount);
  1857. }
  1858. // Warn template.
  1859. function populateNotifyTemplate()
  1860. {
  1861. index = document.getElementById(\'warn_temp\').value;
  1862. if (index == -1)
  1863. return false;
  1864. // Otherwise see what we can do...';
  1865. foreach ($context['notification_templates'] as $k => $type)
  1866. echo '
  1867. if (index == ', $k, ')
  1868. document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
  1869. echo '
  1870. }
  1871. // ]]></script>';
  1872. echo '
  1873. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  1874. <div class="cat_bar">
  1875. <h3 class="catbg">
  1876. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />
  1877. ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '
  1878. </span>
  1879. </h3>
  1880. </div>';
  1881. if (!$context['user']['is_owner'])
  1882. echo '
  1883. <p class="description">', $txt['profile_warning_desc'], '</p>';
  1884. echo '
  1885. <div class="windowbg">
  1886. <span class="topslice"><span></span></span>
  1887. <div class="content">
  1888. <dl class="settings">';
  1889. if (!$context['user']['is_owner'])
  1890. echo '
  1891. <dt>
  1892. <strong>', $txt['profile_warning_name'], ':</strong>
  1893. </dt>
  1894. <dd>
  1895. <strong>', $context['member']['name'], '</strong>
  1896. </dd>';
  1897. echo '
  1898. <dt>
  1899. <strong>', $txt['profile_warning_level'], ':</strong>';
  1900. // Is there only so much they can apply?
  1901. if ($context['warning_limit'])
  1902. echo '
  1903. <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
  1904. echo '
  1905. </dt>
  1906. <dd>
  1907. <div id="warndiv1" style="display: none;">
  1908. <div>
  1909. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span>
  1910. <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);">
  1911. <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>
  1912. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1913. </div>
  1914. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span>
  1915. <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div>
  1916. </div>
  1917. <input type="hidden" name="warning_level" id="warning_level" value="SAME" />
  1918. </div>
  1919. <div id="warndiv2">
  1920. <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" />&nbsp;', $txt['profile_warning_max'], '
  1921. <div class="smalltext">', $txt['profile_warning_impact'], ':<br />';
  1922. // For non-javascript give a better list.
  1923. foreach ($context['level_effects'] as $limit => $effect)
  1924. echo '
  1925. ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />';
  1926. echo '
  1927. </div>
  1928. </div>
  1929. </dd>';
  1930. if (!$context['user']['is_owner'])
  1931. {
  1932. echo '
  1933. <dt>
  1934. <strong>', $txt['profile_warning_reason'], ':</strong><br />
  1935. <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span>
  1936. </dt>
  1937. <dd>
  1938. <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" />
  1939. </dd>
  1940. </dl>
  1941. <hr />
  1942. <dl class="settings">
  1943. <dt>
  1944. <strong>', $txt['profile_warning_notify'], ':</strong>
  1945. </dt>
  1946. <dd>
  1947. <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" />
  1948. </dd>
  1949. <dt>
  1950. <strong>', $txt['profile_warning_notify_subject'], ':</strong>
  1951. </dt>
  1952. <dd>
  1953. <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" />
  1954. </dd>
  1955. <dt>
  1956. <strong>', $txt['profile_warning_notify_body'], ':</strong>
  1957. </dt>
  1958. <dd>
  1959. <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;">
  1960. <option value="-1">', $txt['profile_warning_notify_template'], '</option>
  1961. <option value="-1">------------------------------</option>';
  1962. foreach ($context['notification_templates'] as $id_template => $template)
  1963. echo '
  1964. <option value="', $id_template, '">', $template['title'], '</option>';
  1965. echo '
  1966. </select>
  1967. <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 />
  1968. <textarea name="warn_body" id="warn_body" cols="40" rows="8">', $context['warning_data']['notify_body'], '</textarea>
  1969. </dd>';
  1970. }
  1971. echo '
  1972. </dl>
  1973. <div class="righttext">';
  1974. if (!empty($context['token_check']))
  1975. echo '
  1976. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  1977. echo '
  1978. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1979. <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" />
  1980. </div>
  1981. </div>
  1982. <span class="botslice"><span></span></span>
  1983. </div>
  1984. </form>';
  1985. // Previous warnings?
  1986. echo '<br />
  1987. <div class="cat_bar">
  1988. <h3 class="catbg">
  1989. ', $txt['profile_warning_previous'], '
  1990. </h3>
  1991. </div>
  1992. <table border="0" width="100%" cellspacing="0" cellpadding="5" class="table_grid">
  1993. <thead>
  1994. <tr class="titlebg lefttext">
  1995. <th class="first_th" scope="col" width="20%">', $txt['profile_warning_previous_issued'], '</th>
  1996. <th scope="col" width="30%">', $txt['profile_warning_previous_time'], '</th>
  1997. <th scope="col">', $txt['profile_warning_previous_reason'], '</th>
  1998. <th class="last_th" scope="col" width="6%">', $txt['profile_warning_previous_level'], '</th>
  1999. </tr>
  2000. </thead>
  2001. <tbody>';
  2002. // Print the warnings.
  2003. $alternate = 0;
  2004. foreach ($context['previous_warnings'] as $warning)
  2005. {
  2006. $alternate = !$alternate;
  2007. echo '
  2008. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  2009. <td class="smalltext">', $warning['issuer']['link'], '</td>
  2010. <td class="smalltext">', $warning['time'], '</td>
  2011. <td class="smalltext">
  2012. <div class="floatleft">
  2013. ', $warning['reason'], '
  2014. </div>';
  2015. if (!empty($warning['id_notice']))
  2016. echo '
  2017. <div class="floatright">
  2018. <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>
  2019. </div>';
  2020. echo '
  2021. </td>
  2022. <td class="smalltext">', $warning['counter'], '</td>
  2023. </tr>';
  2024. }
  2025. if (empty($context['previous_warnings']))
  2026. echo '
  2027. <tr class="windowbg2">
  2028. <td align="center" colspan="4">
  2029. ', $txt['profile_warning_previous_none'], '
  2030. </td>
  2031. </tr>';
  2032. echo '
  2033. </tbody>
  2034. </table>
  2035. <div class="pagesection">', $txt['pages'], ': ', $context['page_index'], '</div>';
  2036. // Do our best to get pretty javascript enabled.
  2037. echo '
  2038. <script type="text/javascript"><!-- // --><![CDATA[
  2039. document.getElementById(\'warndiv1\').style.display = "";
  2040. document.getElementById(\'warndiv2\').style.display = "none";';
  2041. if (!$context['user']['is_owner'])
  2042. echo '
  2043. modifyWarnNotify();';
  2044. echo '
  2045. // ]]></script>';
  2046. }
  2047. // Template to show for deleting a users account - now with added delete post capability!
  2048. function template_deleteAccount()
  2049. {
  2050. global $context, $settings, $options, $scripturl, $txt, $scripturl;
  2051. // The main containing header.
  2052. echo '
  2053. <form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  2054. <div class="title_bar">
  2055. <h3 class="titlebg">
  2056. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['deleteAccount'], '</span>
  2057. </h3>
  2058. </div>';
  2059. // If deleting another account give them a lovely info box.
  2060. if (!$context['user']['is_owner'])
  2061. echo '
  2062. <p class="windowbg2 description">', $txt['deleteAccount_desc'], '</p>';
  2063. echo '
  2064. <div class="windowbg2">
  2065. <span class="topslice"><span></span></span>
  2066. <div class="content">';
  2067. // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
  2068. if ($context['needs_approval'])
  2069. echo '
  2070. <div id ="profile_error" class="alert">', $txt['deleteAccount_approval'], '</div>';
  2071. // If the user is deleting their own account warn them first - and require a password!
  2072. if ($context['user']['is_owner'])
  2073. {
  2074. echo '
  2075. <div class="alert">', $txt['own_profile_confirm'], '</div>
  2076. <div>
  2077. <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
  2078. <input type="password" name="oldpasswrd" size="20" class="input_password" />&nbsp;&nbsp;&nbsp;&nbsp;
  2079. <input type="submit" value="', $txt['yes'], '" class="button_submit" />';
  2080. if (!empty($context['token_check']))
  2081. echo '
  2082. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2083. echo '
  2084. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2085. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2086. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2087. </div>';
  2088. }
  2089. // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
  2090. else
  2091. {
  2092. echo '
  2093. <div class="alert">', $txt['deleteAccount_warning'], '</div>';
  2094. // Only actually give these options if they are kind of important.
  2095. if ($context['can_delete_posts'])
  2096. echo '
  2097. <div>
  2098. ', $txt['deleteAccount_posts'], ':
  2099. <select name="remove_type">
  2100. <option value="none">', $txt['deleteAccount_none'], '</option>
  2101. <option value="posts">', $txt['deleteAccount_all_posts'], '</option>
  2102. <option value="topics">', $txt['deleteAccount_topics'], '</option>
  2103. </select>
  2104. </div>';
  2105. echo '
  2106. <div>
  2107. <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>
  2108. </div>
  2109. <div>
  2110. <input type="submit" value="', $txt['delete'], '" class="button_submit" />';
  2111. if (!empty($context['token_check']))
  2112. echo '
  2113. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2114. echo '
  2115. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2116. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2117. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2118. </div>';
  2119. }
  2120. echo '
  2121. </div>
  2122. <span class="botslice"><span></span></span>
  2123. </div>
  2124. <br />
  2125. </form>';
  2126. }
  2127. // Template for the password box/save button stuck at the bottom of every profile page.
  2128. function template_profile_save()
  2129. {
  2130. global $context, $settings, $options, $txt;
  2131. echo '
  2132. <hr width="100%" size="1" class="hrcolor clear" />';
  2133. // Only show the password box if it's actually needed.
  2134. if ($context['require_password'])
  2135. echo '
  2136. <dl>
  2137. <dt>
  2138. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2139. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2140. </dt>
  2141. <dd>
  2142. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2143. </dd>
  2144. </dl>';
  2145. echo '
  2146. <div class="righttext">
  2147. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2148. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2149. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2150. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2151. </div>';
  2152. }
  2153. // Small template for showing an error message upon a save problem in the profile.
  2154. function template_error_message()
  2155. {
  2156. global $context, $txt;
  2157. if (!empty($context['post_errors']))
  2158. {
  2159. echo '
  2160. <div class="errorbox" id="profile_error">
  2161. <span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ':</span>
  2162. <ul class="reset">';
  2163. // Cycle through each error and display an error message.
  2164. foreach ($context['post_errors'] as $error)
  2165. echo '
  2166. <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '.</li>';
  2167. echo '
  2168. </ul>
  2169. </div>';
  2170. }
  2171. else
  2172. echo '
  2173. <div class="errorbox" style="display:none" id="profile_error"></div>';
  2174. }
  2175. // Display a load of drop down selectors for allowing the user to change group.
  2176. function template_profile_group_manage()
  2177. {
  2178. global $context, $txt, $scripturl;
  2179. echo '
  2180. <dt>
  2181. <strong>', $txt['primary_membergroup'], ': </strong><br />
  2182. <span class="smalltext">(<a href="', $scripturl, '?action=helpadmin;help=moderator_why_missing" onclick="return reqWin(this.href);">', $txt['moderator_why_missing'], '</a>)</span>
  2183. </dt>
  2184. <dd>
  2185. <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;"' : ''), '>';
  2186. // Fill the select box with all primary member groups that can be assigned to a member.
  2187. foreach ($context['member_groups'] as $member_group)
  2188. if (!empty($member_group['can_be_primary']))
  2189. echo '
  2190. <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected="selected"' : '', '>
  2191. ', $member_group['name'], '
  2192. </option>';
  2193. echo '
  2194. </select>
  2195. </dd>
  2196. <dt>
  2197. <strong>', $txt['additional_membergroups'], ':</strong>
  2198. </dt>
  2199. <dd>
  2200. <span id="additional_groupsList">
  2201. <input type="hidden" name="additional_groups[]" value="0" />';
  2202. // For each membergroup show a checkbox so members can be assigned to more than one group.
  2203. foreach ($context['member_groups'] as $member_group)
  2204. if ($member_group['can_be_additional'])
  2205. echo '
  2206. <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 />';
  2207. echo '
  2208. </span>
  2209. <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>
  2210. <script type="text/javascript"><!-- // --><![CDATA[
  2211. document.getElementById("additional_groupsList").style.display = "none";
  2212. document.getElementById("additional_groupsLink").style.display = "";
  2213. // ]]></script>
  2214. </dd>';
  2215. }
  2216. // Callback function for entering a birthdate!
  2217. function template_profile_birthdate()
  2218. {
  2219. global $txt, $context;
  2220. // Just show the pretty box!
  2221. echo '
  2222. <dt>
  2223. <strong>', $txt['dob'], ':</strong><br />
  2224. <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
  2225. </dt>
  2226. <dd>
  2227. <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '" class="input_text" /> -
  2228. <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '" class="input_text" /> -
  2229. <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '" class="input_text" />
  2230. </dd>';
  2231. }
  2232. // Show the signature editing box?
  2233. function template_profile_signature_modify()
  2234. {
  2235. global $txt, $context, $settings, $scripturl;
  2236. echo '
  2237. <dt id="current_signature"', !isset($context['member']['current_signature']) ? ' style="display:none"' : '', '>
  2238. <strong>', $txt['current_signature'], ':</strong>
  2239. </dt>
  2240. <dd id="current_signature_display"', !isset($context['member']['current_signature']) ? ' style="display:none"' : '', '>
  2241. ', isset($context['member']['current_signature']) ? $context['member']['current_signature'] : '', '<hr />
  2242. </dd>';
  2243. echo '
  2244. <dt id="preview_signature"', !isset($context['member']['signature_preview']) ? ' style="display:none"' : '', '>
  2245. <strong>', $txt['signature_preview'], ':</strong>
  2246. </dt>
  2247. <dd id="preview_signature_display"', !isset($context['member']['signature_preview']) ? ' style="display:none"' : '', '>
  2248. ', isset($context['member']['signature_preview']) ? $context['member']['signature_preview'] : '', '<hr />
  2249. </dd>';
  2250. echo '
  2251. <dt>
  2252. <strong>', $txt['signature'], ':</strong><br />
  2253. <span class="smalltext">', $txt['sig_info'], '</span><br />
  2254. <br />';
  2255. if ($context['show_spellchecking'])
  2256. echo '
  2257. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit" />';
  2258. echo '
  2259. </dt>
  2260. <dd>
  2261. <textarea class="editor" onkeyup="calcCharLeft();" id="signature" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br />';
  2262. // If there is a limit at all!
  2263. if (!empty($context['signature_limits']['max_length']))
  2264. echo '
  2265. <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br />';
  2266. if (!empty($context['show_preview_button']))
  2267. echo '
  2268. <input type="submit" name="preview" id="preview_button" value="', $txt['preview_signature'], '" class="button_submit" />';
  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. var currentChars = 0;
  2294. if (!document.getElementById("signatureLeft"))
  2295. return;
  2296. if (oldSignature != currentSignature)
  2297. {
  2298. oldSignature = currentSignature;
  2299. var currentChars = currentSignature.replace(/\r/, "").length;
  2300. if (is_opera)
  2301. currentChars = currentSignature.replace(/\r/g,\'\').length;
  2302. //ajax_getSignaturePreview(false);
  2303. if (currentChars > maxLength)
  2304. {
  2305. document.getElementById("signatureLeft").className = "error";
  2306. if (!$("#profile_error").is(":visible"))
  2307. ajax_getSignaturePreview(false);
  2308. }
  2309. else
  2310. {
  2311. if ($("#profile_error").is(":visible"))
  2312. ajax_getSignaturePreview(false);
  2313. document.getElementById("signatureLeft").className = "";
  2314. }
  2315. }
  2316. setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentChars);
  2317. }
  2318. addLoadEvent(tick);
  2319. $(document).ready(function() {
  2320. $("#preview_button").click(function() {
  2321. return ajax_getSignaturePreview(true);
  2322. });
  2323. });
  2324. function ajax_getSignaturePreview (showPreview)
  2325. {
  2326. showPreview = (typeof showPreview == \'undefined\') ? false : showPreview;
  2327. $.ajax({
  2328. type: "POST",
  2329. url: "' . $scripturl . '?action=xmlhttp;sa=previews;xml",
  2330. data: {item: "sig_preview", signature: $("#signature").val(), user: $(\'input[name="u"]\').attr("value")},
  2331. context: document.body,
  2332. success: function(request){
  2333. if (showPreview)
  2334. {
  2335. var signatures = new Array("current", "preview");
  2336. for (var i = 0; i < signatures.length; i++)
  2337. {
  2338. $("#" + signatures[i] + "_signature").css({display:""});
  2339. $("#" + signatures[i] + "_signature_display").css({display:""}).html($(request).find(\'[type="\' + signatures[i] + \'"]\').text() + \'<hr />\');
  2340. }
  2341. }
  2342. if ($(request).find("error").text() != \'\')
  2343. {
  2344. $("#profile_error").css({display:""});
  2345. var errors = $(request).find(\'[type="error"]\');
  2346. var errors_html = \'<span>\' + $(request).find(\'[type="errors_occurred"]\').text() + \'</span><ul class="reset">\';
  2347. for (var i = 0; i < errors.length; i++)
  2348. errors_html += \'<li>\' + $(errors).text() + \'</li>\';
  2349. errors_html += \'</ul>\';
  2350. $(document).find("#profile_error").html(errors_html);
  2351. }
  2352. else
  2353. {
  2354. $("#profile_error").css({display:"none"});
  2355. $("#profile_error").html(\'\');
  2356. }
  2357. return false;
  2358. },
  2359. });
  2360. return false;
  2361. }
  2362. // ]]></script>
  2363. </dd>';
  2364. }
  2365. function template_profile_avatar_select()
  2366. {
  2367. global $context, $txt, $modSettings;
  2368. // Start with the upper menu
  2369. echo '
  2370. <dt>
  2371. <strong id="personal_picture">', $txt['personal_picture'], '</strong>
  2372. <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 />
  2373. ', !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 />' : '', '
  2374. ', !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 />' : '', '
  2375. ', !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>' : '', '
  2376. </dt>
  2377. <dd>';
  2378. // If users are allowed to choose avatars stored on the server show selection boxes to choice them from.
  2379. if (!empty($context['member']['avatar']['allow_server_stored']))
  2380. {
  2381. echo '
  2382. <div id="avatar_server_stored">
  2383. <div>
  2384. <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
  2385. // This lists all the file catergories.
  2386. foreach ($context['avatars'] as $avatar)
  2387. echo '
  2388. <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected="selected"' : ''), '>', $avatar['name'], '</option>';
  2389. echo '
  2390. </select>
  2391. </div>
  2392. <div>
  2393. <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>
  2394. </div>
  2395. <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>
  2396. <script type="text/javascript"><!-- // --><![CDATA[
  2397. var files = ["' . implode('", "', $context['avatar_list']) . '"];
  2398. var avatar = document.getElementById("avatar");
  2399. var cat = document.getElementById("cat");
  2400. var selavatar = "' . $context['avatar_selected'] . '";
  2401. var avatardir = "' . $modSettings['avatar_url'] . '/";
  2402. var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116);
  2403. var file = document.getElementById("file");
  2404. if (avatar.src.indexOf("blank.gif") > -1)
  2405. changeSel(selavatar);
  2406. else
  2407. previewExternalAvatar(avatar.src)
  2408. function changeSel(selected)
  2409. {
  2410. if (cat.selectedIndex == -1)
  2411. return;
  2412. if (cat.options[cat.selectedIndex].value.indexOf("/") > 0)
  2413. {
  2414. var i;
  2415. var count = 0;
  2416. file.style.display = "inline";
  2417. file.disabled = false;
  2418. for (i = file.length; i >= 0; i = i - 1)
  2419. file.options[i] = null;
  2420. for (i = 0; i < files.length; i++)
  2421. if (files[i].indexOf(cat.options[cat.selectedIndex].value) == 0)
  2422. {
  2423. var filename = files[i].substr(files[i].indexOf("/") + 1);
  2424. var showFilename = filename.substr(0, filename.lastIndexOf("."));
  2425. showFilename = showFilename.replace(/[_]/g, " ");
  2426. file.options[count] = new Option(showFilename, files[i]);
  2427. if (filename == selected)
  2428. {
  2429. if (file.options.defaultSelected)
  2430. file.options[count].defaultSelected = true;
  2431. else
  2432. file.options[count].selected = true;
  2433. }
  2434. count++;
  2435. }
  2436. if (file.selectedIndex == -1 && file.options[0])
  2437. file.options[0].selected = true;
  2438. showAvatar();
  2439. }
  2440. else
  2441. {
  2442. file.style.display = "none";
  2443. file.disabled = true;
  2444. document.getElementById("avatar").src = avatardir + cat.options[cat.selectedIndex].value;
  2445. document.getElementById("avatar").style.width = "";
  2446. document.getElementById("avatar").style.height = "";
  2447. }
  2448. }
  2449. function showAvatar()
  2450. {
  2451. if (file.selectedIndex == -1)
  2452. return;
  2453. document.getElementById("avatar").src = avatardir + file.options[file.selectedIndex].value;
  2454. document.getElementById("avatar").alt = file.options[file.selectedIndex].text;
  2455. document.getElementById("avatar").alt += file.options[file.selectedIndex].text == size ? "!" : "";
  2456. document.getElementById("avatar").style.width = "";
  2457. document.getElementById("avatar").style.height = "";
  2458. }
  2459. function previewExternalAvatar(src)
  2460. {
  2461. if (!document.getElementById("avatar"))
  2462. return;
  2463. var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, ';
  2464. var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, ';
  2465. var tempImage = new Image();
  2466. tempImage.src = src;
  2467. if (maxWidth != 0 && tempImage.width > maxWidth)
  2468. {
  2469. document.getElementById("avatar").style.height = parseInt((maxWidth * tempImage.height) / tempImage.width) + "px";
  2470. document.getElementById("avatar").style.width = maxWidth + "px";
  2471. }
  2472. else if (maxHeight != 0 && tempImage.height > maxHeight)
  2473. {
  2474. document.getElementById("avatar").style.width = parseInt((maxHeight * tempImage.width) / tempImage.height) + "px";
  2475. document.getElementById("avatar").style.height = maxHeight + "px";
  2476. }
  2477. document.getElementById("avatar").src = src;
  2478. }
  2479. // ]]></script>
  2480. </div>';
  2481. }
  2482. // If the user can link to an off server avatar, show them a box to input the address.
  2483. if (!empty($context['member']['avatar']['allow_external']))
  2484. {
  2485. echo '
  2486. <div id="avatar_external">
  2487. <div class="smalltext">', $txt['avatar_by_url'], '</div>
  2488. <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" />
  2489. </div>';
  2490. }
  2491. // If the user is able to upload avatars to the server show them an upload box.
  2492. if (!empty($context['member']['avatar']['allow_upload']))
  2493. {
  2494. echo '
  2495. <div id="avatar_upload">
  2496. <input type="file" size="44" name="attachment" value="" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" class="input_file" />
  2497. ', ($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'] . '" />' : ''), '
  2498. </div>';
  2499. }
  2500. echo '
  2501. <script type="text/javascript"><!-- // --><![CDATA[
  2502. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', '
  2503. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', '
  2504. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', '
  2505. function swap_avatar(type)
  2506. {
  2507. switch(type.id)
  2508. {
  2509. case "avatar_choice_server_stored":
  2510. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', '
  2511. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2512. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2513. break;
  2514. case "avatar_choice_external":
  2515. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2516. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', '
  2517. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2518. break;
  2519. case "avatar_choice_upload":
  2520. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2521. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2522. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', '
  2523. break;
  2524. case "avatar_choice_none":
  2525. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2526. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2527. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2528. break;
  2529. }
  2530. }
  2531. // ]]></script>
  2532. </dd>';
  2533. }
  2534. // Callback for modifying karam.
  2535. function template_profile_karma_modify()
  2536. {
  2537. global $context, $modSettings, $txt;
  2538. echo '
  2539. <dt>
  2540. <strong>', $modSettings['karmaLabel'], '</strong>
  2541. </dt>
  2542. <dd>
  2543. ', $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 />
  2544. (', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
  2545. </dd>';
  2546. }
  2547. // Select the time format!
  2548. function template_profile_timeformat_modify()
  2549. {
  2550. global $context, $modSettings, $txt, $scripturl, $settings;
  2551. echo '
  2552. <dt>
  2553. <strong>', $txt['time_format'], ':</strong><br />
  2554. <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>
  2555. <span class="smalltext">&nbsp;', $txt['date_format'], '</span>
  2556. </dt>
  2557. <dd>
  2558. <select name="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
  2559. // Help the user by showing a list of common time formats.
  2560. foreach ($context['easy_timeformats'] as $time_format)
  2561. echo '
  2562. <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected="selected"' : '', '>', $time_format['title'], '</option>';
  2563. echo '
  2564. </select><br />
  2565. <input type="text" name="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text" />
  2566. </dd>';
  2567. }
  2568. // Time offset?
  2569. function template_profile_timeoffset_modify()
  2570. {
  2571. global $txt, $context;
  2572. echo '
  2573. <dt>
  2574. <strong', (isset($context['modify_error']['bad_offset']) ? ' class="error"' : ''), '>', $txt['time_offset'], ':</strong><br />
  2575. <span class="smalltext">', $txt['personal_time_offset'], '</span>
  2576. </dt>
  2577. <dd>
  2578. <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>
  2579. </dd>';
  2580. }
  2581. // Theme?
  2582. function template_profile_theme_pick()
  2583. {
  2584. global $txt, $context, $scripturl;
  2585. echo '
  2586. <dt>
  2587. <strong>', $txt['current_theme'], ':</strong>
  2588. </dt>
  2589. <dd>
  2590. ', $context['member']['theme']['name'], ' <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>
  2591. </dd>';
  2592. }
  2593. // Smiley set picker.
  2594. function template_profile_smiley_pick()
  2595. {
  2596. global $txt, $context, $modSettings, $settings;
  2597. echo '
  2598. <dt>
  2599. <strong>', $txt['smileys_current'], ':</strong>
  2600. </dt>
  2601. <dd>
  2602. <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\';">';
  2603. foreach ($context['smiley_sets'] as $set)
  2604. echo '
  2605. <option value="', $set['id'], '"', $set['selected'] ? ' selected="selected"' : '', '>', $set['name'], '</option>';
  2606. echo '
  2607. </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;" />
  2608. </dd>';
  2609. }
  2610. // Change the way you login to the forum.
  2611. function template_authentication_method()
  2612. {
  2613. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  2614. // The main header!
  2615. echo '
  2616. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/register.js"></script>
  2617. <form action="', $scripturl, '?action=profile;area=authentication;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data">
  2618. <div class="cat_bar">
  2619. <h3 class="catbg">
  2620. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['authentication'], '</span>
  2621. </h3>
  2622. </div>
  2623. <p class="windowbg description">', $txt['change_authentication'], '</p>
  2624. <div class="windowbg2">
  2625. <span class="topslice"><span></span></span>
  2626. <div class="content">
  2627. <dl>
  2628. <dt>
  2629. <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 />
  2630. <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>
  2631. </dt>
  2632. <dd>
  2633. <dl id="auth_openid_div">
  2634. <dt>
  2635. <em>', $txt['authenticate_openid_url'], ':</em>
  2636. </dt>
  2637. <dd>
  2638. <input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', $context['member']['openid_uri'], '" class="input_text openid_login" />
  2639. </dd>
  2640. </dl>
  2641. <dl id="auth_pass_div">
  2642. <dt>
  2643. <em>', $txt['choose_pass'], ':</em>
  2644. </dt>
  2645. <dd>
  2646. <input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2647. <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>
  2648. </dd>
  2649. <dt>
  2650. <em>', $txt['verify_pass'], ':</em>
  2651. </dt>
  2652. <dd>
  2653. <input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2654. <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>
  2655. </dd>
  2656. </dl>
  2657. </dd>
  2658. </dl>';
  2659. if ($context['require_password'])
  2660. echo '
  2661. <hr width="100%" size="1" class="hrcolor clear" />
  2662. <dl>
  2663. <dt>
  2664. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2665. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2666. </dt>
  2667. <dd>
  2668. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2669. </dd>
  2670. </dl>';
  2671. echo '
  2672. <div class="righttext">';
  2673. if (!empty($context['token_check']))
  2674. echo '
  2675. <input type="hidden" name="', $context[$context['token_check'] . '_token_var'], '" value="', $context[$context['token_check'] . '_token'], '" />';
  2676. echo '
  2677. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2678. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2679. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2680. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2681. </div>
  2682. </div>
  2683. <span class="botslice"><span></span></span>
  2684. </div>
  2685. </form>';
  2686. // The password stuff.
  2687. echo '
  2688. <script type="text/javascript"><!-- // --><![CDATA[
  2689. var regTextStrings = {
  2690. "password_short": "', $txt['registration_password_short'], '",
  2691. "password_reserved": "', $txt['registration_password_reserved'], '",
  2692. "password_numbercase": "', $txt['registration_password_numbercase'], '",
  2693. "password_no_match": "', $txt['registration_password_no_match'], '",
  2694. "password_valid": "', $txt['registration_password_valid'], '"
  2695. };
  2696. var verificationHandle = new smfRegister("creator", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
  2697. var currentAuthMethod = \'passwd\';
  2698. function updateAuthMethod()
  2699. {
  2700. // What authentication method is being used?
  2701. if (!document.getElementById(\'auth_openid\') || !document.getElementById(\'auth_openid\').checked)
  2702. currentAuthMethod = \'passwd\';
  2703. else
  2704. currentAuthMethod = \'openid\';
  2705. // No openID?
  2706. if (!document.getElementById(\'auth_openid\'))
  2707. return true;
  2708. document.forms.creator.openid_url.disabled = currentAuthMethod == \'openid\' ? false : true;
  2709. document.forms.creator.smf_autov_pwmain.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2710. document.forms.creator.smf_autov_pwverify.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2711. document.getElementById(\'smf_autov_pwmain_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2712. document.getElementById(\'smf_autov_pwverify_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2713. if (currentAuthMethod == \'passwd\')
  2714. {
  2715. verificationHandle.refreshMainPassword();
  2716. verificationHandle.refreshVerifyPassword();
  2717. document.forms.creator.openid_url.style.backgroundColor = \'\';
  2718. document.getElementById("auth_openid_div").style.display = "none";
  2719. document.getElementById("auth_pass_div").style.display = "";
  2720. }
  2721. else
  2722. {
  2723. document.forms.creator.smf_autov_pwmain.style.backgroundColor = \'\';
  2724. document.forms.creator.smf_autov_pwverify.style.backgroundColor = \'\';
  2725. document.forms.creator.openid_url.style.backgroundColor = \'#FCE184\';
  2726. document.getElementById("auth_openid_div").style.display = "";
  2727. document.getElementById("auth_pass_div").style.display = "none";
  2728. }
  2729. }
  2730. updateAuthMethod();
  2731. // ]]></script>';
  2732. }
  2733. ?>