Profile.template.php 124 KB

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