Admin.template.php 57 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. /**
  13. * This is the administration center home.
  14. */
  15. function template_admin()
  16. {
  17. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  18. // Welcome message for the admin.
  19. echo '
  20. <div id="admincenter">
  21. <div class="cat_bar">
  22. <h3 class="catbg">';
  23. if ($context['user']['is_admin'])
  24. echo '
  25. <object id="quick_search">
  26. <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
  27. <img src="', $settings['images_url'] , '/filter.gif" alt="" />
  28. <input type="text" name="search_term" value="', $txt['admin_search'], '" onclick="if (this.value == \'', $txt['admin_search'], '\') this.value = \'\';" class="input_text" />
  29. <select name="search_type">
  30. <option value="internal"', (empty($context['admin_preferences']['sb']) || $context['admin_preferences']['sb'] == 'internal' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_internal'], '</option>
  31. <option value="member"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'member' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_member'], '</option>
  32. <option value="online"', (!empty($context['admin_preferences']['sb']) && $context['admin_preferences']['sb'] == 'online' ? ' selected="selected"' : ''), '>', $txt['admin_search_type_online'], '</option>
  33. </select>
  34. <input type="submit" name="search_go" id="search_go" value="', $txt['admin_search_go'], '" class="button_submit" />
  35. </form>
  36. </object>';
  37. echo $txt['admin_center'], '
  38. </h3>
  39. </div>
  40. <span class="upperframe"><span></span></span>
  41. <div class="roundframe">
  42. <div id="welcome">
  43. <strong>', $txt['hello_guest'], ' ', $context['user']['name'], '!</strong>
  44. ', sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']), '
  45. </div>
  46. </div>
  47. <span class="lowerframe"><span></span></span>';
  48. // Is there an update available?
  49. echo '
  50. <div id="update_section"></div>';
  51. echo '
  52. <div id="admin_main_section">';
  53. // Display the "live news" from simplemachines.org.
  54. echo '
  55. <div id="live_news" class="floatleft">
  56. <div class="cat_bar">
  57. <h3 class="catbg">
  58. <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=live_news" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['live'], '</span>
  59. </h3>
  60. </div>
  61. <div class="windowbg nopadding">
  62. <span class="topslice"><span></span></span>
  63. <div class="content">
  64. <div id="smfAnnouncements">', $txt['lfyi'], '</div>
  65. </div>
  66. <span class="botslice"><span></span></span>
  67. </div>
  68. </div>';
  69. // Show the user version information from their server.
  70. echo '
  71. <div id="supportVersionsTable" class="floatright">
  72. <div class="cat_bar">
  73. <h3 class="catbg">
  74. <a href="', $scripturl, '?action=admin;area=credits">', $txt['support_title'], '</a>
  75. </h3>
  76. </div>
  77. <div class="windowbg nopadding">
  78. <span class="topslice"><span></span></span>
  79. <div class="content">
  80. <div id="version_details">
  81. <strong>', $txt['support_versions'], ':</strong><br />
  82. ', $txt['support_versions_forum'], ':
  83. <em id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</em><br />
  84. ', $txt['support_versions_current'], ':
  85. <em id="smfVersion" style="white-space: nowrap;">??</em><br />
  86. ', $context['can_admin'] ? '<a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br />';
  87. // Display all the members who can administrate the forum.
  88. echo '
  89. <br />
  90. <strong>', $txt['administrators'], ':</strong>
  91. ', implode(', ', $context['administrators']);
  92. // If we have lots of admins... don't show them all.
  93. if (!empty($context['more_admins_link']))
  94. echo '
  95. (', $context['more_admins_link'], ')';
  96. echo '
  97. </div>
  98. </div>
  99. <span class="botslice"><span></span></span>
  100. </div>
  101. </div>
  102. </div>';
  103. echo '
  104. <div class="windowbg2 clear_right">
  105. <span class="topslice"><span></span></span>
  106. <div class="content">
  107. <ul id="quick_tasks" class="flow_hidden">';
  108. foreach ($context['quick_admin_tasks'] as $task)
  109. echo '
  110. <li>
  111. ', !empty($task['icon']) ? '<a href="' . $task['href'] . '"><img src="' . $settings['default_images_url'] . '/admin/' . $task['icon'] . '" alt="" class="home_image png_fix" /></a>' : '', '
  112. <h5>', $task['link'], '</h5>
  113. <span class="task">', $task['description'],'</span>
  114. </li>';
  115. echo '
  116. </ul>
  117. </div>
  118. <span class="botslice clear"><span></span></span>
  119. </div>
  120. </div>
  121. <br class="clear" />';
  122. // The below functions include all the scripts needed from the simplemachines.org site. The language and format are passed for internationalization.
  123. if (empty($modSettings['disable_smf_js']))
  124. echo '
  125. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
  126. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>';
  127. // This sets the announcements and current versions themselves ;).
  128. echo '
  129. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/admin.js?fin20"></script>
  130. <script type="text/javascript"><!-- // --><![CDATA[
  131. var oAdminIndex = new smf_AdminIndex({
  132. sSelf: \'oAdminCenter\',
  133. bLoadAnnouncements: true,
  134. sAnnouncementTemplate: ', JavaScriptEscape('
  135. <dl>
  136. %content%
  137. </dl>
  138. '), ',
  139. sAnnouncementMessageTemplate: ', JavaScriptEscape('
  140. <dt><a href="%href%">%subject%</a> ' . $txt['on'] . ' %time%</dt>
  141. <dd>
  142. %message%
  143. </dd>
  144. '), ',
  145. sAnnouncementContainerId: \'smfAnnouncements\',
  146. bLoadVersions: true,
  147. sSmfVersionContainerId: \'smfVersion\',
  148. sYourVersionContainerId: \'yourVersion\',
  149. sVersionOutdatedTemplate: ', JavaScriptEscape('
  150. <span class="alert">%currentVersion%</span>
  151. '), ',
  152. bLoadUpdateNotification: true,
  153. sUpdateNotificationContainerId: \'update_section\',
  154. sUpdateNotificationDefaultTitle: ', JavaScriptEscape($txt['update_available']), ',
  155. sUpdateNotificationDefaultMessage: ', JavaScriptEscape($txt['update_message']), ',
  156. sUpdateNotificationTemplate: ', JavaScriptEscape('
  157. <div class="cat_bar">
  158. <h3 id="update_title" class="catbg">
  159. %title%
  160. </h3>
  161. </div>
  162. <div class="windowbg">
  163. <span class="topslice"><span></span></span>
  164. <div class="content">
  165. <div id="update_message" class="smalltext">
  166. %message%
  167. </div>
  168. </div>
  169. <span class="botslice"><span></span></span>
  170. </div>
  171. '), ',
  172. sUpdateNotificationLink: smf_scripturl + ', JavaScriptEscape('?action=admin;area=packages;pgdownload;auto;package=%package%;' . $context['session_var'] . '=' . $context['session_id']), '
  173. });
  174. // ]]></script>';
  175. }
  176. /**
  177. * Show some support information and credits to those who helped make this.
  178. */
  179. function template_credits()
  180. {
  181. global $context, $settings, $options, $scripturl, $txt;
  182. // Show the user version information from their server.
  183. echo '
  184. <div id="admincenter">
  185. <div class="cat_bar">
  186. <h3 class="catbg">
  187. ', $txt['support_title'], '
  188. </h3>
  189. </div>
  190. <div class="windowbg">
  191. <span class="topslice"><span></span></span>
  192. <div class="content">
  193. <strong>', $txt['support_versions'], ':</strong><br />
  194. ', $txt['support_versions_forum'], ':
  195. <em id="yourVersion" style="white-space: nowrap;">', $context['forum_version'], '</em>', $context['can_admin'] ? ' <a href="' . $scripturl . '?action=admin;area=maintain;sa=routine;activity=version">' . $txt['version_check_more'] . '</a>' : '', '<br />
  196. ', $txt['support_versions_current'], ':
  197. <em id="smfVersion" style="white-space: nowrap;">??</em><br />';
  198. // Display all the variables we have server information for.
  199. foreach ($context['current_versions'] as $version)
  200. echo '
  201. ', $version['title'], ':
  202. <em>', $version['version'], '</em><br />';
  203. echo '
  204. </div>
  205. <span class="botslice"><span></span></span>
  206. </div>
  207. ';
  208. // Point the admin to common support resources.
  209. echo '
  210. <div class="cat_bar">
  211. <h3 class="catbg">
  212. ', $txt['support_resources'], '
  213. </h3>
  214. </div>
  215. <div class="windowbg2">
  216. <span class="topslice"><span></span></span>
  217. <div class="content">
  218. <p>', $txt['support_resources_p1'], '</p>
  219. <p>', $txt['support_resources_p2'], '</p>
  220. </div>
  221. <span class="botslice"><span></span></span>
  222. </div>';
  223. // Display latest support questions from simplemachines.org.
  224. echo '
  225. <div class="cat_bar">
  226. <h3 class="catbg">
  227. <span class="ie6_header floatleft"><a href="', $scripturl, '?action=helpadmin;help=latest_support" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a> ', $txt['support_latest'], '</span>
  228. </h3>
  229. </div>
  230. <div class="windowbg2">
  231. <span class="topslice"><span></span></span>
  232. <div class="content">
  233. <div id="latestSupport">', $txt['support_latest_fetch'], '</div>
  234. </div>
  235. <span class="botslice"><span></span></span>
  236. </div>';
  237. // The most important part - the credits :P.
  238. echo '
  239. <div class="cat_bar">
  240. <h3 class="catbg">
  241. ', $txt['admin_credits'], '
  242. </h3>
  243. </div>
  244. <div class="windowbg">
  245. <span class="topslice"><span></span></span>
  246. <div class="content">';
  247. foreach ($context['credits'] as $section)
  248. {
  249. if (isset($section['pretext']))
  250. echo '
  251. <p>', $section['pretext'], '</p>';
  252. echo '
  253. <dl>';
  254. foreach ($section['groups'] as $group)
  255. {
  256. if (isset($group['title']))
  257. echo '
  258. <dt>
  259. <strong>', $group['title'], ':</strong>
  260. </dt>';
  261. echo '
  262. <dd>', implode(', ', $group['members']), '</dd>';
  263. }
  264. echo '
  265. </dl>';
  266. if (isset($section['posttext']))
  267. echo '
  268. <p>', $section['posttext'], '</p>';
  269. }
  270. echo '
  271. </div>
  272. <span class="botslice"><span></span></span>
  273. </div>
  274. </div>
  275. <br class="clear" />';
  276. // This makes all the support information available to the support script...
  277. echo '
  278. <script type="text/javascript"><!-- // --><![CDATA[
  279. var smfSupportVersions = {};
  280. smfSupportVersions.forum = "', $context['forum_version'], '";';
  281. // Don't worry, none of this is logged, it's just used to give information that might be of use.
  282. foreach ($context['current_versions'] as $variable => $version)
  283. echo '
  284. smfSupportVersions.', $variable, ' = "', $version['version'], '";';
  285. // Now we just have to include the script and wait ;).
  286. echo '
  287. // ]]></script>
  288. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=current-version.js"></script>
  289. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-news.js"></script>
  290. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-support.js"></script>';
  291. // This sets the latest support stuff.
  292. echo '
  293. <script type="text/javascript"><!-- // --><![CDATA[
  294. function smfSetLatestSupport()
  295. {
  296. if (window.smfLatestSupport)
  297. setInnerHTML(document.getElementById("latestSupport"), window.smfLatestSupport);
  298. }
  299. function smfCurrentVersion()
  300. {
  301. var smfVer, yourVer;
  302. if (!window.smfVersion)
  303. return;
  304. smfVer = document.getElementById("smfVersion");
  305. yourVer = document.getElementById("yourVersion");
  306. setInnerHTML(smfVer, window.smfVersion);
  307. var currentVersion = getInnerHTML(yourVer);
  308. if (currentVersion != window.smfVersion)
  309. setInnerHTML(yourVer, "<span class=\"alert\">" + currentVersion + "</span>");
  310. }';
  311. // IE 4 is rather annoying, this wouldn't be necessary...
  312. echo '
  313. var fSetupCredits = function ()
  314. {
  315. smfSetLatestSupport();
  316. smfCurrentVersion()
  317. }
  318. addLoadEvent(fSetupCredits);
  319. // ]]></script>';
  320. }
  321. /**
  322. * Displays information about file versions installed, and compares them to current version.
  323. */
  324. function template_view_versions()
  325. {
  326. global $context, $settings, $options, $scripturl, $txt;
  327. echo '
  328. <div id="admincenter">
  329. <div class="cat_bar">
  330. <h3 class="catbg">
  331. ', $txt['admin_version_check'], '
  332. </h3>
  333. </div>
  334. <div class="information">', $txt['version_check_desc'], '</div>
  335. <table width="100%" class="table_grid">
  336. <thead>
  337. <tr class="catbg" align="left">
  338. <th class="first_th" scope="col" width="50%">
  339. <strong>', $txt['admin_smffile'], '</strong>
  340. </th>
  341. <th scope="col" width="25%">
  342. <strong>', $txt['dvc_your'], '</strong>
  343. </th>
  344. <th class="last_th" scope="col"" width="25%">
  345. <strong>', $txt['dvc_current'], '</strong>
  346. </th>
  347. </tr>
  348. </thead>
  349. <tbody>';
  350. // The current version of the core SMF package.
  351. echo '
  352. <tr>
  353. <td class="windowbg">
  354. ', $txt['admin_smfpackage'], '
  355. </td>
  356. <td class="windowbg">
  357. <em id="yourSMF">', $context['forum_version'], '</em>
  358. </td>
  359. <td class="windowbg">
  360. <em id="currentSMF">??</em>
  361. </td>
  362. </tr>';
  363. // Now list all the source file versions, starting with the overall version (if all match!).
  364. echo '
  365. <tr>
  366. <td class="windowbg">
  367. <a href="#" id="Sources-link">', $txt['dvc_sources'], '</a>
  368. </td>
  369. <td class="windowbg">
  370. <em id="yourSources">??</em>
  371. </td>
  372. <td class="windowbg">
  373. <em id="currentSources">??</em>
  374. </td>
  375. </tr>
  376. </tbody>
  377. </table>
  378. <table id="Sources" width="100%" class="table_grid">
  379. <tbody>';
  380. // Loop through every source file displaying its version - using javascript.
  381. foreach ($context['file_versions'] as $filename => $version)
  382. echo '
  383. <tr>
  384. <td class="windowbg2" width="50%" style="padding-left: 3ex;">
  385. ', $filename, '
  386. </td>
  387. <td class="windowbg2" width="25%">
  388. <em id="yourSources', $filename, '">', $version, '</em>
  389. </td>
  390. <td class="windowbg2" width="25%">
  391. <em id="currentSources', $filename, '">??</em>
  392. </td>
  393. </tr>';
  394. // Default template files.
  395. echo '
  396. </tbody>
  397. </table>
  398. <table width="100%" class="table_grid">
  399. <tbody>
  400. <tr>
  401. <td class="windowbg" width="50%">
  402. <a href="#" id="Default-link">', $txt['dvc_default'], '</a>
  403. </td>
  404. <td class="windowbg" width="25%">
  405. <em id="yourDefault">??</em>
  406. </td>
  407. <td class="windowbg" width="25%">
  408. <em id="currentDefault">??</em>
  409. </td>
  410. </tr>
  411. </tbody>
  412. </table>
  413. <table id="Default" width="100%" class="table_grid">
  414. <tbody>';
  415. foreach ($context['default_template_versions'] as $filename => $version)
  416. echo '
  417. <tr>
  418. <td class="windowbg2" width="50%" style="padding-left: 3ex;">
  419. ', $filename, '
  420. </td>
  421. <td class="windowbg2" width="25%">
  422. <em id="yourDefault', $filename, '">', $version, '</em>
  423. </td>
  424. <td class="windowbg2" width="25%">
  425. <em id="currentDefault', $filename, '">??</em>
  426. </td>
  427. </tr>';
  428. // Now the language files...
  429. echo '
  430. </tbody>
  431. </table>
  432. <table width="100%" class="table_grid">
  433. <tbody>
  434. <tr>
  435. <td class="windowbg" width="50%">
  436. <a href="#" id="Languages-link">', $txt['dvc_languages'], '</a>
  437. </td>
  438. <td class="windowbg" width="25%">
  439. <em id="yourLanguages">??</em>
  440. </td>
  441. <td class="windowbg" width="25%">
  442. <em id="currentLanguages">??</em>
  443. </td>
  444. </tr>
  445. </tbody>
  446. </table>
  447. <table id="Languages" width="100%" class="table_grid">
  448. <tbody>';
  449. foreach ($context['default_language_versions'] as $language => $files)
  450. {
  451. foreach ($files as $filename => $version)
  452. echo '
  453. <tr>
  454. <td class="windowbg2" width="50%" style="padding-left: 3ex;">
  455. ', $filename, '.<em>', $language, '</em>.php
  456. </td>
  457. <td class="windowbg2" width="25%">
  458. <em id="your', $filename, '.', $language, '">', $version, '</em>
  459. </td>
  460. <td class="windowbg2" width="25%">
  461. <em id="current', $filename, '.', $language, '">??</em>
  462. </td>
  463. </tr>';
  464. }
  465. echo '
  466. </tbody>
  467. </table>';
  468. // Finally, display the version information for the currently selected theme - if it is not the default one.
  469. if (!empty($context['template_versions']))
  470. {
  471. echo '
  472. <table width="100%" class="table_grid">
  473. <tbody>
  474. <tr>
  475. <td class="windowbg" width="50%">
  476. <a href="#" id="Templates-link">', $txt['dvc_templates'], '</a>
  477. </td>
  478. <td class="windowbg" width="25%">
  479. <em id="yourTemplates">??</em>
  480. </td>
  481. <td class="windowbg" width="25%">
  482. <em id="currentTemplates">??</em>
  483. </td>
  484. </tr>
  485. </tbody>
  486. </table>
  487. <table id="Templates" width="100%" class="table_grid">
  488. <tbody>';
  489. foreach ($context['template_versions'] as $filename => $version)
  490. echo '
  491. <tr>
  492. <td class="windowbg2" width="50%" style="padding-left: 3ex;">
  493. ', $filename, '
  494. </td>
  495. <td class="windowbg2" width="25%">
  496. <em id="yourTemplates', $filename, '">', $version, '</em>
  497. </td>
  498. <td class="windowbg2" width="25%">
  499. <em id="currentTemplates', $filename, '">??</em>
  500. </td>
  501. </tr>';
  502. echo '
  503. </tbody>
  504. </table>';
  505. }
  506. echo '
  507. </div>
  508. <br class="clear" />';
  509. /* Below is the hefty javascript for this. Upon opening the page it checks the current file versions with ones
  510. held at simplemachines.org and works out if they are up to date. If they aren't it colors that files number
  511. red. It also contains the function, swapOption, that toggles showing the detailed information for each of the
  512. file categories. (sources, languages, and templates.) */
  513. echo '
  514. <script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=detailed-version.js"></script>
  515. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/admin.js?fin20"></script>
  516. <script type="text/javascript"><!-- // --><![CDATA[
  517. var oViewVersions = new smf_ViewVersions({
  518. aKnownLanguages: [
  519. \'.', implode('\',
  520. \'.', $context['default_known_languages']), '\'
  521. ],
  522. oSectionContainerIds: {
  523. Sources: \'Sources\',
  524. Default: \'Default\',
  525. Languages: \'Languages\',
  526. Templates: \'Templates\'
  527. }
  528. });
  529. // ]]></script>';
  530. }
  531. // Form for stopping people using naughty words, etc.
  532. function template_edit_censored()
  533. {
  534. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  535. // First section is for adding/removing words from the censored list.
  536. echo '
  537. <div id="admincenter">
  538. <form action="', $scripturl, '?action=admin;area=postsettings;sa=censor" method="post" accept-charset="', $context['character_set'], '">
  539. <div class="cat_bar">
  540. <h3 class="catbg">
  541. ', $txt['admin_censored_words'], '
  542. </h3>
  543. </div>
  544. <div class="windowbg2">
  545. <span class="topslice"><span></span></span>
  546. <div class="content">
  547. <p>', $txt['admin_censored_where'], '</p>';
  548. // Show text boxes for censoring [bad ] => [good ].
  549. foreach ($context['censored_words'] as $vulgar => $proper)
  550. echo '
  551. <div style="margin-top: 1ex;"><input type="text" name="censor_vulgar[]" value="', $vulgar, '" size="20" /> => <input type="text" name="censor_proper[]" value="', $proper, '" size="20" /></div>';
  552. // Now provide a way to censor more words.
  553. echo '
  554. <div style="margin-top: 1ex;"><input type="text" name="censor_vulgar[]" size="20" class="input_text" /> => <input type="text" name="censor_proper[]" size="20" class="input_text" /></div>
  555. <div id="moreCensoredWords"></div><div style="margin-top: 1ex; display: none;" id="moreCensoredWords_link"><a href="#;" onclick="addNewWord(); return false;">', $txt['censor_clickadd'], '</a></div>
  556. <script type="text/javascript"><!-- // --><![CDATA[
  557. document.getElementById("moreCensoredWords_link").style.display = "";
  558. // ]]></script>
  559. <hr width="100%" size="1" class="hrcolor clear" />
  560. <dl class="settings">
  561. <dt>
  562. <strong><label for="censorWholeWord_check">', $txt['censor_whole_words'], ':</label></strong>
  563. </dt>
  564. <dd>
  565. <input type="checkbox" name="censorWholeWord" value="1" id="censorWholeWord_check"', empty($modSettings['censorWholeWord']) ? '' : ' checked="checked"', ' class="input_check" />
  566. </dd>
  567. <dt>
  568. <strong><label for="censorIgnoreCase_check">', $txt['censor_case'], ':</label></strong>
  569. </dt>
  570. <dd>
  571. <input type="checkbox" name="censorIgnoreCase" value="1" id="censorIgnoreCase_check"', empty($modSettings['censorIgnoreCase']) ? '' : ' checked="checked"', ' class="input_check" />
  572. </dd>
  573. </dl>
  574. <input type="submit" name="save_censor" value="', $txt['save'], '" class="button_submit" />
  575. </div>
  576. <span class="botslice"><span></span></span>
  577. </div>';
  578. // This table lets you test out your filters by typing in rude words and seeing what comes out.
  579. echo '
  580. <div class="cat_bar">
  581. <h3 class="catbg">
  582. ', $txt['censor_test'], '
  583. </h3>
  584. </div>
  585. <div class="windowbg">
  586. <span class="topslice"><span></span></span>
  587. <div class="content">
  588. <p class="centertext">
  589. <input type="text" name="censortest" value="', empty($context['censor_test']) ? '' : $context['censor_test'], '" class="input_text" />
  590. <input type="submit" value="', $txt['censor_test_save'], '" class="button_submit" />
  591. </p>
  592. </div>
  593. <span class="botslice"><span></span></span>
  594. </div>
  595. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  596. <input type="hidden" name="', $context['admin-censor_token_var'], '" value="', $context['admin-censor_token'], '" />
  597. </form>
  598. </div>
  599. <br class="clear" />';
  600. }
  601. // Maintenance is a lovely thing, isn't it?
  602. function template_not_done()
  603. {
  604. global $context, $settings, $options, $txt, $scripturl;
  605. echo '
  606. <div id="admincenter">
  607. <div class="cat_bar">
  608. <h3 class="catbg">
  609. ', $txt['not_done_title'], '
  610. </h3>
  611. </div>
  612. <div class="windowbg">
  613. <span class="topslice"><span></span></span>
  614. <div class="content">
  615. ', $txt['not_done_reason'];
  616. if (!empty($context['continue_percent']))
  617. echo '
  618. <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
  619. <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  620. <div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['continue_percent'], '%</div>
  621. <div style="width: ', $context['continue_percent'], '%; height: 12pt; z-index: 1; background-color: red;">&nbsp;</div>
  622. </div>
  623. </div>';
  624. if (!empty($context['substep_enabled']))
  625. echo '
  626. <div style="padding-left: 20%; padding-right: 20%; margin-top: 1ex;">
  627. <span class="smalltext">', $context['substep_title'], '</span>
  628. <div style="font-size: 8pt; height: 12pt; border: 1px solid black; background-color: white; padding: 1px; position: relative;">
  629. <div style="padding-top: ', isBrowser('is_webkit') || isBrowser('is_konqueror') ? '2pt' : '1pt', '; width: 100%; z-index: 2; color: black; position: absolute; text-align: center; font-weight: bold;">', $context['substep_continue_percent'], '%</div>
  630. <div style="width: ', $context['substep_continue_percent'], '%; height: 12pt; z-index: 1; background-color: blue;">&nbsp;</div>
  631. </div>
  632. </div>';
  633. echo '
  634. <form action="', $scripturl, $context['continue_get_data'], '" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;" name="autoSubmit" id="autoSubmit">
  635. <div style="margin: 1ex; text-align: right;"><input type="submit" name="cont" value="', $txt['not_done_continue'], '" class="button_submit" /></div>
  636. ', $context['continue_post_data'], '
  637. </form>
  638. </div>
  639. <span class="botslice"><span></span></span>
  640. </div>
  641. </div>
  642. <br class="clear" />
  643. <script type="text/javascript"><!-- // --><![CDATA[
  644. var countdown = ', $context['continue_countdown'], ';
  645. doAutoSubmit();
  646. function doAutoSubmit()
  647. {
  648. if (countdown == 0)
  649. document.forms.autoSubmit.submit();
  650. else if (countdown == -1)
  651. return;
  652. document.forms.autoSubmit.cont.value = "', $txt['not_done_continue'], ' (" + countdown + ")";
  653. countdown--;
  654. setTimeout("doAutoSubmit();", 1000);
  655. }
  656. // ]]></script>';
  657. }
  658. // Template for showing settings (Of any kind really!)
  659. function template_show_settings()
  660. {
  661. global $context, $txt, $settings, $scripturl;
  662. if (!empty($context['settings_pre_javascript']))
  663. echo '
  664. <script type="text/javascript"><!-- // --><![CDATA[', $context['settings_pre_javascript'], '// ]]></script>';
  665. if (!empty($context['settings_insert_above']))
  666. echo $context['settings_insert_above'];
  667. echo '
  668. <div id="admincenter">
  669. <form action="', $context['post_url'], '" method="post" accept-charset="', $context['character_set'], '"', !empty($context['force_form_onsubmit']) ? ' onsubmit="' . $context['force_form_onsubmit'] . '"' : '', '>';
  670. // Is there a custom title?
  671. if (isset($context['settings_title']))
  672. echo '
  673. <div class="cat_bar">
  674. <h3 class="catbg">
  675. ', $context['settings_title'], '
  676. </h3>
  677. </div>';
  678. // Have we got some custom code to insert?
  679. if (!empty($context['settings_message']))
  680. echo '
  681. <div class="information">', $context['settings_message'], '</div>';
  682. // Now actually loop through all the variables.
  683. $is_open = false;
  684. foreach ($context['config_vars'] as $config_var)
  685. {
  686. // Is it a title or a description?
  687. if (is_array($config_var) && ($config_var['type'] == 'title' || $config_var['type'] == 'desc'))
  688. {
  689. // Not a list yet?
  690. if ($is_open)
  691. {
  692. $is_open = false;
  693. echo '
  694. </dl>
  695. </div>
  696. <span class="botslice"><span></span></span>
  697. </div>';
  698. }
  699. // A title?
  700. if ($config_var['type'] == 'title')
  701. {
  702. echo '
  703. <div class="cat_bar">
  704. <h3 class="', !empty($config_var['class']) ? $config_var['class'] : 'catbg', '"', !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>
  705. ', ($config_var['help'] ? '<a href="' . $scripturl . '?action=helpadmin;help=' . $config_var['help'] . '" onclick="return reqWin(this.href);" class="help"><img src="' . $settings['images_url'] . '/helptopics.gif" class="icon" alt="' . $txt['help'] . '" /></a>' : ''), '
  706. ', $config_var['label'], '
  707. </h3>
  708. </div>';
  709. }
  710. // A description?
  711. else
  712. {
  713. echo '
  714. <p class="description">
  715. ', $config_var['label'], '
  716. </p>';
  717. }
  718. continue;
  719. }
  720. // Not a list yet?
  721. if (!$is_open)
  722. {
  723. $is_open = true;
  724. echo '
  725. <div class="windowbg2">
  726. <span class="topslice"><span></span></span>
  727. <div class="content">
  728. <dl class="settings">';
  729. }
  730. // Hang about? Are you pulling my leg - a callback?!
  731. if (is_array($config_var) && $config_var['type'] == 'callback')
  732. {
  733. if (function_exists('template_callback_' . $config_var['name']))
  734. call_user_func('template_callback_' . $config_var['name']);
  735. continue;
  736. }
  737. if (is_array($config_var))
  738. {
  739. // First off, is this a span like a message?
  740. if (in_array($config_var['type'], array('message', 'warning')))
  741. {
  742. echo '
  743. <dd', $config_var['type'] == 'warning' ? ' class="alert"' : '', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>
  744. ', $config_var['label'], '
  745. </dd>';
  746. }
  747. // Otherwise it's an input box of some kind.
  748. else
  749. {
  750. echo '
  751. <dt', is_array($config_var) && !empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '"' : '', '>';
  752. // Some quick helpers...
  753. $javascript = $config_var['javascript'];
  754. $disabled = !empty($config_var['disabled']) ? ' disabled="disabled"' : '';
  755. $subtext = !empty($config_var['subtext']) ? '<br /><span class="smalltext"> ' . $config_var['subtext'] . '</span>' : '';
  756. // Show the [?] button.
  757. if ($config_var['help'])
  758. echo '
  759. <a id="setting_', $config_var['name'], '" href="', $scripturl, '?action=helpadmin;help=', $config_var['help'], '" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a><span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br /><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
  760. </dt>';
  761. else
  762. echo '
  763. <a id="setting_', $config_var['name'], '"></a> <span', ($config_var['disabled'] ? ' style="color: #777777;"' : ($config_var['invalid'] ? ' class="error"' : '')), '><label for="', $config_var['name'], '">', $config_var['label'], '</label>', $subtext, ($config_var['type'] == 'password' ? '<br /><em>' . $txt['admin_confirm_password'] . '</em>' : ''), '</span>
  764. </dt>';
  765. echo '
  766. <dd', (!empty($config_var['force_div_id']) ? ' id="' . $config_var['force_div_id'] . '_dd"' : ''), '>',
  767. $config_var['preinput'];
  768. // Show a check box.
  769. if ($config_var['type'] == 'check')
  770. echo '
  771. <input type="checkbox"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '"', ($config_var['value'] ? ' checked="checked"' : ''), ' value="1" class="input_check" />';
  772. // Escape (via htmlspecialchars.) the text box.
  773. elseif ($config_var['type'] == 'password')
  774. echo '
  775. <input type="password"', $disabled, $javascript, ' name="', $config_var['name'], '[0]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' value="*#fakepass#*" onfocus="this.value = \'\'; this.form.', $config_var['name'], '.disabled = false;" class="input_password" /><br />
  776. <input type="password" disabled="disabled" id="', $config_var['name'], '" name="', $config_var['name'], '[1]"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_password" />';
  777. // Show a selection box.
  778. elseif ($config_var['type'] == 'select')
  779. {
  780. echo '
  781. <select name="', $config_var['name'], '" id="', $config_var['name'], '" ', $javascript, $disabled, (!empty($config_var['multiple']) ? ' multiple="multiple"' : ''), '>';
  782. foreach ($config_var['data'] as $option)
  783. echo '
  784. <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected="selected"' : ''), '>', $option[1], '</option>';
  785. echo '
  786. </select>';
  787. }
  788. // Text area?
  789. elseif ($config_var['type'] == 'large_text')
  790. echo '
  791. <textarea rows="', ($config_var['size'] ? $config_var['size'] : 4), '" cols="30" ', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '">', $config_var['value'], '</textarea>';
  792. // Permission group?
  793. elseif ($config_var['type'] == 'permissions')
  794. theme_inline_permissions($config_var['name']);
  795. // BBC selection?
  796. elseif ($config_var['type'] == 'bbc')
  797. {
  798. echo '
  799. <fieldset id="', $config_var['name'], '">
  800. <legend>', $txt['bbcTagsToUse_select'], '</legend>
  801. <ul class="reset">';
  802. foreach ($context['bbc_columns'] as $bbcColumn)
  803. {
  804. foreach ($bbcColumn as $bbcTag)
  805. echo '
  806. <li class="list_bbc floatleft">
  807. <input type="checkbox" name="', $config_var['name'], '_enabledTags[]" id="tag_', $config_var['name'], '_', $bbcTag['tag'], '" value="', $bbcTag['tag'], '"', !in_array($bbcTag['tag'], $context['bbc_sections'][$config_var['name']]['disabled']) ? ' checked="checked"' : '', ' class="input_check" /> <label for="tag_', $config_var['name'], '_', $bbcTag['tag'], '">', $bbcTag['tag'], '</label>', $bbcTag['show_help'] ? ' (<a href="' . $scripturl . '?action=helpadmin;help=tag_' . $bbcTag['tag'] . '" onclick="return reqWin(this.href);">?</a>)' : '', '
  808. </li>';
  809. }
  810. echo ' </ul>
  811. <input type="checkbox" id="select_all" onclick="invertAll(this, this.form, \'', $config_var['name'], '_enabledTags\');"', $context['bbc_sections'][$config_var['name']]['all_selected'] ? ' checked="checked"' : '', ' class="input_check" /> <label for="select_all"><em>', $txt['bbcTagsToUse_select_all'], '</em></label>
  812. </fieldset>';
  813. }
  814. // A simple message?
  815. elseif ($config_var['type'] == 'var_message')
  816. echo '
  817. <div', !empty($config_var['name']) ? ' id="' . $config_var['name'] . '"' : '', '>', $config_var['var_message'], '</div>';
  818. // Assume it must be a text box.
  819. else
  820. echo '
  821. <input type="text"', $javascript, $disabled, ' name="', $config_var['name'], '" id="', $config_var['name'], '" value="', $config_var['value'], '"', ($config_var['size'] ? ' size="' . $config_var['size'] . '"' : ''), ' class="input_text" />';
  822. echo isset($config_var['postinput']) ? '
  823. ' . $config_var['postinput'] : '',
  824. '</dd>';
  825. }
  826. }
  827. else
  828. {
  829. // Just show a separator.
  830. if ($config_var == '')
  831. echo '
  832. </dl>
  833. <hr class="hrcolor clear" />
  834. <dl class="settings">';
  835. else
  836. echo '
  837. <dd>
  838. <strong>' . $config_var . '</strong>
  839. </dd>';
  840. }
  841. }
  842. if ($is_open)
  843. echo '
  844. </dl>';
  845. if (empty($context['settings_save_dont_show']))
  846. echo '
  847. <hr class="hrcolor clear" />
  848. <div class="righttext">
  849. <input type="submit" value="', $txt['save'], '"', (!empty($context['save_disabled']) ? ' disabled="disabled"' : ''), (!empty($context['settings_save_onclick']) ? ' onclick="' . $context['settings_save_onclick'] . '"' : ''), ' class="button_submit" />
  850. </div>';
  851. if ($is_open)
  852. echo '
  853. </div>
  854. <span class="botslice"><span></span></span>
  855. </div>';
  856. // At least one token has to be used!
  857. if (isset($context['admin-ssc_token']))
  858. echo '
  859. <input type="hidden" name="', $context['admin-ssc_token_var'], '" value="', $context['admin-ssc_token'], '" />';
  860. if (isset($context['admin-dbsc_token']))
  861. echo '
  862. <input type="hidden" name="', $context['admin-dbsc_token_var'], '" value="', $context['admin-dbsc_token'], '" />';
  863. echo '
  864. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  865. </form>
  866. </div>
  867. <br class="clear" />';
  868. if (!empty($context['settings_post_javascript']))
  869. echo '
  870. <script type="text/javascript"><!-- // --><![CDATA[
  871. ', $context['settings_post_javascript'], '
  872. // ]]></script>';
  873. if (!empty($context['settings_insert_below']))
  874. echo $context['settings_insert_below'];
  875. }
  876. // Template for showing custom profile fields.
  877. function template_show_custom_profile()
  878. {
  879. global $context, $txt, $settings, $scripturl;
  880. // Standard fields.
  881. template_show_list('standard_profile_fields');
  882. echo '
  883. <script type="text/javascript"><!-- // --><![CDATA[
  884. var iNumChecks = document.forms.standardProfileFields.length;
  885. for (var i = 0; i < iNumChecks; i++)
  886. if (document.forms.standardProfileFields[i].id.indexOf(\'reg_\') == 0)
  887. document.forms.standardProfileFields[i].disabled = document.forms.standardProfileFields[i].disabled || !document.getElementById(\'active_\' + document.forms.standardProfileFields[i].id.substr(4)).checked;
  888. // ]]></script><br />';
  889. // Custom fields.
  890. template_show_list('custom_profile_fields');
  891. }
  892. // Edit a profile field?
  893. function template_edit_profile_field()
  894. {
  895. global $context, $txt, $settings, $scripturl;
  896. // All the javascript for this page - quite a bit!
  897. echo '
  898. <script type="text/javascript"><!-- // --><![CDATA[
  899. var startOptID = ', count($context['field']['options']), ';
  900. // ]]></script>';
  901. echo '
  902. <div id="admincenter">
  903. <form action="', $scripturl, '?action=admin;area=featuresettings;sa=profileedit;fid=', $context['fid'], ';', $context['session_var'], '=', $context['session_id'], '" method="post" accept-charset="', $context['character_set'], '">
  904. <div class="cat_bar">
  905. <h3 class="catbg">
  906. ', $context['page_title'], '
  907. </h3>
  908. </div>
  909. <div class="windowbg">
  910. <span class="topslice"><span></span></span>
  911. <div class="content">
  912. <fieldset>
  913. <legend>', $txt['custom_edit_general'], '</legend>
  914. <dl class="settings">
  915. <dt>
  916. <strong>', $txt['custom_edit_name'], ':</strong>
  917. </dt>
  918. <dd>
  919. <input type="text" name="field_name" value="', $context['field']['name'], '" size="20" maxlength="40" class="input_text" />
  920. </dd>
  921. <dt>
  922. <strong>', $txt['custom_edit_desc'], ':</strong>
  923. </dt>
  924. <dd>
  925. <textarea name="field_desc" rows="3" cols="40">', $context['field']['desc'], '</textarea>
  926. </dd>
  927. <dt>
  928. <strong>', $txt['custom_edit_profile'], ':</strong><br />
  929. <span class="smalltext">', $txt['custom_edit_profile_desc'], '</span>
  930. </dt>
  931. <dd>
  932. <select name="profile_area">
  933. <option value="none"', $context['field']['profile_area'] == 'none' ? ' selected="selected"' : '', '>', $txt['custom_edit_profile_none'], '</option>
  934. <option value="account"', $context['field']['profile_area'] == 'account' ? ' selected="selected"' : '', '>', $txt['account'], '</option>
  935. <option value="forumprofile"', $context['field']['profile_area'] == 'forumprofile' ? ' selected="selected"' : '', '>', $txt['forumprofile'], '</option>
  936. <option value="theme"', $context['field']['profile_area'] == 'theme' ? ' selected="selected"' : '', '>', $txt['theme'], '</option>
  937. </select>
  938. </dd>
  939. <dt>
  940. <strong>', $txt['custom_edit_registration'], ':</strong>
  941. </dt>
  942. <dd>
  943. <select name="reg" id="reg">
  944. <option value="0"', $context['field']['reg'] == 0 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_disable'], '</option>
  945. <option value="1"', $context['field']['reg'] == 1 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_allow'], '</option>
  946. <option value="2"', $context['field']['reg'] == 2 ? ' selected="selected"' : '', '>', $txt['custom_edit_registration_require'], '</option>
  947. </select>
  948. </dd>
  949. <dt>
  950. <strong>', $txt['custom_edit_display'], ':</strong>
  951. </dt>
  952. <dd>
  953. <input type="checkbox" name="display" id="display"', $context['field']['display'] ? ' checked="checked"' : '', ' class="input_check" />
  954. </dd>
  955. <dt>
  956. <strong>', $txt['custom_edit_placement'], ':</strong>
  957. </dt>
  958. <dd>
  959. <select name="placement" id="placement">
  960. <option value="0"', $context['field']['placement'] == '0' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_standard'], '</option>
  961. <option value="1"', $context['field']['placement'] == '1' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_withicons'], '</option>
  962. <option value="2"', $context['field']['placement'] == '2' ? ' selected="selected"' : '', '>', $txt['custom_edit_placement_abovesignature'], '</option>
  963. </select>
  964. </dd>
  965. <dt>
  966. <a id="field_show_enclosed" href="', $scripturl, '?action=helpadmin;help=field_show_enclosed" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" align="top" /></a>
  967. <strong>', $txt['custom_edit_enclose'], ':</strong><br />
  968. <span class="smalltext">', $txt['custom_edit_enclose_desc'], '</span>
  969. </dt>
  970. <dd>
  971. <textarea name="enclose" rows="10" cols="50">', @$context['field']['enclose'], '</textarea>
  972. </dd>
  973. </dl>
  974. </fieldset>
  975. <fieldset>
  976. <legend>', $txt['custom_edit_input'], '</legend>
  977. <dl class="settings">
  978. <dt>
  979. <strong>', $txt['custom_edit_picktype'], ':</strong>
  980. </dt>
  981. <dd>
  982. <select name="field_type" id="field_type" onchange="updateInputBoxes();">
  983. <option value="text"', $context['field']['type'] == 'text' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_text'], '</option>
  984. <option value="textarea"', $context['field']['type'] == 'textarea' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_textarea'], '</option>
  985. <option value="select"', $context['field']['type'] == 'select' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_select'], '</option>
  986. <option value="radio"', $context['field']['type'] == 'radio' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_radio'], '</option>
  987. <option value="check"', $context['field']['type'] == 'check' ? ' selected="selected"' : '', '>', $txt['custom_profile_type_check'], '</option>
  988. </select>
  989. </dd>
  990. <dt id="max_length_dt">
  991. <strong>', $txt['custom_edit_max_length'], ':</strong><br />
  992. <span class="smalltext">', $txt['custom_edit_max_length_desc'], '</span>
  993. </dt>
  994. <dd id="max_length_dd">
  995. <input type="text" name="max_length" value="', $context['field']['max_length'], '" size="7" maxlength="6" class="input_text" />
  996. </dd>
  997. <dt id="dimension_dt">
  998. <strong>', $txt['custom_edit_dimension'], ':</strong>
  999. </dt>
  1000. <dd id="dimension_dd">
  1001. <strong>', $txt['custom_edit_dimension_row'], ':</strong> <input type="text" name="rows" value="', $context['field']['rows'], '" size="5" maxlength="3" class="input_text" />
  1002. <strong>', $txt['custom_edit_dimension_col'], ':</strong> <input type="text" name="cols" value="', $context['field']['cols'], '" size="5" maxlength="3" class="input_text" />
  1003. </dd>
  1004. <dt id="bbc_dt">
  1005. <strong>', $txt['custom_edit_bbc'], '</strong>
  1006. </dt>
  1007. <dd id="bbc_dd">
  1008. <input type="checkbox" name="bbc"', $context['field']['bbc'] ? ' checked="checked"' : '', ' class="input_check" />
  1009. </dd>
  1010. <dt id="options_dt">
  1011. <a href="', $scripturl, '?action=helpadmin;help=customoptions" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" /></a>
  1012. <strong>', $txt['custom_edit_options'], ':</strong><br />
  1013. <span class="smalltext">', $txt['custom_edit_options_desc'], '</span>
  1014. </dt>
  1015. <dd id="options_dd">
  1016. <div>';
  1017. foreach ($context['field']['options'] as $k => $option)
  1018. {
  1019. echo '
  1020. ', $k == 0 ? '' : '<br />', '<input type="radio" name="default_select" value="', $k, '"', $context['field']['default_select'] == $option ? ' checked="checked"' : '', ' class="input_radio" /><input type="text" name="select_option[', $k, ']" value="', $option, '" class="input_text" />';
  1021. }
  1022. echo '
  1023. <span id="addopt"></span>
  1024. [<a href="" onclick="addOption(); return false;">', $txt['custom_edit_options_more'], '</a>]
  1025. </div>
  1026. </dd>
  1027. <dt id="default_dt">
  1028. <strong>', $txt['custom_edit_default'], ':</strong>
  1029. </dt>
  1030. <dd id="default_dd">
  1031. <input type="checkbox" name="default_check"', $context['field']['default_check'] ? ' checked="checked"' : '', ' class="input_check" />
  1032. </dd>
  1033. </dl>
  1034. </fieldset>
  1035. <fieldset>
  1036. <legend>', $txt['custom_edit_advanced'], '</legend>
  1037. <dl class="settings">
  1038. <dt id="mask_dt">
  1039. <a id="custom_mask" href="', $scripturl, '?action=helpadmin;help=custom_mask" onclick="return reqWin(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.gif" class="icon" alt="', $txt['help'], '" align="top" /></a>
  1040. <strong>', $txt['custom_edit_mask'], ':</strong><br />
  1041. <span class="smalltext">', $txt['custom_edit_mask_desc'], '</span>
  1042. </dt>
  1043. <dd>
  1044. <select name="mask" id="mask" onchange="updateInputBoxes();">
  1045. <option value="nohtml"', $context['field']['mask'] == 'nohtml' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_nohtml'], '</option>
  1046. <option value="email"', $context['field']['mask'] == 'email' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_email'], '</option>
  1047. <option value="number"', $context['field']['mask'] == 'number' ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_number'], '</option>
  1048. <option value="regex"', strpos($context['field']['mask'], 'regex') === 0 ? ' selected="selected"' : '', '>', $txt['custom_edit_mask_regex'], '</option>
  1049. </select>
  1050. <br />
  1051. <span id="regex_div">
  1052. <input type="text" name="regex" value="', $context['field']['regex'], '" size="30" class="input_text" />
  1053. </span>
  1054. </dd>
  1055. <dt>
  1056. <strong>', $txt['custom_edit_privacy'], ':</strong>
  1057. <span class="smalltext">', $txt['custom_edit_privacy_desc'], '</span>
  1058. </dt>
  1059. <dd>
  1060. <select name="private" id="private" onchange="updateInputBoxes();" style="width: 100%">
  1061. <option value="0"', $context['field']['private'] == 0 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_all'], '</option>
  1062. <option value="1"', $context['field']['private'] == 1 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_see'], '</option>
  1063. <option value="2"', $context['field']['private'] == 2 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_owner'], '</option>
  1064. <option value="3"', $context['field']['private'] == 3 ? ' selected="selected"' : '', '>', $txt['custom_edit_privacy_none'], '</option>
  1065. </select>
  1066. </dd>
  1067. <dt id="can_search_dt">
  1068. <strong>', $txt['custom_edit_can_search'], ':</strong><br />
  1069. <span class="smalltext">', $txt['custom_edit_can_search_desc'], '</span>
  1070. </dt>
  1071. <dd id="can_search_dd">
  1072. <input type="checkbox" name="can_search"', $context['field']['can_search'] ? ' checked="checked"' : '', ' class="input_check" />
  1073. </dd>
  1074. <dt>
  1075. <strong>', $txt['custom_edit_active'], ':</strong><br />
  1076. <span class="smalltext">', $txt['custom_edit_active_desc'], '</span>
  1077. </dt>
  1078. <dd>
  1079. <input type="checkbox" name="active"', $context['field']['active'] ? ' checked="checked"' : '', ' class="input_check" />
  1080. </dd>
  1081. </dl>
  1082. </fieldset>
  1083. <div class="righttext">
  1084. <input type="submit" name="save" value="', $txt['save'], '" class="button_submit" />';
  1085. if ($context['fid'])
  1086. echo '
  1087. <input type="submit" name="delete" value="', $txt['delete'], '" onclick="return confirm(\'', $txt['custom_edit_delete_sure'], '\');" class="button_submit" />';
  1088. echo '
  1089. </div>
  1090. </div>
  1091. <span class="botslice"><span></span></span>
  1092. </div>
  1093. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1094. <input type="hidden" name="', $context['admin-ecp_token_var'], '" value="', $context['admin-ecp_token'], '" />
  1095. </form>
  1096. </div>
  1097. <br class="clear" />';
  1098. // Get the javascript bits right!
  1099. echo '
  1100. <script type="text/javascript"><!-- // --><![CDATA[
  1101. updateInputBoxes();
  1102. // ]]></script>';
  1103. }
  1104. // Results page for an admin search.
  1105. function template_admin_search_results()
  1106. {
  1107. global $context, $txt, $settings, $options, $scripturl;
  1108. echo '
  1109. <div class="cat_bar">
  1110. <h3 class="catbg">
  1111. <object id="quick_search">
  1112. <form action="', $scripturl, '?action=admin;area=search" method="post" accept-charset="', $context['character_set'], '" class="floatright">
  1113. <input type="text" name="search_term" value="', $context['search_term'], '" class="input_text" />
  1114. <input type="hidden" name="search_type" value="', $context['search_type'], '" />
  1115. <input type="submit" name="search_go" value="', $txt['admin_search_results_again'], '" class="button_submit" />
  1116. </form>
  1117. </object>
  1118. <span class="ie6_header floatleft"><img src="' . $settings['images_url'] . '/buttons/search.gif" alt="" />&nbsp;', sprintf($txt['admin_search_results_desc'], $context['search_term']), '</span>
  1119. </h3>
  1120. </div>
  1121. <div class="windowbg nopadding">
  1122. <span class="topslice"><span></span></span>
  1123. <div class="content">';
  1124. if (empty($context['search_results']))
  1125. {
  1126. echo '
  1127. <p class="centertext"><strong>', $txt['admin_search_results_none'], '</strong></p>';
  1128. }
  1129. else
  1130. {
  1131. echo '
  1132. <ol class="search_results">';
  1133. foreach ($context['search_results'] as $result)
  1134. {
  1135. // Is it a result from the online manual?
  1136. if ($context['search_type'] == 'online')
  1137. {
  1138. echo '
  1139. <li>
  1140. <p>
  1141. <a href="', $context['doc_scripturl'], '?topic=', $result['topic_id'], '.0" target="_blank" class="new_win"><strong>', $result['messages'][0]['subject'], '</strong></a>
  1142. <br /><span class="smalltext"><a href="', $result['category']['href'], '" target="_blank" class="new_win">', $result['category']['name'], '</a> &nbsp;/&nbsp;
  1143. <a href="', $result['board']['href'], '" target="_blank" class="new_win">', $result['board']['name'], '</a> /</span>
  1144. </p>
  1145. <p class="double_height">
  1146. ', $result['messages'][0]['body'], '
  1147. </p>
  1148. </li>';
  1149. }
  1150. // Otherwise it's... not!
  1151. else
  1152. {
  1153. echo '
  1154. <li class="windowbg">
  1155. <a href="', $result['url'], '"><strong>', $result['name'], '</strong></a> [', isset($txt['admin_search_section_' . $result['type']]) ? $txt['admin_search_section_' . $result['type']] : $result['type'] , ']';
  1156. if ($result['help'])
  1157. echo '
  1158. <p class="double_height">', $result['help'], '</p>';
  1159. echo '
  1160. </li>';
  1161. }
  1162. }
  1163. echo '
  1164. </ol>';
  1165. }
  1166. echo '
  1167. </div>
  1168. <span class="botslice"><span></span></span>
  1169. </div>
  1170. <br class="clear" />';
  1171. }
  1172. // Turn on and off certain key features.
  1173. function template_core_features()
  1174. {
  1175. global $context, $txt, $settings, $options, $scripturl;
  1176. echo '
  1177. <script type="text/javascript"><!-- // --><![CDATA[
  1178. function toggleItem(itemID)
  1179. {
  1180. // Toggle the hidden item.
  1181. var itemValueHandle = document.getElementById("feature_" + itemID);
  1182. itemValueHandle.value = itemValueHandle.value == 1 ? 0 : 1;
  1183. // Change the image, alternative text and the title.
  1184. document.getElementById("switch_" + itemID).src = \'', $settings['images_url'], '/admin/switch_\' + (itemValueHandle.value == 1 ? \'on\' : \'off\') + \'.png\';
  1185. document.getElementById("switch_" + itemID).alt = itemValueHandle.value == 1 ? \'', $txt['core_settings_switch_off'], '\' : \'', $txt['core_settings_switch_on'], '\';
  1186. document.getElementById("switch_" + itemID).title = itemValueHandle.value == 1 ? \'', $txt['core_settings_switch_off'], '\' : \'', $txt['core_settings_switch_on'], '\';
  1187. // Don\'t reload.
  1188. return false;
  1189. }
  1190. // ]]></script>
  1191. <div id="admincenter">';
  1192. if ($context['is_new_install'])
  1193. {
  1194. echo '
  1195. <div class="cat_bar">
  1196. <h3 class="catbg">
  1197. ', $txt['core_settings_welcome_msg'], '
  1198. </h3>
  1199. </div>
  1200. <div class="information">
  1201. ', $txt['core_settings_welcome_msg_desc'], '
  1202. </div>';
  1203. }
  1204. echo '
  1205. <form action="', $scripturl, '?action=admin;area=corefeatures;" method="post" accept-charset="', $context['character_set'], '">
  1206. <div class="cat_bar">
  1207. <h3 class="catbg">
  1208. ', $txt['core_settings_title'], '
  1209. </h3>
  1210. </div>';
  1211. $alternate = true;
  1212. foreach ($context['features'] as $id => $feature)
  1213. {
  1214. echo '
  1215. <div class="windowbg', $alternate ? '2' : '', '">
  1216. <span class="topslice"><span></span></span>
  1217. <div class="content features">
  1218. <img class="features_image png_fix" src="', $settings['default_images_url'], '/admin/feature_', $id, '.png" alt="', $feature['title'], '" />
  1219. <div class="features_switch" id="js_feature_', $id, '" style="display: none;">
  1220. <a href="', $scripturl, '?action=admin;area=featuresettings;sa=core;', $context['session_var'], '=', $context['session_id'], ';toggle=', $id, ';state=', $feature['enabled'] ? 0 : 1, '" onclick="return toggleItem(\'', $id, '\');">
  1221. <input type="hidden" name="feature_', $id, '" id="feature_', $id, '" value="', $feature['enabled'] ? 1 : 0, '" /><img src="', $settings['images_url'], '/admin/switch_', $feature['enabled'] ? 'on' : 'off', '.png" id="switch_', $id, '" style="margin-top: 1.3em;" alt="', $txt['core_settings_switch_' . ($feature['enabled'] ? 'off' : 'on')], '" title="', $txt['core_settings_switch_' . ($feature['enabled'] ? 'off' : 'on')], '" />
  1222. </a>
  1223. </div>
  1224. <h4>', ($feature['enabled'] && $feature['url'] ? '<a href="' . $feature['url'] . '">' . $feature['title'] . '</a>' : $feature['title']), '</h4>
  1225. <p>', $feature['desc'], '</p>
  1226. <div id="plain_feature_', $id, '">
  1227. <label for="plain_feature_', $id, '_radio_on"><input type="radio" name="feature_plain_', $id, '" id="plain_feature_', $id, '_radio_on" value="1"', $feature['enabled'] ? ' checked="checked"' : '', ' class="input_radio" />', $txt['core_settings_enabled'], '</label>
  1228. <label for="plain_feature_', $id, '_radio_off"><input type="radio" name="feature_plain_', $id, '" id="plain_feature_', $id, '_radio_off" value="0"', !$feature['enabled'] ? ' checked="checked"' : '', ' class="input_radio" />', $txt['core_settings_disabled'], '</label>
  1229. </div>
  1230. </div>
  1231. <span class="botslice clear_right"><span></span></span>
  1232. </div>';
  1233. $alternate = !$alternate;
  1234. }
  1235. echo '
  1236. <div class="righttext">
  1237. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1238. <input type="hidden" name="', $context['admin-core_token_var'], '" value="', $context['admin-core_token'], '" />
  1239. <input type="hidden" value="0" name="js_worked" id="js_worked" />
  1240. <input type="submit" value="', $txt['save'], '" name="save" class="button_submit" />
  1241. </div>
  1242. </form>
  1243. </div>
  1244. <br class="clear" />';
  1245. // Turn on the pretty javascript if we can!
  1246. echo '
  1247. <script type="text/javascript"><!-- // --><![CDATA[
  1248. document.getElementById(\'js_worked\').value = "1";';
  1249. foreach ($context['features'] as $id => $feature)
  1250. echo '
  1251. document.getElementById(\'js_feature_', $id, '\').style.display = "";
  1252. document.getElementById(\'plain_feature_', $id, '\').style.display = "none";';
  1253. echo '
  1254. // ]]></script>';
  1255. }
  1256. // This little beauty shows questions and answer from the captcha type feature.
  1257. function template_callback_question_answer_list()
  1258. {
  1259. global $txt, $context;
  1260. echo '
  1261. <dt>
  1262. <strong>', $txt['setup_verification_question'], '</strong>
  1263. </dt>
  1264. <dd>
  1265. <strong>', $txt['setup_verification_answer'], '</strong>
  1266. </dd>';
  1267. foreach ($context['question_answers'] as $data)
  1268. echo '
  1269. <dt>
  1270. <input type="text" name="question[', $data['id'], ']" value="', $data['question'], '" size="50" class="input_text verification_question" />
  1271. </dt>
  1272. <dd>
  1273. <input type="text" name="answer[', $data['id'], ']" value="', $data['answer'], '" size="50" class="input_text verification_answer" />
  1274. </dd>';
  1275. // Some blank ones.
  1276. for ($count = 0; $count < 3; $count++)
  1277. echo '
  1278. <dt>
  1279. <input type="text" name="question[]" size="50" class="input_text verification_question" />
  1280. </dt>
  1281. <dd>
  1282. <input type="text" name="answer[]" size="50" class="input_text verification_answer" />
  1283. </dd>';
  1284. echo '
  1285. <dt id="add_more_question_placeholder" style="display: none;"></dt><dd></dd>
  1286. <dt id="add_more_link_div" style="display: none;">
  1287. <a href="#" onclick="addAnotherQuestion(); return false;">&#171; ', $txt['setup_verification_add_more'], ' &#187;</a>
  1288. </dt><dd></dd>';
  1289. // The javascript needs to go at the end but we'll put it in this template for looks.
  1290. $context['settings_post_javascript'] .= '
  1291. var placeHolder = document.getElementById(\'add_more_question_placeholder\');
  1292. document.getElementById(\'add_more_link_div\').style.display = \'\';
  1293. ';
  1294. }
  1295. // Repairing boards.
  1296. function template_repair_boards()
  1297. {
  1298. global $context, $txt, $scripturl;
  1299. echo '
  1300. <div id="admincenter">
  1301. <div class="cat_bar">
  1302. <h3 class="catbg">',
  1303. $context['error_search'] ? $txt['errors_list'] : $txt['errors_fixing'] , '
  1304. </h3>
  1305. </div>
  1306. <div class="windowbg">
  1307. <span class="topslice"><span></span></span>
  1308. <div class="content">';
  1309. // Are we actually fixing them, or is this just a prompt?
  1310. if ($context['error_search'])
  1311. {
  1312. if (!empty($context['to_fix']))
  1313. {
  1314. echo '
  1315. ', $txt['errors_found'], ':
  1316. <ul>';
  1317. foreach ($context['repair_errors'] as $error)
  1318. echo '
  1319. <li>
  1320. ', $error, '
  1321. </li>';
  1322. echo '
  1323. </ul>
  1324. <p>
  1325. ', $txt['errors_fix'], '
  1326. </p>
  1327. <p class="padding">
  1328. <strong><a href="', $scripturl, '?action=admin;area=repairboards;fixErrors;', $context['session_var'], '=', $context['session_id'], '">', $txt['yes'], '</a> - <a href="', $scripturl, '?action=admin;area=maintain">', $txt['no'], '</a></strong>
  1329. </p>';
  1330. }
  1331. else
  1332. echo '
  1333. <p>', $txt['maintain_no_errors'], '</p>
  1334. <p class="padding">
  1335. <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
  1336. </p>';
  1337. }
  1338. else
  1339. {
  1340. if (!empty($context['redirect_to_recount']))
  1341. {
  1342. echo '
  1343. <p>
  1344. ', $txt['errors_do_recount'], '
  1345. </p>
  1346. <form action="', $scripturl, '?action=admin;area=maintain;sa=routine;activity=recount" id="recount_form" method="post">
  1347. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  1348. <input type="submit" name="recount" id="recount_now" value="', $txt['errors_recount_now'], '" />
  1349. </form>';
  1350. }
  1351. else
  1352. {
  1353. echo '
  1354. <p>', $txt['errors_fixed'], '</p>
  1355. <p class="padding">
  1356. <a href="', $scripturl, '?action=admin;area=maintain;sa=routine">', $txt['maintain_return'], '</a>
  1357. </p>';
  1358. }
  1359. }
  1360. echo '
  1361. </div>
  1362. <span class="botslice"><span></span></span>
  1363. </div>
  1364. </div>
  1365. <br class="clear" />';
  1366. if (!empty($context['redirect_to_recount']))
  1367. {
  1368. echo '
  1369. <script type="text/javascript"><!-- // --><![CDATA[
  1370. var countdown = 5;
  1371. doAutoSubmit();
  1372. function doAutoSubmit()
  1373. {
  1374. if (countdown == 0)
  1375. document.forms.recount_form.submit();
  1376. else if (countdown == -1)
  1377. return;
  1378. document.forms.recount_form.recount_now.value = "', $txt['errors_recount_now'], ' (" + countdown + ")";
  1379. countdown--;
  1380. setTimeout("doAutoSubmit();", 1000);
  1381. }
  1382. // ]]></script>';
  1383. }
  1384. }
  1385. ?>