Profile.template.php 125 KB

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