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 = "md5";
  561. if ($cp_passwd_expiry_days == "") $cp_passwd_expiry_days = "180";
  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. // ----------------------------------------------------------------------
  1012. // MAIN FORM GENERATION
  1013.  
  1014. // Width of large form elements..
  1015.  
  1016. $fullwidth = 540;
  1017. $halfwidth = ceil($fullwidth * 0.50);
  1018. $thirdwidth = ceil($fullwidth * 0.37);
  1019. $quartwidth = ceil($fullwidth * 0.25);
  1020. $ewidth = $halfwidth . "px"; // Normal text fields
  1021. $awidth = $fullwidth . "px"; // Full field width
  1022. $cbowidth = $quartwidth . "px"; // Normal combos
  1023. $cwidth = $thirdwidth . "px"; // Wide combos
  1024.  
  1025. if ($cp_view == CP_VIEW_DB) {
  1026. // DATABASE LISTBOX
  1027. // Defined early so that buttons can be registered..
  1028. $database_listbox = new form_combofield("dbid");
  1029. $database_listbox->setclass("axlistbox");
  1030. // Make a new record maintainer, and attach the buttons..
  1031. $maintainer = new recmaintainer($formname, $database_listbox);
  1032. $bup = new form_imagebutton("_up", "", "", "$LIBDIR/img/_up.gif", "Move up", 57, 15);
  1033. $bdown = new form_imagebutton("_down", "", "", "$LIBDIR/img/_down.gif", "Move down", 57, 15);
  1034. $bdel = new form_imagebutton("_del", "", "", "$LIBDIR/img/_delete.gif", "Delete database", 57, 15);
  1035. $badd = new form_imagebutton("_add", "", "", "$LIBDIR/img/_add.gif", "Add new database", 57, 15);
  1036. }
  1037.  
  1038. // Standard buttons
  1039. $bsave = new form_imagebutton("_save", "", "", "$LIBDIR/img/_save.gif", "Save your settings", 57, 15);
  1040. $breset = new form_imagebutton("_reset", "", "", "$LIBDIR/img/_reset.gif", "Reverse your changes", 57, 15);
  1041. $breset->set_onclick("resetchgd()");
  1042. $bdef = new form_imagebutton("_default", "", "", "$LIBDIR/img/_default.gif", "Replace ALL settings with defaults", 57, 15);
  1043. $bdef->set_confirm_text("This will over-write your WHOLE file with the default configuration (ie. not just the current page). Continue?");
  1044.  
  1045. // If we have a database maintainer, register all buttons..
  1046. if ($cp_view == CP_VIEW_DB) {
  1047. // Register all relevant buttons to the maintainer..
  1048. $maintainer->register_button("up" , $bup);
  1049. $maintainer->register_button("down", $bdown);
  1050. $maintainer->register_button("del", $bdel);
  1051. $maintainer->register_button("add", $badd);
  1052. $maintainer->register_button("save", $bsave);
  1053. }
  1054.  
  1055. $Tapp = new table();
  1056. $Tapp->setwidth($fullwidth);
  1057. $Tapp->setalign("center");
  1058.  
  1059. // Initialise tab buttons string..
  1060. $tab_btn = new img("$LIBDIR/img/_cptabtip.gif", "", $CPTABS[0], 6, 23);
  1061. $rendered_tabs = $tab_btn->render();
  1062. foreach ($CPTABS as $tabno => $tabdesc) {
  1063. $tab_btn = new img("$LIBDIR/img/_cptab" . $tabno . ".gif", "_tab" . $tabno, $tabdesc, 84, 23);
  1064. $tab_btn->set_onclick("tabclick('$tabno')");
  1065. $rendered_tabs .= $tab_btn->render();
  1066. }
  1067. $Tapp->tr();
  1068. $Tapp->td($rendered_tabs, "text-align:right");
  1069. $Tapp->td_alignment("right");
  1070.  
  1071. // ......................................................................
  1072. // Heading
  1073.  
  1074.  
  1075.  
  1076. switch ($cp_view) {
  1077. case CP_VIEW_DEFAULT: $view = "Main Settings"; break;
  1078. case CP_VIEW_AUTH: $view = "User & Security Settings"; break;
  1079. case CP_VIEW_DB: $view = "Database Settings"; break;
  1080. case CP_VIEW_DEBUG: $view = "Debug Settings"; break;
  1081. } // switch
  1082.  
  1083. $Tapp->tr("axtitle");
  1084. $Tapp->td("<b>AXYL CONTROL PANEL - $view</b>", "axtitle");
  1085. $Tapp->td_css("vertical-align:center;height:30px;padding-left:5px;");
  1086. if ($user_msg != "") {
  1087. $Tapp->tr("axsubhdg");
  1088. $Tapp->td($user_msg, "color:#F5DD64;text-align:center;");
  1089. }
  1090. elseif ($synced) {
  1091. $Tapp->tr("axsubhdg");
  1092. $Tapp->td("The Axyl configuration structure was successfully updated.", "color:#F5DD64;text-align:center;");
  1093. }
  1094.  
  1095. if (!$error) {
  1096. // ......................................................................
  1097. // Toolbar..
  1098. $toolbar = array();
  1099. $toolbar[] = $breset;
  1100. $toolbar[] = $bdef;
  1101. $toolbar[] = $bsave;
  1102. $Tbar = new table("toolbar");
  1103. $Tbar->tr();
  1104. $tools = "";
  1105. foreach ($toolbar as $tool) {
  1106. $tools .= $tool->render();
  1107. }
  1108. $Tbar->th($tools, "text-align:right");
  1109. $Tapp->tr("axbglite");
  1110. $Tapp->td( $Tbar->render() );
  1111.  
  1112. $tbox = new form_textfield();
  1113. $tbox->setstyle("width:$ewidth");
  1114. $tbox->setclass("axtxtbox");
  1115. $tbox->set_onchange('setchgd()');
  1116.  
  1117. $chkbox = new form_checkbox();
  1118. $chkbox->setclass("axchkbox");
  1119. $chkbox->setvalue("yes");
  1120. $chkbox->checked = false;
  1121. $chkbox->set_onclick('setchgd()');
  1122.  
  1123. // ......................................................................
  1124. // DEFINITIONS
  1125. // Installs text field in $Tin table..
  1126. function entryField($label, $fieldname, &$valarray, $tooltip="") {
  1127. global $app, $Tin, $tbox, $bg;
  1128. $mybox = $tbox;
  1129. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1130. $Tin->tr($bg);
  1131. $Tin->td( $label, "axfg" );
  1132. $mybox->setvalue($valarray[$fieldname]);
  1133. if ($tooltip != "") {
  1134. $mybox->settitle($tooltip);
  1135. }
  1136. $Tin->td( $mybox->render("cp_" . strtolower($fieldname)) );
  1137. }
  1138. // Installs info row in $Tin table..
  1139. function infoField($info) {
  1140. global $app, $Tin, $tbox, $bg;
  1141. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1142. $Tin->tr($bg);
  1143. $Tin->td();
  1144. $Tin->td($info, "axfg");
  1145. $Tin->td_css("font-style:italic;font-size:80%");
  1146. }
  1147. // Installs text field in $Tin table..
  1148. function integerField($label, $fieldname, &$valarray, $intlimit, $pxwidth=100, $tooltip="") {
  1149. global $app, $Tin, $tbox, $bg;
  1150. $mybox = $tbox;
  1151. $bg = ($bg == "axbgdark" ? "axbglite" : "axbgdark");
  1152. $Tin->tr($bg);
  1153. $Tin->td( $label, "axfg" );
  1154. $mybox->setstyle("width:" . $pxwidth . "px");
  1155. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1156. $mybox->setvalue($valarray[$fieldname]);
  1157. if ($tooltip != "") {
  1158. $mybox->settitle($tooltip);
  1159. }
  1160. $Tin->td( $mybox->render("cp_" . strtolower($fieldname)) );
  1161. }
  1162.  
  1163. // For toggling background colour..
  1164. $bg = "axbgdark";
  1165. switch ($cp_view) {
  1166. // ......................................................................
  1167. // AUTH & SECURITY SETTINGS
  1168. case CP_VIEW_AUTH:
  1169. $Tapp->tr("axsubhdg");
  1170. $Tapp->td("<b>Local password controls</b>", "axsubhdg");
  1171. $Tin = new table("local_pass");
  1172. $Tin->setpadding(2);
  1173. $Tin->tr("axbgdark");
  1174. $Tin->td( "Password encryption method:", "axfg" );
  1175. $Fenc = new form_combofield("cp_passwd_encryption");
  1176. $Fenc->setclass("axcombo");
  1177. $Fenc->setstyle("width:$cwidth");
  1178. $Fenc->set_onchange("setchgd()");
  1179. $Fenc->settitle("Determines the method used for encrypting/decrypting the submitted user password.");
  1180. $Fenc->additem("none", "No encryption (plaintext)");
  1181. $Fenc->additem("md5", "Standard MD5 encrypted password");
  1182. $Fenc->additem("md5salted", "Salted MD5 in '*salt*salted_md5' format");
  1183. $Fenc->additem("custom", "Use custom password functions");
  1184. $Fenc->setvalue($app->getparameter("security_profile", "passwd_encryption"));
  1185. $Tin->td( $Fenc->render() );
  1186. $mybox = $tbox;
  1187. $label = "Password expiry days"; $fld = "passwd_expiry_days"; $style = "width:50px"; $intlimit = 999;
  1188. $mybox->setstyle($style);
  1189. $mybox->set_onblur("limitInt(this, 1, $intlimit)");
  1190. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1191. $mybox->settitle(
  1192. "Days before a new password expires. After this time the user will be "
  1193. . "required to choose a new password. To override this, you can check the "
  1194. . "'Password never expires' option, in user maintenance."
  1195. );
  1196. $Tin->tr("axbglite");
  1197. $Tin->td( "$label:", "axfg" );
  1198. $Tin->td( $mybox->render("cp_" . $fld) );
  1199. $label = "Allowed password failures"; $fld = "passwd_max_attempts"; $style = "width:50px"; $intlimit = 99;
  1200. $mybox->setstyle($style);
  1201. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1202. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1203. $mybox->settitle(
  1204. "Number of consecutive times the user can fail to supply the correct password before "
  1205. . "the account is locked. Locked accounts require an administrator to unlock them. "
  1206. . "Set to zero to allow any number of failures."
  1207. );
  1208. $Tin->tr("axbgdark");
  1209. $Tin->td( "$label:", "axfg" );
  1210. $Tin->td( $mybox->render("cp_" . $fld) );
  1211. $label = "Password history cycle"; $fld = "passwd_history_cycle"; $style = "width:50px"; $intlimit = 999;
  1212. $mybox->setstyle($style);
  1213. $mybox->set_onblur("limitInt(this, 0, $intlimit)");
  1214. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1215. $mybox->settitle(
  1216. "Number of passwords the system will remember for each user. This prevents re-use of "
  1217. . "passwords chosen in the recent past. Set to zero to disable this feature."
  1218. );
  1219. $Tin->tr("axbglite");
  1220. $Tin->td( "$label:", "axfg" );
  1221. $Tin->td( $mybox->render("cp_" . $fld) );
  1222. $label = "Minimum password length"; $fld = "passwd_min_chars"; $style = "width:50px"; $intlimit = 99;
  1223. $mybox->setstyle($style);
  1224. $mybox->set_onblur("limitInt(this, 1, $intlimit)");
  1225. $mybox->setvalue($app->getparameter("security_profile", $fld));
  1226. $mybox->settitle(
  1227. "The minimum number of characters a new password must have to be acceptable."
  1228. );
  1229. $Tin->tr("axbgdark");
  1230. $Tin->td( "$label:", "axfg" );
  1231. $Tin->td( $mybox->render("cp_" . $fld) );
  1232. $Tin->tr("axbglite");
  1233. $Tin->td( "Level of char uniqueness:", "axfg" );
  1234. $Fpunq = new form_combofield();
  1235. $Fpunq->setclass("axcombo");
  1236. $Fpunq->setstyle("width:$cwidth");
  1237. $Fpunq->set_onchange('setchgd()');
  1238. $Fpunq->settitle(
  1239. "A level of character uniqueness a new password must have. This helps prevent the "
  1240. . "choice of silly passwords containing repeating character sequences."
  1241. );
  1242. $Fpunq->additem("none", "No requirement");
  1243. $Fpunq->additem("low", "Low");
  1244. $Fpunq->additem("medium", "Medium");
  1245. $Fpunq->additem("high", "High");
  1246. $Fpunq->setvalue($app->getparameter("security_profile", "passwd_char_uniqueness"));
  1247. $Tin->td( $Fpunq->render("cp_passwd_char_uniqueness") );
  1248. $mychkbox = $chkbox;
  1249. $mychkbox->checked = $app->getparameter("security_profile", "passwd_alphanum_mixed");
  1250. $mychkbox->settitle(
  1251. "If checked, this will require a mix of numbers and alphabetic characters in "
  1252. . "a new password. Such passwords are generally stronger."
  1253. );
  1254. $Tin->tr("axbgdark");
  1255. $Tin->td( "Require mix of alpha & numerics:", "axfg" );
  1256. $Tin->td( $mychkbox->render("cp_passwd_alphanum_mixed") );
  1257. $mychkbox = $chkbox;
  1258. $mychkbox->checked = $app->getparameter("security_profile", "passwd_apply_stopwords");
  1259. $mychkbox->settitle(
  1260. "If checked, the system will check a new password against a database of common "
  1261. . "'bad' words which people use in their choices, and prevent them selecting "
  1262. . "words which are considered easy to crack, including variations of their own "
  1263. . "name and user logon ID."
  1264. );
  1265. $Tin->tr("axbglite");
  1266. $Tin->td( "Apply stop-words to password:", "axfg" );
  1267. $Tin->td( $mychkbox->render("cp_passwd_apply_stopwords") );
  1268.  
  1269. $Tin->set_width_profile("50%,50%");
  1270. $Tapp->tr();
  1271. $Tapp->td( $Tin->render() );
  1272.  
  1273. $Tapp->tr("axsubhdg");
  1274. $Tapp->td("<b>Login control</b>", "axsubhdg");
  1275. $Tin = new table("login");
  1276. $Tin->setpadding(2);
  1277. $Tin->tr("axbgdark");
  1278. $Tin->td( "Login method:", "axfg" );
  1279. $Fcomp = new form_combofield();
  1280. $Fcomp->setclass("axcombo");
  1281. $Fcomp->setstyle("width:$cwidth");
  1282. $Fcomp->set_onchange('setchgd()');
  1283. $Fcomp->settitle(
  1284. "Select the type of login method - the usual is via a custom Axyl form. HTTP "
  1285. . "authentication uses the browser-based popup form."
  1286. );
  1287. $Fcomp->additem(0, "No authentication");
  1288. $Fcomp->additem(1, "HTTP authentication");
  1289. $Fcomp->additem(2, "Axyl login form");
  1290. $Fcomp->setvalue($app->getparameter("authtype", "authtype"));
  1291. $Tin->td( $Fcomp->render("cp_authtype") );
  1292. $Tin->tr("axbglite");
  1293. $Tin->td( "On failed login:", "axfg" );
  1294. $Fcomp = new form_combofield();
  1295. $Fcomp->setclass("axcombo");
  1296. $Fcomp->setstyle("width:$cwidth");
  1297. $Fcomp->set_onchange('setchgd()');
  1298. $Fcomp->settitle(
  1299. "Actions to take when the user fails on login. Note that some of these have "
  1300. . "implications for security - for example you might want to have the system give "
  1301. . "no feedback in some cases. In others a pretty webpage might be the best option."
  1302. );
  1303. $Fcomp->additem(0, "Display basic fail message");
  1304. $Fcomp->additem(1, "Die silently");
  1305. $Fcomp->additem(2, "Re-direct to URL (below)");
  1306. $Fcomp->additem(3, "Login as guest instead");
  1307. $Fcomp->setvalue($app->getparameter("authfail", "authfailopt"));
  1308. $Tin->td( $Fcomp->render("cp_authfailopt") );
  1309. $Tin->tr("axbgdark");
  1310. $Tin->td( "Failed login re-direct URL:", "axfg" );
  1311. $mybox = $tbox;
  1312. $mybox->settitle(
  1313. "Supply the URL to re-direct to on failed login."
  1314. );
  1315. $mybox->setvalue($app->getparameter("authfail", "authfailurl"));
  1316. $Tin->td( $mybox->render("cp_authfailurl") );
  1317. $Tin->tr("axbglite");
  1318. $Tin->td( "Login delay after failure (mS):", "axfg" );
  1319. $mybox = $tbox;
  1320. $mybox->setstyle("width:90px");
  1321. $mybox->set_onblur("limitInt(this, 0, 9999)");
  1322. $mybox->settitle(
  1323. "A delay time (in milliseconds) applied after a failed login. This acts as a "
  1324. . "control on automated password hacking scripts which repeatedly try passwords "
  1325. . "to crack an account."
  1326. );
  1327. $mybox->setvalue($app->getparameter("security_profile", "passwd_delay_ms"));
  1328. $Tin->td( $mybox->render("cp_passwd_delay_ms") );
  1329. $Tin->tr("axbgdark");
  1330. $Tin->td( "On login limit exceeded:", "axfg" );
  1331. $Flogexc = new form_combofield();
  1332. $Flogexc->setclass("axcombo");
  1333. $Flogexc->setstyle("width:$cwidth");
  1334. $Flogexc->set_onchange('setchgd()');
  1335. $Flogexc->settitle(
  1336. "Actions to take when user session (login) limit is exceeded. This only applies "
  1337. . "if the account has a non-zero limit set on it."
  1338. );
  1339. $Flogexc->additem(0, "Take no action");
  1340. $Flogexc->additem(1, "Allow, cull oldest sessions");
  1341. $Flogexc->additem(2, "Deny access, display message");
  1342. $Flogexc->additem(3, "Deny access silently");
  1343. $Flogexc->additem(4, "Redirect to a URL (below)");
  1344. $Flogexc->additem(5, "Login as guest instead");
  1345. $Flogexc->setvalue($app->getparameter("loginlimit", "logexceedopt"));
  1346. $Tin->td( $Flogexc->render("cp_logexceedopt") );
  1347. $Tin->tr("axbglite");
  1348. $Tin->td( "Login excess re-direct URL:", "axfg" );
  1349. $mybox = $tbox;
  1350. $mybox->settitle(
  1351. "If re-directing to a webpage, enter the URL for the page here."
  1352. );
  1353. $mybox->setvalue($app->getparameter("loginlimit", "logexceedurl"));
  1354. $Tin->td( $mybox->render("cp_logexceedurl") );
  1355. $Tin->set_width_profile("50%,50%");
  1356. $Tapp->tr();
  1357. $Tapp->td( $Tin->render() );
  1358. // ......................................................................
  1359. // REMOTE AUTHENTICATION
  1360. $Tapp->tr("axsubhdg");
  1361. $Tapp->td("<b>Remote authentication</b>", "axsubhdg");
  1362. $Tin = new table("remote");
  1363. $Tin->setpadding(2);
  1364.  
  1365. $Tin->tr("axbgdark");
  1366. $Tin->td( "User authentication source:", "axfg" );
  1367. $Fauthsrc = new form_combofield("cp_remote_auth_source");
  1368. $Fauthsrc->setclass("axcombo");
  1369. $Fauthsrc->setstyle("width:$cwidth");
  1370. $Fauthsrc->set_onchange("setchgd();control_auth_fields(this,'$formname')");
  1371. $Fauthsrc->settitle(
  1372. "Determines the source used for acquiring login userid/password information for "
  1373. . "authentication. The default is to use the local Axyl ax_user table. If you "
  1374. . "specify a remote database, that database must be defined in the database "
  1375. . "setup section of this control panel."
  1376. );
  1377. $Fauthsrc->additem(LOCAL_AUTH, "Local authentication (default)");
  1378. $Fauthsrc->additem(REMOTE_AUTH_REMOTEDB, "Remote database");
  1379. //$Fauthsrc->additem(REMOTE_AUTH_LDAP, "From LDAP server");
  1380. $remote_auth_source = $app->getparameter("remote_authentication", "remote_auth_source");
  1381. $Fauthsrc->setvalue($remote_auth_source);
  1382. $Tin->td( $Fauthsrc->render() );
  1383. $Tin->tr("axbglite");
  1384. $Tin->td( "Password encryption method:", "axfg" );
  1385. $Fauthmeth = new form_combofield("cp_remote_auth_method");
  1386. $Fauthmeth->setclass("axcombo");
  1387. $Fauthmeth->setstyle("width:$cwidth");
  1388. $Fauthmeth->set_onchange("setchgd()");
  1389. $Fauthmeth->setid("auth_fields");
  1390. $Fauthmeth->settitle(
  1391. "Determines the method used for authenticating the submitted remote user password. "
  1392. . "Select one of the common methods, otherwise choose the custom option, and define "
  1393. . "the algorithm using the 'custom_password_authentication()' function, in your "
  1394. . "local copy of 'application.php'."
  1395. );
  1396. $Fauthmeth->additem("none", "No encryption (plaintext)");
  1397. $Fauthmeth->additem("md5", "Standard MD5 encrypted password");
  1398. $Fauthmeth->additem("md5salted", "Salted MD5 in '*salt*salted_md5' format");
  1399. $Fauthmeth->additem("custom", "Use custom password functions");
  1400. $Fauthmeth->setvalue($app->getparameter("remote_authentication", "remote_auth_method"));
  1401. $Tin->td( $Fauthmeth->render() );
  1402. $Tin->tr("axbgdark");
  1403. $Tin->td( "Remote database:", "axfg" );
  1404. $Fauthdb = new form_combofield("cp_remote_auth_dbname");
  1405. $Fauthdb->setclass("axcombo");
  1406. $Fauthdb->setstyle("width:$cwidth");
  1407. $Fauthdb->set_onchange('setchgd()');
  1408. $Fauthdb->setid("auth_fields");
  1409. $Fauthdb->settitle(
  1410. "If you selected 'remote database' above then select the database the user "
  1411. . "authentication data is held on here."
  1412. );
  1413. // Get defined databases..
  1414. $dbs = $app->get_setting("database");
  1415. if ($dbs === false) $databases = array();
  1416. elseif (is_array($dbs)) $databases = $dbs;
  1417. else $databases[0] = $dbs;
  1418. $Fauthdb->additem("");
  1419. foreach ($databases as $database) {
  1420. // Populate listbox..
  1421. $dbname = $database->getparameter("name");
  1422. $Fauthdb->additem($dbname);
  1423. }
  1424. $Fauthdb->setvalue($app->getparameter("remote_authentication", "remote_auth_dbname"));
  1425. $Tin->td( $Fauthdb->render() );
  1426. $Tin->tr("axbglite");
  1427. $Tin->td( "Remote user table name:", "axfg" );
  1428. $mybox = $tbox;
  1429. $mybox->setid("auth_fields");
  1430. $mybox->setstyle("width:$cwidth");
  1431. $mybox->settitle(
  1432. "This is the name of the table on the remote database which holds the user "
  1433. . "authentication data such as userid and password."
  1434. );
  1435. $mybox->setvalue($app->getparameter("remote_authentication", "remote_auth_tablename"));
  1436. $Tin->td( $mybox->render("cp_remote_auth_tablename") );
  1437.  
  1438. foreach ($REMOTE_AUTH_FIELDNAMES as $axyl_field) {
  1439. $Tin->tr("axbgdark");
  1440. $Tin->td( "&raquo;&nbsp;remote field for $axyl_field:", "axfg" );
  1441. $mybox = $tbox;
  1442. $mybox->setid("auth_fields");
  1443. $mybox->setstyle("width:$cwidth");
  1444. $mybox->settitle(
  1445. "Enter the name of the remote field corresponding to the local '$axyl_field' field."
  1446. );
  1447. $mapping = $app->getparameter("remote_authentication", "remote_auth_mappings", $axyl_field);
  1448. $mybox->setvalue( $mapping !== false ? $mapping : "" );
  1449. $Tin->td( $mybox->render("cp_remote_auth_mapping_$axyl_field") );
  1450. }
  1451. $Tin->tr("axbgdark");
  1452. $Tin->td();
  1453. $Tin->td(
  1454. "Only enter names of mapped fields, leaving unmapped ones blank. "
  1455. . "Note: user_id and password are mandatory.",
  1456. "axfg"
  1457. );
  1458. $Tin->td_css("font-style:italic;font-size:80%");
  1459. $Tin->set_width_profile("50%,50%");
  1460. $Tapp->tr();
  1461. $Tapp->td( $Tin->render() );
  1462. // ......................................................................
  1463. // MISC SETTINGS
  1464. $Tapp->tr("axsubhdg");
  1465. $Tapp->td("<b>Miscellaneous settings</b>", "axsubhdg");
  1466. $Tin = new table("misc");
  1467. $Tin->setpadding(2);
  1468. $Tin->tr("axbglite");
  1469. $Tin->td( "IP addresses to block:", "axfg" );
  1470. $mybox = $tbox;
  1471. $mybox->settitle(
  1472. "This is used to block specific IP addresses which are causing a problem "
  1473. . "accessing the website. Any IP listed here will be denied access."
  1474. );
  1475. $mybox->setvalue(str_replace("\"", "", $app->getparameter("badips", "badips")));
  1476. $Tin->td( $mybox->render("cp_badips") );
  1477. $Tin->tr("axbglite");
  1478. $Tin->td();
  1479. $Tin->td(
  1480. "A comma-delimited list of IP addresses which are to be denied access.",
  1481. "axfg"
  1482. );
  1483. $Tin->td_css("font-style:italic;font-size:80%");
  1484. $Tin->set_width_profile("50%,50%");
  1485. $Tapp->tr();
  1486. $Tapp->td( $Tin->render() );
  1487. break;
  1488.  
  1489. // ......................................................................
  1490. // DATABASE SETTINGS
  1491. case CP_VIEW_DB:
  1492. $Tapp->tr("axsubhdg");
  1493. $Tapp->td("<b>Database connections</b>", "axsubhdg");
  1494. $Tin = new table("dbsettings");
  1495. $Tin->setpadding(2);
  1496. $database_listbox->setstyle("width:$ewidth;");
  1497. $database_listbox->size = 6;
  1498. // Get defined databases..
  1499. $dbs = $app->get_setting("database");
  1500. if ($dbs === false) $databases = array();
  1501. elseif (is_array($dbs)) $databases = $dbs;
  1502. else $databases[0] = $dbs;
  1503. $dbid = 0;
  1504. foreach ($databases as $database) {
  1505. // Populate listbox..
  1506. $dbname = $database->getparameter("name");
  1507. $database_listbox->additem($dbid, $dbname);
  1508. // Populate maintainer data. The maintainer add_record method
  1509. // requires an associative array keyed on listbox key id..
  1510. $rec = array(
  1511. "dbtype" => $database->getparameter("type"),
  1512. "dbname" => $dbname,
  1513. "dbuser" => $database->getparameter("user"),
  1514. "dbpassword" => $database->getparameter("password"),
  1515. "dbhost" => $database->getparameter("host"),
  1516. "dbport" => $database->getparameter("port"),
  1517. "dbenc" => $database->getparameter("enc"),
  1518. "dbdatestyle" => $database->getparameter("datestyle")
  1519. );
  1520. $maintainer->add_record($dbid, $rec);
  1521. if (!isset($firstrec)) {
  1522. $firstrec = $rec;
  1523. }
  1524. $dbid += 1;
  1525. } // foreach
  1526. // Now set the defaults for each of the fields. These are
  1527. // necessary for when a new record is created..
  1528. $defaults = array(
  1529. "dbtype" => "postgres",
  1530. "dbname" => "",
  1531. "dbuser" => "",
  1532. "dbpassword" => "",
  1533. "dbhost" => "",
  1534. "dbport" => "",
  1535. "dbenc" => "UNICODE",
  1536. "dbdatestyle" => "ISO"
  1537. );
  1538. $maintainer->add_defaults($defaults);
  1539. if (!isset($firstrec)) {
  1540. $firstrec = $defaults;
  1541. }
  1542. // The listbox field..
  1543. $database_listbox->settitle(
  1544. "Databases which this website needs to connect to. The first will be the "
  1545. . "default database."
  1546. );
  1547. $database_listbox->setvalue($firstrec["dbname"]);
  1548. $Tin->tr("axbgdark");
  1549. $Tin->td( $database_listbox->render() );
  1550. $Tin->td_width("50%");
  1551. $Tin2 = new table();
  1552. $Tin2->td(
  1553. "NB: The ordering of this list is important. The first "
  1554. . "database will be the default connection.",
  1555. "axfg"
  1556. );
  1557. $Tin2->td_css("font-style:italic;font-size:80%");
  1558. $Tin2->td_alignment("", "top");
  1559. $bdel->setstyle("padding-top:4px");
  1560. $Tin2->td(
  1561. $badd->render() . "<br>"
  1562. . $bup->render() . "<br>"
  1563. . $bdown->render() . "<br>"
  1564. . $bdel->render()
  1565. );
  1566. $Tin2->td_alignment("right", "top");
  1567. $Tin->td( $Tin2->render() );
  1568. $Tin->td_width("50%");
  1569. $Tin->td_alignment("", "top");
  1570. // ..................................................................
  1571. // Database type field..
  1572. $Fdbtype = new form_combofield("dbtype", "", $firstrec["dbtype"]);
  1573. $Fdbtype->setclass("axcombo");
  1574. $Fdbtype->settitle(
  1575. "The type of database it is. This determines the database interface "
  1576. . "module for executing your queries."
  1577. );
  1578. $maintainer->register_field($Fdbtype);
  1579. $Fdbtype->additem("postgres", "Postgres");
  1580. $Fdbtype->additem("odbc", "ODBC");
  1581. $Fdbtype->additem("mssql", "MS SQL Server");
  1582. $Fdbtype->additem("mysql", "MySQL");
  1583. $Fdbtype->additem("oracle", "Oracle");
  1584. $Fdbtype->setstyle("width:$cbowidth;");
  1585. $Tin->tr("axbglite");
  1586. $Tin->td( "Database type:", "axfg" );
  1587. $Tin->td( $Fdbtype->render() );
  1588. // ..................................................................
  1589. // Database name field..
  1590. $Fdbname = new form_textfield("dbname", "", $firstrec["dbname"]);
  1591. $maintainer->register_field($Fdbname);
  1592. $Fdbname->setstyle("width:$ewidth;");
  1593. $Fdbname->setclass("axtxtbox");
  1594. $Fdbname->settitle(
  1595. "The unique name of this database, as used in the connect string."
  1596. );
  1597. $Tin->tr("axbgdark");
  1598. $Tin->td( "Database name:", "axfg" );
  1599. $Tin->td( $Fdbname->render() );
  1600. // ..................................................................
  1601. // Database user field..
  1602. $Fdbuser = new form_textfield("dbuser", "", $firstrec["dbuser"]);
  1603. $maintainer->register_field($Fdbuser);
  1604. $Fdbuser->setstyle("width:$ewidth;");
  1605. $Fdbuser->setclass("axtxtbox");
  1606. $Fdbuser->settitle(
  1607. "The name of a user who is permitted to connect to the database."
  1608. );
  1609. $Tin->tr("axbglite");
  1610. $Tin->td( "Username:", "axfg" );
  1611. $Tin->td( $Fdbuser->render() );
  1612. // ..................................................................
  1613. // Database password field..
  1614. $Fdbpassword = new form_textfield("dbpassword", "", $firstrec["dbpassword"]);
  1615. $maintainer->register_field($Fdbpassword);
  1616. $Fdbpassword->setstyle("width:$ewidth;");
  1617. $Fdbpassword->setclass("axtxtbox");
  1618. $Fdbpassword->settitle(
  1619. "If the database requires a password to authenticate the connection, then "
  1620. . "enter it here, otherwise leave blank."
  1621. );
  1622. $Tin->tr("axbgdark");
  1623. $Tin->td( "User password:", "axfg" );
  1624. $Tin->td( $Fdbpassword->render() );
  1625. // ..................................................................
  1626. // Database host field..
  1627. $Fdbhost = new form_textfield("dbhost", "", $firstrec["dbhost"]);
  1628. $maintainer->register_field($Fdbhost);
  1629. $Fdbhost->setstyle("width:$ewidth;");
  1630. $Fdbhost->setclass("axtxtbox");
  1631. $Fdbhost->settitle(
  1632. "For a locally hosted database, leave blank. However, if this database "
  1633. . "lives on a remote machine, enter the hostname of that machine here."
  1634. );
  1635. $Tin->tr("axbglite");
  1636. $Tin->td( "Hostname:", "axfg" );
  1637. $Tin->td( $Fdbhost->render() );
  1638. // ..................................................................
  1639. // Database port field..
  1640. $Fdbport = new form_textfield("dbport", "", $firstrec["dbport"]);
  1641. $maintainer->register_field($Fdbport);
  1642. $Fdbport->setstyle("width:$ewidth;");
  1643. $Fdbport->setclass("axtxtbox");
  1644. $Fdbport->settitle(
  1645. "For a locally hosted database leave this blank. For a remotely hosted "
  1646. . "database, you would usually enter '5432' here."
  1647. );
  1648. $Tin->tr("axbgdark");
  1649. $Tin->td( "Port number:", "axfg" );
  1650. $Tin->td( $Fdbport->render() );
  1651. $Tin->set_width_profile("50%,50%");
  1652. // ..................................................................
  1653. // Database char encoding field..
  1654. $Fdbenc = new form_combofield("dbenc", "", $firstrec["dbenc"]);
  1655. $Fdbenc->setclass("axcombo");
  1656. $Fdbenc->setstyle("width:$cwidth;");
  1657. $Fdbenc->settitle(
  1658. "Make sure you set this to the encoding that the database was created "
  1659. . "with. In Postgres you can find this out by listing the databases "
  1660. . "in 'psql'."
  1661. );
  1662. $maintainer->register_field($Fdbenc);
  1663. $Fdbenc->additem("", "default");
  1664. $Fdbenc->additem("SQL_ASCII", "ASCII");
  1665. $Fdbenc->additem("UNICODE", "Unicode (UTF-8)");
  1666. $Fdbenc->additem("EUC_JP", "Japanese EUC");
  1667. $Fdbenc->additem("EUC_CN", "Chinese EUC");
  1668. $Fdbenc->additem("EUC_KR", "Korean EUC");
  1669. $Fdbenc->additem("JOHAB", "Korean EUC (Hangle base)");
  1670. $Fdbenc->additem("EUC_TW", "Taiwan EUC");
  1671. $Fdbenc->additem("MULE_INTERNAL", "Mule internal code");
  1672. $Fdbenc->additem("LATIN1", "ISO 8859-1/ECMA 94 (Latin alphabet no.1)");
  1673. $Fdbenc->additem("LATIN2", "ISO 8859-2/ECMA 94 (Latin alphabet no.2)");
  1674. $Fdbenc->additem("LATIN3", "ISO 8859-3/ECMA 94 (Latin alphabet no.3)");
  1675. $Fdbenc->additem("LATIN4", "ISO 8859-4/ECMA 94 (Latin alphabet no.4)");
  1676. $Fdbenc->additem("LATIN5", "ISO 8859-9/ECMA 128 (Latin alphabet no.5)");
  1677. $Fdbenc->additem("LATIN6", "ISO 8859-10/ECMA 144 (Latin alphabet no.6)");
  1678. $Fdbenc->additem("LATIN7", "ISO 8859-13 (Latin alphabet no.7)");
  1679. $Fdbenc->additem("LATIN8", "ISO 8859-14 (Latin alphabet no.8)");
  1680. $Fdbenc->additem("LATIN9", "ISO 8859-15 (Latin alphabet no.9)");
  1681. $Fdbenc->additem("LATIN10", "ISO 8859-16/ASRO SR 14111 (Latin alphabet no.10)");
  1682. $Fdbenc->additem("ISO_8859_5", "ISO 8859-5/ECMA 113 (Latin/Cyrillic)");
  1683. $Fdbenc->additem("ISO_8859_6", "ISO 8859-6/ECMA 114 (Latin/Arabic)");
  1684. $Fdbenc->additem("ISO_8859_7", "ISO 8859-7/ECMA 118 (Latin/Greek)");
  1685. $Fdbenc->additem("ISO_8859_8", "ISO 8859-8/ECMA 121 (Latin/Hebrew)");
  1686. $Fdbenc->additem("KOI8", "KOI8-R(U)");
  1687. $Fdbenc->additem("WIN", "Windows CP1251");
  1688. $Fdbenc->additem("ALT", "Windows CP866");
  1689. $Fdbenc->additem("WIN1256", "Windows CP1256 (Arabic)");
  1690. $Fdbenc->additem("TCVN", "TCVN-5712/Windows CP1258 (Vietnamese)");
  1691. $Fdbenc->additem("WIN874", "Windows CP874 (Thai)");
  1692. $Tin->tr("axbglite");
  1693. $Tin->td( "Database encoding:", "axfg" );
  1694. $Tin->td( $Fdbenc->render() );
  1695. // ..................................................................
  1696. // Database date style field..
  1697. $Fdbdatestyle = new form_combofield("dbdatestyle", "", $firstrec["dbdatestyle"]);
  1698. $Fdbdatestyle->setclass("axcombo");
  1699. $Fdbdatestyle->setstyle("width:$cwidth;");
  1700. $Fdbdatestyle->settitle(
  1701. "This affects the output format of date-time data from the database. Axyl "
  1702. . "library code expects the ISO format, so it is recommended to always use "
  1703. . "that here, unless you have a good reason to change it."
  1704. );
  1705. $maintainer->register_field($Fdbdatestyle);
  1706. $Fdbdatestyle->additem("", "default");
  1707. $Fdbdatestyle->additem("ISO", "ISO 8601 (1997-12-17 07:37:16-08)");
  1708. $Fdbdatestyle->additem("SQL", "SQL Traditional (12/17/1997 07:37:16.00 PST)");
  1709. $Fdbdatestyle->additem("POSTGRES", "Postgres (Wed Dec 17 07:37:16 1997 PST)");
  1710. $Fdbdatestyle->additem("German", "Regional (17.12.1997 07:37:16.00 PST)");
  1711. $Tin->tr("axbgdark");
  1712. $Tin->td( "Date output style:", "axfg" );
  1713. $Tin->td( $Fdbdatestyle->render() );
  1714. $Tapp->tr();
  1715. $Tapp->td( $Tin->render() );
  1716.  
  1717. $Tin = new table("dbsettings");
  1718. $Tin->setpadding(2);
  1719. $Tapp->tr("axsubhdg");
  1720. $Tapp->td("<b>Misc settings</b>", "axsubhdg");
  1721. $mychkbox = $chkbox;
  1722. $mychkbox->checked = $app->getparameter("database_backed", "database_backed");
  1723. $mychkbox->settitle(
  1724. "Check this if your website connects to a database. Most do, but this allows "
  1725. . "the possibility of providing simple websites without it."
  1726. );
  1727. $Tin->tr("axbgdark");
  1728. $Tin->td( "Website uses a Database:", "axfg" );
  1729. $Tin->td( $mychkbox->render("cp_database_backed") );
  1730. $Tin->tr("axbglite");
  1731. $Tin->td( "Hosts for persistent DB connection:", "axfg" );
  1732. $mybox = $tbox;
  1733. $mybox->settitle(
  1734. "If the database hostname contains the string you enter here, then database "
  1735. . "connections will be made persistently, improving performance when the "
  1736. . "site is busy."
  1737. );
  1738. $mybox->setvalue(str_replace("\"", "", $app->getparameter("permhosts", "permhosts")));
  1739. $Tin->td( $mybox->render("cp_permhosts") );
  1740. $Tin->tr("axbglite");
  1741. $Tin->td();
  1742. $Tin->td(
  1743. "A comma-delimited list of hostnames which will use persistent "
  1744. . "database connections. Usually these would be your production "
  1745. . "web-servers.",
  1746. "axfg"
  1747. );
  1748. $Tin->td_css("font-style:italic;font-size:80%");
  1749. $Tin->set_width_profile("50%,50%");
  1750. $Tapp->tr();
  1751. $Tapp->td( $Tin->render() );
  1752. break;
  1753. // ......................................................................
  1754. // DEBUG SETTINGS
  1755. case CP_VIEW_DEBUG:
  1756. $Tapp->tr("axsubhdg");
  1757. $Tapp->td("<b>Output controls</b>", "axsubhdg");
  1758. $Tin = new table("debug_output");
  1759. $Tin->setpadding(2);
  1760. $debugging = $app->getparameter("debug_on", "debug_on");
  1761. $mychkbox = $chkbox;
  1762. $mychkbox->settitle(
  1763. "If you want site-wide debugging to be displayed then check this box. It "
  1764. . "will cause every page to display debug information."
  1765. );
  1766. $mychkbox->checked = $debugging;
  1767. $Tin->tr("axbgdark");
  1768. $Tin->td( "Enable debugging:", "axfg" );
  1769. $Tin->td( $mychkbox->render("cp_debug_on") );
  1770. $Tin->tr("axbglite");
  1771. $Tin->td( "Classes of output to show:", "axfg");
  1772. $Tin->td_alignment("", "top");
  1773. $Fdebugcl = new form_combofield();
  1774. $Fdebugcl->multiselect = true;
  1775. $Fdebugcl->set_size(6);
  1776. $Fdebugcl->setstyle("width:$cwidth");
  1777. $Fdebugcl->settitle(
  1778. "This multiple-select box allows you to choose which classes of debug output "
  1779. . "are displayed. Eg. If you only want your ad-hoc 'debugbr()' statements to be "
  1780. . "output, then choose 'User diagnostics'."
  1781. );
  1782. $Fdebugcl->set_onchange('setchgd()');
  1783. $Fdebugcl->additem(2, "User diagnostics (default)");
  1784. $Fdebugcl->additem(4, "SQL statements");
  1785. $Fdebugcl->additem(8, "All SQL data (verbose)");
  1786. $Fdebugcl->additem(16, "Dump of GET/POST vars etc.");
  1787. $Fdebugcl->additem(32, "Include traceback info");
  1788. $Fdebugcl->additem(64, "Show table outlines");
  1789. $Fdebugcl->additem(128, "Execution profiler");
  1790. $Fdebugcl->additem(256, "Authentication");
  1791. $Fdebugcl->additem(1, "System diagnostics");
  1792. // Build value as array of set bits..
  1793. $debugcl = $app->getparameter("debug_classes", "debug_classes");
  1794. $debug_value = array();
  1795. for ($i=1; $i < 512; $i*=2) {
  1796. if ($debugcl & $i) {
  1797. $debug_value[] = $i;
  1798. }
  1799. }
  1800. $Fdebugcl->setvalue($debug_value);
  1801. $Tin->td( $Fdebugcl->render("cp_debug_classes") );
  1802. $Tin->tr("axbgdark");
  1803. $Tin->td( "Output modes:", "axfg");
  1804. $Tin->td_alignment("", "top");
  1805. $Fdebugop = new form_combofield();
  1806. $Fdebugop->multiselect = true;
  1807. $Fdebugop->set_size(6);
  1808. $Fdebugop->set_onchange('setchgd()');
  1809. $Fdebugop->setstyle("width:$cwidth");
  1810. $Fdebugop->settitle(
  1811. "This determines where the debugging goes. Standard output is displayed in "
  1812. . "the webpage, at the top - this is generally the most useful in a website "
  1813. . "with buffered output. Another useful option is to send it to the system "
  1814. . "log."
  1815. );
  1816. $Fdebugop->additem(1, "Standard (default)");
  1817. $Fdebugop->additem(2, "Unbuffered echo");
  1818. $Fdebugop->additem(4, "CLI output (non-web mode)");
  1819. $Fdebugop->additem(8, "To system logfile");
  1820. // Build value as array of set bits..
  1821. $debugop = $app->getparameter("debug_output", "debug_output");
  1822. $debugop_value = array();
  1823. for ($i=1; $i < 512; $i*=2) {
  1824. if ($debugop & $i) {
  1825. $debugop_value[] = $i;
  1826. }
  1827. }
  1828. $Fdebugop->setvalue($debugop_value);
  1829. $Tin->td( $Fdebugop->render("cp_debug_output") );
  1830. $Tin->set_width_profile("50%,50%");
  1831. $Tapp->tr();
  1832. $Tapp->td( $Tin->render() );
  1833.  
  1834. $Tapp->tr("axsubhdg");
  1835. $Tapp->td("<b>Diagnostics</b>", "axsubhdg");
  1836. $Tin = new table("debug_diags");
  1837. $Tin->setpadding(2);
  1838. $bg = "axbgdark";
  1839. integerField(
  1840. "SQL Execution log threshold:",
  1841. "SQL_EXEC_THRESHOLD",
  1842. $app->globals,
  1843. 60000, 80,
  1844. "Use this to detect queries which are taking much longer than they "
  1845. . "should to complete."
  1846. );
  1847. infoField(
  1848. "SQL queries exeeding the specified number of milliseconds will "
  1849. . "be logged in the system log. To disable, set to zero."
  1850. );
  1851. $resptimer = $app->getparameter("response_timer", "response_timer");
  1852. $mychkbox = $chkbox;
  1853. $mychkbox->checked = $resptimer;
  1854. $mychkbox->settitle(
  1855. "Use this option to find out how long your website pages are taking to "
  1856. . "render to the user-agent. Useful for separating render time from network "
  1857. . "transit time."
  1858. );
  1859. $Tin->tr("axbglite");
  1860. $Tin->td( "Enable response time logging:", "axfg" );
  1861. $Tin->td( $mychkbox->render("cp_response_timer") );
  1862. $Tin->set_width_profile("50%,50%");
  1863. $Tapp->tr();
  1864. $Tapp->td( $Tin->render() );
  1865. $Tapp->tr("axfoot");
  1866. $Tapp->td("&nbsp;", "axfoot");
  1867. break;
  1868.  
  1869. // ......................................................................
  1870. // DEFAULT SETTINGS
  1871. default:
  1872. $Tapp->tr("axsubhdg");
  1873. $Tapp->td("<b>Identification</b>", "axsubhdg");
  1874. $Tin = new table("definitions");
  1875. $Tin->setpadding(2);
  1876.  
  1877. entryField(
  1878. "Application Name:",
  1879. "APP_NAME",
  1880. $app->definitions,
  1881. "This is the 'nice' name for your website. Usually a single word, but can be "
  1882. . "more then one. It is used in areas such as e-mails, and error messages."
  1883. );
  1884. entryField(
  1885. "Application Prefix:",
  1886. "APP_PREFIX",
  1887. $app->definitions,
  1888. "A single word with no spaces or hyphens. This should uniquely identify your "
  1889. . "website on the local machine. This value is also used with Axyl Lucene "
  1890. . "to set your indexing 'domain'."
  1891. );
  1892. $Tin->set_width_profile("50%,50%");
  1893. $Tapp->tr();
  1894. $Tapp->td( $Tin->render() );
  1895. // ......................................................................
  1896. // GLOBALS
  1897. $Tapp->tr("axsubhdg");
  1898. $Tapp->td("<b>Global variables</b>", "axsubhdg");
  1899. $Tin = new table("globals");
  1900. $Tin->setpadding(2);
  1901. $Tin->tbody("fmlook");
  1902. $bg = "axbgdark";
  1903. entryField(
  1904. "Templates directory:",
  1905. "TEMPLATESDIR",
  1906. $app->globals,
  1907. "The directory Axyl searches for templates. Should be in your website "
  1908. . "directory hierarchy. Accessible as global var \$TEMPLATESDIR"
  1909. );
  1910. entryField(
  1911. "Images directory:",
  1912. "IMAGESDIR",
  1913. $app->globals,
  1914. "The directory Axyl searches for images. Should be in your website "
  1915. . "directory hierarchy. Accessible as global var \$IMAGESDIR"
  1916. );
  1917. entryField(
  1918. "Cached files directory:",
  1919. "CACHEDIR",
  1920. $app->globals,
  1921. "The directory Axyl uses to cache pages which you have designated as "
  1922. . "being cacehable."
  1923. );
  1924. entryField(
  1925. "Media catalog directory:",
  1926. "CATALOGDIR",
  1927. $app->globals,
  1928. "The directory Axyl stores media uploaded to your Media Catalog. "
  1929. . "Accessible as global var \$CATALOGDIR"
  1930. );
  1931. entryField(
  1932. "Managed content directory:",
  1933. "CMDIR",
  1934. $app->globals,
  1935. "This is a directory hierarchy which contains the content-managed pages "
  1936. . "created by users."
  1937. );
  1938. entryField(
  1939. "Includes directory:",
  1940. "INCDIR",
  1941. $app->globals,
  1942. "This is a directory you store your application 'include' files. It is "
  1943. . "then accessible to you as global var \$INCDIR."
  1944. );
  1945. infoField(
  1946. "NB: all directories specified above should be relative to the "
  1947. . "website root directory. Additionally, if they are to be writeable "
  1948. . "then they should be under the 'var' subdirectory."
  1949. );
  1950. entryField(
  1951. "Webmaster name:",
  1952. "WEBMASTER_PERSON",
  1953. $app->globals,
  1954. "Name of the person who looks after the website. Mainly used in system-generated "
  1955. . "e-mails and messages."
  1956. );
  1957. entryField(
  1958. "Webmaster e-mail:",
  1959. "WEBMASTER_EMAIL",
  1960. $app->globals,
  1961. "The e-mail address of the person named above."
  1962. );
  1963. $Tin->set_width_profile("50%,50%");
  1964. $Tapp->tr();
  1965. $Tapp->td( $Tin->render() );
  1966. // ......................................................................
  1967. // DTD & ENCODING
  1968. $Tapp->tr("axsubhdg");
  1969. $Tapp->td("<b>Default DTD and website encoding</b>", "axsubhdg");
  1970. $Tin = new table("dtd_enc");
  1971. $Tin->setpadding(2);
  1972. $cboHTMLDTD = new form_combofield();
  1973. $cboHTMLDTD->setclass("axcombo");
  1974. $cboHTMLDTD->set_onchange('setchgd()');
  1975. $cboHTMLDTD->settitle(
  1976. "The default site-wide Document Type Definition to be generated for each HTML page. "
  1977. . "This value may be overridden by templates, or in specific pages by your "
  1978. . "code."
  1979. );
  1980. $cboHTMLDTD->additem("", "None");
  1981. $cboHTMLDTD->additem(
  1982. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">"),
  1983. "HTML 3.2 Strict"
  1984. );
  1985. $cboHTMLDTD->additem(
  1986. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"),
  1987. "HTML 4.01 Transitional"
  1988. );
  1989. $cboHTMLDTD->additem(
  1990. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"),
  1991. "HTML 4.01 Strict"
  1992. );
  1993. $cboHTMLDTD->additem(
  1994. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Frameset//EN\">"),
  1995. "HTML 4.01 with Frameset"
  1996. );
  1997. $cboHTMLDTD->additem(
  1998. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">"),
  1999. "XHTML 1.0 Transitional"
  2000. );
  2001. $cboHTMLDTD->additem(
  2002. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\">"),
  2003. "XHTML 1.0 Strict"
  2004. );
  2005. $cboHTMLDTD->additem(
  2006. rawurlencode("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\">"),
  2007. "XHTML 1.0 with Frameset"
  2008. );
  2009. $cboHTMLDTD->setvalue($app->getparameter("dtd", "dtd", "html"));
  2010. $cboWMLDTD = new form_combofield();
  2011. $cboWMLDTD->setclass("axcombo");
  2012. $cboWMLDTD->set_onchange('setchgd()');
  2013. $cboWMLDTD->settitle(
  2014. "The default site-wide Document Type Definition to be generated for each WML page. "
  2015. . "This value may be overridden by templates, or in specific pages by your "
  2016. . "code."
  2017. );
  2018. $cboWMLDTD->additem("", "None");
  2019. $cboWMLDTD->additem(
  2020. rawurlencode("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1_1.xml\">"),
  2021. "WML 1.1"
  2022. );
  2023. $cboWMLDTD->additem(
  2024. rawurlencode("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.2//EN\" \"http://www.wapforum.org/DTD/wml12.xml\">"),
  2025. "WML 1.2"
  2026. );
  2027. $cboWMLDTD->setvalue($app->getparameter("dtd", "dtd", "wml"));
  2028. $cboENC = new form_combofield();
  2029. $cboENC->setclass("axcombo");
  2030. $cboENC->set_onchange('setchgd()');
  2031. $cboENC->settitle(
  2032. "The encoding for pages generated by this website. This determines the 'charset=' "
  2033. . "portion of the 'Content-Type:' header which gets ssent for each webpage."
  2034. );
  2035. $cboENC->additem("ISO-8859-1", "ISO-8859-1 Latin 1 (Western)");
  2036. $cboENC->additem("US-ASCII", "US-ASCII");
  2037. $cboENC->additem("UTF-8", "UTF-8 (Unicode)");
  2038. $setting = $app->get_setting("encoding");
  2039. $cboENC->setvalue($app->getparameter("encoding", "encoding"));
  2040. if ($app->getparameter("multilang", "multilang")) {
  2041. $cboENC->disabled = true;
  2042. }
  2043. $Tin->tr("axbgdark");
  2044. $Tin->td( "DTD for HTML content:", "axfg" );
  2045. $Tin->td( $cboHTMLDTD->render("cp_dtd_html") );
  2046. $Tin->tr("axbglite");
  2047. $Tin->td( "DTD for WAP content:", "axfg" );
  2048. $Tin->td( $cboWMLDTD->render("cp_dtd_wml") );
  2049. $Tin->tr("axbgdark");
  2050. $Tin->td( "Character encoding:", "axfg" );
  2051. $Tin->td( $cboENC->render("cp_encoding") );
  2052. $mychkbox = $chkbox;
  2053. $mychkbox->checked = $app->getparameter("multilang", "multilang");
  2054. $mychkbox->set_onclick("setUTF8mode(this.checked)");
  2055. $mychkbox->settitle(
  2056. "If you need to render multiple character sets in UTF-8 on your website then "
  2057. . "check this option, and select Unicode (UTF-8) above. This will cause Axyl "
  2058. . "to do some special string handling (using mb_output_handler), and also "
  2059. . "produce a 'lang=' attribute in the &LT;html&GT; tag, plus a 'Content-Language' "
  2060. . "meta tag for each language used in the webpage."
  2061. );
  2062. $Tin->tr("axbglite");
  2063. $Tin->td( "Website uses multiple languages:", "axfg" );
  2064. $Tin->td( $mychkbox->render("cp_multilang") . "&nbsp;(requires UTF-8 encoding above)" );
  2065. $Tin->td_css("font-style:italic;font-size:80%");
  2066. $Tin->set_width_profile("50%,50%");
  2067. $Tapp->tr();
  2068. $Tapp->td( $Tin->render() );
  2069. // ......................................................................
  2070. // SESSION
  2071. $Tapp->tr("axsubhdg");
  2072. $Tapp->td("<b>Session settings</b>", "axsubhdg");
  2073. $Tin = new table("session");
  2074. $Tin->setpadding(2);
  2075. $Tin->tr("axbgdark");
  2076. $Tin->td( "Website HTTP hostname:", "axfg" );
  2077. $http_host = $app->getparameter("http_host", "http_host");
  2078. if ($http_host == "") {
  2079. $http_host = "(default to webserver)";
  2080. }
  2081. $mybox = $tbox;
  2082. $mybox->setvalue($http_host);
  2083. $mybox->settitle(
  2084. "This allows you to specify a different hostname from the local webserver. Normally "
  2085. . "this isn't required, however some architectures require Axyl to run through a "
  2086. . "proxy and hence cookies and webpages etc. are identified as coming from that machine "
  2087. . "rather than the local one."
  2088. . ""
  2089. );
  2090. $Tin->td( $mybox->render("cp_http_host") );
  2091. $Tin->tr("axbgdark");
  2092. $Tin->td();
  2093. $Tin->td(
  2094. "Set to blank, or '(default to webserver)' to get the default "
  2095. . "webserver hostname. Otherwise set your own.",
  2096. "axfg"
  2097. );
  2098. $Tin->td_css("font-style:italic;font-size:80%");
  2099. $Tin->set_width_profile("50%,50%");
  2100. $Tin->tr("axbglite");
  2101. $Tin->td( "Cookie name:", "axfg" );
  2102. $cookiename = $app->getparameter("cookiename", "cookiename");
  2103. if ($cookiename == "") {
  2104. $cookiename = $app->definitions["APP_PREFIX"] . "_session_id";
  2105. }
  2106. $mybox = $tbox;
  2107. $mybox->setvalue($cookiename);
  2108. $mybox->settitle(
  2109. "If you don't like the default Axyl name for your cookie, then just "
  2110. . "take the opporunity to change it here!"
  2111. );
  2112. $Tin->td( $mybox->render("cp_cookiename") );
  2113. $Tin->tr("axbgdark");
  2114. $Tin->td( "Cookie/session lifetime:", "axfg" );
  2115. $Flife = new form_combofield();
  2116. $Flife->setclass("axcombo");
  2117. $Flife->setstyle("width:$cwidth");
  2118. $Flife->set_onchange('setchgd()');
  2119. $Flife->additem(-1, "Until browser closed");
  2120. $Flife->additem(315360000, "Forever and a day");
  2121. $Flife->additem(31536000, "A year");
  2122. $Flife->additem(2592000, "A month");
  2123. $Flife->additem(604800, "A week");
  2124. $Flife->additem(86400, "24 hours");
  2125. $Flife->additem(43200, "12 hours");
  2126. $Flife->additem(28800, "8 hours");
  2127. $Flife->additem(14400, "4 hours");
  2128. $Flife->additem(3600, "An hour");
  2129. $Flife->additem(1200, "20 minutes");
  2130. $Flife->additem(0, "Immediate expiry");
  2131. $Flife->setvalue($app->getparameter("lifetime", "lifetime"));
  2132. $Flife->settitle(
  2133. "This determines how long the session cookie is valid. The most common setting "
  2134. . "is 'Until browser closed' which requires a login each time. This can be "
  2135. . "overridden to be 'forever' if the login process contains a '\$chkRememberMe' "
  2136. . "defined in the form submit."
  2137. );
  2138. $Tin->td( $Flife->render("cp_lifetime") );
  2139. $Tin->tr("axbglite");
  2140. $Tin->td( "Page expiry (seconds):", "axfg" );
  2141. $Fexpiry = new form_combofield();
  2142. $Fexpiry->setclass("axcombo");
  2143. $Fexpiry->setstyle("width:$cwidth");
  2144. $Fexpiry->set_onchange('setchgd()');
  2145. $Fexpiry->additem(-1, "Immediate (dynamic content)");
  2146. $Fexpiry->additem(60, "1 minute");
  2147. $Fexpiry->additem(120, "2 minutes");
  2148. $Fexpiry->additem(180, "3 minutes");
  2149. $Fexpiry->additem(240, "4 minutes");
  2150. $Fexpiry->additem(300, "5 minutes");
  2151. $Fexpiry->additem(600, "10 minutes");
  2152. $Fexpiry->additem(1800, "30 minutes");
  2153. $Fexpiry->additem(3600, "1 hour");
  2154. $Fexpiry->additem(14400, "4 hours");
  2155. $Fexpiry->additem(28800, "8 hours");
  2156. $Fexpiry->additem(86400, "24 hours");
  2157. $Fexpiry->additem(315360000, "Never (static content)");
  2158. $Fexpiry->setvalue($app->getparameter("expiry", "expiry"));
  2159. $Fexpiry->settitle(
  2160. "This sets the expiry of content sent to the browser. For pages which are "
  2161. . "dynamically generated, this is normally 'Immediate', however this does "
  2162. . "have the effect of negating the user's 'Back' button. A compromise is to "
  2163. . "set this to a small value, such as 1 minute."
  2164. );
  2165. $Tin->td( $Fexpiry->render("cp_expiry") );
  2166. $mychkbox = $chkbox;
  2167. $mychkbox->checked = $app->getparameter("guest_browser_lifetime", "guest_browser_lifetime");
  2168. $mychkbox->settitle(
  2169. "Non-logged-in users in Axyl get allocated a 'guest' session cookie. This option will "
  2170. . "set the lifetime of that cookie to the life of their browser session. To be honest "
  2171. . "there isn't much difference either way!"
  2172. );
  2173. $Tin->tr("axbgdark");
  2174. $Tin->td( "Guest cookies browser lifetime:", "axfg" );
  2175. $Tin->td( $mychkbox->render("cp_guest_browser_lifetime") );
  2176. $mychkbox = $chkbox;
  2177. $mychkbox->checked = $app->getparameter("session_track_logins", "session_track_logins");
  2178. $mychkbox->settitle(
  2179. "If checked then Axyl will keep track of each user's logins, counting them as they "
  2180. . "log in each time. Unchecking removes that small processing overhead."
  2181. );
  2182. $Tin->tr("axbglite");
  2183. $Tin->td( "Count user login sessions:", "axfg" );
  2184. $Tin->td( $mychkbox->render("cp_session_track_logins") );
  2185. $Tin->set_width_profile("50%,50%");
  2186. $Tapp->tr();
  2187. $Tapp->td( $Tin->render() );
  2188. // ......................................................................
  2189. // CONTENT
  2190. $Tapp->tr("axsubhdg");
  2191. $Tapp->td("<b>Content settings</b>", "axsubhdg");
  2192. $Tin = new table("content");
  2193. $Tin->setpadding(2);
  2194. $mychkbox = $chkbox;
  2195. $mychkbox->checked = $app->getparameter("metadata_enabled", "metadata_enabled");
  2196. $mychkbox->settitle(
  2197. "If you installed the Axyl Metadata Extension when you created the website, then "
  2198. . "you can enable it here. This gives extra functionality in the Axyl Content "
  2199. . "Managed Layouts for defining metadata for webpages."
  2200. );
  2201. $Tin->tr("axbglite");
  2202. $Tin->td( "Enable metadata edit/generation:", "axfg" );
  2203. $Tin->td( $mychkbox->render("cp_metadata_enabled") );
  2204. $mychkbox = $chkbox;
  2205. $mychkbox->checked = $app->getparameter("microsites_enabled", "microsites_enabled");
  2206. $mychkbox->set_onchange(
  2207. "if(this.checked) "
  2208. . "alert("
  2209. . "'NOTICE:\\n\\n"
  2210. . "For microsite creation to work you must be running \'pg-microsites-installer.php\' from cron.\\n"
  2211. . "The crontab for this can be found in the \'scripts/cron\' sub-directory of your Axyl installation,\\n"
  2212. . "and should have been automatically installed into /etc/cron.d by your Debian package.\\n\\n"
  2213. . "')"
  2214. );
  2215. $mychkbox->settitle(
  2216. "If you installed the Axyl Microsites Extension when you created the website, then "
  2217. . "you can enable it here. This gives you some extra functions to create and maintain "
  2218. . "microsites of the main website."
  2219. );
  2220. $Tin->tr("axbgdark");
  2221. $Tin->td( "Enable microsite(s) creation:", "axfg" );
  2222. $Tin->td( $mychkbox->render("cp_microsites_enabled") );
  2223. $mychkbox = $chkbox;
  2224. $mychkbox->checked = $app->getparameter("buffered_output", "buffered_output");
  2225. $mychkbox->settitle(
  2226. "Whether or not to run the website using buffered Php output. Buffering allows Axyl "
  2227. . "to collect output, post-process it, and render it in one hit just before sending "
  2228. . "it to the browser. Non-buffered output severely restricts debugging, and other "
  2229. . "post-processing and is not recommended."
  2230. );
  2231. $Tin->tr("axbglite");
  2232. $Tin->td( "Buffered output (recommended):", "axfg" );
  2233. $Tin->td( $mychkbox->render("cp_buffered_output") );
  2234. $Tin->tr("axbgdark");
  2235. $Tin->td( "Compression type:", "axfg" );
  2236. $Fcomp = new form_combofield();
  2237. $Fcomp->setclass("axcombo");
  2238. $Fcomp->setstyle("width:$cwidth");
  2239. $Fcomp->set_onchange('setchgd()');
  2240. $Fcomp->additem(0, "No compression");
  2241. $Fcomp->additem(1, "Built-in compression (Php >= 4.0.4)");
  2242. $Fcomp->additem(2, "Axyl custom compression");
  2243. $Fcomp->setvalue($app->getparameter("compression_type", "compression_type"));
  2244. $Fcomp->settitle(
  2245. "Axyl can compress the output stream to save transmission time for large-ish "
  2246. . "webpages. The recommended option is 'Built-in' compression."
  2247. );
  2248. $Tin->td( $Fcomp->render("cp_compression_type") );
  2249. $Tin->tr("axbglite");
  2250. $Tin->td( "Compression threshold:", "axfg" );
  2251. $Fcomp = new form_combofield();
  2252. $Fcomp->setclass("axcombo");
  2253. $Fcomp->setstyle("width:$cwidth");
  2254. $Fcomp->set_onchange('setchgd()');
  2255. $Fcomp->additem(0, "None (compress all content)");
  2256. $Fcomp->additem(1024, "Over 1Kb");
  2257. $Fcomp->additem(4096, "Over 4Kb");
  2258. $Fcomp->additem(8192, "Over 8Kb");
  2259. $Fcomp->additem(16384, "Over 16Kb");
  2260. $Fcomp->additem(32768, "Over 32Kb");
  2261. $Fcomp->additem(65536, "Over 64Kb");
  2262. $Fcomp->additem(262144, "Over 256Kb");
  2263. $Fcomp->setvalue($app->getparameter("compression_threshold", "compression_threshold"));
  2264. $Fcomp->settitle(
  2265. "On some systems you might want to save processing power by only compressing "
  2266. . "pages above a certain size."
  2267. );
  2268. $Tin->td( $Fcomp->render("cp_compression_threshold") );
  2269. $Tin->set_width_profile("50%,50%");
  2270. $Tapp->tr();
  2271. $Tapp->td( $Tin->render() );
  2272. // ......................................................................
  2273. // GET/POST settings
  2274. $Tapp->tr("axsubhdg");
  2275. $Tapp->td("<b>GET/POST settings</b>", "axsubhdg");
  2276. $Tin = new table("getpost");
  2277. $Tin->setpadding(2);
  2278. $mychkbox = $chkbox;
  2279. $mychkbox->checked = $app->getparameter("keep", "keep");
  2280. $mychkbox->settitle(
  2281. "This option causes Axyl to set a second browser cookie. You can then use Php "
  2282. . "session management to keep track of variables across webpages using Axyl's "
  2283. . "'remember()' method."
  2284. );
  2285. $Tin->tr("axbgdark");
  2286. $Tin->td( "Enable Axyl KEEP feature:", "axfg" );
  2287. $Tin->td( $mychkbox->render("cp_keep") );
  2288. $mychkbox = $chkbox;
  2289. $mychkbox->checked = $app->getparameter("globalise", "globalise");
  2290. $mychkbox->settitle(
  2291. "When checked this causes Axyl to auto globalise variables submitted to the "
  2292. . "website. This circumvents any php.ini setting which turns off globals."
  2293. );
  2294. $Tin->tr("axbglite");
  2295. $Tin->td( "Auto-globalise all GET/POST vars:", "axfg" );
  2296. $Tin->td( $mychkbox->render("cp_globalise") );
  2297. $Tin->set_width_profile("50%,50%");
  2298. $Tapp->tr();
  2299. $Tapp->td( $Tin->render() );
  2300. } // switch
  2301. $cprf = new img("$LIBDIR/img/_cpfootr.gif", "", "", 87, 23);
  2302. $Tin = new table();
  2303. $Tin->tr();
  2304. $Tin->td();
  2305. $Tin->td_css("background: url('$LIBDIR/img/_cpfootfill.gif')");
  2306. $Tin->td_width("100%");
  2307. $Tin->td($cprf->render());
  2308. $Tin->td_alignment("right");
  2309. $Tapp->tr();
  2310. $Tapp->td($Tin->render());
  2311.  
  2312. } // if no errors
  2313. // ----------------------------------------------------------------------
  2314. // Finish and return the page..
  2315.  
  2316. $hidcpview = new form_hiddenfield("cp_view", $cp_view);
  2317. $s .= "<form name=\"$formname\" method=\"post\">\n";
  2318. $s .= $Tapp->render();
  2319. $s .= $hidcpview->render();
  2320. // Also render maintainer bits if database view..
  2321. if ($cp_view == CP_VIEW_DB) {
  2322. $s .= $maintainer->render();
  2323. }
  2324. else {
  2325. $hid = new form_hiddenfield("_recmaintpost_form", $formname);
  2326. $s .= $hid->render();
  2327. }
  2328. $s .= "</form>\n";
  2329.  
  2330. //echo $app->htmldump();
  2331.  
  2332. if ($cp_view == CP_VIEW_AUTH) {
  2333. $s .= "<script language=\"javascript\">\n"
  2334. . "var cbo = eval('document.forms.$formname.cp_remote_auth_source');\n"
  2335. . "if (cbo) {\n"
  2336. . " control_auth_fields(cbo,'$formname');\n"
  2337. . "}\n"
  2338. . "</script>\n";
  2339. }
  2340. $s .= "</body>\n";
  2341. $s .= "</html>\n";
  2342. echo $s;
  2343. // ----------------------------------------------------------------------
  2344. ?>

Documentation generated by phpDocumentor 1.3.0RC3