Profile.template.php 123 KB

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