function getConfig($xml = "") { global $_CONFIG, $CONFIG, $INTERNAL; $skeys = array("gl_db_host", "gl_db_user", "gl_db_pass", "gl_db_name"); $hashfile = FILE_CONFIG; $ms = base64_decode($_CONFIG["gl_lzst"]) == 1; $cindex = 0; $cfiles = getDirectory(PATH_CONFIG, "config.inc.php"); foreach ($_CONFIG as $index => $server_val) { if (is_array($server_val)) { $xml .= "<conf key=\"" . base64_encode($index) . "\">\r\n"; foreach ($server_val as $skey => $sval) { if (!is_array($sval)) { $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n"; } } $xml .= "</conf>\r\n"; } else { if (!(is_int($index) && is_array($server_val))) { $xml .= "<conf value=\"" . $server_val . "\" key=\"" . base64_encode($index) . "\" />\r\n"; } } } if (!empty($CONFIG["gl_root"])) { $cfiles = array_merge(array("config.inc.php"), $cfiles); } $rootBased = $CONFIG["gl_root"]; foreach ($cfiles as $file) { if (substr($file, 0, 7) == "config." && strpos($file, ".inc.php") == strlen($file) - 8) { $chost = str_replace("inc.php", "", str_replace("config.", "", $file)); $chost = strlen($chost) > 0 ? substr($chost, 0, strlen($chost) - 1) : $chost; if (!$ms || (empty($_GET["ws"]) && strtolower($_SERVER["HTTP_HOST"]) == strtolower($chost) || empty($chost) && strtolower($_SERVER["HTTP_HOST"]) == strtolower($CONFIG["gl_host"]) || !empty($_GET["ws"]) && base64_decode($_GET["ws"]) == $chost || !empty($rootBased) && SERVERSETUP && !MANAGEMENT || in_array($chost, $INTERNAL[CALLER_SYSTEM_ID]->WebsitesConfig) || in_array($chost, $INTERNAL[CALLER_SYSTEM_ID]->WebsitesUsers))) { if (!empty($chost) && file_exists(str_replace("config.inc", "config." . $chost . ".inc", FILE_CONFIG))) { $hashfile = str_replace("config.inc", "config." . $chost . ".inc", FILE_CONFIG); requireDynamic($hashfile, LIVEZILLA_PATH . "_config/"); loadConfig(false); initDataProvider(); } foreach ($_CONFIG as $index => $server_val) { if (is_int($index) && is_array($server_val)) { $xml .= "<site index=\"" . base64_encode($cindex) . "\">\r\n"; foreach ($server_val as $key => $site_val) { if (is_array($site_val)) { $xml .= "<conf key=\"" . base64_encode($key) . "\">\r\n"; foreach ($site_val as $skey => $sval) { $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . $sval . "</sub>\r\n"; } $xml .= "</conf>\r\n"; } else { if (!in_array($key, $skeys) || SERVERSETUP) { $xml .= "<conf value=\"" . $site_val . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } else { $xml .= "<conf value=\"" . base64_encode("") . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } } } $cindex++; if ($CONFIG["gl_host"] == base64_decode($server_val["gl_host"])) { $xml .= "<db_conf>\r\n"; if (!empty($CONFIG["db"]["cct"])) { $xml .= "<cct>\r\n"; foreach ($CONFIG["db"]["cct"] as $cct) { $xml .= $cct->GetXML(); } $xml .= "</cct>\r\n"; } if (!empty($CONFIG["db"]["ccpp"])) { $xml .= "<ccpp>\r\n"; foreach ($CONFIG["db"]["ccpp"] as $ccpp) { $xml .= $ccpp->GetXML(); } $xml .= "</ccpp>\r\n"; } if (!empty($CONFIG["db"]["gl_email"])) { $xml .= "<gl_email>\r\n"; foreach ($CONFIG["db"]["gl_email"] as $mb) { $xml .= $mb->GetXML(); } $xml .= "</gl_email>\r\n"; } $xml .= "</db_conf>\r\n"; } $xml .= "</site>\r\n"; } } } } } if (SERVERSETUP) { $xml .= "<translations>\r\n"; $files = getDirectory("./_language", "index", true); foreach ($files as $translation) { if (strpos($translation, ".bak.") === false) { $lang = str_replace(".php", "", str_replace("lang", "", $translation)); $parts = explode(".", $lang); if (ISSUBSITE && strpos($translation, SUBSITEHOST) !== false || !ISSUBSITE && substr_count($translation, ".") == 1) { $xml .= "<language key=\"" . base64_encode($parts[0]) . "\" blocked=\"" . base64_encode(@filesize("./_language/" . $translation) == 0 ? 1 : "0") . "\" />\r\n"; } else { if (ISSUBSITE && strpos($translation, SUBSITEHOST) === false && !@file_exists(getLocalizationFileString($parts[0], false))) { $xml .= "<language key=\"" . base64_encode($parts[0]) . "\" derived=\"" . base64_encode(1) . "\" />\r\n"; } } } } $xml .= "</translations>\r\n"; } $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("post_max_size")) ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("upload_max_filesize")) ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n"; $xml .= "</gl_c>\r\n"; return "<gl_c h=\"" . base64_encode(substr(md5file($hashfile), 0, 5)) . "\">\r\n" . $xml; }
function getConfig() { global $CONFIG; loadConfig(); $skeys = array("gl_db_host", "gl_db_user", "gl_db_pass", "gl_db_name"); $xml = "<gl_c h=\"" . base64_encode(substr(md5file(FILE_CONFIG), 0, 5)) . "\">\r\n"; foreach ($CONFIG as $key => $val) { if (is_array($val)) { $xml .= "<conf key=\"" . base64_encode($key) . "\">\r\n"; foreach ($val as $skey => $sval) { $xml .= "<sub key=\"" . base64_encode($skey) . "\">" . base64_encode($sval) . "</sub>\r\n"; } $xml .= "</conf>\r\n"; } else { if (!in_array($key, $skeys) || SERVERSETUP) { $xml .= "<conf value=\"" . base64_encode($val) . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } else { $xml .= "<conf value=\"" . base64_encode("") . "\" key=\"" . base64_encode($key) . "\" />\r\n"; } } } if (SERVERSETUP) { $xml .= "<translations>\r\n"; $files = getDirectory("./_language", "index", true); foreach ($files as $translation) { $lang = str_replace(".php", "", str_replace("lang", "", $translation)); $xml .= "<language key=\"" . base64_encode($lang) . "\" />\r\n"; } $xml .= "</translations>\r\n"; if (@file_exists(FILE_CARRIERLOGO)) { $xml .= "<carrier_logo content=\"" . fileToBase64(FILE_CARRIERLOGO) . "\" />\r\n"; } if (@file_exists(FILE_CARRIERHEADER)) { $xml .= "<carrier_header content=\"" . fileToBase64(FILE_CARRIERHEADER) . "\" />\r\n"; } if (@file_exists(FILE_INVITATIONLOGO)) { $xml .= "<invitation_logo content=\"" . fileToBase64(FILE_INVITATIONLOGO) . "\" />\r\n"; } } $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("post_max_size")) ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(cfgFileSizeToBytes(!isnull(@get_cfg_var("upload_max_filesize")) ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n"; $xml .= "</gl_c>\r\n"; return $xml; }
function getConfig() { global $CONFIG; $xml = "<gl_c h=\"" . base64_encode(substr(md5file(FILE_CONFIG), 0, 5)) . "\">\r\n"; foreach ($CONFIG as $key => $val) { if (is_array($val)) { $val = implode(";", $val); } $xml .= "<conf value=\"" . base64_encode($val) . "\" />\r\n"; } if (SERVERSETUP && file_exists(FILE_CARRIERLOGO)) { $xml .= "<carrier_logo content=\"" . fileToBase64(FILE_CARRIERLOGO) . "\" />\r\n"; } if (SERVERSETUP && file_exists(FILE_INVITATIONLOGO)) { $xml .= "<invitation_logo content=\"" . fileToBase64(FILE_INVITATIONLOGO) . "\" />\r\n"; } $xml .= "<php_cfg_vars post_max_size=\"" . base64_encode(cfgFileSizeToBytes(@get_cfg_var("post_max_size") != NULL ? get_cfg_var("post_max_size") : MAX_POST_SIZE_SAFE_MODE)) . "\" upload_max_filesize=\"" . base64_encode(cfgFileSizeToBytes(@get_cfg_var("upload_max_filesize") != NULL ? get_cfg_var("upload_max_filesize") : MAX_UPLOAD_SIZE_SAFE_MODE)) . "\" />\r\n"; $xml .= "</gl_c>\r\n"; return $xml; }