Profile.template.php 127 KB

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