Profile.template.php 126 KB

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