Source for file control-panel.php

Documentation is available at control-panel.php

  1. <?php
  2. /* ******************************************************************** */
  3. /* CATALYST PHP Source Code */
  4. /* -------------------------------------------------------------------- */
  5. /* This program is free software; you can redistribute it and/or modify */
  6. /* it under the terms of the GNU General Public License as published by */
  7. /* the Free Software Foundation; either version 2 of the License, or */
  8. /* (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU General Public License for more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License */
  16. /* along with this program; if not, write to: */
  17. /* The Free Software Foundation, Inc., 59 Temple Place, Suite 330, */
  18. /* Boston, MA 02111-1307 USA */
  19. /* -------------------------------------------------------------------- */
  20. /* */
  21. /* Filename: control-panel.php */
  22. /* Author: Paul Waite */
  23. /* Description: Axyl control panel */
  24. /* */
  25. /* ******************************************************************** */
  26. /** @package core */
  27.  
  28. /** Standard (default) view */
  29. ("CP_VIEW_DEFAULT", 0);
  30. /** View of authentication & security settings */
  31. ("CP_VIEW_AUTH", 1);
  32. /** View of database settings */
  33. ("CP_VIEW_DB", 2);
  34. /** View of debugging settings */
  35. ("CP_VIEW_DEBUG", 3);
  36.  
  37. /** User data is maintained on the local database in Axyl format
  38. * This is the default. */
  39.  
  40. define("LOCAL_AUTH", 0);
  41. /** User data is maintained on a remote database */
  42. ("REMOTE_AUTH_REMOTEDB", 1);
  43. /** User data maintained on an LDAP server (not yet implemented) */
  44. ("REMOTE_AUTH_LDAP", 2);
  45. /** Used to indicate items do not have a remote mapping */
  46. ("NOT_MAPPED", "");
  47.  
  48.  
  49. $CPTABS = array(
  50. CP_VIEW_DEFAULT => "Main",
  51. CP_VIEW_AUTH => "Authentication & Security",
  52. CP_VIEW_DB => "Database",
  53. CP_VIEW_DEBUG => "Debugging"
  54. );
  55.  
  56. // Initialise view if required..
  57. if (!isset($cp_view)) {
  58. $cp_view = CP_VIEW_DEFAULT;
  59. }
  60.  
  61. // Local library has Axyl images..
  62. $LIBDIR = "/lib";
  63.  
  64. // Axyl installation settings..
  65. $AXYL_HOME = "";
  66. $AXYL_CONF = "/etc/axyl/axyl.conf";
  67. if (file_exists($AXYL_CONF)) {
  68. $result = exec("grep \"AXYL_HOME=\" $AXYL_CONF");
  69. if ($result != "") {
  70. $bits = explode("=", $result);
  71. if (is_dir($bits[1])) {
  72. $AXYL_HOME = $bits[1];
  73. }
  74. }
  75. }
  76.  
  77. // Name of our master form..
  78. $formname = "cpform";
  79.  
  80. // These are the candidate Axyl fields for remote
  81. // authentication mapping..
  82.  
  83. $REMOTE_AUTH_FIELDNAMES = array(
  84. "user_id",
  85. "password",
  86. "full_name",
  87. "honorific_prefix",
  88. "first_name",
  89. "mid_names",
  90. "last_name",
  91. "email",
  92. "address",
  93. "phone",
  94. "fax",
  95. "mobile"
  96. );
  97.  
  98. // ----------------------------------------------------------------------
  99. // Include required modules..
  100.  
  101. /** Sundry contants & defs */
  102. ("constants.php");
  103. /** Renderable module defs */
  104. ("renderable.php");
  105. /** Form handling */
  106. ("form-defs.php");
  107. /** Utilities */
  108. ("utils.php");
  109. /** Debugger defs */
  110. ("debugger.php");
  111. /** Record maintainer module */
  112. ("recmaint-defs.php");
  113. /** Application setup */
  114. ("application-defs.php");
  115.  
  116. // ----------------------------------------------------------------------
  117. // FUNCTIONS
  118.  
  119. /**
  120. * Determine the index of Nth database entry..
  121. * @access private
  122. */
  123. function getdbindex($Nth) {
  124. global $app;
  125. $dbix = -1; $dbpos = 0;
  126. for ($ix = 0; $ix < count($app->settings); $ix++) {
  127. $setting = $app->settings[$ix];
  128. if ($setting->name == "database") {
  129. if ($dbpos == $Nth) {
  130. $dbix = $ix;
  131. break;
  132. }
  133. else {
  134. $dbpos += 1;
  135. }
  136. }
  137. }
  138. return $dbix;
  139. }
  140. /**
  141. * Determine the index of last database entry..
  142. * @access private
  143. */
  144. function getlastdbindex() {
  145. global $app;
  146. $dbix = -1;
  147. for ($ix = 0; $ix < count($app->settings); $ix++) {
  148. $setting = $app->settings[$ix];
  149. if ($setting->name == "database") {
  150. $dbix = $ix;
  151. }
  152. }
  153. return $dbix;
  154. }
  155. /**
  156. * Delete the Nth database entry. Database entries are numbered
  157. * from zero (first database entry) upwards..
  158. * @access private
  159. */
  160. function deletedbentry($Nth) {
  161. global $app;
  162. $dbix = getdbindex($Nth);
  163. if ($dbix != -1) {
  164. $setting = $app->settings[$dbix];
  165. if ($setting->name == "database") {
  166. unset($app->settings[$dbix]);
  167. }
  168. }
  169. return $dbix;
  170. }
  171.  
  172. // ----------------------------------------------------------------------
  173. // CONVERSION OF OLD APPLICATION.PHP FILE TO NEW XML SCHEMA
  174.  
  175. $error = false;
  176. $user_msg = "";
  177. $appfile = new inputfile("application.php");
  178. if ($appfile->opened) {
  179. $appfile->readall();
  180. $appfile->closefile();
  181. $appstuff = $appfile->content;
  182. if (strstr($appstuff, "\$TEMPLATESDIR =")) {
  183. if (file_exists("$AXYL_HOME/lib/default-application.xml")) {
  184. copy("application.php", "application.php.bak");
  185. if (file_exists("application.php.bak")) {
  186.  
  187. if (is_writeable("application.php")) {
  188. copy("$AXYL_HOME/lib/application.php", "application.php");
  189. copy("$AXYL_HOME/lib/default-application.xml", "application.xml");
  190.  
  191. if (file_exists("application.xml")) {
  192.  
  193. $app = new application("application.xml");
  194. //echo "converting..<br>";
  195. // DEFINITIONS
  196. if (preg_match("/define\(\"APP_NAME\",[\s]*\"(.*?)\"/", $appstuff, $matches)) {
  197. $app->definitions["APP_NAME"] = $matches[1];
  198. //echo "setting APP_NAME to [" . $matches[1] . "]<br>";
  199. }
  200. if (preg_match("/define\(\"APP_PREFIX\",[\s]*\"(.*?)\"/", $appstuff, $matches)) {
  201. $app->definitions["APP_PREFIX"] = $matches[1];
  202. //echo "setting APP_PREFIX to [" . $matches[1] . "]<br>";
  203. }
  204.  
  205. // GLOBALS
  206. if (preg_match("/^[$]TEMPLATESDIR[\s]*\=[\s]*\"(.*?)\"/m", $appstuff, $matches)) {
  207. $app->globals["TEMPLATESDIR"] = $matches[1];
  208. //echo "setting TEMPLATESDIR to [" . $matches[1] . "]<br>";
  209. }
  210. if (preg_match("/^[$]IMAGESDIR[\s]*\=[\s]*\"(.*?)\"/m", $appstuff, $matches)) {
  211. $app->globals["IMAGESDIR"] = $matches[1];
  212. //echo "setting IMAGESDIR to [" . $matches[1] . "]<br>";
  213. }
  214. if (preg_match("/^[$]WEBMASTER_PERSON[\s]*\=[\s]*\"(.*?)\"/m", $appstuff, $matches)) {
  215. $app->globals["WEBMASTER_PERSON"] = $matches[1];
  216. //echo "setting WEBMASTER_PERSON to [" . $matches[1] . "]<br>";
  217. }
  218. if (preg_match("/^[$]WEBMASTER_EMAIL[\s]*\=[\s]*\"(.*?)\"/m", $appstuff, $matches)) {
  219. $app->globals["WEBMASTER_EMAIL"] = $matches[1];
  220. //echo "setting WEBMASTER_EMAIL to [" . $matches[1] . "]<br>";
  221. }
  222.  
  223. // SETTINGS
  224. if (preg_match("/^[$]RESPONSE->set_encoding\(\"(.*?)\"\)/m", $appstuff, $matches)) {
  225. $app->setparameter($matches[1], "encoding", "encoding");
  226. //echo "setting char encoding to [" . $matches[1] . "]<br>";
  227. }
  228. //else {
  229. // echo "char encoding defaulted<br>";
  230. //}
  231.  
  232.  
  233. if (preg_match("/^[$]RESPONSE->set_blocked_ips\((.*?)\)/m", $appstuff, $matches)) {
  234. $app->setparameter($matches[1], "badips", "badips");
  235. //echo "setting blocked ips to [" . $matches[1] . "]<br>";
  236. }
  237. //else {
  238. // echo "blocked ips defaulted<br>";
  239. //}
  240.  
  241.  
  242. if (preg_match("/^[$]RESPONSE->set_sessiontype\((.*?)\)/m", $appstuff, $matches)) {
  243. $app->setparameter(($matches[1] == "SESS_DATABASE_BACKED"), "database_backed", "database_backed");
  244. //echo "setting database-backed is " . ($matches[1] == "SESS_DATABASE_BACKED" ? "true" : "false") . "<br>";
  245. }
  246.  
  247. if (preg_match("/^[$]RESPONSE->set_lifetime\((.*?)\)/m", $appstuff, $matches)) {
  248. switch ($matches[1]) {
  249. case "SESS_FOREVER": $life = 315360000; break;
  250. case "SESS_1_YEAR": $life = 31536000; break;
  251. case "SESS_1_MONTH": $life = 2592000; break;
  252. case "SESS_1_WEEK": $life = 604800; break;
  253. case "SESS_1_DAY": $life = 86400; break;
  254. case "SESS_12_HOURS": $life = 43200; break;
  255. case "SESS_8_HOURS": $life = 28800; break;
  256. case "SESS_4_HOURS": $life = 14400; break;
  257. case "SESS_1_HOUR": $life = 3600; break;
  258. case "SESS_20_MINS": $life = 1200; break;
  259. case "SESS_BROWSER_LIFETIME": $life = -1; break;
  260. case "SESS_ZERO_LIFETIME": $life = 0; break;
  261. default: $life = -1;
  262. }
  263. $app->setparameter($life, "lifetime", "lifetime");
  264. //echo "setting cookie life to [" . $matches[1] . "($life)]<br>";
  265. }
  266.  
  267. if (preg_match("/^[$]RESPONSE->set_cookiename\((.*?)\)/m", $appstuff, $matches)) {
  268. if ($matches[1] != "APP_PREFIX . \"_session_id\"") {
  269. $app->setparameter($matches[1], "cookiename", "cookiename");
  270. //echo "setting cookiename to [" . $matches[1] . "]<br>";
  271. }
  272. //else {
  273. // echo "setting cookiename to default<br>";
  274. //}
  275. }
  276.  
  277. if (preg_match("/^[$]RESPONSE->set_keep\((.*?)\)/m", $appstuff, $matches)) {
  278. $app->setparameter(($matches[1] == "KEEP_ENABLED"), "keep", "keep");
  279. //echo "setting keep status " . ($matches[1] == "KEEP_ENABLED" ? "ON" : "OFF") . "<br>";
  280. }
  281.  
  282. if (preg_match("/^[$]RESPONSE->globalise_all\(\)/m", $appstuff, $matches)) {
  283. $app->setparameter(true, "globalise", "globalise");
  284. //echo "setting globalise all ON<br>";
  285. }
  286. else {
  287. $app->setparameter(false, "globalise", "globalise");
  288. //echo "setting globalise all OFF<br>";
  289. }
  290.  
  291. if (preg_match("/^[$]RESPONSE->set_compression_type\((.*?)\)/m", $appstuff, $matches)) {
  292. switch ($matches[1]) {
  293. case "NO_COMPRESSION": $comp = 0; break;
  294. case "BUILTIN_COMPRESSION": $comp = 1; break;
  295. case "CUSTOM_COMPRESSION": $comp = 2; break;
  296. default: $comp = 0;
  297. }
  298. $app->setparameter($comp, "compression_type", "compression_type");
  299. //echo "setting compression type to [" . $matches[1] . "($comp)]<br>";
  300. }
  301.  
  302. if (preg_match("/^[$]RESPONSE->set_compression_minsize\((.*?)\)/m", $appstuff, $matches)) {
  303. $app->setparameter($matches[1], "compression_threshold", "compression_threshold");
  304. //echo "setting compression threshold to [" . $matches[1] . "]<br>";
  305. }
  306. else {
  307. //echo "compression threshold is defaulted (0)<br>";
  308. }
  309.  
  310. if (preg_match("/^[$]RESPONSE->set_buffering_mode\((.*?)\)/m", $appstuff, $matches)) {
  311. $app->setparameter(($matches[1] == "BUFFERED"), "buffered_output", "buffered_output");
  312. //echo "setting buffered output " . ($matches[1] == "BUFFERED" ? "ON" : "OFF") . "<br>";
  313. }
  314.  
  315. if (preg_match("/^[$]RESPONSE->set_page_expirysecs\((.*?)\)/m", $appstuff, $matches)) {
  316. $app->setparameter($matches[1], "expiry", "expiry");
  317. //echo "setting page expiry to [" . $matches[1] . "]<br>";
  318. }
  319. //else {
  320. // echo "compression page expiry is defaulted (-1)<br>";
  321. //}
  322.  
  323.  
  324. if (preg_match("/^[$]RESPONSE->set_authentication_type\((.*?)\)/m", $appstuff, $matches)) {
  325. switch ($matches[1]) {
  326. case "NO_AUTHENTICATION": $auth = 0; break;
  327. case "HTTP_AUTHENTICATION": $auth = 1; break;
  328. case "FORM_AUTHENTICATION": $auth = 2; break;
  329. default: $auth = 2;
  330. }
  331. $app->setparameter($auth, "authtype", "authtype");
  332. //echo "setting authentication type to [" . $matches[1] . "($auth)]<br>";
  333. }
  334.  
  335. if (preg_match("/^[$]RESPONSE->on_authentication_fail\((.*?)(,(.*?))*?\)/m", $appstuff, $matches)) {
  336. switch ($matches[1]) {
  337. case "AUTHFAIL_DIE_MSG": $authf = 0; break;
  338. case "AUTHFAIL_DIE_SILENT": $authf = 1; break;
  339. case "AUTHFAIL_REDIRECT": $authf = 2; break;
  340. case "AUTHFAIL_GUEST": $authf = 3; break;
  341. default: $authf = 0;
  342. }
  343. $app->setparameter($authf, "authfail", "authfailopt");
  344. //echo "setting auth fail option to [" . $matches[1] . "($authf)]<br>";
  345. }
  346.  
  347. if (isset($matches[3])) {
  348. $authurl = preg_replace("/['\"]/", "", $matches[3]);
  349. $app->setparameter($authurl, "authfail", "authfailurl");
  350. //echo "setting auth fail URL to [$authurl]<br>";
  351. }
  352. //else {
  353. // echo "no URL<br>";
  354. //}
  355.  
  356.  
  357. if (preg_match("/^[$]RESPONSE->on_logins_exceeded\((.*?)(,(.*?))*?\)/m", $appstuff, $matches)) {
  358. switch ($matches[1]) {
  359. case "SESS_ALLOW": $logexc = 0; break;
  360. case "SESS_ALLOW_CULL": $logexc = 1; break;
  361. case "SESS_BLOCK_MSG": $logexc = 2; break;
  362. case "SESS_BLOCK_SILENT": $logexc = 3; break;
  363. case "SESS_BLOCK_REDIRECT": $logexc = 4; break;
  364. case "SESS_BLOCK_GUEST": $logexc = 5; break;
  365. default: $logexc = 0;
  366. }
  367. $app->setparameter($logexc, "loglimit", "logexceedopt");
  368. //echo "setting logins exceeded option to [" . $matches[1] . "]<br>";
  369. }
  370.  
  371. if (isset($matches[3])) {
  372. $logexcurl = preg_replace("/['\"]/", "", $matches[3]);
  373. $app->setparameter($logexcurl, "loglimit", "logexceedurl");
  374. //echo "setting logins exceeded URL to [$logexcurl]<br>";
  375. }
  376. //else {
  377. // echo "no URL<br>";
  378. //}
  379.  
  380.  
  381. if (preg_match("/^[$]RESPONSE->set_persistent_hosts\((.*?)\)/m", $appstuff, $matches)) {
  382. if ($matches[1] != "\"\"") {
  383. $app->setparameter($matches[1], "permhosts", "permhosts");
  384. //echo "setting persistent hosts list to [" . $matches[1] . "]<br>";
  385. }
  386. //else {
  387. // echo "null persistent hosts list.<br>";
  388. //}
  389. }
  390. //else {
  391. // echo "no persistent hosts.<br>";
  392. //}
  393.  
  394.  
  395. $patt = "RESPONSE->add_database\(\n";
  396. $patt .= "[\s]*?\"(.*?)\",.*\n"; // DB type
  397. $patt .= "[\s]*?\"(.*?)\",.*\n"; // name
  398. $patt .= "[\s]*?\"(.*?)\",.*\n"; // user
  399. $patt .= "[\s]*?\"(.*?)\",.*\n"; // password
  400. $patt .= "[\s]*?\"(.*?)\",.*\n"; // host
  401. $patt .= "[\s]*?\"(.*?)\".*\n"; // port
  402. $patt .= "(([\s])*?(DEFAULT_DATASOURCE))*"; // default flag
  403. // Purge existing database settings..
  404. $newsettings = array();
  405. for ($ix=0; $ix < count($app->settings); $ix++) {
  406. $setting = $app->settings[$ix];
  407. if ($setting->name != "database") {
  408. $newsettings[] = $setting;
  409. }
  410. }
  411. $app->settings = $newsettings;
  412.  
  413. preg_match_all("/$patt/", $appstuff, $matches);
  414. for ($i=0; $i < count($matches[0]); $i++) {
  415. /*
  416. echo "database defs:<br>";
  417. echo " type: " . $matches[1][$i] . "<br>";
  418. echo " name: " . $matches[2][$i] . "<br>";
  419. echo " user: " . $matches[3][$i] . "<br>";
  420. echo " pass: " . $matches[4][$i] . "<br>";
  421. echo " host: " . $matches[5][$i] . "<br>";
  422. echo " port: " . $matches[6][$i] . "<br>";
  423. */
  424. $dbsetting = new setting("database", "add_database");
  425. $parameter = new parameter("type", "string");
  426. $parameter->setvalue($matches[1][$i]);
  427. $dbsetting->addparameter($parameter->name, $parameter);
  428.  
  429. $parameter = new parameter("name", "string");
  430. $parameter->setvalue($matches[2][$i]);
  431. $dbsetting->addparameter($parameter->name, $parameter);
  432.  
  433. $parameter = new parameter("user", "string");
  434. $parameter->setvalue($matches[3][$i]);
  435. $dbsetting->addparameter($parameter->name, $parameter);
  436.  
  437. $parameter = new parameter("password", "string");
  438. $parameter->setvalue($matches[4][$i]);
  439. $dbsetting->addparameter($parameter->name, $parameter);
  440.  
  441. $parameter = new parameter("host", "string");
  442. $parameter->setvalue($matches[5][$i]);
  443. $dbsetting->addparameter($parameter->name, $parameter);
  444.  
  445. $parameter = new parameter("port", "integer");
  446. $parameter->setvalue($matches[6][$i]);
  447. $dbsetting->addparameter($parameter->name, $parameter);
  448. if (isset($matches[9][$i]) && $matches[9][$i] == "DEFAULT_DATASOURCE") {
  449. $defaultdb = $dbsetting;
  450. //echo "default DB<br>";
  451. }
  452. else {
  453. $secdbs[] = $dbsetting;
  454. //echo "secondary DB<br>";
  455. }
  456. } // for
  457.  
  458. if (isset($defaultdb)) {
  459. $app->settings[] = $defaultdb;
  460. }
  461. if (isset($secdbs)) {
  462. foreach ($secdbs as $db) {
  463. $app->settings[] = $db;
  464. }
  465. }
  466.  
  467. // Save all conversion changes..
  468. $app->save();
  469. $user_msg = "Your application configuration has been converted to XML format. ";
  470. $user_msg .= "The old file has been saved as 'application.php.bak'. A new file ";
  471. $user_msg .= "'application.xml' has been created, which should only ever be ";
  472. $user_msg .= "changed by using this Control Panel.";
  473. }
  474. else {
  475. $error = true;
  476. $user_msg = "Conversion aborted due to problems creating XML file."
  477. . "<br>Please fix & retry.";
  478. }
  479. }
  480. else {
  481. $error = true;
  482. $user_msg = "Conversion aborted. File 'application.php must be "
  483. . "writeable by webserver.<br>Please fix & retry.";
  484. }
  485. } // // application.php.bak exists
  486. else {
  487. $error = true;
  488. $user_msg = "Conversion aborted due to problems backing up data."
  489. . "<br>Please fix & retry.";
  490. }
  491. } // lib/default-application.xml exists
  492. } // old format file
  493. } // appfile opened
  494. // ----------------------------------------------------------------------
  495. // FAILSAFE TO DEFAULT
  496. // Failsafe - if no application XML file, copy default into place..
  497.  
  498. if (!file_exists("application.xml")) {
  499. if (file_exists("$AXYL_HOME/lib/default-application.xml")) {
  500. copy("$AXYL_HOME/lib/default-application.xml", "application.xml");
  501. }
  502. }
  503.  
  504. // ----------------------------------------------------------------------
  505. // READ XML APPLICATION SETTINGS
  506. // Read in current application..
  507.  
  508. if (file_exists("application.xml") && is_writeable("application.xml")) {
  509. $app = new application();
  510. }
  511. else {
  512. $error = true;
  513. $user_msg = "Error: Please make 'application.xml' writeable to the webserver.";
  514. }
  515.  
  516. // ----------------------------------------------------------------------
  517. // SYNCHRONIZE
  518. // Make sure that the current application XML file has all the required
  519. // defs, globals & settings. For this we have to refer to the Axyl HOME
  520. // file default-application.xml, so find Axyl HOME first of all..
  521.  
  522. if (!$error) {
  523. if (is_dir($AXYL_HOME)) {
  524. $defaultapp = new application("$AXYL_HOME/lib/default-application.xml");
  525. $synced = $app->synchronize($defaultapp);
  526. if ($synced) {
  527. $app->save();
  528. $app = new application();
  529. }
  530. }
  531. }
  532.  
  533. // ----------------------------------------------------------------------
  534. // POST ACTION
  535. // Check if they opted to set things to default..
  536.  
  537. if (!$error) {
  538. if (isset($_default_x)) {
  539. if (file_exists("$AXYL_HOME/lib/default-application.xml")) {
  540. copy("$AXYL_HOME/lib/default-application.xml", "application.xml");
  541. $app = new application();
  542. }
  543. }
  544. elseif (isset($_recmaintpost_form) && $_recmaintpost_form == $formname) {
  545. /*
  546. // DEBUGGING: POSTED VARS DUMP
  547. $s .= "<table border=1 cellpadding=2 cellspacing=0>";
  548. if (isset($HTTP_POST_VARS)) {
  549. $s .= "<tr><td colspan=2><h4>POSTed Vars</h4></td></tr>";
  550. reset($HTTP_POST_VARS);
  551. while (list($key, $val) = each($HTTP_POST_VARS)) {
  552. $s .= "<tr><td>$key</td><td>" . displayvar($val) . "</td></tr>";
  553. }
  554. }
  555. $s .= "</table>";
  556. */
  557. switch ($cp_view) {
  558. case CP_VIEW_AUTH:
  559. // Defaults
  560. if ($cp_passwd_encryption == "") $cp_passwd_encryption = "none";
  561. if ($cp_passwd_expiry_days == "") $cp_passwd_expiry_days = "0";
  562. if ($cp_passwd_max_attempts == "") $cp_passwd_max_attempts = "0";
  563. if ($cp_passwd_history_cycle == "") $cp_passwd_history_cycle = "0";
  564. if ($cp_passwd_delay_ms == "") $cp_passwd_delay_ms = "0";
  565. if ($cp_passwd_min_chars == "") $cp_passwd_min_chars = "0";
  566. if ($cp_passwd_char_uniqueness == "") $cp_passwd_char_uniqueness = "low";
  567. $app->setparameter($cp_authtype, "authtype", "authtype");
  568. $app->setparameter($cp_authfailopt, "authfail", "authfailopt");
  569. $app->setparameter($cp_authfailurl, "authfail", "authfailurl");
  570. $app->setparameter($cp_passwd_encryption, "security_profile", "passwd_encryption");
  571. $app->setparameter($cp_passwd_expiry_days, "security_profile", "passwd_expiry_days");
  572. $app->setparameter($cp_passwd_max_attempts, "security_profile", "passwd_max_attempts");
  573. $app->setparameter($cp_passwd_history_cycle, "security_profile", "passwd_history_cycle");
  574. $app->setparameter($cp_passwd_delay_ms, "security_profile", "passwd_delay_ms");
  575. $app->setparameter($cp_passwd_min_chars, "security_profile", "passwd_min_chars");
  576. $app->setparameter($cp_passwd_char_uniqueness, "security_profile", "passwd_char_uniqueness");
  577. $app->setparameter(isset($cp_passwd_alphanum_mixed), "security_profile", "passwd_alphanum_mixed");
  578. $app->setparameter(isset($cp_passwd_apply_stopwords), "security_profile", "passwd_apply_stopwords");
  579. $app->setparameter($cp_logexceedopt, "loginlimit", "logexceedopt");
  580. $app->setparameter($cp_logexceedurl, "loginlimit", "logexceedurl");
  581. $app->setparameter($cp_badips, "badips", "badips");
  582. // Remote authorisation fields..
  583. $app->setparameter($cp_remote_auth_source, "remote_authentication", "remote_auth_source");
  584. $app->setparameter($cp_remote_auth_method, "remote_authentication", "remote_auth_method");
  585. $app->setparameter($cp_remote_auth_dbname, "remote_authentication", "remote_auth_dbname");
  586. $app->setparameter($cp_remote_auth_tablename, "remote_authentication", "remote_auth_tablename");
  587. // Refresh all mappings..
  588. $app->delparameter("remote_authentication", "remote_auth_mappings");
  589. foreach ($REMOTE_AUTH_FIELDNAMES as $axyl_field) {
  590. $varname = "cp_remote_auth_mapping_$axyl_field";
  591. if (isset($$varname) && $$varname != "") {
  592. $app->setparameter($$varname, "remote_authentication", "remote_auth_mappings", $axyl_field, "array");
  593. }
  594. }
  595. break;
  596. case CP_VIEW_DB:
  597. // Database Definition Deletes
  598. if (isset($_recmaintpost_dels) && $_recmaintpost_dels != "") {
  599. $delids = explode(FIELD_DELIM, $_recmaintpost_dels);
  600. $delixs = array();
  601. foreach ($delids as $dbid) {
  602. $ix = getdbindex($dbid);
  603. if ($ix != -1) {
  604. $delixs[] = $ix;
  605. }
  606. }
  607. foreach ($delixs as $ix) {
  608. unset($app->settings[$ix]);
  609. }
  610. }
  611. // DATABASES
  612. if (isset($_recmaintpost_data) && $_recmaintpost_data != "") {
  613. $dbrecs = explode(RECORD_DELIM, $_recmaintpost_data);
  614. $dbfields = explode(",", $_recmaintpost_flds);
  615. foreach ($dbrecs as $dbrec) {
  616. $dbvalues = explode(FIELD_DELIM, $dbrec);
  617. $dbid = array_shift($dbvalues);
  618. $dbsetting = new setting("database", "add_database");
  619. $pos = 0;
  620. foreach ($dbfields as $dbfield) {
  621. $value = $dbvalues[$pos++];
  622. switch ($dbfield) {
  623. case "dbname":
  624. $parameter = new parameter("name", "string");
  625. $dbname = $value;
  626. break;
  627. case "dbtype":
  628. $parameter = new parameter("type", "string");
  629. break;
  630. case "dbuser":
  631. $parameter = new parameter("user", "string");
  632. break;
  633. case "dbpassword":
  634. $parameter = new parameter("password", "string");
  635. break;
  636. case "dbhost":
  637. $parameter = new parameter("host", "string");
  638. break;
  639. case "dbport":
  640. $parameter = new parameter("port", "integer");
  641. break;
  642. case "dbenc":
  643. $parameter = new parameter("enc", "string");
  644. break;
  645. case "dbdatestyle":
  646. $parameter = new parameter("datestyle", "string");
  647. break;
  648. }
  649. $parameter->setvalue($value);
  650. $dbsetting->addparameter($parameter->name, $parameter);
  651. }
  652. $ix = get_settingindex($app, $dbname);
  653. if ($ix > -1) {
  654. $app->settings[$ix] = $dbsetting;
  655. }
  656. else {
  657. // Insert new database at end of existing databases
  658. // so that they stay pleasingly grouped..
  659. $lastdbix = getlastdbindex();
  660. if ($lastdbix == -1) {
  661. $app->settings[] = $dbsetting;
  662. }
  663. else {
  664. $ix = 0;
  665. $settings = array();
  666. foreach ($app->settings as $setting) {
  667. $settings[] = $setting;
  668. if ($ix == $lastdbix) {
  669. $settings[] = $dbsetting;
  670. }
  671. $ix += 1;
  672. }
  673. $app->settings = $settings;
  674. }
  675. }
  676. } // foreach dbrecs
  677. } // database save
  678. // Database ordering - determines default database
  679. elseif (isset($_recmaintpost_order) && $_recmaintpost_order != "") {
  680. $dborderings = explode(FIELD_DELIM, $_recmaintpost_order);
  681. $dbsettings = array();
  682. foreach ($dborderings as $dborder) {
  683. $ix = getdbindex($dborder);
  684. $dbsettings[] = $app->settings[$ix];
  685. }
  686. $firstdbix = getdbindex(0);
  687. for ($ix=0; $ix < count($dbsettings); $ix++) {
  688. $app->settings[$ix + $firstdbix] = $dbsettings[$ix];
  689. }
  690. }
  691. $app->setparameter(isset($cp_database_backed), "database_backed", "database_backed");
  692. $app->setparameter($cp_permhosts, "permhosts", "permhosts");
  693. break;
  694. case CP_VIEW_DEBUG:
  695. $app->globals["SQL_EXEC_THRESHOLD"] = $cp_sql_exec_threshold;
  696. $app->setparameter(isset($cp_debug_on), "debug_on", "debug_on");
  697. $app->setparameter(isset($cp_response_timer), "response_timer", "response_timer");
  698. // Unpack debug classes..
  699. $debug_classes = 0;
  700. foreach ($cp_debug_classes as $class) {
  701. $debug_classes |= $class;
  702. }
  703. $app->setparameter($debug_classes, "debug_classes", "debug_classes");
  704. // Unpack debug outputs..
  705. $debug_output = 0;
  706. foreach ($cp_debug_output as $output) {
  707. $debug_output |= $output;
  708. }
  709. $app->setparameter($debug_output, "debug_output", "debug_output");
  710. break;
  711. default:
  712. // DEFINITIONS
  713. $app->definitions["APP_PREFIX"] = $cp_app_prefix;
  714. $app->definitions["APP_NAME"] = $cp_app_name;
  715. // GLOBALS
  716. $app->globals["TEMPLATESDIR"] = $cp_templatesdir;
  717. $app->globals["IMAGESDIR"] = $cp_imagesdir;
  718. $app->globals["CACHEDIR"] = $cp_cachedir;
  719. $app->globals["CATALOGDIR"] = $cp_catalogdir;
  720. $app->globals["CMDIR"] = $cp_cmdir;
  721. $app->globals["INCDIR"] = $cp_incdir;
  722. $app->globals["WEBMASTER_PERSON"] = $cp_webmaster_person;
  723. $app->globals["WEBMASTER_EMAIL"] = $cp_webmaster_email;
  724. // Handle the HTTP host setting. If it has the word 'default' in it
  725. // then we assume there is no HTTP_HOST override being made..
  726. if (stristr($cp_http_host, "default")) {
  727. $cp_http_host = "";
  728. }
  729. // SETTINGS
  730. $app->setparameter($cp_dtd_html, "dtd", "dtd", "html");
  731. $app->setparameter($cp_dtd_wml, "dtd", "dtd", "wml");
  732. if (isset($cp_multilang)) {
  733. $app->setparameter(true, "multilang", "multilang");
  734. $app->setparameter("UTF-8", "encoding", "encoding");
  735. }
  736. else {
  737. $app->setparameter(false, "multilang", "multilang");
  738. $app->setparameter($cp_encoding, "encoding", "encoding");
  739. }
  740. $app->setparameter($cp_http_host, "http_host", "http_host");
  741. $app->setparameter($cp_cookiename, "cookiename", "cookiename");
  742. $app->setparameter($cp_lifetime, "lifetime", "lifetime");
  743. $app->setparameter(isset($cp_guest_browser_lifetime), "guest_browser_lifetime", "guest_browser_lifetime");
  744. $app->setparameter(isset($cp_session_track_logins), "session_track_logins", "session_track_logins");
  745. $app->setparameter($cp_expiry, "expiry", "expiry");
  746. $app->setparameter(isset($cp_microsites_enabled), "microsites_enabled", "microsites_enabled");
  747. $app->setparameter(isset($cp_metadata_enabled), "metadata_enabled", "metadata_enabled");
  748. $app->setparameter(isset($cp_buffered_output), "buffered_output", "buffered_output");
  749. $app->setparameter($cp_compression_type, "compression_type", "compression_type");
  750. $app->setparameter($cp_compression_threshold, "compression_threshold", "compression_threshold");
  751. $app->setparameter(isset($cp_keep), "keep", "keep");
  752. $app->setparameter(isset($cp_globalise), "globalise", "globalise");
  753. } // switch
  754. // Save it
  755. $app->save();
  756. $app = new application();
  757. }
  758. }
  759.  
  760. // ----------------------------------------------------------------------
  761. // BOILERPLATING
  762.  
  763. $s = <<< EOS
  764. <html>
  765. <head>
  766. <title>Axyl Control Panel</title>
  767. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  768. <meta name="generator" content="Catalyst IT Axyl">
  769. <style type="text/css">
  770. margin: 0px 0px 0px 0px;
  771. font-family: Verdana, Arial, Helvetica, sans-serif;
  772. color: #605728;
  773. font-size: 9pt;
  774. font-style: normal;
  775. font-weight: normal;
  776. scrollbar-face-color: #f7f7f7;
  777. scrollbar-highlight-color: #b2b1b1;
  778. scrollbar-shadow-color: #b2b1b1;
  779. scrollbar-3dlight-color: white;
  780. scrollbar-arrow-color: #c9c9c9;
  781. scrollbar-track-color: #f5f5f5;
  782. scrollbar-darkshadow-color: white;
  783. }
  784. p, td, th, ol, ul, li, input, textarea, select {
  785. font-family: Arial, Helvetica, sans-serif;
  786. font-size: 9pt;
  787. font-style: normal;
  788. font-weight: normal;
  789. color: #605728;
  790. }
  791. input, textarea, select {
  792. font-family: Arial, Helvetica, sans-serif;
  793. font-size: 9pt;
  794. font-style: normal;
  795. font-weight: normal;
  796. }
  797. p {
  798. line-height: 115%;
  799. }
  800. hr {
  801. height: 1px;
  802. color: black;
  803. margin-top: 0;
  804. margin-bottom: 0;
  805. }
  806. form {
  807. margin: 0px;
  808. padding: 0px;
  809. }
  810. a {
  811. color: #AC9D46;
  812. text-decoration: none;
  813. }
  814. a:hover {
  815. color: #AC9D46;
  816. text-decoration: underline;
  817. }
  818. a:active {
  819. color: #AC9D46;
  820. }
  821. a:visited {
  822. color: #AC9D46;
  823. }
  824. th {
  825. text-align: left;
  826. }
  827.  
  828. h1, h2, h5, h3, h4, h6 {
  829. font-family: Verdana, Arial, Helvetica, sans-serif;
  830. font-weight: bold;
  831. margin-top: 2px;
  832. margin-bottom: 2px;
  833. }
  834. h1 { color:#605728; font-size:125%; text-transform:capitalize; }
  835. h2 { color:#605728; font-size:120%; }
  836. h3 { color:#605728; font-size:115%; font-weight:bold;}
  837. h4 { color:#605728; font-size:105%; font-weight:bold;}
  838. h5 { color:#605728; font-size:100%; font-weight:bold;}
  839. h6 { color:#605728; font-size:96%; font-weight:bold;}
  840. .axform {
  841. font-family: Arial, Helvetica, sans-serif;
  842. font-size: 95%;
  843. padding: 0px;
  844. }
  845. .axcombo {
  846. font-family: Arial, Helvetica, sans-serif;
  847. font-size: 95%;
  848. height: 20px;
  849. padding-left: 2px;
  850. }
  851. .axlistbox {
  852. font-family: Arial, Helvetica, sans-serif;
  853. font-size: 95%;
  854. padding-left: 2px;
  855. }
  856. .axtxtbox {
  857. font-family: Arial, Helvetica, sans-serif;
  858. font-size: 95%;
  859. width: 250px;
  860. height: 22px;
  861. padding-left: 2px;
  862. vertical-align: middle;
  863. }
  864. .axmemo {
  865. font-family: Arial, Helvetica, sans-serif;
  866. font-size: 95%;
  867. width: 250px;
  868. height: 100px;
  869. padding-left: 2px;
  870. }
  871. .axdatetime {
  872. font-family: Arial, Helvetica, sans-serif;
  873. font-size: 95%;
  874. width: 150px;
  875. height: 22px;
  876. padding-left: 2px;
  877. }
  878. .axnumbox {
  879. font-family: Arial, Helvetica, sans-serif;
  880. font-size: 95%;
  881. width: 80px;
  882. height: 22px;
  883. padding-left: 2px;
  884. padding-right: 2px;
  885. vertical-align: middle;
  886. text-align: right;
  887. }
  888. .axchkbox {
  889. vertical-align: middle;
  890. }
  891. .axfmlbl {
  892. font-family: Arial, Helvetica, sans-serif;
  893. font-size: 95%;
  894. font-weight: normal;
  895. vertical-align: top;
  896. color: black;
  897. }
  898. .axtitle {
  899. font-family: Arial, Helvetica, sans-serif;
  900. font-size:110%;
  901. color: white;
  902. background-color: #66700F;
  903. font-weight: bold;
  904. }
  905. .axfoot {
  906. height: 12px;
  907. background-color: #66700F;
  908. }
  909. .axhdg {
  910. font-family: Arial, Helvetica, sans-serif;
  911. font-size:100%;
  912. color: white;
  913. background-color: #898437;
  914. font-weight: bold;
  915. }
  916. .axsubhdg {
  917. font-family: Arial, Helvetica, sans-serif;
  918. font-size:100%;
  919. color: white;
  920. background-color: #66700F;
  921. font-weight: bold;
  922. }
  923. .axfg {
  924. color: #605728;
  925. font-weight: normal;
  926. }
  927. .axhl {
  928. color: red;
  929. font-weight: bold;
  930. }
  931. .axerror {
  932. color: red;
  933. }
  934. .axbgwhite {
  935. color: black;
  936. background-color: white;
  937. }
  938. .axbglite {
  939. color: black;
  940. background-color: #EAEBDF;
  941. }
  942. .axbgdark {
  943. color: white;
  944. background-color: #DEDFD4;
  945. }
  946. .axbgdarker {
  947. color: white;
  948. background-color: #66700F;
  949. }
  950. </style>
  951. <script language="javascript">
  952. var keyfield = new Array();
  953. var curid = new Array();
  954. var newid = new Array();
  955. function setUTF8mode(multilang) {
  956. if (multilang) {
  957. document.forms.$formname.cp_encoding.value='UTF-8';
  958. document.forms.$formname.cp_encoding.disabled=true;
  959. }
  960. else {
  961. document.forms.$formname.cp_encoding.readonly=false;
  962. document.forms.$formname.cp_encoding.disabled=false;
  963. }
  964. return true;
  965. }
  966. var pgchanged=false;
  967. function tabclick(tabno) {
  968. if (pgchanged) {
  969. msg = 'WARNING:\\n';
  970. msg += 'You have changed data on this page. Before you can switch to another\\n';
  971. msg += 'page, you must either Save this one, or Reset it.\\n\\n';
  972. alert(msg);
  973. }
  974. else {
  975. location = '$PHP_SELF?cp_view=' + tabno;
  976. }
  977. }
  978. function setchgd() {
  979. pgchanged = true;
  980. }
  981. function resetchgd() {
  982. pgchanged = false;
  983. document.forms.$formname.reset();
  984. }
  985. function control_auth_fields(auth,formname) {
  986. var form = eval('document.forms.'+formname);
  987. var mode = (auth.value == 0);
  988. if (form) {
  989. for (var i = 0; i < form.length; i++) {
  990. var e = form.elements[i];
  991. if (e.id == 'auth_fields') {
  992. if (e.type.substr(0,6) == 'select') e.disabled = mode;
  993. else e.readOnly = mode;
  994. if (mode == true) {
  995. e.style.backgroundColor = '#ededed';
  996. }
  997. else {
  998. e.style.backgroundColor = '#ffffff';
  999. }
  1000. }
  1001. }
  1002. }
  1003. }
  1004. </script>
  1005. <script type="text/javascript" src="$LIBDIR/js/recmaint.js"></script>
  1006. <script type="text/javascript" src="$LIBDIR/js/fieldvalidation.js"></script>
  1007. </head>
  1008. <body>
  1009. EOS;
  1010. // ----------------------------------------------------------------------
  1011. // MAIN FORM GENERATION
  1012.  
  1013. // Width of large form elements..
  1014.  
  1015. $fullwidth = 540;
  1016. $halfwidth = ceil($fullwidth * 0.50);
  1017. $thirdwidth = ceil($fullwidth * 0.37);
  1018. $quartwidth = ceil($fullwidth * 0.25);
  1019. $ewidth = $halfwidth . "px"; // Normal text fields
  1020. $awidth = $fullwidth . "px"; // Full field width
  1021. $cbowidth = $quartwidth . "px"; // Normal combos
  1022. $cwidth = $thirdwidth . "px"; // Wide combos
  1023.  
  1024. if ($cp_view == CP_VIEW_DB) {
  1025. // DATABASE LISTBOX
  1026. // Defined early so that buttons can be registered..
  1027. $database_listbox = new form_combofield("dbid");
  1028. $database_listbox->setclass("axlistbox");
  1029. // Make a new record maintainer, and attach the buttons..
  1030. $maintainer = new recmaintainer($formname, $database_listbox);
  1031. $bup = new form_imagebutton("_up", "", "", "$LIBDIR/img/_up.gif", "Move up", 57, 15);
  1032. $bdown = new form_imagebutton("_down", "", "", "$LIBDIR/img/_down.gif", "Move down", 57, 15);
  1033. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete database", 57, 15);
  1034. $badd = new form_imagebutton("_add", "", "", "$LIBDIR/img/_add.gif", "Add new database", 57, 15);
  1035. }
  1036.  
  1037. // Standard buttons
  1038. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save your settings", 57, 15);
  1039. $breset = new form_imagebutton("_reset", "", "", "$LIBDIR/img/_reset.gif", "Reverse your changes", 57, 15);
  1040. $breset->set_onclick("resetchgd()");
  1041. $bdef = new form_imagebutton("_default", "", "", "$LIBDIR/img/_default.gif", "Replace ALL settings with defaults", 57, 15);
  1042. $bdef->set_confirm_text("This will over-write your WHOLE file with the default configuration (ie. not just the current page). Continue?");
  1043.  
  1044. // If we have a database maintainer, register all buttons..
  1045. if ($cp_view == CP_VIEW_DB) {
  1046. // Register all relevant buttons to the maintainer..
  1047. $maintainer->register_button("up" , $bup);
  1048. $maintainer->register_button("down", $bdown);
  1049. $maintainer->register_button("del", $bdel);
  1050. $maintainer->register_button("add", $badd);
  1051. $maintainer->register_button("save", $bsave);
  1052. }
  1053.  
  1054. $Tapp = new table();
  1055. $Tapp->setwidth($fullwidth);
  1056. $Tapp->setalign("center");
  1057.  
  1058. // Initialise tab buttons string..
  1059. $tab_btn = new img("$LIBDIR/img/_cptabtip.gif", "", $CPTABS[0], 6, 23);
  1060. $rendered_tabs = $tab_btn->render();
  1061. foreach ($CPTABS as $tabno => $tabdesc) {
  1062. $tab_btn = new img("$LIBDIR/img/_cptab" . $tabno . ".gif", "_tab" . $tabno, $tabdesc, 84, 23);
  1063. $tab_btn->set_onclick("tabclick('$tabno')");
  1064. $rendered_tabs .= $tab_btn->render();
  1065. }
  1066. $Tapp->tr();
  1067. $Tapp->td($rendered_tabs, "text-align:right");
  1068. $Tapp->td_alignment("right");
  1069.  
  1070. // ......................................................................
  1071. // Heading
  1072.  
  1073.  
  1074.  
  1075. switch ($cp_view) {
  1076. case CP_VIEW_DEFAULT: $view = "Main Settings"; break;
  1077. case CP_VIEW_AUTH: $view = "User & Security Settings"; break;
  1078. case CP_VIEW_DB: $view = "Database Settings"; break;
  1079. case CP_VIEW_DEBUG: $view = "Debug Settings"; break;
  1080. } // switch
  1081.  
  1082. $Tapp->tr("axtitle");
  1083. $Tapp->td("<b>AXYL CONTROL PANEL - $view</b>", "axtitle");
  1084. $Tapp->td_css("vertical-align:center;height:30px;padding-left:5px;");
  1085. if ($user_msg != "") {
  1086. $Tapp->tr("axsubhdg");
  1087. $Tapp->td($user_msg, "color:#F5DD64;text-align:center;");
  1088. }
  1089. elseif ($synced) {
  1090. $Tapp->tr("axsubhdg");
  1091. $Tapp->td("The Axyl configuration structure was successfully updated.", "color:#F5DD64;text-align:center;");
  1092. }
  1093.  
  1094. if (!$error) {
  1095. // ......................................................................
  1096. // Toolbar..
  1097. $toolbar = array();
  1098. $toolbar[] = $breset;
  1099. $toolbar[] = $bdef;
  1100. $toolbar[] = $bsave;
  1101. $Tbar = new table("toolbar");
  1102. $Tbar->tr();
  1103. $tools = "";
  1104. foreach ($toolbar as $tool) {
  1105. $tools .= $tool->render();
  1106. }
  1107. $Tbar->th($tools, "text-align:right");
  1108. $Tapp->tr("axbglite");
  1109. $Tapp->td( $Tbar->render() );
  1110.  
  1111. $tbox = new form_textfield();
  1112. $tbox->setstyle("width:$ewidth");
  1113. $tbox->setclass("axtxtbox");
  1114. $tbox->set_onchange('setchgd()');
  1115.  
  1116. $chkbox = new form_checkbox();
  1117. $chkbox->setclass("axchkbox");
  1118. $chkbox->setvalue("yes");
  1119. $chkbox->checked = false;
  1120. $chkbox->set_onclick('setchgd()');
  1121.  
  1122. // ......................................................................
  1123. // DEFINITIONS
  1124. // Installs text field in $Tin table..
  1125. function entryField($label, $fieldname, &$valarray, $tooltip="") {
  1126. global $app, $Tin, $tbox, $bg;
  1127. $mybox = $tbox;
  1128. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1129. $Tin->tr($bg);
  1130. $Tin->td( $label, "axfg" );
  1131. $mybox->setvalue($valarray[$fieldname]);
  1132. if ($tooltip != "") {
  1133. $mybox->settitle($tooltip);
  1134. }
  1135. $Tin->td( $mybox->render("cp_" . strtolower($fieldname)) );
  1136. }
  1137. // Installs info row in $Tin table..
  1138. function infoField($info) {
  1139. global $app, $Tin, $tbox, $bg;
  1140. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1141. $Tin->tr($bg);
  1142. $Tin->td();
  1143. $Tin->td($info, "axfg");
  1144. $Tin->td_css("font-style:italic;font-size:80%");
  1145. }
  1146. // Installs text field in $Tin table..
  1147. function integerField($label, $fieldname, &$valarray, $intlimit, $pxwidth=100, $tooltip="") {
  1148. global $app, $Tin, $tbox, $bg;
  1149. $mybox = $tbox;
  1150. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1151. $Tin->tr($bg);
  1152. $Tin->td( $label, "axfg" );
  1153. $mybox->setstyle("width:" . $pxwidth . "px");
  1154. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1155. $mybox->setvalue($valarray[$fieldname]);
  1156. if ($tooltip != "") {
  1157. $mybox->settitle($tooltip);
  1158. }
  1159. $Tin->td( $mybox->render("cp_" . strtolower($fieldname)) );
  1160. }
  1161.  
  1162. // For toggling background colour..
  1163. $bg = "axbgdark";
  1164. switch ($cp_view) {
  1165. // ......................................................................
  1166. // AUTH & SECURITY SETTINGS
  1167. case CP_VIEW_AUTH:
  1168. $Tapp->tr("axsubhdg");
  1169. $Tapp->td("<b>Local password controls</b>", "axsubhdg");
  1170. $Tin = new table("local_pass");
  1171. $Tin->setpadding(2);
  1172. $Tin->tr("axbgdark");
  1173. $Tin->td( "Password encryption method:", "axfg" );
  1174. $Fenc = new form_combofield("cp_passwd_encryption");
  1175. $Fenc->setclass("axcombo");
  1176. $Fenc->setstyle("width:$cwidth");
  1177. $Fenc->set_onchange("setchgd()");
  1178. $Fenc->settitle("Determines the method used for encrypting/decrypting the submitted user password.");
  1179. $Fenc->additem("none", "No encryption (plaintext)");
  1180. $Fenc->additem("md5", "Standard MD5 encrypted password");
  1181. $Fenc->additem("md5salted", "Salted MD5 in '*salt*salted_md5' format");
  1182. $Fenc->additem("custom", "Use custom password functions");
  1183. $Fenc->setvalue($app->getparameter("security_profile", "passwd_encryption"));
  1184. $Tin->td( $Fenc->render() );
  1185. $mybox = $tbox;
  1186. $label = "Password expiry days"; $fld = "passwd_expiry_days"; $style = "width:50px"; $intlimit = 999;
  1187. $mybox->setstyle($style);
  1188. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1189. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1190. $mybox->settitle(
  1191. "Days before a new password expires. After this time the user will be "
  1192. . "required to choose a new password. Set to zero to disable this "
  1193. . "feature."
  1194. );
  1195. $Tin->tr("axbglite");
  1196. $Tin->td( "$label:", "axfg" );
  1197. $Tin->td( $mybox->render("cp_" . $fld) );
  1198. $label = "Allowed password failures"; $fld = "passwd_max_attempts"; $style = "width:50px"; $intlimit = 99;
  1199. $mybox->setstyle($style);
  1200. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1201. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1202. $mybox->settitle(
  1203. "Number of consecutive times the user can fail to supply the correct password before "
  1204. . "the account is locked. Locked accounts require an administrator to unlock them. "
  1205. . "Set to zero to allow any number of failures."
  1206. );
  1207. $Tin->tr("axbgdark");
  1208. $Tin->td( "$label:", "axfg" );
  1209. $Tin->td( $mybox->render("cp_" . $fld) );
  1210. $label = "Password history cycle"; $fld = "passwd_history_cycle"; $style = "width:50px"; $intlimit = 999;
  1211. $mybox->setstyle($style);
  1212. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1213. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1214. $mybox->settitle(
  1215. "Number of passwords the system will remember for each user. This prevents re-use of "
  1216. . "passwords chosen in the recent past. Set to zero to disable this feature."
  1217. );
  1218. $Tin->tr("axbglite");
  1219. $Tin->td( "$label:", "axfg" );
  1220. $Tin->td( $mybox->render("cp_" . $fld) );
  1221. $label = "Minimum password length"; $fld = "passwd_min_chars"; $style = "width:50px"; $intlimit = 99;
  1222. $mybox->setstyle($style);
  1223. $mybox->set_onblur("limitInt(this, 1, $intlimit)");
  1224. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1225. $mybox->settitle(
  1226. "The minimum number of characters a new password must have to be acceptable."
  1227. );
  1228. $Tin->tr("axbgdark");
  1229. $Tin->td( "$label:", "axfg" );
  1230. $Tin->td( $mybox->render("cp_" . $fld) );
  1231. $Tin->tr("axbglite");
  1232. $Tin->td( "Level of char uniqueness:", "axfg" );
  1233. $Fpunq = new form_combofield();
  1234. $Fpunq->setclass("axcombo");
  1235. $Fpunq->setstyle("width:$cwidth");
  1236. $Fpunq->set_onchange('setchgd()');
  1237. $Fpunq->settitle(
  1238. "A level of character uniqueness a new password must have. This helps prevent the "
  1239. . "choice of silly passwords containing repeating character sequences."
  1240. );
  1241. $Fpunq->additem("none", "No requirement");
  1242. $Fpunq->additem("low", "Low");
  1243. $Fpunq->additem("medium", "Medium");
  1244. $Fpunq->additem("high", "High");
  1245. $Fpunq->setvalue($app->getparameter("security_profile", "passwd_char_uniqueness"));
  1246. $Tin->td( $Fpunq->render("cp_passwd_char_uniqueness") );
  1247. $mychkbox = $chkbox;
  1248. $mychkbox->checked = $app->getparameter("security_profile", "passwd_alphanum_mixed");
  1249. $mychkbox->settitle(
  1250. "If checked, this will require a mix of numbers and alphabetic characters in "
  1251. . "a new password. Such passwords are generally stronger."
  1252. );
  1253. $Tin->tr("axbgdark");
  1254. $Tin->td( "Require mix of alpha & numerics:", "axfg" );
  1255. $Tin->td( $mychkbox->render("cp_passwd_alphanum_mixed") );
  1256. $mychkbox = $chkbox;
  1257. $mychkbox->checked = $app->getparameter("security_profile", "passwd_apply_stopwords");
  1258. $mychkbox->settitle(
  1259. "If checked, the system will check a new password against a database of common "
  1260. . "'bad' words which people use in their choices, and prevent them selecting "
  1261. . "words which are considered easy to crack, including variations of their own "
  1262. . "name and user logon ID."
  1263. );
  1264. $Tin->tr("axbglite");
  1265. $Tin->td( "Apply stop-words to password:", "axfg" );
  1266. $Tin->td( $mychkbox->render("cp_passwd_apply_stopwords") );
  1267.  
  1268. $Tin->set_width_profile("50%,50%");
  1269. $Tapp->tr();
  1270. $Tapp->td( $Tin->render() );
  1271.  
  1272. $Tapp->tr("axsubhdg");
  1273. $Tapp->td("<b>Login control</b>", "axsubhdg");
  1274. $Tin = new table("login");
  1275. $Tin->setpadding(2);
  1276. $Tin->tr("axbgdark");
  1277. $Tin->td( "Login method:", "axfg" );
  1278. $Fcomp = new form_combofield();
  1279. $Fcomp->setclass("axcombo");
  1280. $Fcomp->setstyle("width:$cwidth");
  1281. $Fcomp->set_onchange('setchgd()');
  1282. $Fcomp->settitle(
  1283. "Select the type of login method - the usual is via a custom Axyl form. HTTP "
  1284. . "authentication uses the browser-based popup form."
  1285. );
  1286. $Fcomp->additem(0, "No authentication");
  1287. $Fcomp->additem(1, "HTTP authentication");
  1288. $Fcomp->additem(2, "Axyl login form");
  1289. $Fcomp->setvalue($app->getparameter("authtype", "authtype"));
  1290. $Tin->td( $Fcomp->render("cp_authtype") );
  1291. $Tin->tr("axbglite");
  1292. $Tin->td( "On failed login:", "axfg" );
  1293. $Fcomp = new form_combofield();
  1294. $Fcomp->setclass("axcombo");
  1295. $Fcomp->setstyle("width:$cwidth");
  1296. $Fcomp->set_onchange('setchgd()');
  1297. $Fcomp->settitle(
  1298. "Actions to take when the user fails on login. Note that some of these have "
  1299. . "implications for security - for example you might want to have the system give "
  1300. . "no feedback in some cases. In others a pretty webpage might be the best option."
  1301. );
  1302. $Fcomp->additem(0, "Display basic fail message");
  1303. $Fcomp->additem(1, "Die silently");
  1304. $Fcomp->additem(2, "Re-direct to URL (below)");
  1305. $Fcomp->additem(3, "Login as guest instead");
  1306. $Fcomp->setvalue($app->getparameter("authfail", "authfailopt"));
  1307. $Tin->td( $Fcomp->render("cp_authfailopt") );
  1308. $Tin->tr("axbgdark");
  1309. $Tin->td( "Failed login re-direct URL:", "axfg" );
  1310. $mybox = $tbox;
  1311. $mybox->settitle(
  1312. "Supply the URL to re-direct to on failed login."
  1313. );
  1314. $mybox->setvalue($app->getparameter("authfail", "authfailurl"));
  1315. $Tin->td( $mybox->render("cp_authfailurl") );
  1316. $Tin->tr("axbglite");
  1317. $Tin->td( "Login delay after failure (mS):", "axfg" );
  1318. $mybox = $tbox;
  1319. $mybox->setstyle("width:90px");
  1320. $mybox->set_onblur("limitInt(this, 0, 9999)");
  1321. $mybox->settitle(
  1322. "A delay time (in milliseconds) applied after a failed login. This acts as a "
  1323. . "control on automated password hacking scripts which repeatedly try passwords "
  1324. . "to crack an account."
  1325. );
  1326. $mybox->setvalue($app->getparameter("security_profile", "passwd_delay_ms"));
  1327. $Tin->td( $mybox->render("cp_passwd_delay_ms") );
  1328. $Tin->tr("axbgdark");
  1329. $Tin->td( "On login limit exceeded:", "axfg" );
  1330. $Flogexc = new form_combofield();
  1331. $Flogexc->setclass("axcombo");
  1332. $Flogexc->setstyle("width:$cwidth");
  1333. $Flogexc->set_onchange('setchgd()');
  1334. $Flogexc->settitle(
  1335. "Actions to take when user session (login) limit is exceeded. This only applies "
  1336. . "if the account has a non-zero limit set on it."
  1337. );
  1338. $Flogexc->additem(0, "Take no action");
  1339. $Flogexc->additem(1, "Allow, cull oldest sessions");
  1340. $Flogexc->additem(2, "Deny access, display message");
  1341. $Flogexc->additem(3, "Deny access silently");
  1342. $Flogexc->additem(4, "Redirect to a URL (below)");
  1343. $Flogexc->additem(5, "Login as guest instead");
  1344. $Flogexc->setvalue($app->getparameter("loginlimit", "logexceedopt"));
  1345. $Tin->td( $Flogexc->render("cp_logexceedopt") );
  1346. $Tin->tr("axbglite");
  1347. $Tin->td( "Login excess re-direct URL:", "axfg" );
  1348. $mybox = $tbox;
  1349. $mybox->settitle(
  1350. "If re-directing to a webpage, enter the URL for the page here."
  1351. );
  1352. $mybox->setvalue($app->getparameter("loginlimit", "logexceedurl"));
  1353. $Tin->td( $mybox->render("cp_logexceedurl") );
  1354. $Tin->set_width_profile("50%,50%");
  1355. $Tapp->tr();
  1356. $Tapp->td( $Tin->render() );
  1357. // ......................................................................
  1358. // REMOTE AUTHENTICATION
  1359. $Tapp->tr("axsubhdg");
  1360. $Tapp->td("<b>Remote authentication</b>", "axsubhdg");
  1361. $Tin = new table("remote");
  1362. $Tin->setpadding(2);
  1363.  
  1364. $Tin->tr("axbgdark");
  1365. $Tin->td( "User authentication source:", "axfg" );
  1366. $Fauthsrc = new form_combofield("cp_remote_auth_source");
  1367. $Fauthsrc->setclass("axcombo");
  1368. $Fauthsrc->setstyle("width:$cwidth");
  1369. $Fauthsrc->set_onchange("setchgd();control_auth_fields(this,'$formname')");
  1370. $Fauthsrc->settitle(
  1371. "Determines the source used for acquiring login userid/password information for "
  1372. . "authentication. The default is to use the local Axyl ax_user table. If you "
  1373. . "specify a remote database, that database must be defined in the database "
  1374. . "setup section of this control panel."
  1375. );
  1376. $Fauthsrc->additem(LOCAL_AUTH, "Local authentication (default)");
  1377. $Fauthsrc->additem(REMOTE_AUTH_REMOTEDB, "Remote database");
  1378. //$Fauthsrc->additem(REMOTE_AUTH_LDAP, "From LDAP server");
  1379. $remote_auth_source = $app->getparameter("remote_authentication", "remote_auth_source");
  1380. $Fauthsrc->setvalue($remote_auth_source);
  1381. $Tin->td( $Fauthsrc->render() );
  1382. $Tin->tr("axbglite");
  1383. $Tin->td( "Password encryption method:", "axfg" );
  1384. $Fauthmeth = new form_combofield("cp_remote_auth_method");
  1385. $Fauthmeth->setclass("axcombo");
  1386. $Fauthmeth->setstyle("width:$cwidth");
  1387. $Fauthmeth->set_onchange("setchgd()");
  1388. $Fauthmeth->setid("auth_fields");
  1389. $Fauthmeth->settitle(
  1390. "Determines the method used for authenticating the submitted remote user password. "
  1391. . "Select one of the common methods, otherwise choose the custom option, and define "
  1392. . "the algorithm using the 'custom_password_authentication()' function, in your "
  1393. . "local copy of 'application.php'."
  1394. );
  1395. $Fauthmeth->additem("none", "No encryption (plaintext)");
  1396. $Fauthmeth->additem("md5", "Standard MD5 encrypted password");
  1397. $Fauthmeth->additem("md5salted", "Salted MD5 in '*salt*salted_md5' format");
  1398. $Fauthmeth->additem("custom", "Use custom password functions");
  1399. $Fauthmeth->setvalue($app->getparameter("remote_authentication", "remote_auth_method"));
  1400. $Tin->td( $Fauthmeth->render() );
  1401. $Tin->tr("axbgdark");
  1402. $Tin->td( "Remote database:", "axfg" );
  1403. $Fauthdb = new form_combofield("cp_remote_auth_dbname");
  1404. $Fauthdb->setclass("axcombo");
  1405. $Fauthdb->setstyle("width:$cwidth");
  1406. $Fauthdb->set_onchange('setchgd()');
  1407. $Fauthdb->setid("auth_fields");
  1408. $Fauthdb->settitle(
  1409. "If you selected 'remote database' above then select the database the user "
  1410. . "authentication data is held on here."
  1411. );
  1412. // Get defined databases..
  1413. $dbs = $app->get_setting("database");
  1414. if ($dbs === false) $databases = array();
  1415. elseif (is_array($dbs)) $databases = $dbs;
  1416. else $databases[0] = $dbs;
  1417. $Fauthdb->additem("");
  1418. foreach ($databases as $database) {
  1419. // Populate listbox..
  1420. $dbname = $database->getparameter("name");
  1421. $Fauthdb->additem($dbname);
  1422. }
  1423. $Fauthdb->setvalue($app->getparameter("remote_authentication", "remote_auth_dbname"));
  1424. $Tin->td( $Fauthdb->render() );
  1425. $Tin->tr("axbglite");
  1426. $Tin->td( "Remote user table name:", "axfg" );
  1427. $mybox = $tbox;
  1428. $mybox->setid("auth_fields");
  1429. $mybox->setstyle("width:$cwidth");
  1430. $mybox->settitle(
  1431. "This is the name of the table on the remote database which holds the user "
  1432. . "authentication data such as userid and password."
  1433. );
  1434. $mybox->setvalue($app->getparameter("remote_authentication", "remote_auth_tablename"));
  1435. $Tin->td( $mybox->render("cp_remote_auth_tablename") );
  1436.  
  1437. foreach ($REMOTE_AUTH_FIELDNAMES as $axyl_field) {
  1438. $Tin->tr("axbgdark");
  1439. $Tin->td( "&raquo;&nbsp;remote field for $axyl_field:", "axfg" );
  1440. $mybox = $tbox;
  1441. $mybox->setid("auth_fields");
  1442. $mybox->setstyle("width:$cwidth");
  1443. $mybox->settitle(
  1444. "Enter the name of the remote field corresponding to the local '$axyl_field' field."
  1445. );
  1446. $mapping = $app->getparameter("remote_authentication", "remote_auth_mappings", $axyl_field);
  1447. $mybox->setvalue( $mapping !== false ? $mapping : "" );
  1448. $Tin->td( $mybox->render("cp_remote_auth_mapping_$axyl_field") );
  1449. }
  1450. $Tin->tr("axbgdark");
  1451. $Tin->td();
  1452. $Tin->td(
  1453. "Only enter names of mapped fields, leaving unmapped ones blank. "
  1454. . "Note: user_id and password are mandatory.",
  1455. "axfg"
  1456. );
  1457. $Tin->td_css("font-style:italic;font-size:80%");
  1458. $Tin->set_width_profile("50%,50%");
  1459. $Tapp->tr();
  1460. $Tapp->td( $Tin->render() );
  1461. // ......................................................................
  1462. // MISC SETTINGS
  1463. $Tapp->tr("axsubhdg");
  1464. $Tapp->td("<b>Miscellaneous settings</b>", "axsubhdg");
  1465. $Tin = new table("misc");
  1466. $Tin->setpadding(2);
  1467. $Tin->tr("axbglite");
  1468. $Tin->td( "IP addresses to block:", "axfg" );
  1469. $mybox = $tbox;
  1470. $mybox->settitle(
  1471. "This is used to block specific IP addresses which are causing a problem "
  1472. . "accessing the website. Any IP listed here will be denied access."
  1473. );
  1474. $mybox->setvalue(str_replace("\"", "", $app->getparameter("badips", "badips")));
  1475. $Tin->td( $mybox->render("cp_badips") );
  1476. $Tin->tr("axbglite");
  1477. $Tin->td();
  1478. $Tin->td(
  1479. "A comma-delimited list of IP addresses which are to be denied access.",
  1480. "axfg"
  1481. );
  1482. $Tin->td_css("font-style:italic;font-size:80%");
  1483. $Tin->set_width_profile("50%,50%");
  1484. $Tapp->tr();
  1485. $Tapp->td( $Tin->render() );
  1486. break;
  1487.  
  1488. // ......................................................................
  1489. // DATABASE SETTINGS
  1490. case CP_VIEW_DB:
  1491. $Tapp->tr("axsubhdg");
  1492. $Tapp->td("<b>Database connections</b>", "axsubhdg");
  1493. $Tin = new table("dbsettings");
  1494. $Tin->setpadding(2);
  1495. $database_listbox->setstyle("width:$ewidth;");
  1496. $database_listbox->size = 6;
  1497. // Get defined databases..
  1498. $dbs = $app->get_setting("database");
  1499. if ($dbs === false) $databases = array();
  1500. elseif (is_array($dbs)) $databases = $dbs;
  1501. else $databases[0] = $dbs;
  1502. $dbid = 0;
  1503. foreach ($databases as $database) {
  1504. // Populate listbox..
  1505. $dbname = $database->getparameter("name");
  1506. $database_listbox->additem($dbid, $dbname);
  1507. // Populate maintainer data. The maintainer add_record method
  1508. // requires an associative array keyed on listbox key id..
  1509. $rec = array(
  1510. "dbtype" => $database->getparameter("type"),
  1511. "dbname" => $dbname,
  1512. "dbuser" => $database->getparameter("user"),
  1513. "dbpassword" => $database->getparameter("password"),
  1514. "dbhost" => $database->getparameter("host"),
  1515. "dbport" => $database->getparameter("port"),
  1516. "dbenc" => $database->getparameter("enc"),
  1517. "dbdatestyle" => $database->getparameter("datestyle")
  1518. );
  1519. $maintainer->add_record($dbid, $rec);
  1520. if (!isset($firstrec)) {
  1521. $firstrec = $rec;
  1522. }
  1523. $dbid += 1;
  1524. } // foreach
  1525. // Now set the defaults for each of the fields. These are
  1526. // necessary for when a new record is created..
  1527. $defaults = array(
  1528. "dbtype" => "postgres",
  1529. "dbname" => "",
  1530. "dbuser" => "",
  1531. "dbpassword" => "",
  1532. "dbhost" => "",
  1533. "dbport" => "",
  1534. "dbenc" => "UNICODE",
  1535. "dbdatestyle" => "ISO"
  1536. );
  1537. $maintainer->add_defaults($defaults);
  1538. if (!isset($firstrec)) {
  1539. $firstrec = $defaults;
  1540. }
  1541. // The listbox field..
  1542. $database_listbox->settitle(
  1543. "Databases which this website needs to connect to. The first will be the "
  1544. . "default database."
  1545. );
  1546. $database_listbox->setvalue($firstrec["dbname"]);
  1547. $Tin->tr("axbgdark");
  1548. $Tin->td( $database_listbox->render() );
  1549. $Tin->td_width("50%");
  1550. $Tin2 = new table();
  1551. $Tin2->td(
  1552. "NB: The ordering of this list is important. The first "
  1553. . "database will be the default connection.",
  1554. "axfg"
  1555. );
  1556. $Tin2->td_css("font-style:italic;font-size:80%");
  1557. $Tin2->td_alignment("", "top");
  1558. $bdel->setstyle("padding-top:4px");
  1559. $Tin2->td(
  1560. $badd->render() . "<br>"
  1561. . $bup->render() . "<br>"
  1562. . $bdown->render() . "<br>"
  1563. . $bdel->render()
  1564. );
  1565. $Tin2->td_alignment("right", "top");
  1566. $Tin->td( $Tin2->render() );
  1567. $Tin->td_width("50%");
  1568. $Tin->td_alignment("", "top");
  1569. // ..................................................................
  1570. // Database type field..
  1571. $Fdbtype = new form_combofield("dbtype", "", $firstrec["dbtype"]);
  1572. $Fdbtype->setclass("axcombo");
  1573. $Fdbtype->settitle(
  1574. "The type of database it is. This determines the database interface "
  1575. . "module for executing your queries."
  1576. );
  1577. $maintainer->register_field($Fdbtype);
  1578. $Fdbtype->additem("postgres", "Postgres");
  1579. $Fdbtype->additem("odbc", "ODBC");
  1580. $Fdbtype->additem("mssql", "MS SQL Server");
  1581. $Fdbtype->additem("mysql", "MySQL");
  1582. $Fdbtype->additem("oracle", "Oracle");
  1583. $Fdbtype->setstyle("width:$cbowidth;");
  1584. $Tin->tr("axbglite");
  1585. $Tin->td( "Database type:", "axfg" );
  1586. $Tin->td( $Fdbtype->render() );
  1587. // ..................................................................
  1588. // Database name field..
  1589. $Fdbname = new form_textfield("dbname", "", $firstrec["dbname"]);
  1590. $maintainer->register_field($Fdbname);
  1591. $Fdbname->setstyle("width:$ewidth;");
  1592. $Fdbname->setclass("axtxtbox");
  1593. $Fdbname->settitle(
  1594. "The unique name of this database, as used in the connect string."
  1595. );
  1596. $Tin->tr("axbgdark");
  1597. $Tin->td( "Database name:", "axfg" );
  1598. $Tin->td( $Fdbname->render() );
  1599. // ..................................................................
  1600. // Database user field..
  1601. $Fdbuser = new form_textfield("dbuser", "", $firstrec["dbuser"]);
  1602. $maintainer->register_field($Fdbuser);
  1603. $Fdbuser->setstyle("width:$ewidth;");
  1604. $Fdbuser->setclass("axtxtbox");
  1605. $Fdbuser->settitle(
  1606. "The name of a user who is permitted to connect to the database."
  1607. );
  1608. $Tin->tr("axbglite");
  1609. $Tin->td( "Username:", "axfg" );
  1610. $Tin->td( $Fdbuser->render() );
  1611. // ..................................................................
  1612. // Database password field..
  1613. $Fdbpassword = new form_textfield("dbpassword", "", $firstrec["dbpassword"]);
  1614. $maintainer->register_field($Fdbpassword);
  1615. $Fdbpassword->setstyle("width:$ewidth;");
  1616. $Fdbpassword->setclass("axtxtbox");
  1617. $Fdbpassword->settitle(
  1618. "If the database requires a password to authenticate the connection, then "
  1619. . "enter it here, otherwise leave blank."
  1620. );
  1621. $Tin->tr("axbgdark");
  1622. $Tin->td( "User password:", "axfg" );
  1623. $Tin->td( $Fdbpassword->render() );
  1624. // ..................................................................
  1625. // Database host field..
  1626. $Fdbhost = new form_textfield("dbhost", "", $firstrec["dbhost"]);
  1627. $maintainer->register_field($Fdbhost);
  1628. $Fdbhost->setstyle("width:$ewidth;");
  1629. $Fdbhost->setclass("axtxtbox");
  1630. $Fdbhost->settitle(
  1631. "For a locally hosted database, leave blank. However, if this database "
  1632. . "lives on a remote machine, enter the hostname of that machine here."
  1633. );
  1634. $Tin->tr("axbglite");
  1635. $Tin->td( "Hostname:", "axfg" );
  1636. $Tin->td( $Fdbhost->render() );
  1637. // ..................................................................
  1638. // Database port field..
  1639. $Fdbport = new form_textfield("dbport", "", $firstrec["dbport"]);
  1640. $maintainer->register_field($Fdbport);
  1641. $Fdbport->setstyle("width:$ewidth;");
  1642. $Fdbport->setclass("axtxtbox");
  1643. $Fdbport->settitle(
  1644. "For a locally hosted database leave this blank. For a remotely hosted "
  1645. . "database, you would usually enter '5432' here."
  1646. );
  1647. $Tin->tr("axbgdark");
  1648. $Tin->td( "Port number:", "axfg" );
  1649. $Tin->td( $Fdbport->render() );
  1650. $Tin->set_width_profile("50%,50%");
  1651. // ..................................................................
  1652. // Database char encoding field..
  1653. $Fdbenc = new form_combofield("dbenc", "", $firstrec["dbenc"]);
  1654. $Fdbenc->setclass("axcombo");
  1655. $Fdbenc->setstyle("width:$cwidth;");
  1656. $Fdbenc->settitle(
  1657. "Make sure you set this to the encoding that the database was created "
  1658. . "with. In Postgres you can find this out by listing the databases "
  1659. . "in 'psql'."
  1660. );
  1661. $maintainer->register_field($Fdbenc);
  1662. $Fdbenc->additem("", "default");
  1663. $Fdbenc->additem("SQL_ASCII", "ASCII");
  1664. $Fdbenc->additem("UNICODE", "Unicode (UTF-8)");
  1665. $Fdbenc->additem("EUC_JP", "Japanese EUC");
  1666. $Fdbenc->additem("EUC_CN", "Chinese EUC");
  1667. $Fdbenc->additem("EUC_KR", "Korean EUC");
  1668. $Fdbenc->additem("JOHAB", "Korean EUC (Hangle base)");
  1669. $Fdbenc->additem("EUC_TW", "Taiwan EUC");
  1670. $Fdbenc->additem("MULE_INTERNAL", "Mule internal code");
  1671. $Fdbenc->additem("LATIN1", "ISO 8859-1/ECMA 94 (Latin alphabet no.1)");
  1672. $Fdbenc->additem("LATIN2", "ISO 8859-2/ECMA 94 (Latin alphabet no.2)");
  1673. $Fdbenc->additem("LATIN3", "ISO 8859-3/ECMA 94 (Latin alphabet no.3)");
  1674. $Fdbenc->additem("LATIN4", "ISO 8859-4/ECMA 94 (Latin alphabet no.4)");
  1675. $Fdbenc->additem("LATIN5", "ISO 8859-9/ECMA 128 (Latin alphabet no.5)");
  1676. $Fdbenc->additem("LATIN6", "ISO 8859-10/ECMA 144 (Latin alphabet no.6)");
  1677. $Fdbenc->additem("LATIN7", "ISO 8859-13 (Latin alphabet no.7)");
  1678. $Fdbenc->additem("LATIN8", "ISO 8859-14 (Latin alphabet no.8)");
  1679. $Fdbenc->additem("LATIN9", "ISO 8859-15 (Latin alphabet no.9)");
  1680. $Fdbenc->additem("LATIN10", "ISO 8859-16/ASRO SR 14111 (Latin alphabet no.10)");
  1681. $Fdbenc->additem("ISO_8859_5", "ISO 8859-5/ECMA 113 (Latin/Cyrillic)");
  1682. $Fdbenc->additem("ISO_8859_6", "ISO 8859-6/ECMA 114 (Latin/Arabic)");
  1683. $Fdbenc->additem("ISO_8859_7", "ISO 8859-7/ECMA 118 (Latin/Greek)");
  1684. $Fdbenc->additem("ISO_8859_8", "ISO 8859-8/ECMA 121 (Latin/Hebrew)");
  1685. $Fdbenc->additem("KOI8", "KOI8-R(U)");
  1686. $Fdbenc->additem("WIN", "Windows CP1251");
  1687. $Fdbenc->additem("ALT", "Windows CP866");
  1688. $Fdbenc->additem("WIN1256", "Windows CP1256 (Arabic)");
  1689. $Fdbenc->additem("TCVN", "TCVN-5712/Windows CP1258 (Vietnamese)");
  1690. $Fdbenc->additem("WIN874", "Windows CP874 (Thai)");
  1691. $Tin->tr("axbglite");
  1692. $Tin->td( "Database encoding:", "axfg" );
  1693. $Tin->td( $Fdbenc->render() );
  1694. // ..................................................................
  1695. // Database date style field..
  1696. $Fdbdatestyle = new form_combofield("dbdatestyle", "", $firstrec["dbdatestyle"]);
  1697. $Fdbdatestyle->setclass("axcombo");
  1698. $Fdbdatestyle->setstyle("width:$cwidth;");
  1699. $Fdbdatestyle->settitle(
  1700. "This affects the output format of date-time data from the database. Axyl "
  1701. . "library code expects the ISO format, so it is recommended to always use "
  1702. . "that here, unless you have a good reason to change it."
  1703. );
  1704. $maintainer->register_field($Fdbdatestyle);
  1705. $Fdbdatestyle->additem("", "default");
  1706. $Fdbdatestyle->additem("ISO", "ISO 8601 (1997-12-17 07:37:16-08)");
  1707. $Fdbdatestyle->additem("SQL", "SQL Traditional (12/17/1997 07:37:16.00 PST)");
  1708. $Fdbdatestyle->additem("POSTGRES", "Postgres (Wed Dec 17 07:37:16 1997 PST)");
  1709. $Fdbdatestyle->additem("German", "Regional (17.12.1997 07:37:16.00 PST)");
  1710. $Tin->tr("axbgdark");
  1711. $Tin->td( "Date output style:", "axfg" );
  1712. $Tin->td( $Fdbdatestyle->render() );
  1713. $Tapp->tr();
  1714. $Tapp->td( $Tin->render() );
  1715.  
  1716. $Tin = new table("dbsettings");
  1717. $Tin->setpadding(2);
  1718. $Tapp->tr("axsubhdg");
  1719. $Tapp->td("<b>Misc settings</b>", "axsubhdg");
  1720. $mychkbox = $chkbox;
  1721. $mychkbox->checked = $app->getparameter("database_backed", "database_backed");
  1722. $mychkbox->settitle(
  1723. "Check this if your website connects to a database. Most do, but this allows "
  1724. . "the possibility of providing simple websites without it."
  1725. );
  1726. $Tin->tr("axbgdark");
  1727. $Tin->td( "Website uses a Database:", "axfg" );
  1728. $Tin->td( $mychkbox->render("cp_database_backed") );
  1729. $Tin->tr("axbglite");
  1730. $Tin->td( "Hosts for persistent DB connection:", "axfg" );
  1731. $mybox = $tbox;
  1732. $mybox->settitle(
  1733. "If the database hostname contains the string you enter here, then database "
  1734. . "connections will be made persistently, improving performance when the "
  1735. . "site is busy."
  1736. );
  1737. $mybox->setvalue(str_replace("\"", "", $app->getparameter("permhosts", "permhosts")));
  1738. $Tin->td( $mybox->render("cp_permhosts") );
  1739. $Tin->tr("axbglite");
  1740. $Tin->td();
  1741. $Tin->td(
  1742. "A comma-delimited list of hostnames which will use persistent "
  1743. . "database connections. Usually these would be your production "
  1744. . "web-servers.",
  1745. "axfg"
  1746. );
  1747. $Tin->td_css("font-style:italic;font-size:80%");
  1748. $Tin->set_width_profile("50%,50%");
  1749. $Tapp->tr();
  1750. $Tapp->td( $Tin->render() );
  1751. break;
  1752. // ......................................................................
  1753. // DEBUG SETTINGS
  1754. case CP_VIEW_DEBUG:
  1755. $Tapp->tr("axsubhdg");
  1756. $Tapp->td("<b>Output controls</b>", "axsubhdg");
  1757. $Tin = new table("debug_output");
  1758. $Tin->setpadding(2);
  1759. $debugging = $app->getparameter("debug_on", "debug_on");
  1760. $mychkbox = $chkbox;
  1761. $mychkbox->settitle(
  1762. "If you want site-wide debugging to be displayed then check this box. It "
  1763. . "will cause every page to display debug information."
  1764. );
  1765. $mychkbox->checked = $debugging;
  1766. $Tin->tr("axbgdark");
  1767. $Tin->td( "Enable debugging:", "axfg" );
  1768. $Tin->td( $mychkbox->render("cp_debug_on") );
  1769. $Tin->tr("axbglite");
  1770. $Tin->td( "Classes of output to show:", "axfg");
  1771. $Tin->td_alignment("", "top");
  1772. $Fdebugcl = new form_combofield();
  1773. $Fdebugcl->multiselect = true;
  1774. $Fdebugcl->set_size(6);
  1775. $Fdebugcl->setstyle("width:$cwidth");
  1776. $Fdebugcl->settitle(
  1777. "This multiple-select box allows you to choose which classes of debug output "
  1778. . "are displayed. Eg. If you only want your ad-hoc 'debugbr()' statements to be "
  1779. . "output, then choose 'User diagnostics'."
  1780. );
  1781. $Fdebugcl->set_onchange('setchgd()');
  1782. $Fdebugcl->additem(2, "User diagnostics (default)");
  1783. $Fdebugcl->additem(4, "SQL statements");
  1784. $Fdebugcl->additem(8, "All SQL data (verbose)");
  1785. $Fdebugcl->additem(16, "Dump of GET/POST vars etc.");
  1786. $Fdebugcl->additem(32, "Include traceback info");
  1787. $Fdebugcl->additem(64, "Show table outlines");
  1788. $Fdebugcl->additem(128, "Execution profiler");
  1789. $Fdebugcl->additem(1, "System diagnostics");
  1790. // Build value as array of set bits..
  1791. $debugcl = $app->getparameter("debug_classes", "debug_classes");
  1792. $debug_value = array();
  1793. for ($i=1; $i < 256; $i*=2) {
  1794. if ($debugcl & $i) {
  1795. $debug_value[] = $i;
  1796. }
  1797. }
  1798. $Fdebugcl->setvalue($debug_value);
  1799. $Tin->td( $Fdebugcl->render("cp_debug_classes") );
  1800. $Tin->tr("axbgdark");
  1801. $Tin->td( "Output modes:", "axfg");
  1802. $Tin->td_alignment("", "top");
  1803. $Fdebugop = new form_combofield();
  1804. $Fdebugop->multiselect = true;
  1805. $Fdebugop->set_size(6);
  1806. $Fdebugop->set_onchange('setchgd()');
  1807. $Fdebugop->setstyle("width:$cwidth");
  1808. $Fdebugop->settitle(
  1809. "This determines where the debugging goes. Standard output is displayed in "
  1810. . "the webpage, at the top - this is generally the most useful in a website "
  1811. . "with buffered output. Another useful option is to send it to the system "
  1812. . "log."
  1813. );
  1814. $Fdebugop->additem(1, "Standard (default)");
  1815. $Fdebugop->additem(2, "Unbuffered echo");
  1816. $Fdebugop->additem(4, "CLI output (non-web mode)");
  1817. $Fdebugop->additem(8, "To system logfile");
  1818. // Build value as array of set bits..
  1819. $debugop = $app->getparameter("debug_output", "debug_output");
  1820. $debugop_value = array();
  1821. for ($i=1; $i < 256; $i*=2) {
  1822. if ($debugop & $i) {
  1823. $debugop_value[] = $i;
  1824. }
  1825. }
  1826. $Fdebugop->setvalue($debugop_value);
  1827. $Tin->td( $Fdebugop->render("cp_debug_output") );
  1828. $Tin->set_width_profile("50%,50%");
  1829. $Tapp->tr();
  1830. $Tapp->td( $Tin->render() );
  1831.  
  1832. $Tapp->tr("axsubhdg");
  1833. $Tapp->td("<b>Diagnostics</b>", "axsubhdg");
  1834. $Tin = new table("debug_diags");
  1835. $Tin->setpadding(2);
  1836. $bg = "axbgdark";
  1837. integerField(
  1838. "SQL Execution log threshold:",
  1839. "SQL_EXEC_THRESHOLD",
  1840. $app->globals,
  1841. 60000, 80,
  1842. "Use this to detect queries which are taking much longer than they "
  1843. . "should to complete."
  1844. );
  1845. infoField(
  1846. "SQL queries exeeding the specified number of milliseconds will "
  1847. . "be logged in the system log. To disable, set to zero."
  1848. );
  1849. $resptimer = $app->getparameter("response_timer", "response_timer");
  1850. $mychkbox = $chkbox;
  1851. $mychkbox->checked = $resptimer;
  1852. $mychkbox->settitle(
  1853. "Use this option to find out how long your website pages are taking to "
  1854. . "render to the user-agent. Useful for separating render time from network "
  1855. . "transit time."
  1856. );
  1857. $Tin->tr("axbglite");
  1858. $Tin->td( "Enable response time logging:", "axfg" );
  1859. $Tin->td( $mychkbox->render("cp_response_timer") );
  1860. $Tin->set_width_profile("50%,50%");
  1861. $Tapp->tr();
  1862. $Tapp->td( $Tin->render() );
  1863. $Tapp->tr("axfoot");
  1864. $Tapp->td("&nbsp;", "axfoot");
  1865. break;
  1866.  
  1867. // ......................................................................
  1868. // DEFAULT SETTINGS
  1869. default:
  1870. $Tapp->tr("axsubhdg");
  1871. $Tapp->td("<b>Identification</b>", "axsubhdg");
  1872. $Tin = new table("definitions");
  1873. $Tin->setpadding(2);
  1874.  
  1875. entryField(
  1876. "Application Name:",
  1877. "APP_NAME",
  1878. $app->definitions,
  1879. "This is the 'nice' name for your website. Usually a single word, but can be "
  1880. . "more then one. It is used in areas such as e-mails, and error messages."
  1881. );
  1882. entryField(
  1883. "Application Prefix:",
  1884. "APP_PREFIX",
  1885. $app->definitions,
  1886. "A single word with no spaces or hyphens. This should uniquely identify your "
  1887. . "website on the local machine. This value is also used with Axyl Lucene "
  1888. . "to set your indexing 'domain'."
  1889. );
  1890. $Tin->set_width_profile("50%,50%");
  1891. $Tapp->tr();
  1892. $Tapp->td( $Tin->render() );
  1893. // ......................................................................
  1894. // GLOBALS
  1895. $Tapp->tr("axsubhdg");
  1896. $Tapp->td("<b>Global variables</b>", "axsubhdg");
  1897. $Tin = new table("globals");
  1898. $Tin->setpadding(2);
  1899. $Tin->tbody("fmlook");
  1900. $bg = "axbgdark";
  1901. entryField(
  1902. "Templates directory:",
  1903. "TEMPLATESDIR",
  1904. $app->globals,
  1905. "The directory Axyl searches for templates. Should be in your website "
  1906. . "directory hierarchy. Accessible as global var \$TEMPLATESDIR"
  1907. );
  1908. entryField(
  1909. "Images directory:",
  1910. "IMAGESDIR",
  1911. $app->globals,
  1912. "The directory Axyl searches for images. Should be in your website "
  1913. . "directory hierarchy. Accessible as global var \$IMAGESDIR"
  1914. );
  1915. entryField(
  1916. "Cached files directory:",
  1917. "CACHEDIR",
  1918. $app->globals,
  1919. "The directory Axyl uses to cache pages which you have designated as "
  1920. . "being cacehable."
  1921. );
  1922. entryField(
  1923. "Media catalog directory:",
  1924. "CATALOGDIR",
  1925. $app->globals,
  1926. "The directory Axyl stores media uploaded to your Media Catalog. "
  1927. . "Accessible as global var \$CATALOGDIR"
  1928. );
  1929. entryField(
  1930. "Managed content directory:",
  1931. "CMDIR",
  1932. $app->globals,
  1933. "This is a directory hierarchy which contains the content-managed pages "
  1934. . "created by users."
  1935. );
  1936. entryField(
  1937. "Includes directory:",
  1938. "INCDIR",
  1939. $app->globals,
  1940. "This is a directory you store your application 'include' files. It is "
  1941. . "then accessible to you as global var \$INCDIR."
  1942. );
  1943. infoField(
  1944. "NB: all directories specified above should be relative to the "
  1945. . "website root directory. Additionally, if they are to be writeable "
  1946. . "then they should be under the 'var' subdirectory."
  1947. );
  1948. entryField(
  1949. "Webmaster name:",
  1950. "WEBMASTER_PERSON",
  1951. $app->globals,
  1952. "Name of the person who looks after the website. Mainly used in system-generated "
  1953. . "e-mails and messages."
  1954. );
  1955. entryField(
  1956. "Webmaster e-mail:",
  1957. "WEBMASTER_EMAIL",
  1958. $app->globals,
  1959. "The e-mail address of the person named above."
  1960. );
  1961. $Tin->set_width_profile("50%,50%");
  1962. $Tapp->tr();
  1963. $Tapp->td( $Tin->render() );
  1964. // ......................................................................
  1965. // DTD & ENCODING
  1966. $Tapp->tr("axsubhdg");
  1967. $Tapp->td("<b>Default DTD and website encoding</b>", "axsubhdg");
  1968. $Tin = new table("dtd_enc");
  1969. $Tin->setpadding(2);
  1970. $cboHTMLDTD = new form_combofield();
  1971. $cboHTMLDTD->setclass("axcombo");
  1972. $cboHTMLDTD->set_onchange('setchgd()');
  1973. $cboHTMLDTD->settitle(
  1974. "The default site-wide Document Type Definition to be generated for each HTML page. "
  1975. . "This value may be overridden by templates, or in specific pages by your "
  1976. . "code."
  1977. );
  1978. $cboHTMLDTD->additem("", "None");
  1979. $cboHTMLDTD->additem(
  1980. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">"),
  1981. "HTML 3.2 Strict"
  1982. );
  1983. $cboHTMLDTD->additem(
  1984. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"),
  1985. "HTML 4.01 Transitional"
  1986. );
  1987. $cboHTMLDTD->additem(
  1988. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"),
  1989. "HTML 4.01 Strict"
  1990. );
  1991. $cboHTMLDTD->additem(
  1992. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">"),
  1993. "HTML 4.01 with Frameset"
  1994. );
  1995. $cboHTMLDTD->additem(
  1996. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">"),
  1997. "XHTML 1.0 Transitional"
  1998. );
  1999. $cboHTMLDTD->additem(
  2000. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\">"),
  2001. "XHTML 1.0 Strict"
  2002. );
  2003. $cboHTMLDTD->additem(
  2004. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\">"),
  2005. "XHTML 1.0 with Frameset"
  2006. );
  2007. $cboHTMLDTD->setvalue($app->getparameter("dtd", "dtd", "html"));
  2008. $cboWMLDTD = new form_combofield();
  2009. $cboWMLDTD->setclass("axcombo");
  2010. $cboWMLDTD->set_onchange('setchgd()');
  2011. $cboWMLDTD->settitle(
  2012. "The default site-wide Document Type Definition to be generated for each WML page. "
  2013. . "This value may be overridden by templates, or in specific pages by your "
  2014. . "code."
  2015. );
  2016. $cboWMLDTD->additem("", "None");
  2017. $cboWMLDTD->additem(
  2018. rawurlencode("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1_1.xml\">"),
  2019. "WML 1.1"
  2020. );
  2021. $cboWMLDTD->additem(
  2022. rawurlencode("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.xml\">"),
  2023. "WML 1.2"
  2024. );
  2025. $cboWMLDTD->setvalue($app->getparameter("dtd", "dtd", "wml"));
  2026. $cboENC = new form_combofield();
  2027. $cboENC->setclass("axcombo");
  2028. $cboENC->set_onchange('setchgd()');
  2029. $cboENC->settitle(
  2030. "The encoding for pages generated by this website. This determines the 'charset=' "
  2031. . "portion of the 'Content-Type:' header which gets ssent for each webpage."
  2032. );
  2033. $cboENC->additem("ISO-8859-1", "ISO-8859-1 Latin 1 (Western)");
  2034. $cboENC->additem("US-ASCII", "US-ASCII");
  2035. $cboENC->additem("UTF-8", "UTF-8 (Unicode)");
  2036. $setting = $app->get_setting("encoding");
  2037. $cboENC->setvalue($app->getparameter("encoding", "encoding"));
  2038. if ($app->getparameter("multilang", "multilang")) {
  2039. $cboENC->disabled = true;
  2040. }
  2041. $Tin->tr("axbgdark");
  2042. $Tin->td( "DTD for HTML content:", "axfg" );
  2043. $Tin->td( $cboHTMLDTD->render("cp_dtd_html") );
  2044. $Tin->tr("axbglite");
  2045. $Tin->td( "DTD for WAP content:", "axfg" );
  2046. $Tin->td( $cboWMLDTD->render("cp_dtd_wml") );
  2047. $Tin->tr("axbgdark");
  2048. $Tin->td( "Character encoding:", "axfg" );
  2049. $Tin->td( $cboENC->render("cp_encoding") );
  2050. $mychkbox = $chkbox;
  2051. $mychkbox->checked = $app->getparameter("multilang", "multilang");
  2052. $mychkbox->set_onclick("setUTF8mode(this.checked)");
  2053. $mychkbox->settitle(
  2054. "If you need to render multiple character sets in UTF-8 on your website then "
  2055. . "check this option, and select Unicode (UTF-8) above. This will cause Axyl "
  2056. . "to do some special string handling (using mb_output_handler), and also "
  2057. . "produce a 'lang=' attribute in the &LT;html&GT; tag, plus a 'Content-Language' "
  2058. . "meta tag for each language used in the webpage."
  2059. );
  2060. $Tin->tr("axbglite");
  2061. $Tin->td( "Website uses multiple languages:", "axfg" );
  2062. $Tin->td( $mychkbox->render("cp_multilang") . "&nbsp;(requires UTF-8 encoding above)" );
  2063. $Tin->td_css("font-style:italic;font-size:80%");
  2064. $Tin->set_width_profile("50%,50%");
  2065. $Tapp->tr();
  2066. $Tapp->td( $Tin->render() );
  2067. // ......................................................................
  2068. // SESSION
  2069. $Tapp->tr("axsubhdg");
  2070. $Tapp->td("<b>Session settings</b>", "axsubhdg");
  2071. $Tin = new table("session");
  2072. $Tin->setpadding(2);
  2073. $Tin->tr("axbgdark");
  2074. $Tin->td( "Website HTTP hostname:", "axfg" );
  2075. $http_host = $app->getparameter("http_host", "http_host");
  2076. if ($http_host == "") {
  2077. $http_host = "(default to webserver)";
  2078. }
  2079. $mybox = $tbox;
  2080. $mybox->setvalue($http_host);
  2081. $mybox->settitle(
  2082. "This allows you to specify a different hostname from the local webserver. Normally "
  2083. . "this isn't required, however some architectures require Axyl to run through a "
  2084. . "proxy and hence cookies and webpages etc. are identified as coming from that machine "
  2085. . "rather than the local one."
  2086. . ""
  2087. );
  2088. $Tin->td( $mybox->render("cp_http_host") );
  2089. $Tin->tr("axbgdark");
  2090. $Tin->td();
  2091. $Tin->td(
  2092. "Set to blank, or '(default to webserver)' to get the default "
  2093. . "webserver hostname. Otherwise set your own.",
  2094. "axfg"
  2095. );
  2096. $Tin->td_css("font-style:italic;font-size:80%");
  2097. $Tin->set_width_profile("50%,50%");
  2098. $Tin->tr("axbglite");
  2099. $Tin->td( "Cookie name:", "axfg" );
  2100. $cookiename = $app->getparameter("cookiename", "cookiename");
  2101. if ($cookiename == "") {
  2102. $cookiename = $app->definitions["APP_PREFIX"] . "_session_id";
  2103. }
  2104. $mybox = $tbox;
  2105. $mybox->setvalue($cookiename);
  2106. $mybox->settitle(
  2107. "If you don't like the default Axyl name for your cookie, then just "
  2108. . "take the opporunity to change it here!"
  2109. );
  2110. $Tin->td( $mybox->render("cp_cookiename") );
  2111. $Tin->tr("axbgdark");
  2112. $Tin->td( "Cookie/session lifetime:", "axfg" );
  2113. $Flife = new form_combofield();
  2114. $Flife->setclass("axcombo");
  2115. $Flife->setstyle("width:$cwidth");
  2116. $Flife->set_onchange('setchgd()');
  2117. $Flife->additem(-1, "Until browser closed");
  2118. $Flife->additem(315360000, "Forever and a day");
  2119. $Flife->additem(31536000, "A year");
  2120. $Flife->additem(2592000, "A month");
  2121. $Flife->additem(604800, "A week");
  2122. $Flife->additem(86400, "24 hours");
  2123. $Flife->additem(43200, "12 hours");
  2124. $Flife->additem(28800, "8 hours");
  2125. $Flife->additem(14400, "4 hours");
  2126. $Flife->additem(3600, "An hour");
  2127. $Flife->additem(1200, "20 minutes");
  2128. $Flife->additem(0, "Immediate expiry");
  2129. $Flife->setvalue($app->getparameter("lifetime", "lifetime"));
  2130. $Flife->settitle(
  2131. "This determines how long the session cookie is valid. The most common setting "
  2132. . "is 'Until browser closed' which requires a login each time. This can be "
  2133. . "overridden to be 'forever' if the login process contains a '\$chkRememberMe' "
  2134. . "defined in the form submit."
  2135. );
  2136. $Tin->td( $Flife->render("cp_lifetime") );
  2137. $Tin->tr("axbglite");
  2138. $Tin->td( "Page expiry (seconds):", "axfg" );
  2139. $Fexpiry = new form_combofield();
  2140. $Fexpiry->setclass("axcombo");
  2141. $Fexpiry->setstyle("width:$cwidth");
  2142. $Fexpiry->set_onchange('setchgd()');
  2143. $Fexpiry->additem(-1, "Immediate (dynamic content)");
  2144. $Fexpiry->additem(60, "1 minute");
  2145. $Fexpiry->additem(120, "2 minutes");
  2146. $Fexpiry->additem(180, "3 minutes");
  2147. $Fexpiry->additem(240, "4 minutes");
  2148. $Fexpiry->additem(300, "5 minutes");
  2149. $Fexpiry->additem(600, "10 minutes");
  2150. $Fexpiry->additem(1800, "30 minutes");
  2151. $Fexpiry->additem(3600, "1 hour");
  2152. $Fexpiry->additem(14400, "4 hours");
  2153. $Fexpiry->additem(28800, "8 hours");
  2154. $Fexpiry->additem(86400, "24 hours");
  2155. $Fexpiry->additem(315360000, "Never (static content)");
  2156. $Fexpiry->setvalue($app->getparameter("expiry", "expiry"));
  2157. $Fexpiry->settitle(
  2158. "This sets the expiry of content sent to the browser. For pages which are "
  2159. . "dynamically generated, this is normally 'Immediate', however this does "
  2160. . "have the effect of negating the user's 'Back' button. A compromise is to "
  2161. . "set this to a small value, such as 1 minute."
  2162. );
  2163. $Tin->td( $Fexpiry->render("cp_expiry") );
  2164. $mychkbox = $chkbox;
  2165. $mychkbox->checked = $app->getparameter("guest_browser_lifetime", "guest_browser_lifetime");
  2166. $mychkbox->settitle(
  2167. "Non-logged-in users in Axyl get allocated a 'guest' session cookie. This option will "
  2168. . "set the lifetime of that cookie to the life of their browser session. To be honest "
  2169. . "there isn't much difference either way!"
  2170. );
  2171. $Tin->tr("axbgdark");
  2172. $Tin->td( "Guest cookies browser lifetime:", "axfg" );
  2173. $Tin->td( $mychkbox->render("cp_guest_browser_lifetime") );
  2174. $mychkbox = $chkbox;
  2175. $mychkbox->checked = $app->getparameter("session_track_logins", "session_track_logins");
  2176. $mychkbox->settitle(
  2177. "If checked then Axyl will keep track of each user's logins, counting them as they "
  2178. . "log in each time. Unchecking removes that small processing overhead."
  2179. );
  2180. $Tin->tr("axbglite");
  2181. $Tin->td( "Count user login sessions:", "axfg" );
  2182. $Tin->td( $mychkbox->render("cp_session_track_logins") );
  2183. $Tin->set_width_profile("50%,50%");
  2184. $Tapp->tr();
  2185. $Tapp->td( $Tin->render() );
  2186. // ......................................................................
  2187. // CONTENT
  2188. $Tapp->tr("axsubhdg");
  2189. $Tapp->td("<b>Content settings</b>", "axsubhdg");
  2190. $Tin = new table("content");
  2191. $Tin->setpadding(2);
  2192. $mychkbox = $chkbox;
  2193. $mychkbox->checked = $app->getparameter("metadata_enabled", "metadata_enabled");
  2194. $mychkbox->settitle(
  2195. "If you installed the Axyl Metadata Extension when you created the website, then "
  2196. . "you can enable it here. This gives extra functionality in the Axyl Content "
  2197. . "Managed Layouts for defining metadata for webpages."
  2198. );
  2199. $Tin->tr("axbglite");
  2200. $Tin->td( "Enable metadata edit/generation:", "axfg" );
  2201. $Tin->td( $mychkbox->render("cp_metadata_enabled") );
  2202. $mychkbox = $chkbox;
  2203. $mychkbox->checked = $app->getparameter("microsites_enabled", "microsites_enabled");
  2204. $mychkbox->set_onchange(
  2205. "if(this.checked) "
  2206. . "alert("
  2207. . "'NOTICE:\\n\\n"
  2208. . "For microsite creation to work you must be running \'pg-microsites-installer.php\' from cron.\\n"
  2209. . "The crontab for this can be found in the \'scripts/cron\' sub-directory of your Axyl installation,\\n"
  2210. . "and should have been automatically installed into /etc/cron.d by your Debian package.\\n\\n"
  2211. . "')"
  2212. );
  2213. $mychkbox->settitle(
  2214. "If you installed the Axyl Microsites Extension when you created the website, then "
  2215. . "you can enable it here. This gives you some extra functions to create and maintain "
  2216. . "microsites of the main website."
  2217. );
  2218. $Tin->tr("axbgdark");
  2219. $Tin->td( "Enable microsite(s) creation:", "axfg" );
  2220. $Tin->td( $mychkbox->render("cp_microsites_enabled") );
  2221. $mychkbox = $chkbox;
  2222. $mychkbox->checked = $app->getparameter("buffered_output", "buffered_output");
  2223. $mychkbox->settitle(
  2224. "Whether or not to run the website using buffered Php output. Buffering allows Axyl "
  2225. . "to collect output, post-process it, and render it in one hit just before sending "
  2226. . "it to the browser. Non-buffered output severely restricts debugging, and other "
  2227. . "post-processing and is not recommended."
  2228. );
  2229. $Tin->tr("axbglite");
  2230. $Tin->td( "Buffered output (recommended):", "axfg" );
  2231. $Tin->td( $mychkbox->render("cp_buffered_output") );
  2232. $Tin->tr("axbgdark");
  2233. $Tin->td( "Compression type:", "axfg" );
  2234. $Fcomp = new form_combofield();
  2235. $Fcomp->setclass("axcombo");
  2236. $Fcomp->setstyle("width:$cwidth");
  2237. $Fcomp->set_onchange('setchgd()');
  2238. $Fcomp->additem(0, "No compression");
  2239. $Fcomp->additem(1, "Built-in compression (Php >= 4.0.4)");
  2240. $Fcomp->additem(2, "Axyl custom compression");
  2241. $Fcomp->setvalue($app->getparameter("compression_type", "compression_type"));
  2242. $Fcomp->settitle(
  2243. "Axyl can compress the output stream to save transmission time for large-ish "
  2244. . "webpages. The recommended option is 'Built-in' compression."
  2245. );
  2246. $Tin->td( $Fcomp->render("cp_compression_type") );
  2247. $Tin->tr("axbglite");
  2248. $Tin->td( "Compression threshold:", "axfg" );
  2249. $Fcomp = new form_combofield();
  2250. $Fcomp->setclass("axcombo");
  2251. $Fcomp->setstyle("width:$cwidth");
  2252. $Fcomp->set_onchange('setchgd()');
  2253. $Fcomp->additem(0, "None (compress all content)");
  2254. $Fcomp->additem(1024, "Over 1Kb");
  2255. $Fcomp->additem(4096, "Over 4Kb");
  2256. $Fcomp->additem(8192, "Over 8Kb");
  2257. $Fcomp->additem(16384, "Over 16Kb");
  2258. $Fcomp->additem(32768, "Over 32Kb");
  2259. $Fcomp->additem(65536, "Over 64Kb");
  2260. $Fcomp->additem(262144, "Over 256Kb");
  2261. $Fcomp->setvalue($app->getparameter("compression_threshold", "compression_threshold"));
  2262. $Fcomp->settitle(
  2263. "On some systems you might want to save processing power by only compressing "
  2264. . "pages above a certain size."
  2265. );
  2266. $Tin->td( $Fcomp->render("cp_compression_threshold") );
  2267. $Tin->set_width_profile("50%,50%");
  2268. $Tapp->tr();
  2269. $Tapp->td( $Tin->render() );
  2270. // ......................................................................
  2271. // GET/POST settings
  2272. $Tapp->tr("axsubhdg");
  2273. $Tapp->td("<b>GET/POST settings</b>", "axsubhdg");
  2274. $Tin = new table("getpost");
  2275. $Tin->setpadding(2);
  2276. $mychkbox = $chkbox;
  2277. $mychkbox->checked = $app->getparameter("keep", "keep");
  2278. $mychkbox->settitle(
  2279. "This option causes Axyl to set a second browser cookie. You can then use Php "
  2280. . "session management to keep track of variables across webpages using Axyl's "
  2281. . "'remember()' method."
  2282. );
  2283. $Tin->tr("axbgdark");
  2284. $Tin->td( "Enable Axyl KEEP feature:", "axfg" );
  2285. $Tin->td( $mychkbox->render("cp_keep") );
  2286. $mychkbox = $chkbox;
  2287. $mychkbox->checked = $app->getparameter("globalise", "globalise");
  2288. $mychkbox->settitle(
  2289. "When checked this causes Axyl to auto globalise variables submitted to the "
  2290. . "website. This circumvents any php.ini setting which turns off globals."
  2291. );
  2292. $Tin->tr("axbglite");
  2293. $Tin->td( "Auto-globalise all GET/POST vars:", "axfg" );
  2294. $Tin->td( $mychkbox->render("cp_globalise") );
  2295. $Tin->set_width_profile("50%,50%");
  2296. $Tapp->tr();
  2297. $Tapp->td( $Tin->render() );
  2298. } // switch
  2299. $cprf = new img("$LIBDIR/img/_cpfootr.gif", "", "", 87, 23);
  2300. $Tin = new table();
  2301. $Tin->tr();
  2302. $Tin->td();
  2303. $Tin->td_css("background: url('$LIBDIR/img/_cpfootfill.gif')");
  2304. $Tin->td_width("100%");
  2305. $Tin->td($cprf->render());
  2306. $Tin->td_alignment("right");
  2307. $Tapp->tr();
  2308. $Tapp->td($Tin->render());
  2309.  
  2310. } // if no errors
  2311. // ----------------------------------------------------------------------
  2312. // Finish and return the page..
  2313.  
  2314. $hidcpview = new form_hiddenfield("cp_view", $cp_view);
  2315. $s .= "<form name=\"$formname\" method=\"post\">\n";
  2316. $s .= $Tapp->render();
  2317. $s .= $hidcpview->render();
  2318. // Also render maintainer bits if database view..
  2319. if ($cp_view == CP_VIEW_DB) {
  2320. $s .= $maintainer->render();
  2321. }
  2322. else {
  2323. $hid = new form_hiddenfield("_recmaintpost_form", $formname);
  2324. $s .= $hid->render();
  2325. }
  2326. $s .= "</form>\n";
  2327.  
  2328. //echo $app->htmldump();
  2329.  
  2330. if ($cp_view == CP_VIEW_AUTH) {
  2331. $s .= "<script language=\"javascript\">\n"
  2332. . "var cbo = eval('document.forms.$formname.cp_remote_auth_source');\n"
  2333. . "if (cbo) {\n"
  2334. . " control_auth_fields(cbo,'$formname');\n"
  2335. . "}\n"
  2336. . "</script>\n";
  2337. }
  2338. $s .= "</body>\n";
  2339. $s .= "</html>\n";
  2340. echo $s;
  2341. // ----------------------------------------------------------------------
  2342. ?>

Documentation generated by phpDocumentor 1.3.0RC3