} else { $chmodval = sprintf('0%o', $chmod); } if ($updatechmod) { $zp_cfg = updateConfigItem('CHMOD', sprintf('0%o', $chmod), $zp_cfg, false); if (strpos($zp_cfg, "if (!defined('CHMOD_VALUE')) {") !== false) { $zp_cfg = preg_replace("|if\\s\\(!defined\\('CHMOD_VALUE'\\)\\)\\s{\\sdefine\\(\\'CHMOD_VALUE\\'\\,(.*)\\);\\s}|", "if (!defined('CHMOD_VALUE')) { define('CHMOD_VALUE', " . $chmodval . "); }\n", $zp_cfg); } else { $i = strpos($zp_cfg, "/** Do not edit below this line. **/"); $zp_cfg = substr($zp_cfg, 0, $i) . "if (!defined('CHMOD_VALUE')) { define('CHMOD_VALUE', " . $chmodval . "); }\n" . substr($zp_cfg, $i); } } $updatezp_config = true; } if (isset($_REQUEST['FILESYSTEM_CHARSET'])) { setupXSRFDefender(); $fileset = $_REQUEST['FILESYSTEM_CHARSET']; $zp_cfg = updateConfigItem('FILESYSTEM_CHARSET', $fileset, $zp_cfg); $updatezp_config = true; } if ($updatezp_config) { updateConfigfile($zp_cfg); $updatezp_config = false; } $curdir = getcwd(); chdir(dirname(dirname(__FILE__))); // Important. when adding new database support this switch may need to be extended, $engines = array(); $preferences = array('mysqli' => 1, 'pdo_mysql' => 2, 'mysql' => 3); $cur = 999999; $preferred = NULL;
} else { $chmodval = sprintf('0%o', $chmod); } if ($updatechmod) { $zp_cfg = updateConfigItem('CHMOD', sprintf('0%o', $chmod), $zp_cfg, false); if (strpos($zp_cfg, "if (!defined('CHMOD_VALUE')) {") !== false) { $zp_cfg = preg_replace("|if\\s\\(!defined\\('CHMOD_VALUE'\\)\\)\\s{\\sdefine\\(\\'CHMOD_VALUE\\'\\,(.*)\\);\\s}|", "if (!defined('CHMOD_VALUE')) { define('CHMOD_VALUE', " . $chmodval . "); }\n", $zp_cfg); } else { $i = strpos($zp_cfg, "/** Do not edit below this line. **/"); $zp_cfg = substr($zp_cfg, 0, $i) . "if (!defined('CHMOD_VALUE')) { define('CHMOD_VALUE', " . $chmodval . "); }\n" . substr($zp_cfg, $i); } } $updatezp_config = true; } if (isset($_REQUEST['FILESYSTEM_CHARSET'])) { setupXSRFDefender('FILESYSTEM_CHARSET'); $fileset = $_REQUEST['FILESYSTEM_CHARSET']; $zp_cfg = updateConfigItem('FILESYSTEM_CHARSET', $fileset, $zp_cfg); $updatezp_config = true; } if ($updatezp_config) { storeConfig($zp_cfg); $updatezp_config = false; } // Important. when adding new database support this switch may need to be extended, $engines = array(); $preferences = array('mysqli' => 1, 'pdo_mysql' => 2, 'mysql' => 3); $cur = 999999; $preferred = NULL; $dir = opendir(dirname(dirname(__FILE__))); while (($engineMC = readdir($dir)) !== false) {