Profile.template.php 123 KB

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