function server_receive_status() { writelogs("Receive infos from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__); $gl = new gluster(); if ($gl->clients[$_POST["NTFY_STATUS"]] == null) { writelogs("Depreciated server, send order to delete", __FUNCTION__, __FILE__, __LINE__); echo "DELETE_YOU"; exit; } $ini = new Bs_IniHandler(); while (list($num, $ligne) = each($_POST)) { writelogs("Receive infos {$num} = {$ligne} from {$_POST["NTFY_STATUS"]}", __FUNCTION__, __FILE__, __LINE__); $ini->_params["CLUSTER"][$num] = $ligne; } $sock = new sockets(); $sock->SaveClusterConfigFile($ini->toString(), "clusters-" . $_POST["NTFY_STATUS"]); $cyrus_id = $sock->getFrameWork("cmd.php?idofUser=cyrus"); echo "CYRUS-ID={$cyrus_id};\n"; $gl = new gluster(); if (is_array($gl->clients)) { while (list($num, $name) = each($gl->clients)) { $cl[] = $name; } } $datas = implode(";", $cl); writelogs("Sending servers list " . strlen($datas) . " bytes", __FUNCTION__, __FILE__, __LINE__); echo $datas; }
function import_webfilter($filename) { if (!is_file($filename)) { echo "{$filename} no such file\n"; return; } $unix = new unix(); $ext = Get_extension($filename); if ($ext != "gz") { echo "{$filename} not a compressed file\n"; return; } $destinationfile = $unix->FILE_TEMP(); $sqlsourcefile = $unix->FILE_TEMP() . ".sql"; if (!$unix->uncompress($filename, $destinationfile)) { echo "{$filename} corrupted GZ file...\n"; return; } $contentArray = unserialize(base64_decode(@file_get_contents($destinationfile))); if (!is_array($contentArray)) { echo "{$filename} corrupted file not an array...\n"; return; } @file_put_contents($sqlsourcefile, $contentArray["SQL"]); $sock = new sockets(); echo "Saving default rule...\n"; $sock->SaveClusterConfigFile($contentArray["DansGuardianDefaultMainRule"], "DansGuardianDefaultMainRule"); $mysqlbin = $unix->find_program("mysql"); $q = new mysql_squid_builder(); $password = null; $localdatabase = "squidlogs"; $q = new mysql_squid_builder(); $cmdline = "{$mysqlbin} --batch --force {$q->MYSQL_CMDLINES}"; $cmd = "{$cmdline} --database={$localdatabase} <{$sqlsourcefile} 2>&1"; if ($GLOBALS["VERBOSE"]) { echo $cmd . "\n"; } exec($cmd, $results); while (list($key, $value) = each($results)) { echo "{$value}\n"; } }