http://www.fsf.org/ or write * to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * */ function check_facility($config_file) { // Checking if we can write to $config_file //$fhandle is the configuration file handler //@chmod ($config_file, 0666); $fhandle = @fopen($config_file, "a+"); // file opend in append mode if ($fhandle === false) { // Problem open configuration file for writing @fclose($fhandle); return true; } else { @fclose($fhandle); return false; } return true; } function start_facility($fhandle) { // Begin file //$fhandle is the configuration file handler @fwrite ($fhandle, '' . "\n"); @fwrite ($fhandle, "\n"); @fwrite ($fhandle, ' /**' . "\n"); @fwrite ($fhandle, ' * cmsdAm configuration file.' . "\n"); @fwrite ($fhandle, ' * You have to configure this before using cmsdAm CMS. It\'s very simple, if not please send me a mail!' . "\n"); @fwrite ($fhandle, ' */' . "\n"); @fwrite ($fhandle, "\n"); } // DB Configuration directives ************************************* function db_facility($fhandle) { //$fhandle is the configuration file handler global $DB_servername; global $DB_name; global $DB_username; global $DB_password; global $DB_tbl_prefix; global $DB_type; @fwrite ($fhandle, ' // DB Configuration directives *************************************' . "\n"); @fwrite ($fhandle, ' $DB_servername = "' . $DB_servername . "\"; // Database server name\n"); @fwrite ($fhandle, ' $DB_name = "' . $DB_name . "\"; // Database name\n"); @fwrite ($fhandle, ' $DB_username = "' . $DB_username . "\"; // Database username\n"); @fwrite ($fhandle, ' $DB_password = "' . $DB_password . "\"; // Database password\n"); @fwrite ($fhandle, ' $DB_tbl_prefix = "' . $DB_tbl_prefix . "\"; // Database table prefix\n"); @fwrite ($fhandle, ' $DB_type = "' . $DB_type . "\"; // Database type. Can be mysql, postgresql, defaults to mysql\n"); @fwrite ($fhandle, ' // END of DB Configuration directives *************************************' . "\n"); @fwrite ($fhandle, "\n"); } // LDAP Configuration directives ************************************* function ldap_facility($fhandle) { //$fhandle is the configuration file handler global $LDAP_exclusive; global $LDAP_servername; global $LDAP_basedn; global $LDAP_filter; global $LDAP_rootdn; global $LDAP_rootdnpass; global $LDAP_groupbasedn; global $LDAP_groupfilter; global $LDAP_groupstag; global $LDAP_groupsuserstag; @fwrite ($fhandle, ' // LDAP Configuration directives *************************************' . "\n"); @fwrite ($fhandle, ' $LDAP_exclusive = "' . $LDAP_exclusive . "\"; // LDAP use:\n"); @fwrite ($fhandle, ' // 0 -> never use LDAP, only use the DB for users login, groups, ecc...' . "\n"); @fwrite ($fhandle, ' // 1 -> always use LDAP, don\'t use DB for users operations: login, groups...' . "\n"); @fwrite ($fhandle, ' // 2 -> first use LDAP, if the user is not present in LDAP or the credentials are not ok then use the DB' . "\n"); @fwrite ($fhandle, ' $LDAP_servername = "' . $LDAP_servername . "\"; // LDAP server name (\"\" for no LDAP use)\n"); @fwrite ($fhandle, ' $LDAP_basedn = "' . $LDAP_basedn . "\"; // LDAP base DN, the ldap base branch to search from\n"); @fwrite ($fhandle, ' $LDAP_filter = "' . $LDAP_filter . "\"; // LDAP filter to check if a user entry is valid\n"); @fwrite ($fhandle, ' $LDAP_rootdn = "' . $LDAP_rootdn . "\"; // LDAP administrator DN, \"\" for anonymous (recommended)\n"); @fwrite ($fhandle, ' $LDAP_rootdnpass = "' . $LDAP_rootdnpass . "\"; // LDAP administrator password\n"); @fwrite ($fhandle, ' $LDAP_groupbasedn = "' . $LDAP_groupbasedn . "\"; // LDAP groups base DN. Each entry in this DN is\n"); @fwrite ($fhandle, ' // a group for cmsdam, and must contain every user DN for that group.' . "\n"); @fwrite ($fhandle, ' $LDAP_groupfilter = "' . $LDAP_groupfilter . "\"; // LDAP filter to check if a group entry is valid\n"); @fwrite ($fhandle, ' $LDAP_groupstag = "' . $LDAP_groupstag . "\"; // LDAP attribute to identify group entities\n"); @fwrite ($fhandle, ' $LDAP_groupsuserstag = "' . $LDAP_groupsuserstag . "\"; // LDAP attribute to identify groups user DNs\n"); @fwrite ($fhandle, ' // END of LDAP Configuration directives *************************************' . "\n"); @fwrite ($fhandle, "\n"); } // SERVER CACHING ************************************* function servercache_facility($fhandle) { //$fhandle is the configuration file handler global $use_memcached; global $memcached_servers; global $memcached_port; global $memcached_compress_threshold; global $memcached_persistant; if ($use_memcached == "0") { // Don't use memcached daemon $use_memcached = "NO"; } else { // Use memcached daemon $use_memcached = "YES"; } if ($memcached_port == "") { $memcached_port = "11211"; } $memcached_servers = "array ('$memcached_servers:$memcached_port')"; @fwrite ($fhandle, ' // SERVER CACHING *************************************' . "\n"); @fwrite ($fhandle, ' $use_memcached = "' . $use_memcached . "\"; // Boost up things activating cmsdam output/variables caching\n"); @fwrite ($fhandle, ' $memcached_servers = ' . $memcached_servers . "; // memcached servers name and port\n"); @fwrite ($fhandle, ' $memcached_compress_threshold = "' . $memcached_compress_threshold . "\"; // at how many bytes should we compress?\n"); @fwrite ($fhandle, ' $memcached_persistant = "' . $memcached_persistant . "\"; // are we using persistant links?\n"); @fwrite ($fhandle, ' // END of SERVER CACHING *************************************' . "\n"); @fwrite ($fhandle, "\n"); } // GENERAL Site Configuration *********************************** function general_facility($fhandle) { //$fhandle is the configuration file handler global $Administrator; global $Administrator_Password; global $Administrator_Group; global $PHPWarn_on_sectioninclude; global $site_title; global $HTML_Meta_description; global $HTML_Meta_keywords; global $HTML_Meta_author; global $HTML_Meta_revisit; global $HTTP_maxage; global $HTTP_contenttype; global $HTTP_charset; global $cmsdam_admin_email; global $PHP_time_limit; global $parsetimecomment; @fwrite ($fhandle, ' // GENERAL *************************************' . "\n"); @fwrite ($fhandle, ' /* Super Administration User name - It is only used for Site Administration */' . "\n"); @fwrite ($fhandle, ' $Administrator = "' . $Administrator . "\"; \n"); @fwrite ($fhandle, ' /* Super Administrator Password - It is only used for Site Administration */' . "\n"); @fwrite ($fhandle, ' $Administrator_Password = "' . $Administrator_Password . "\";\n"); @fwrite ($fhandle, ' /* Administration Group - It is used for Site Administration */' . "\n"); @fwrite ($fhandle, ' /* WARNING: All people in this group will be cmsdAm administrators!! So pay attention! */' . "\n"); @fwrite ($fhandle, ' $Administrator_Group = "' . $Administrator_Group . "\";\n"); @fwrite ($fhandle, ' /* PHP Warnings and comments on section include. You may want to disable it in production sites */' . "\n"); @fwrite ($fhandle, ' $PHPWarn_on_sectioninclude = "' . $PHPWarn_on_sectioninclude . "\";\n"); @fwrite ($fhandle, ' /* This is the default site title (