Profile.template.php 117 KB

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