2
0

Profile.template.php 117 KB

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