Profile.template.php 119 KB

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