Profile.template.php 121 KB

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