Profile.template.php 122 KB

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