Profile.template.php 124 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.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. // OneAll Social Login (https://docs.oneall.com/plugins/)
  1140. if (!empty ($modSettings['oasl_api_key']) && !empty ($modSettings['oasl_enabled_providers']))
  1141. {
  1142. if ( ! empty ($context['user']['is_owner']) && ! empty ($context['user']['id']))
  1143. {
  1144. global $boardurl, $sourcedir;
  1145. // Include the OneAll Toolbox.
  1146. require_once($sourcedir . '/OneallSocialLogin.sdk.php');
  1147. //Extract providers
  1148. $oasl_enabled_providers = explode (',', trim ($modSettings['oasl_enabled_providers']));
  1149. //User Token
  1150. $oasl_user_token = oneall_social_login_get_user_token_for_id_member($context['user']['id']);
  1151. //Random integer
  1152. $rand = mt_rand (99999, 9999999);
  1153. echo '
  1154. <hr width="100%" size="1" class="hrcolor clear" />
  1155. <dl id="oasl_social_link">
  1156. <dt>
  1157. <strong>'.$modSettings['oasl_settings_profile_caption'].'</strong><br />
  1158. <span class="smalltext">'.$modSettings['oasl_settings_profile_desc'].'</span>
  1159. </dt>
  1160. <dd>
  1161. <div class="oneall_social_login_providers" id="oneall_social_login_providers_'.$rand.'"></div>
  1162. <script type="text/javascript">
  1163. oneall.api.plugins.social_link.build("oneall_social_login_providers_'.$rand.'", {
  1164. "providers": [\''.implode ("', '", $oasl_enabled_providers).'\'],
  1165. "user_token": \''.$oasl_user_token.'\',
  1166. "callback_uri": \''.$boardurl.'/index.php?action=oasl_callback;oasl_source=profile;oasl_uid='.$context['user']['id'].'\'
  1167. });
  1168. </script>
  1169. <!-- OneAll.com / Social Login for SMF -->
  1170. </dd>
  1171. </dl>';
  1172. }
  1173. }
  1174. // Any closing HTML?
  1175. if (!empty($context['profile_posthtml']))
  1176. echo '
  1177. <div>', $context['profile_posthtml'], '</div>';
  1178. elseif ($lastItem != 'hr')
  1179. echo '
  1180. <hr width="100%" size="1" class="hrcolor clear" />';
  1181. // Only show the password box if it's actually needed.
  1182. if ($context['require_password'])
  1183. echo '
  1184. <dl>
  1185. <dt>
  1186. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  1187. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  1188. </dt>
  1189. <dd>
  1190. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  1191. </dd>
  1192. </dl>';
  1193. echo '
  1194. <div class="righttext">';
  1195. // The button shouldn't say "Change profile" unless we're changing the profile...
  1196. if (!empty($context['submit_button_text']))
  1197. echo '
  1198. <input type="submit" value="', $context['submit_button_text'], '" class="button_submit" />';
  1199. else
  1200. echo '
  1201. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />';
  1202. echo '
  1203. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1204. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1205. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1206. </div>
  1207. </div>
  1208. <span class="botslice"><span></span></span>
  1209. </div>
  1210. <br />
  1211. </form>';
  1212. // Some javascript!
  1213. echo '
  1214. <script type="text/javascript"><!-- // --><![CDATA[
  1215. function checkProfileSubmit()
  1216. {';
  1217. // If this part requires a password, make sure to give a warning.
  1218. if ($context['require_password'])
  1219. echo '
  1220. // Did you forget to type your password?
  1221. if (document.forms.creator.oldpasswrd.value == "")
  1222. {
  1223. alert("', $txt['required_security_reasons'], '");
  1224. return false;
  1225. }';
  1226. // Any onsubmit javascript?
  1227. if (!empty($context['profile_onsubmit_javascript']))
  1228. echo '
  1229. ', $context['profile_javascript'];
  1230. echo '
  1231. }';
  1232. // Any totally custom stuff?
  1233. if (!empty($context['profile_javascript']))
  1234. echo '
  1235. ', $context['profile_javascript'];
  1236. echo '
  1237. // ]]></script>';
  1238. // Any final spellchecking stuff?
  1239. if (!empty($context['show_spellchecking']))
  1240. echo '
  1241. <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>';
  1242. }
  1243. // Personal Message settings.
  1244. function template_profile_pm_settings()
  1245. {
  1246. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1247. echo '
  1248. <dt>
  1249. <label for="pm_prefs">', $txt['pm_display_mode'], ':</label>
  1250. </dt>
  1251. <dd>
  1252. <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'], '\');">
  1253. <option value="0"', $context['display_mode'] == 0 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_all'], '</option>
  1254. <option value="1"', $context['display_mode'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_one'], '</option>
  1255. <option value="2"', $context['display_mode'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_display_mode_linked'], '</option>
  1256. </select>
  1257. </dd>
  1258. <dt>
  1259. <label for="view_newest_pm_first">', $txt['recent_pms_at_top'], '</label>
  1260. </dt>
  1261. <dd>
  1262. <input type="hidden" name="default_options[view_newest_pm_first]" value="0" />
  1263. <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" />
  1264. </dd>
  1265. </dl>
  1266. <hr />
  1267. <dl>
  1268. <dt>
  1269. <label for="pm_receive_from">', $txt['pm_receive_from'], '</label>
  1270. </dt>
  1271. <dd>
  1272. <select name="pm_receive_from" id="pm_receive_from">
  1273. <option value="0"', empty($context['receive_from']) || (empty($modSettings['enable_buddylist']) && $context['receive_from'] < 3) ? ' selected="selected"' : '', '>', $txt['pm_receive_from_everyone'], '</option>';
  1274. if (!empty($modSettings['enable_buddylist']))
  1275. echo '
  1276. <option value="1"', !empty($context['receive_from']) && $context['receive_from'] == 1 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_ignore'], '</option>
  1277. <option value="2"', !empty($context['receive_from']) && $context['receive_from'] == 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_buddies'], '</option>';
  1278. echo '
  1279. <option value="3"', !empty($context['receive_from']) && $context['receive_from'] > 2 ? ' selected="selected"' : '', '>', $txt['pm_receive_from_admins'], '</option>
  1280. </select>
  1281. </dd>
  1282. <dt>
  1283. <label for="pm_email_notify">', $txt['email_notify'], '</label>
  1284. </dt>
  1285. <dd>
  1286. <select name="pm_email_notify" id="pm_email_notify">
  1287. <option value="0"', empty($context['send_email']) ? ' selected="selected"' : '', '>', $txt['email_notify_never'], '</option>
  1288. <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>';
  1289. if (!empty($modSettings['enable_buddylist']))
  1290. echo '
  1291. <option value="2"', !empty($context['send_email']) && $context['send_email'] > 1 ? ' selected="selected"' : '', '>', $txt['email_notify_buddies'], '</option>';
  1292. echo '
  1293. </select>
  1294. </dd>
  1295. <dt>
  1296. <label for="popup_messages">', $txt['popup_messages'], '</label>
  1297. </dt>
  1298. <dd>
  1299. <input type="hidden" name="default_options[popup_messages]" value="0" />
  1300. <input type="checkbox" name="default_options[popup_messages]" id="popup_messages" value="1"', !empty($context['member']['options']['popup_messages']) ? ' checked="checked"' : '', ' class="input_check" />
  1301. </dd>
  1302. </dl>
  1303. <hr />
  1304. <dl>
  1305. <dt>
  1306. <label for="copy_to_outbox"> ', $txt['copy_to_outbox'], '</label>
  1307. </dt>
  1308. <dd>
  1309. <input type="hidden" name="default_options[copy_to_outbox]" value="0" />
  1310. <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" />
  1311. </dd>
  1312. <dt>
  1313. <label for="pm_remove_inbox_label">', $txt['pm_remove_inbox_label'], '</label>
  1314. </dt>
  1315. <dd>
  1316. <input type="hidden" name="default_options[pm_remove_inbox_label]" value="0" />
  1317. <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" />
  1318. </dd>';
  1319. }
  1320. // Template for showing theme settings. Note: template_options() actually adds the theme specific options.
  1321. function template_profile_theme_settings()
  1322. {
  1323. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1324. echo '
  1325. <dd></dd>
  1326. </dl>
  1327. <ul id="theme_settings">
  1328. <li>
  1329. <input type="hidden" name="default_options[show_board_desc]" value="0" />
  1330. <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>
  1331. </li>
  1332. <li>
  1333. <input type="hidden" name="default_options[show_children]" value="0" />
  1334. <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>
  1335. </li>
  1336. <li>
  1337. <input type="hidden" name="default_options[use_sidebar_menu]" value="0" />
  1338. <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>
  1339. </li>
  1340. <li>
  1341. <input type="hidden" name="default_options[show_no_avatars]" value="0" />
  1342. <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>
  1343. </li>
  1344. <li>
  1345. <input type="hidden" name="default_options[show_no_signatures]" value="0" />
  1346. <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>
  1347. </li>';
  1348. if ($settings['allow_no_censored'])
  1349. echo '
  1350. <li>
  1351. <input type="hidden" name="default_options[show_no_censored]" value="0" />
  1352. <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>
  1353. </li>';
  1354. echo '
  1355. <li>
  1356. <input type="hidden" name="default_options[return_to_post]" value="0" />
  1357. <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>
  1358. </li>
  1359. <li>
  1360. <input type="hidden" name="default_options[no_new_reply_warning]" value="0" />
  1361. <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>
  1362. </li>';
  1363. if (!empty($modSettings['enable_buddylist']))
  1364. echo '
  1365. <li>
  1366. <input type="hidden" name="default_options[posts_apply_ignore_list]" value="0" />
  1367. <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>
  1368. </li>';
  1369. echo '
  1370. <li>
  1371. <input type="hidden" name="default_options[view_newest_first]" value="0" />
  1372. <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>
  1373. </li>';
  1374. // Choose WYSIWYG settings?
  1375. if (empty($modSettings['disable_wysiwyg']))
  1376. echo '
  1377. <li>
  1378. <input type="hidden" name="default_options[wysiwyg_default]" value="0" />
  1379. <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>
  1380. </li>';
  1381. if (empty($modSettings['disableCustomPerPage']))
  1382. {
  1383. echo '
  1384. <li>
  1385. <label for="topics_per_page">', $txt['topics_per_page'], '</label>
  1386. <select name="default_options[topics_per_page]" id="topics_per_page">
  1387. <option value="0"', empty($context['member']['options']['topics_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxTopics'], ')</option>
  1388. <option value="5"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1389. <option value="10"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1390. <option value="25"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1391. <option value="50"', !empty($context['member']['options']['topics_per_page']) && $context['member']['options']['topics_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1392. </select>
  1393. </li>
  1394. <li>
  1395. <label for="messages_per_page">', $txt['messages_per_page'], '</label>
  1396. <select name="default_options[messages_per_page]" id="messages_per_page">
  1397. <option value="0"', empty($context['member']['options']['messages_per_page']) ? ' selected="selected"' : '', '>', $txt['per_page_default'], ' (', $modSettings['defaultMaxMessages'], ')</option>
  1398. <option value="5"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 5 ? ' selected="selected"' : '', '>5</option>
  1399. <option value="10"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 10 ? ' selected="selected"' : '', '>10</option>
  1400. <option value="25"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 25 ? ' selected="selected"' : '', '>25</option>
  1401. <option value="50"', !empty($context['member']['options']['messages_per_page']) && $context['member']['options']['messages_per_page'] == 50 ? ' selected="selected"' : '', '>50</option>
  1402. </select>
  1403. </li>';
  1404. }
  1405. if (!empty($modSettings['cal_enabled']))
  1406. echo '
  1407. <li>
  1408. <label for="calendar_start_day">', $txt['calendar_start_day'], ':</label>
  1409. <select name="default_options[calendar_start_day]" id="calendar_start_day">
  1410. <option value="0"', empty($context['member']['options']['calendar_start_day']) ? ' selected="selected"' : '', '>', $txt['days'][0], '</option>
  1411. <option value="1"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 1 ? ' selected="selected"' : '', '>', $txt['days'][1], '</option>
  1412. <option value="6"', !empty($context['member']['options']['calendar_start_day']) && $context['member']['options']['calendar_start_day'] == 6 ? ' selected="selected"' : '', '>', $txt['days'][6], '</option>
  1413. </select>
  1414. </li>';
  1415. echo '
  1416. <li>
  1417. <label for="display_quick_reply">', $txt['display_quick_reply'], '</label>
  1418. <select name="default_options[display_quick_reply]" id="display_quick_reply">
  1419. <option value="0"', empty($context['member']['options']['display_quick_reply']) ? ' selected="selected"' : '', '>', $txt['display_quick_reply1'], '</option>
  1420. <option value="1"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 1 ? ' selected="selected"' : '', '>', $txt['display_quick_reply2'], '</option>
  1421. <option value="2"', !empty($context['member']['options']['display_quick_reply']) && $context['member']['options']['display_quick_reply'] == 2 ? ' selected="selected"' : '', '>', $txt['display_quick_reply3'], '</option>
  1422. </select>
  1423. </li>
  1424. <li>
  1425. <label for="display_quick_mod">', $txt['display_quick_mod'], '</label>
  1426. <select name="default_options[display_quick_mod]" id="display_quick_mod">
  1427. <option value="0"', empty($context['member']['options']['display_quick_mod']) ? ' selected="selected"' : '', '>', $txt['display_quick_mod_none'], '</option>
  1428. <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>
  1429. <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>
  1430. </select>
  1431. </li>
  1432. </ul>
  1433. <dl>
  1434. <dd></dd>';
  1435. }
  1436. function template_notification()
  1437. {
  1438. global $context, $settings, $options, $txt, $scripturl, $modSettings;
  1439. // The main containing header.
  1440. echo '
  1441. <div class="cat_bar">
  1442. <h3 class="catbg">
  1443. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1444. </h3>
  1445. </div>
  1446. <p class="windowbg description">', $txt['notification_info'], '</p>
  1447. <div class="windowbg2">
  1448. <span class="topslice"><span></span></span>
  1449. <div class="content">
  1450. <form action="', $scripturl, '?action=profile;area=notification;save" method="post" accept-charset="', $context['character_set'], '" id="notify_options" class="flow_hidden">';
  1451. // Allow notification on announcements to be disabled?
  1452. if (!empty($modSettings['allow_disableAnnounce']))
  1453. echo '
  1454. <input type="hidden" name="notify_announcements" value="0" />
  1455. <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 />';
  1456. // More notification options.
  1457. echo '
  1458. <input type="hidden" name="default_options[auto_notify]" value="0" />
  1459. <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 />';
  1460. if (empty($modSettings['disallow_sendBody']))
  1461. echo '
  1462. <input type="hidden" name="notify_send_body" value="0" />
  1463. <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 />';
  1464. echo '
  1465. <br />
  1466. <label for="notify_regularity">', $txt['notify_regularity'], ':</label>
  1467. <select name="notify_regularity" id="notify_regularity">
  1468. <option value="0"', $context['member']['notify_regularity'] == 0 ? ' selected="selected"' : '', '>', $txt['notify_regularity_instant'], '</option>
  1469. <option value="1"', $context['member']['notify_regularity'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_regularity_first_only'], '</option>
  1470. <option value="2"', $context['member']['notify_regularity'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_regularity_daily'], '</option>
  1471. <option value="3"', $context['member']['notify_regularity'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_regularity_weekly'], '</option>
  1472. </select>
  1473. <br /><br />
  1474. <label for="notify_types">', $txt['notify_send_types'], ':</label>
  1475. <select name="notify_types" id="notify_types">
  1476. <option value="1"', $context['member']['notify_types'] == 1 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything'], '</option>
  1477. <option value="2"', $context['member']['notify_types'] == 2 ? ' selected="selected"' : '', '>', $txt['notify_send_type_everything_own'], '</option>
  1478. <option value="3"', $context['member']['notify_types'] == 3 ? ' selected="selected"' : '', '>', $txt['notify_send_type_only_replies'], '</option>
  1479. <option value="4"', $context['member']['notify_types'] == 4 ? ' selected="selected"' : '', '>', $txt['notify_send_type_nothing'], '</option>
  1480. </select><br class="clear" />
  1481. <div>
  1482. <input id="notify_submit" type="submit" value="', $txt['notify_save'], '" class="button_submit floatright" />
  1483. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1484. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1485. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  1486. </div><br class="clear" />
  1487. </form>
  1488. </div>
  1489. <span class="botslice"><span></span></span>
  1490. </div>
  1491. <br />';
  1492. template_show_list('topic_notification_list');
  1493. echo '
  1494. <br />';
  1495. template_show_list('board_notification_list');
  1496. }
  1497. // Template for choosing group membership.
  1498. function template_groupMembership()
  1499. {
  1500. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1501. // The main containing header.
  1502. echo '
  1503. <form action="', $scripturl, '?action=profile;area=groupmembership;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1504. <div class="cat_bar">
  1505. <h3 class="catbg">
  1506. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1507. </h3>
  1508. </div>
  1509. <p class="description">', $txt['groupMembership_info'], '</p>';
  1510. // Do we have an update message?
  1511. if (!empty($context['update_message']))
  1512. echo '
  1513. <div id="profile_success">
  1514. ', $context['update_message'], '.
  1515. </div>';
  1516. // Requesting membership to a group?
  1517. if (!empty($context['group_request']))
  1518. {
  1519. echo '
  1520. <div class="groupmembership">
  1521. <div class="cat_bar">
  1522. <h3 class="catbg">', $txt['request_group_membership'], '</h3>
  1523. </div>
  1524. <span class="upperframe"><span></span></span>
  1525. <div class="roundframe"><div class="innerframe">
  1526. ', $txt['request_group_membership_desc'], ':
  1527. <textarea name="reason" rows="4" style="' . ($context['browser']['is_ie8'] ? 'width: 635px; max-width: 99%; min-width: 99%' : 'width: 99%') . ';"></textarea>
  1528. <div class="righttext" style="margin: 0.5em 0.5% 0 0.5%;">
  1529. <input type="hidden" name="gid" value="', $context['group_request']['id'], '" />
  1530. <input type="submit" name="req" value="', $txt['submit_request'], '" class="button_submit" />
  1531. </div>
  1532. </div></div>
  1533. <span class="lowerframe"><span></span></span>
  1534. </div>';
  1535. }
  1536. else
  1537. {
  1538. echo '
  1539. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1540. <thead>
  1541. <tr class="catbg">
  1542. <th class="first_th" scope="col" ', $context['can_edit_primary'] ? ' colspan="2"' : '', '>', $txt['current_membergroups'], '</th>
  1543. <th class="last_th" scope="col"></th>
  1544. </tr>
  1545. </thead>
  1546. <tbody>';
  1547. $alternate = true;
  1548. foreach ($context['groups']['member'] as $group)
  1549. {
  1550. echo '
  1551. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '" id="primdiv_', $group['id'], '">';
  1552. if ($context['can_edit_primary'])
  1553. echo '
  1554. <td width="4%">
  1555. <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" />
  1556. </td>';
  1557. echo '
  1558. <td>
  1559. <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>
  1560. </td>
  1561. <td width="15%" class="righttext">';
  1562. // Can they leave their group?
  1563. if ($group['can_leave'])
  1564. echo '
  1565. <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>';
  1566. echo '
  1567. </td>
  1568. </tr>';
  1569. $alternate = !$alternate;
  1570. }
  1571. echo '
  1572. </tbody>
  1573. </table>';
  1574. if ($context['can_edit_primary'])
  1575. echo '
  1576. <div class="padding righttext">
  1577. <input type="submit" value="', $txt['make_primary'], '" class="button_submit" />
  1578. </div>';
  1579. // Any groups they can join?
  1580. if (!empty($context['groups']['available']))
  1581. {
  1582. echo '
  1583. <br />
  1584. <table border="0" width="100%" cellspacing="0" cellpadding="4" class="table_grid">
  1585. <thead>
  1586. <tr class="catbg">
  1587. <th class="first_th" scope="col">
  1588. ', $txt['available_groups'], '
  1589. </th>
  1590. <th class="last_th" scope="col"></th>
  1591. </tr>
  1592. </thead>
  1593. <tbody>';
  1594. $alternate = true;
  1595. foreach ($context['groups']['available'] as $group)
  1596. {
  1597. echo '
  1598. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  1599. <td>
  1600. <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>' : ''), '
  1601. </td>
  1602. <td width="15%" class="lefttext">';
  1603. if ($group['type'] == 3)
  1604. echo '
  1605. <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>';
  1606. elseif ($group['type'] == 2 && $group['pending'])
  1607. echo '
  1608. ', $txt['approval_pending'];
  1609. elseif ($group['type'] == 2)
  1610. echo '
  1611. <a href="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=groupmembership;request=', $group['id'], '">', $txt['request_group'], '</a>';
  1612. echo '
  1613. </td>
  1614. </tr>';
  1615. $alternate = !$alternate;
  1616. }
  1617. echo '
  1618. </tbody>
  1619. </table>';
  1620. }
  1621. // Javascript for the selector stuff.
  1622. echo '
  1623. <script type="text/javascript"><!-- // --><![CDATA[
  1624. var prevClass = "";
  1625. var prevDiv = "";
  1626. function highlightSelected(box)
  1627. {
  1628. if (prevClass != "")
  1629. {
  1630. prevDiv.className = prevClass;
  1631. }
  1632. prevDiv = document.getElementById(box);
  1633. prevClass = prevDiv.className;
  1634. prevDiv.className = "highlight2";
  1635. }';
  1636. if (isset($context['groups']['member'][$context['primary_group']]))
  1637. echo '
  1638. highlightSelected("primdiv_' . $context['primary_group'] . '");';
  1639. echo '
  1640. // ]]></script>';
  1641. }
  1642. echo '
  1643. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1644. <input type="hidden" name="u" value="', $context['id_member'], '" />
  1645. </form>';
  1646. }
  1647. function template_ignoreboards()
  1648. {
  1649. global $context, $txt, $settings, $scripturl;
  1650. // The main containing header.
  1651. echo '
  1652. <script type="text/javascript"><!-- // --><![CDATA[
  1653. function selectBoards(ids)
  1654. {
  1655. var toggle = true;
  1656. for (i = 0; i < ids.length; i++)
  1657. toggle = toggle & document.forms.creator["ignore_brd" + ids[i]].checked;
  1658. for (i = 0; i < ids.length; i++)
  1659. document.forms.creator["ignore_brd" + ids[i]].checked = !toggle;
  1660. }
  1661. // ]]></script>
  1662. <form action="', $scripturl, '?action=profile;area=ignoreboards;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  1663. <div class="cat_bar">
  1664. <h3 class="catbg">
  1665. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['profile'], '</span>
  1666. </h3>
  1667. </div>
  1668. <p class="description">', $txt['ignoreboards_info'], '</p>
  1669. <div class="windowbg2">
  1670. <span class="topslice"><span></span></span>
  1671. <div class="content flow_hidden">
  1672. <ul class="ignoreboards floatleft">';
  1673. $i = 0;
  1674. $limit = ceil($context['num_boards'] / 2);
  1675. foreach ($context['categories'] as $category)
  1676. {
  1677. if ($i == $limit)
  1678. {
  1679. echo '
  1680. </ul>
  1681. <ul class="ignoreboards floatright">';
  1682. $i++;
  1683. }
  1684. echo '
  1685. <li class="category">
  1686. <a href="javascript:void(0);" onclick="selectBoards([', implode(', ', $category['child_ids']), ']); return false;">', $category['name'], '</a>
  1687. <ul>';
  1688. foreach ($category['boards'] as $board)
  1689. {
  1690. if ($i == $limit)
  1691. echo '
  1692. </ul>
  1693. </li>
  1694. </ul>
  1695. <ul class="ignoreboards floatright">
  1696. <li class="category">
  1697. <ul>';
  1698. echo '
  1699. <li class="board" style="margin-', $context['right_to_left'] ? 'right' : 'left', ': ', $board['child_level'], 'em;">
  1700. <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>
  1701. </li>';
  1702. $i++;
  1703. }
  1704. echo '
  1705. </ul>
  1706. </li>';
  1707. }
  1708. echo '
  1709. </ul>
  1710. <br class="clear" />';
  1711. // Show the standard "Save Settings" profile button.
  1712. template_profile_save();
  1713. echo '
  1714. </div>
  1715. <span class="botslice"><span></span></span>
  1716. </div>
  1717. </form>
  1718. <br />';
  1719. }
  1720. // Simple load some theme variables common to several warning templates.
  1721. function template_load_warning_variables()
  1722. {
  1723. global $modSettings, $context;
  1724. $context['warningBarWidth'] = 200;
  1725. // Setup the colors - this is a little messy for theming.
  1726. $context['colors'] = array(
  1727. 0 => 'green',
  1728. $modSettings['warning_watch'] => 'darkgreen',
  1729. $modSettings['warning_moderate'] => 'orange',
  1730. $modSettings['warning_mute'] => 'red',
  1731. );
  1732. // Work out the starting color.
  1733. $context['current_color'] = $context['colors'][0];
  1734. foreach ($context['colors'] as $limit => $color)
  1735. if ($context['member']['warning'] >= $limit)
  1736. $context['current_color'] = $color;
  1737. }
  1738. // Show all warnings of a user?
  1739. function template_viewWarning()
  1740. {
  1741. global $context, $txt, $scripturl, $settings;
  1742. template_load_warning_variables();
  1743. echo '
  1744. <div class="title_bar">
  1745. <h3 class="titlebg">
  1746. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />
  1747. ', sprintf($txt['profile_viewwarning_for_user'], $context['member']['name']), '
  1748. </span>
  1749. </h3>
  1750. </div>
  1751. <div class="windowbg">
  1752. <span class="topslice"><span></span></span>
  1753. <div class="content">
  1754. <dl class="settings">
  1755. <dt>
  1756. <strong>', $txt['profile_warning_name'], ':</strong>
  1757. </dt>
  1758. <dd>
  1759. ', $context['member']['name'], '
  1760. </dd>
  1761. <dt>
  1762. <strong>', $txt['profile_warning_level'], ':</strong>
  1763. </dt>
  1764. <dd>
  1765. <div>
  1766. <div>
  1767. <div style="font-size: 8pt; height: 12pt; width: ', $context['warningBarWidth'], 'px; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  1768. <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>
  1769. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1770. </div>
  1771. </div>
  1772. </div>
  1773. </dd>';
  1774. // There's some impact of this?
  1775. if (!empty($context['level_effects'][$context['current_level']]))
  1776. echo '
  1777. <dt>
  1778. <strong>', $txt['profile_viewwarning_impact'], ':</strong>
  1779. </dt>
  1780. <dd>
  1781. ', $context['level_effects'][$context['current_level']], '
  1782. </dd>';
  1783. echo '
  1784. </dl>
  1785. </div>
  1786. <span class="botslice"><span></span></span>
  1787. </div>';
  1788. template_show_list('view_warnings');
  1789. }
  1790. // Show a lovely interface for issuing warnings.
  1791. function template_issueWarning()
  1792. {
  1793. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  1794. template_load_warning_variables();
  1795. echo '
  1796. <script type="text/javascript"><!-- // --><![CDATA[
  1797. function setWarningBarPos(curEvent, isMove, changeAmount)
  1798. {
  1799. barWidth = ', $context['warningBarWidth'], ';
  1800. // Are we passing the amount to change it by?
  1801. if (changeAmount)
  1802. {
  1803. if (document.getElementById(\'warning_level\').value == \'SAME\')
  1804. percent = ', $context['member']['warning'], ' + changeAmount;
  1805. else
  1806. percent = parseInt(document.getElementById(\'warning_level\').value) + changeAmount;
  1807. }
  1808. // If not then it\'s a mouse thing.
  1809. else
  1810. {
  1811. if (!curEvent)
  1812. var curEvent = window.event;
  1813. // If it\'s a movement check the button state first!
  1814. if (isMove)
  1815. {
  1816. if (!curEvent.button || curEvent.button != 1)
  1817. return false
  1818. }
  1819. // Get the position of the container.
  1820. contain = document.getElementById(\'warning_contain\');
  1821. position = 0;
  1822. while (contain != null)
  1823. {
  1824. position += contain.offsetLeft;
  1825. contain = contain.offsetParent;
  1826. }
  1827. // Where is the mouse?
  1828. if (curEvent.pageX)
  1829. {
  1830. mouse = curEvent.pageX;
  1831. }
  1832. else
  1833. {
  1834. mouse = curEvent.clientX;
  1835. mouse += document.documentElement.scrollLeft != "undefined" ? document.documentElement.scrollLeft : document.body.scrollLeft;
  1836. }
  1837. // Is this within bounds?
  1838. if (mouse < position || mouse > position + barWidth)
  1839. return;
  1840. percent = Math.round(((mouse - position) / barWidth) * 100);
  1841. // Round percent to the nearest 5 - by kinda cheating!
  1842. percent = Math.round(percent / 5) * 5;
  1843. }
  1844. // What are the limits?
  1845. minLimit = ', $context['min_allowed'], ';
  1846. maxLimit = ', $context['max_allowed'], ';
  1847. percent = Math.max(percent, minLimit);
  1848. percent = Math.min(percent, maxLimit);
  1849. size = barWidth * (percent/100);
  1850. setInnerHTML(document.getElementById(\'warning_text\'), percent + "%");
  1851. document.getElementById(\'warning_level\').value = percent;
  1852. document.getElementById(\'warning_progress\').style.width = size + "px";
  1853. // Get the right color.
  1854. color = "black"';
  1855. foreach ($context['colors'] as $limit => $color)
  1856. echo '
  1857. if (percent >= ', $limit, ')
  1858. color = "', $color, '";';
  1859. echo '
  1860. document.getElementById(\'warning_progress\').style.backgroundColor = color;
  1861. // Also set the right effect.
  1862. effectText = "";';
  1863. foreach ($context['level_effects'] as $limit => $text)
  1864. echo '
  1865. if (percent >= ', $limit, ')
  1866. effectText = "', $text, '";';
  1867. echo '
  1868. setInnerHTML(document.getElementById(\'cur_level_div\'), effectText);
  1869. }
  1870. // Disable notification boxes as required.
  1871. function modifyWarnNotify()
  1872. {
  1873. disable = !document.getElementById(\'warn_notify\').checked;
  1874. document.getElementById(\'warn_sub\').disabled = disable;
  1875. document.getElementById(\'warn_body\').disabled = disable;
  1876. document.getElementById(\'warn_temp\').disabled = disable;
  1877. document.getElementById(\'new_template_link\').style.display = disable ? \'none\' : \'\';
  1878. }
  1879. function changeWarnLevel(amount)
  1880. {
  1881. setWarningBarPos(false, false, amount);
  1882. }
  1883. // Warn template.
  1884. function populateNotifyTemplate()
  1885. {
  1886. index = document.getElementById(\'warn_temp\').value;
  1887. if (index == -1)
  1888. return false;
  1889. // Otherwise see what we can do...';
  1890. foreach ($context['notification_templates'] as $k => $type)
  1891. echo '
  1892. if (index == ', $k, ')
  1893. document.getElementById(\'warn_body\').value = "', strtr($type['body'], array('"' => "'", "\n" => '\\n', "\r" => '')), '";';
  1894. echo '
  1895. }
  1896. // ]]></script>';
  1897. echo '
  1898. <form action="', $scripturl, '?action=profile;u=', $context['id_member'], ';area=issuewarning" method="post" class="flow_hidden" accept-charset="', $context['character_set'], '">
  1899. <div class="cat_bar">
  1900. <h3 class="catbg">
  1901. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />
  1902. ', $context['user']['is_owner'] ? $txt['profile_warning_level'] : $txt['profile_issue_warning'], '
  1903. </span>
  1904. </h3>
  1905. </div>';
  1906. if (!$context['user']['is_owner'])
  1907. echo '
  1908. <p class="description">', $txt['profile_warning_desc'], '</p>';
  1909. echo '
  1910. <div class="windowbg">
  1911. <span class="topslice"><span></span></span>
  1912. <div class="content">
  1913. <dl class="settings">';
  1914. if (!$context['user']['is_owner'])
  1915. echo '
  1916. <dt>
  1917. <strong>', $txt['profile_warning_name'], ':</strong>
  1918. </dt>
  1919. <dd>
  1920. <strong>', $context['member']['name'], '</strong>
  1921. </dd>';
  1922. echo '
  1923. <dt>
  1924. <strong>', $txt['profile_warning_level'], ':</strong>';
  1925. // Is there only so much they can apply?
  1926. if ($context['warning_limit'])
  1927. echo '
  1928. <br /><span class="smalltext">', sprintf($txt['profile_warning_limit_attribute'], $context['warning_limit']), '</span>';
  1929. echo '
  1930. </dt>
  1931. <dd>
  1932. <div id="warndiv1" style="display: none;">
  1933. <div>
  1934. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(-5); return false;">[-]</a></span>
  1935. <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);">
  1936. <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>
  1937. <div id="warning_progress" style="width: ', $context['member']['warning'], '%; height: 12pt; z-index: 1; background-color: ', $context['current_color'], ';">&nbsp;</div>
  1938. </div>
  1939. <span class="floatleft" style="padding: 0 0.5em"><a href="#" onclick="changeWarnLevel(5); return false;">[+]</a></span>
  1940. <div class="clear_left smalltext">', $txt['profile_warning_impact'], ': <span id="cur_level_div">', $context['level_effects'][$context['current_level']], '</span></div>
  1941. </div>
  1942. <input type="hidden" name="warning_level" id="warning_level" value="SAME" />
  1943. </div>
  1944. <div id="warndiv2">
  1945. <input type="text" name="warning_level_nojs" size="6" maxlength="4" value="', $context['member']['warning'], '" class="input_text" />&nbsp;', $txt['profile_warning_max'], '
  1946. <div class="smalltext">', $txt['profile_warning_impact'], ':<br />';
  1947. // For non-javascript give a better list.
  1948. foreach ($context['level_effects'] as $limit => $effect)
  1949. echo '
  1950. ', sprintf($txt['profile_warning_effect_text'], $limit, $effect), '<br />';
  1951. echo '
  1952. </div>
  1953. </div>
  1954. </dd>';
  1955. if (!$context['user']['is_owner'])
  1956. {
  1957. echo '
  1958. <dt>
  1959. <strong>', $txt['profile_warning_reason'], ':</strong><br />
  1960. <span class="smalltext">', $txt['profile_warning_reason_desc'], '</span>
  1961. </dt>
  1962. <dd>
  1963. <input type="text" name="warn_reason" id="warn_reason" value="', $context['warning_data']['reason'], '" size="50" style="width: 80%;" class="input_text" />
  1964. </dd>
  1965. </dl>
  1966. <hr />
  1967. <dl class="settings">
  1968. <dt>
  1969. <strong>', $txt['profile_warning_notify'], ':</strong>
  1970. </dt>
  1971. <dd>
  1972. <input type="checkbox" name="warn_notify" id="warn_notify" onclick="modifyWarnNotify();" ', $context['warning_data']['notify'] ? 'checked="checked"' : '', ' class="input_check" />
  1973. </dd>
  1974. <dt>
  1975. <strong>', $txt['profile_warning_notify_subject'], ':</strong>
  1976. </dt>
  1977. <dd>
  1978. <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" />
  1979. </dd>
  1980. <dt>
  1981. <strong>', $txt['profile_warning_notify_body'], ':</strong>
  1982. </dt>
  1983. <dd>
  1984. <select name="warn_temp" id="warn_temp" disabled="disabled" onchange="populateNotifyTemplate();" style="font-size: x-small;">
  1985. <option value="-1">', $txt['profile_warning_notify_template'], '</option>
  1986. <option value="-1">------------------------------</option>';
  1987. foreach ($context['notification_templates'] as $id_template => $template)
  1988. echo '
  1989. <option value="', $id_template, '">', $template['title'], '</option>';
  1990. echo '
  1991. </select>
  1992. <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 />
  1993. <textarea name="warn_body" id="warn_body" cols="40" rows="8">', $context['warning_data']['notify_body'], '</textarea>
  1994. </dd>';
  1995. }
  1996. echo '
  1997. </dl>
  1998. <div class="righttext">
  1999. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2000. <input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" />
  2001. </div>
  2002. </div>
  2003. <span class="botslice"><span></span></span>
  2004. </div>
  2005. </form>';
  2006. // Previous warnings?
  2007. echo '<br />
  2008. <div class="cat_bar">
  2009. <h3 class="catbg">
  2010. ', $txt['profile_warning_previous'], '
  2011. </h3>
  2012. </div>
  2013. <table border="0" width="100%" cellspacing="0" cellpadding="5" class="table_grid">
  2014. <thead>
  2015. <tr class="titlebg lefttext">
  2016. <th class="first_th" scope="col" width="20%">', $txt['profile_warning_previous_issued'], '</th>
  2017. <th scope="col" width="30%">', $txt['profile_warning_previous_time'], '</th>
  2018. <th scope="col">', $txt['profile_warning_previous_reason'], '</th>
  2019. <th class="last_th" scope="col" width="6%">', $txt['profile_warning_previous_level'], '</th>
  2020. </tr>
  2021. </thead>
  2022. <tbody>';
  2023. // Print the warnings.
  2024. $alternate = 0;
  2025. foreach ($context['previous_warnings'] as $warning)
  2026. {
  2027. $alternate = !$alternate;
  2028. echo '
  2029. <tr class="', $alternate ? 'windowbg' : 'windowbg2', '">
  2030. <td class="smalltext">', $warning['issuer']['link'], '</td>
  2031. <td class="smalltext">', $warning['time'], '</td>
  2032. <td class="smalltext">
  2033. <div class="floatleft">
  2034. ', $warning['reason'], '
  2035. </div>';
  2036. if (!empty($warning['id_notice']))
  2037. echo '
  2038. <div class="floatright">
  2039. <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>
  2040. </div>';
  2041. echo '
  2042. </td>
  2043. <td class="smalltext">', $warning['counter'], '</td>
  2044. </tr>';
  2045. }
  2046. if (empty($context['previous_warnings']))
  2047. echo '
  2048. <tr class="windowbg2">
  2049. <td align="center" colspan="4">
  2050. ', $txt['profile_warning_previous_none'], '
  2051. </td>
  2052. </tr>';
  2053. echo '
  2054. </tbody>
  2055. </table>
  2056. <div class="pagesection">', $txt['pages'], ': ', $context['page_index'], '</div>';
  2057. // Do our best to get pretty javascript enabled.
  2058. echo '
  2059. <script type="text/javascript"><!-- // --><![CDATA[
  2060. document.getElementById(\'warndiv1\').style.display = "";
  2061. document.getElementById(\'warndiv2\').style.display = "none";';
  2062. if (!$context['user']['is_owner'])
  2063. echo '
  2064. modifyWarnNotify();';
  2065. echo '
  2066. // ]]></script>';
  2067. }
  2068. // Template to show for deleting a users account - now with added delete post capability!
  2069. function template_deleteAccount()
  2070. {
  2071. global $context, $settings, $options, $scripturl, $txt, $scripturl;
  2072. // The main containing header.
  2073. echo '
  2074. <form action="', $scripturl, '?action=profile;area=deleteaccount;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator">
  2075. <div class="title_bar">
  2076. <h3 class="titlebg">
  2077. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['deleteAccount'], '</span>
  2078. </h3>
  2079. </div>';
  2080. // If deleting another account give them a lovely info box.
  2081. if (!$context['user']['is_owner'])
  2082. echo '
  2083. <p class="windowbg2 description">', $txt['deleteAccount_desc'], '</p>';
  2084. echo '
  2085. <div class="windowbg2">
  2086. <span class="topslice"><span></span></span>
  2087. <div class="content">';
  2088. // If they are deleting their account AND the admin needs to approve it - give them another piece of info ;)
  2089. if ($context['needs_approval'])
  2090. echo '
  2091. <div id ="profile_error" class="alert">', $txt['deleteAccount_approval'], '</div>';
  2092. // If the user is deleting their own account warn them first - and require a password!
  2093. if ($context['user']['is_owner'])
  2094. {
  2095. echo '
  2096. <div class="alert">', $txt['own_profile_confirm'], '</div>
  2097. <div>
  2098. <strong', (isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : ''), '>', $txt['current_password'], ': </strong>
  2099. <input type="password" name="oldpasswrd" size="20" class="input_password" />&nbsp;&nbsp;&nbsp;&nbsp;
  2100. <input type="submit" value="', $txt['yes'], '" class="button_submit" />
  2101. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2102. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2103. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2104. </div>';
  2105. }
  2106. // Otherwise an admin doesn't need to enter a password - but they still get a warning - plus the option to delete lovely posts!
  2107. else
  2108. {
  2109. echo '
  2110. <div class="alert">', $txt['deleteAccount_warning'], '</div>';
  2111. // Only actually give these options if they are kind of important.
  2112. if ($context['can_delete_posts'])
  2113. echo '
  2114. <div>
  2115. ', $txt['deleteAccount_posts'], ':
  2116. <select name="remove_type">
  2117. <option value="none">', $txt['deleteAccount_none'], '</option>
  2118. <option value="posts">', $txt['deleteAccount_all_posts'], '</option>
  2119. <option value="topics">', $txt['deleteAccount_topics'], '</option>
  2120. </select>
  2121. </div>';
  2122. echo '
  2123. <div>
  2124. <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>
  2125. </div>
  2126. <div>
  2127. <input type="submit" value="', $txt['delete'], '" class="button_submit" />
  2128. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2129. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2130. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2131. </div>';
  2132. }
  2133. echo '
  2134. </div>
  2135. <span class="botslice"><span></span></span>
  2136. </div>
  2137. <br />
  2138. </form>';
  2139. }
  2140. // Template for the password box/save button stuck at the bottom of every profile page.
  2141. function template_profile_save()
  2142. {
  2143. global $context, $settings, $options, $txt;
  2144. echo '
  2145. <hr width="100%" size="1" class="hrcolor clear" />';
  2146. // Only show the password box if it's actually needed.
  2147. if ($context['require_password'])
  2148. echo '
  2149. <dl>
  2150. <dt>
  2151. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2152. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2153. </dt>
  2154. <dd>
  2155. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2156. </dd>
  2157. </dl>';
  2158. echo '
  2159. <div class="righttext">
  2160. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2161. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2162. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2163. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2164. </div>';
  2165. }
  2166. // Small template for showing an error message upon a save problem in the profile.
  2167. function template_error_message()
  2168. {
  2169. global $context, $txt;
  2170. echo '
  2171. <div class="windowbg" id="profile_error">
  2172. <span>', !empty($context['custom_error_title']) ? $context['custom_error_title'] : $txt['profile_errors_occurred'], ':</span>
  2173. <ul class="reset">';
  2174. // Cycle through each error and display an error message.
  2175. foreach ($context['post_errors'] as $error)
  2176. echo '
  2177. <li>', isset($txt['profile_error_' . $error]) ? $txt['profile_error_' . $error] : $error, '.</li>';
  2178. echo '
  2179. </ul>
  2180. </div>';
  2181. }
  2182. // Display a load of drop down selectors for allowing the user to change group.
  2183. function template_profile_group_manage()
  2184. {
  2185. global $context, $txt, $scripturl;
  2186. echo '
  2187. <dt>
  2188. <strong>', $txt['primary_membergroup'], ': </strong><br />
  2189. <span class="smalltext">(<a href="', $scripturl, '?action=helpadmin;help=moderator_why_missing" onclick="return reqWin(this.href);">', $txt['moderator_why_missing'], '</a>)</span>
  2190. </dt>
  2191. <dd>
  2192. <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;"' : ''), '>';
  2193. // Fill the select box with all primary member groups that can be assigned to a member.
  2194. foreach ($context['member_groups'] as $member_group)
  2195. if (!empty($member_group['can_be_primary']))
  2196. echo '
  2197. <option value="', $member_group['id'], '"', $member_group['is_primary'] ? ' selected="selected"' : '', '>
  2198. ', $member_group['name'], '
  2199. </option>';
  2200. echo '
  2201. </select>
  2202. </dd>
  2203. <dt>
  2204. <strong>', $txt['additional_membergroups'], ':</strong>
  2205. </dt>
  2206. <dd>
  2207. <span id="additional_groupsList">
  2208. <input type="hidden" name="additional_groups[]" value="0" />';
  2209. // For each membergroup show a checkbox so members can be assigned to more than one group.
  2210. foreach ($context['member_groups'] as $member_group)
  2211. if ($member_group['can_be_additional'])
  2212. echo '
  2213. <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 />';
  2214. echo '
  2215. </span>
  2216. <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>
  2217. <script type="text/javascript"><!-- // --><![CDATA[
  2218. document.getElementById("additional_groupsList").style.display = "none";
  2219. document.getElementById("additional_groupsLink").style.display = "";
  2220. // ]]></script>
  2221. </dd>';
  2222. }
  2223. // Callback function for entering a birthdate!
  2224. function template_profile_birthdate()
  2225. {
  2226. global $txt, $context;
  2227. // Just show the pretty box!
  2228. echo '
  2229. <dt>
  2230. <strong>', $txt['dob'], ':</strong><br />
  2231. <span class="smalltext">', $txt['dob_year'], ' - ', $txt['dob_month'], ' - ', $txt['dob_day'], '</span>
  2232. </dt>
  2233. <dd>
  2234. <input type="text" name="bday3" size="4" maxlength="4" value="', $context['member']['birth_date']['year'], '" class="input_text" /> -
  2235. <input type="text" name="bday1" size="2" maxlength="2" value="', $context['member']['birth_date']['month'], '" class="input_text" /> -
  2236. <input type="text" name="bday2" size="2" maxlength="2" value="', $context['member']['birth_date']['day'], '" class="input_text" />
  2237. </dd>';
  2238. }
  2239. // Show the signature editing box?
  2240. function template_profile_signature_modify()
  2241. {
  2242. global $txt, $context, $settings;
  2243. echo '
  2244. <dt>
  2245. <strong>', $txt['signature'], ':</strong><br />
  2246. <span class="smalltext">', $txt['sig_info'], '</span><br />
  2247. <br />';
  2248. if ($context['show_spellchecking'])
  2249. echo '
  2250. <input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'creator\', \'signature\');" class="button_submit" />';
  2251. echo '
  2252. </dt>
  2253. <dd>
  2254. <textarea class="editor" onkeyup="calcCharLeft();" name="signature" rows="5" cols="50">', $context['member']['signature'], '</textarea><br />';
  2255. // If there is a limit at all!
  2256. if (!empty($context['signature_limits']['max_length']))
  2257. echo '
  2258. <span class="smalltext">', sprintf($txt['max_sig_characters'], $context['signature_limits']['max_length']), ' <span id="signatureLeft">', $context['signature_limits']['max_length'], '</span></span><br />';
  2259. if ($context['signature_warning'])
  2260. echo '
  2261. <span class="smalltext">', $context['signature_warning'], '</span>';
  2262. // Load the spell checker?
  2263. if ($context['show_spellchecking'])
  2264. echo '
  2265. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/spellcheck.js"></script>';
  2266. // Some javascript used to count how many characters have been used so far in the signature.
  2267. echo '
  2268. <script type="text/javascript"><!-- // --><![CDATA[
  2269. function tick()
  2270. {
  2271. if (typeof(document.forms.creator) != "undefined")
  2272. {
  2273. calcCharLeft();
  2274. setTimeout("tick()", 1000);
  2275. }
  2276. else
  2277. setTimeout("tick()", 800);
  2278. }
  2279. function calcCharLeft()
  2280. {
  2281. var maxLength = ', $context['signature_limits']['max_length'], ';
  2282. var oldSignature = "", currentSignature = document.forms.creator.signature.value;
  2283. if (!document.getElementById("signatureLeft"))
  2284. return;
  2285. if (oldSignature != currentSignature)
  2286. {
  2287. oldSignature = currentSignature;
  2288. if (currentSignature.replace(/\r/, "").length > maxLength)
  2289. document.forms.creator.signature.value = currentSignature.replace(/\r/, "").substring(0, maxLength);
  2290. currentSignature = document.forms.creator.signature.value.replace(/\r/, "");
  2291. }
  2292. setInnerHTML(document.getElementById("signatureLeft"), maxLength - currentSignature.length);
  2293. }
  2294. addLoadEvent(tick);
  2295. // ]]></script>
  2296. </dd>';
  2297. }
  2298. function template_profile_avatar_select()
  2299. {
  2300. global $context, $txt, $modSettings;
  2301. // Start with the upper menu
  2302. echo '
  2303. <dt>
  2304. <strong id="personal_picture">', $txt['personal_picture'], '</strong>
  2305. <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 />
  2306. ', !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 />' : '', '
  2307. ', !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 />' : '', '
  2308. ', !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>' : '', '
  2309. </dt>
  2310. <dd>';
  2311. // If users are allowed to choose avatars stored on the server show selection boxes to choice them from.
  2312. if (!empty($context['member']['avatar']['allow_server_stored']))
  2313. {
  2314. echo '
  2315. <div id="avatar_server_stored">
  2316. <div>
  2317. <select name="cat" id="cat" size="10" onchange="changeSel(\'\');" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'server_stored\');">';
  2318. // This lists all the file catergories.
  2319. foreach ($context['avatars'] as $avatar)
  2320. echo '
  2321. <option value="', $avatar['filename'] . ($avatar['is_dir'] ? '/' : ''), '"', ($avatar['checked'] ? ' selected="selected"' : ''), '>', $avatar['name'], '</option>';
  2322. echo '
  2323. </select>
  2324. </div>
  2325. <div>
  2326. <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>
  2327. </div>
  2328. <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>
  2329. <script type="text/javascript"><!-- // --><![CDATA[
  2330. var files = ["' . implode('", "', $context['avatar_list']) . '"];
  2331. var avatar = document.getElementById("avatar");
  2332. var cat = document.getElementById("cat");
  2333. var selavatar = "' . $context['avatar_selected'] . '";
  2334. var avatardir = "' . $modSettings['avatar_url'] . '/";
  2335. var size = avatar.alt.substr(3, 2) + " " + avatar.alt.substr(0, 2) + String.fromCharCode(117, 98, 116);
  2336. var file = document.getElementById("file");
  2337. if (avatar.src.indexOf("blank.gif") > -1)
  2338. changeSel(selavatar);
  2339. else
  2340. previewExternalAvatar(avatar.src)
  2341. function changeSel(selected)
  2342. {
  2343. if (cat.selectedIndex == -1)
  2344. return;
  2345. if (cat.options[cat.selectedIndex].value.indexOf("/") > 0)
  2346. {
  2347. var i;
  2348. var count = 0;
  2349. file.style.display = "inline";
  2350. file.disabled = false;
  2351. for (i = file.length; i >= 0; i = i - 1)
  2352. file.options[i] = null;
  2353. for (i = 0; i < files.length; i++)
  2354. if (files[i].indexOf(cat.options[cat.selectedIndex].value) == 0)
  2355. {
  2356. var filename = files[i].substr(files[i].indexOf("/") + 1);
  2357. var showFilename = filename.substr(0, filename.lastIndexOf("."));
  2358. showFilename = showFilename.replace(/[_]/g, " ");
  2359. file.options[count] = new Option(showFilename, files[i]);
  2360. if (filename == selected)
  2361. {
  2362. if (file.options.defaultSelected)
  2363. file.options[count].defaultSelected = true;
  2364. else
  2365. file.options[count].selected = true;
  2366. }
  2367. count++;
  2368. }
  2369. if (file.selectedIndex == -1 && file.options[0])
  2370. file.options[0].selected = true;
  2371. showAvatar();
  2372. }
  2373. else
  2374. {
  2375. file.style.display = "none";
  2376. file.disabled = true;
  2377. document.getElementById("avatar").src = avatardir + cat.options[cat.selectedIndex].value;
  2378. document.getElementById("avatar").style.width = "";
  2379. document.getElementById("avatar").style.height = "";
  2380. }
  2381. }
  2382. function showAvatar()
  2383. {
  2384. if (file.selectedIndex == -1)
  2385. return;
  2386. document.getElementById("avatar").src = avatardir + file.options[file.selectedIndex].value;
  2387. document.getElementById("avatar").alt = file.options[file.selectedIndex].text;
  2388. document.getElementById("avatar").alt += file.options[file.selectedIndex].text == size ? "!" : "";
  2389. document.getElementById("avatar").style.width = "";
  2390. document.getElementById("avatar").style.height = "";
  2391. }
  2392. function previewExternalAvatar(src)
  2393. {
  2394. if (!document.getElementById("avatar"))
  2395. return;
  2396. var maxHeight = ', !empty($modSettings['avatar_max_height_external']) ? $modSettings['avatar_max_height_external'] : 0, ';
  2397. var maxWidth = ', !empty($modSettings['avatar_max_width_external']) ? $modSettings['avatar_max_width_external'] : 0, ';
  2398. var tempImage = new Image();
  2399. tempImage.src = src;
  2400. if (maxWidth != 0 && tempImage.width > maxWidth)
  2401. {
  2402. document.getElementById("avatar").style.height = parseInt((maxWidth * tempImage.height) / tempImage.width) + "px";
  2403. document.getElementById("avatar").style.width = maxWidth + "px";
  2404. }
  2405. else if (maxHeight != 0 && tempImage.height > maxHeight)
  2406. {
  2407. document.getElementById("avatar").style.width = parseInt((maxHeight * tempImage.width) / tempImage.height) + "px";
  2408. document.getElementById("avatar").style.height = maxHeight + "px";
  2409. }
  2410. document.getElementById("avatar").src = src;
  2411. }
  2412. // ]]></script>
  2413. </div>';
  2414. }
  2415. // If the user can link to an off server avatar, show them a box to input the address.
  2416. if (!empty($context['member']['avatar']['allow_external']))
  2417. {
  2418. echo '
  2419. <div id="avatar_external">
  2420. <div class="smalltext">', $txt['avatar_by_url'], '</div>
  2421. <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" />
  2422. </div>';
  2423. }
  2424. // If the user is able to upload avatars to the server show them an upload box.
  2425. if (!empty($context['member']['avatar']['allow_upload']))
  2426. {
  2427. echo '
  2428. <div id="avatar_upload">
  2429. <input type="file" size="44" name="attachment" value="" onfocus="selectRadioByName(document.forms.creator.avatar_choice, \'upload\');" class="input_file" />
  2430. ', ($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'] . '" />' : ''), '
  2431. </div>';
  2432. }
  2433. echo '
  2434. <script type="text/javascript"><!-- // --><![CDATA[
  2435. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "' . ($context['member']['avatar']['choice'] == 'server_stored' ? '' : 'none') . '";' : '', '
  2436. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "' . ($context['member']['avatar']['choice'] == 'external' ? '' : 'none') . '";' : '', '
  2437. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "' . ($context['member']['avatar']['choice'] == 'upload' ? '' : 'none') . '";' : '', '
  2438. function swap_avatar(type)
  2439. {
  2440. switch(type.id)
  2441. {
  2442. case "avatar_choice_server_stored":
  2443. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "";' : '', '
  2444. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2445. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2446. break;
  2447. case "avatar_choice_external":
  2448. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2449. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "";' : '', '
  2450. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2451. break;
  2452. case "avatar_choice_upload":
  2453. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2454. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2455. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "";' : '', '
  2456. break;
  2457. case "avatar_choice_none":
  2458. ', !empty($context['member']['avatar']['allow_server_stored']) ? 'document.getElementById("avatar_server_stored").style.display = "none";' : '', '
  2459. ', !empty($context['member']['avatar']['allow_external']) ? 'document.getElementById("avatar_external").style.display = "none";' : '', '
  2460. ', !empty($context['member']['avatar']['allow_upload']) ? 'document.getElementById("avatar_upload").style.display = "none";' : '', '
  2461. break;
  2462. }
  2463. }
  2464. // ]]></script>
  2465. </dd>';
  2466. }
  2467. // Callback for modifying karam.
  2468. function template_profile_karma_modify()
  2469. {
  2470. global $context, $modSettings, $txt;
  2471. echo '
  2472. <dt>
  2473. <strong>', $modSettings['karmaLabel'], '</strong>
  2474. </dt>
  2475. <dd>
  2476. ', $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 />
  2477. (', $txt['total'], ': <span id="karmaTotal">', ($context['member']['karma']['good'] - $context['member']['karma']['bad']), '</span>)
  2478. </dd>';
  2479. }
  2480. // Select the time format!
  2481. function template_profile_timeformat_modify()
  2482. {
  2483. global $context, $modSettings, $txt, $scripturl, $settings;
  2484. echo '
  2485. <dt>
  2486. <strong>', $txt['time_format'], ':</strong><br />
  2487. <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>
  2488. <span class="smalltext">&nbsp;', $txt['date_format'], '</span>
  2489. </dt>
  2490. <dd>
  2491. <select name="easyformat" onchange="document.forms.creator.time_format.value = this.options[this.selectedIndex].value;" style="margin-bottom: 4px;">';
  2492. // Help the user by showing a list of common time formats.
  2493. foreach ($context['easy_timeformats'] as $time_format)
  2494. echo '
  2495. <option value="', $time_format['format'], '"', $time_format['format'] == $context['member']['time_format'] ? ' selected="selected"' : '', '>', $time_format['title'], '</option>';
  2496. echo '
  2497. </select><br />
  2498. <input type="text" name="time_format" value="', $context['member']['time_format'], '" size="30" class="input_text" />
  2499. </dd>';
  2500. }
  2501. // Time offset?
  2502. function template_profile_timeoffset_modify()
  2503. {
  2504. global $txt, $context;
  2505. echo '
  2506. <dt>
  2507. <strong', (isset($context['modify_error']['bad_offset']) ? ' class="error"' : ''), '>', $txt['time_offset'], ':</strong><br />
  2508. <span class="smalltext">', $txt['personal_time_offset'], '</span>
  2509. </dt>
  2510. <dd>
  2511. <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>
  2512. </dd>';
  2513. }
  2514. // Theme?
  2515. function template_profile_theme_pick()
  2516. {
  2517. global $txt, $context, $scripturl;
  2518. echo '
  2519. <dt>
  2520. <strong>', $txt['current_theme'], ':</strong>
  2521. </dt>
  2522. <dd>
  2523. ', $context['member']['theme']['name'], ' <a href="', $scripturl, '?action=theme;sa=pick;u=', $context['id_member'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['change'], '</a>
  2524. </dd>';
  2525. }
  2526. // Smiley set picker.
  2527. function template_profile_smiley_pick()
  2528. {
  2529. global $txt, $context, $modSettings, $settings;
  2530. echo '
  2531. <dt>
  2532. <strong>', $txt['smileys_current'], ':</strong>
  2533. </dt>
  2534. <dd>
  2535. <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\';">';
  2536. foreach ($context['smiley_sets'] as $set)
  2537. echo '
  2538. <option value="', $set['id'], '"', $set['selected'] ? ' selected="selected"' : '', '>', $set['name'], '</option>';
  2539. echo '
  2540. </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;" />
  2541. </dd>';
  2542. }
  2543. // Change the way you login to the forum.
  2544. function template_authentication_method()
  2545. {
  2546. global $context, $settings, $options, $scripturl, $modSettings, $txt;
  2547. // The main header!
  2548. echo '
  2549. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/register.js"></script>
  2550. <form action="', $scripturl, '?action=profile;area=authentication;save" method="post" accept-charset="', $context['character_set'], '" name="creator" id="creator" enctype="multipart/form-data">
  2551. <div class="cat_bar">
  2552. <h3 class="catbg">
  2553. <span class="ie6_header floatleft"><img src="', $settings['images_url'], '/icons/profile_sm.gif" alt="" class="icon" />', $txt['authentication'], '</span>
  2554. </h3>
  2555. </div>
  2556. <p class="windowbg description">', $txt['change_authentication'], '</p>
  2557. <div class="windowbg2">
  2558. <span class="topslice"><span></span></span>
  2559. <div class="content">
  2560. <dl>
  2561. <dt>
  2562. <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 />
  2563. <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>
  2564. </dt>
  2565. <dd>
  2566. <dl id="auth_openid_div">
  2567. <dt>
  2568. <em>', $txt['authenticate_openid_url'], ':</em>
  2569. </dt>
  2570. <dd>
  2571. <input type="text" name="openid_identifier" id="openid_url" size="30" tabindex="', $context['tabindex']++, '" value="', $context['member']['openid_uri'], '" class="input_text openid_login" />
  2572. </dd>
  2573. </dl>
  2574. <dl id="auth_pass_div">
  2575. <dt>
  2576. <em>', $txt['choose_pass'], ':</em>
  2577. </dt>
  2578. <dd>
  2579. <input type="password" name="passwrd1" id="smf_autov_pwmain" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2580. <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>
  2581. </dd>
  2582. <dt>
  2583. <em>', $txt['verify_pass'], ':</em>
  2584. </dt>
  2585. <dd>
  2586. <input type="password" name="passwrd2" id="smf_autov_pwverify" size="30" tabindex="', $context['tabindex']++, '" class="input_password" />
  2587. <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>
  2588. </dd>
  2589. </dl>
  2590. </dd>
  2591. </dl>';
  2592. if ($context['require_password'])
  2593. echo '
  2594. <hr width="100%" size="1" class="hrcolor clear" />
  2595. <dl>
  2596. <dt>
  2597. <strong', isset($context['modify_error']['bad_password']) || isset($context['modify_error']['no_password']) ? ' class="error"' : '', '>', $txt['current_password'], ': </strong><br />
  2598. <span class="smalltext">', $txt['required_security_reasons'], '</span>
  2599. </dt>
  2600. <dd>
  2601. <input type="password" name="oldpasswrd" size="20" style="margin-right: 4ex;" class="input_password" />
  2602. </dd>
  2603. </dl>';
  2604. echo '
  2605. <div class="righttext">
  2606. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  2607. <input type="hidden" name="u" value="', $context['id_member'], '" />
  2608. <input type="hidden" name="sa" value="', $context['menu_item_selected'], '" />
  2609. <input type="submit" value="', $txt['change_profile'], '" class="button_submit" />
  2610. </div>
  2611. </div>
  2612. <span class="botslice"><span></span></span>
  2613. </div>
  2614. </form>';
  2615. // The password stuff.
  2616. echo '
  2617. <script type="text/javascript"><!-- // --><![CDATA[
  2618. var regTextStrings = {
  2619. "password_short": "', $txt['registration_password_short'], '",
  2620. "password_reserved": "', $txt['registration_password_reserved'], '",
  2621. "password_numbercase": "', $txt['registration_password_numbercase'], '",
  2622. "password_no_match": "', $txt['registration_password_no_match'], '",
  2623. "password_valid": "', $txt['registration_password_valid'], '"
  2624. };
  2625. var verificationHandle = new smfRegister("creator", ', empty($modSettings['password_strength']) ? 0 : $modSettings['password_strength'], ', regTextStrings);
  2626. var currentAuthMethod = \'passwd\';
  2627. function updateAuthMethod()
  2628. {
  2629. // What authentication method is being used?
  2630. if (!document.getElementById(\'auth_openid\') || !document.getElementById(\'auth_openid\').checked)
  2631. currentAuthMethod = \'passwd\';
  2632. else
  2633. currentAuthMethod = \'openid\';
  2634. // No openID?
  2635. if (!document.getElementById(\'auth_openid\'))
  2636. return true;
  2637. document.forms.creator.openid_url.disabled = currentAuthMethod == \'openid\' ? false : true;
  2638. document.forms.creator.smf_autov_pwmain.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2639. document.forms.creator.smf_autov_pwverify.disabled = currentAuthMethod == \'passwd\' ? false : true;
  2640. document.getElementById(\'smf_autov_pwmain_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2641. document.getElementById(\'smf_autov_pwverify_div\').style.display = currentAuthMethod == \'passwd\' ? \'\' : \'none\';
  2642. if (currentAuthMethod == \'passwd\')
  2643. {
  2644. verificationHandle.refreshMainPassword();
  2645. verificationHandle.refreshVerifyPassword();
  2646. document.forms.creator.openid_url.style.backgroundColor = \'\';
  2647. document.getElementById("auth_openid_div").style.display = "none";
  2648. document.getElementById("auth_pass_div").style.display = "";
  2649. }
  2650. else
  2651. {
  2652. document.forms.creator.smf_autov_pwmain.style.backgroundColor = \'\';
  2653. document.forms.creator.smf_autov_pwverify.style.backgroundColor = \'\';
  2654. document.forms.creator.openid_url.style.backgroundColor = \'#FCE184\';
  2655. document.getElementById("auth_openid_div").style.display = "";
  2656. document.getElementById("auth_pass_div").style.display = "none";
  2657. }
  2658. }
  2659. updateAuthMethod();
  2660. // ]]></script>';
  2661. }
  2662. ?>