function doexport()
{
    $q = new mysql_squid_builder();
    $q->BD_CONNECT();
    $t = $_GET["t"];
    $squidlogs["webfilters_sqacls"] = true;
    $squidlogs["webfilters_sqaclaccess"] = true;
    $squidlogs["webfilters_sqgroups"] = true;
    $squidlogs["webfilters_sqacllinks"] = true;
    $squidlogs["webfilters_sqitems"] = true;
    $squidlogs["webfilters_sqtimes_rules"] = true;
    $squidlogs["webfilters_blkwhlts"] = true;
    $squidlogs["webfilters_usersasks"] = true;
    $squidlogs["webfilters_quotas"] = true;
    $squidlogs["webfilter_avwhitedoms"] = true;
    $squidlogs["webfilter_aclsdynamic"] = true;
    $squidlogs["squidtpls"] = true;
    $dir = dirname(__FILE__) . "/ressources/logs/web/acls.gz";
    $databases["squidlogs"] = $squidlogs;
    if (is_file($dir)) {
        @unlink($dir);
    }
    $dump = new phpMyDumper("squidlogs", $q->mysql_connection, "{$dir}", true, $squidlogs);
    $dump->doDump();
}
Exemplo n.º 2
0
function do_export(){
	if($_GET["single-id"]>0){
		do_export_single_id();
		return;
	}
	
	
	$q=new mysql_squid_builder();
	$q->BD_CONNECT();
	$t=$_GET["t"];
	$squidlogs["webfilters_sqacls"]=true;
	$squidlogs["webfilters_sqaclaccess"]=true;
	$squidlogs["webfilters_sqgroups"]=true;
	$squidlogs["webfilters_sqacllinks"]=true;
	$squidlogs["webfilters_sqitems"]=true;
	$squidlogs["webfilters_sqtimes_rules"]=true;
	$squidlogs["webfilters_blkwhlts"]=true;
	$squidlogs["webfilters_usersasks"]=true;
	$squidlogs["webfilters_quotas"]=true;
	$squidlogs["webfilter_avwhitedoms"]=true;
	$squidlogs["webfilter_aclsdynamic"]=true;
	$squidlogs["squidtpls"]=true;
	
	$artica_backup["ext_time_quota_acl"]=true;
	$artica_backup["ext_time_quota_acl_rules"]=true;
	$artica_backup["ext_time_quota_acl_link"]=true;	
	
	
	$dir=dirname(__FILE__)."/ressources/logs/web/acls.gz";
	$databases["squidlogs"]=$squidlogs;
	$databases["artica_backup"]=$artica_backup;
	if(is_file($dir)){@unlink($dir);}
	$dump=new phpMyDumper("squidlogs",$q->mysql_connection,"$dir",true,$squidlogs);
	$dump->doDump();
	
	if(!is_file($dir)){
		$tpl=new templates();
		echo $tpl->_ENGINE_parse_body(
				"<div style='font-size:18px;color:red;margin-top:15px;margin-bottom:15px'>{failed}</div>");
		return;
	}
	
	$size=@filesize($dir);
	
	echo "
		<div style='margin-top:15px;margin-bottom:15px;text-align:center'>	
			<a href=\"ressources/logs/web/acls.gz\" 
			style='text-decoration:underline;font-size:18px;font-weight:bold'>acls.gz ". FormatBytes($size/1024)."</a>
		</div>
			<script>
			if(document.getElementById('text-$t')){
				document.getElementById('text-$t').innerHTML='';
			
			}
				
			</script>
			
	";
	
	
	
}	
Exemplo n.º 3
0
function export_squid_table()
{
    $workdir = dirname(__FILE__) . "/ressources/squid-export";
    $table = $_GET["squid-table"];
    $q = new mysql_squid_builder();
    $q->BD_CONNECT();
    if (is_file("{$workdir}/{$table}.gz")) {
        @unlink("{$workdir}/{$table}.gz");
    }
    $dump = new phpMyDumper("squidlogs", $q->mysql_connection, "{$workdir}/{$table}.gz", true, $table);
    $dump->doDump();
    $sock = new sockets();
    $content_type = base64_decode($sock->getFrameWork("cmd.php?mime-type=" . base64_encode("{$workdir}/{$table}.gz")));
    $fsize = filesize("{$workdir}/{$table}.gz");
    if ($GLOBALS["VERBOSE"]) {
        echo "Content-type: {$content_type}<br>\nfilesize:{$fsize}<br>\n";
        return;
    }
    header('Content-type: ' . $content_type);
    header('Content-Transfer-Encoding: binary');
    header("Content-Disposition: attachment; filename=\"{$table}.gz\"");
    header("Pragma: public");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date dans le passé
    header("Content-Length: " . $fsize);
    ob_clean();
    flush();
    readfile("{$workdir}/{$table}.gz");
}
Exemplo n.º 4
0
     $tbls = array();
     foreach ($_POST['data'] as $dbname) {
         $dump = new phpMyDumper($dbname, $filename, $compress, $tbls);
         if (!$_POST['dset']) {
             $dump->dropTable = false;
         }
         // Dump DROP TABLE statement, default: true
         if ($_POST['export'] == 0 || $_POST['export'] == 1) {
             $dump->createTable = true;
         }
         // Dump CREATE TABLE statement, default: false
         if ($_POST['export'] == 0 || $_POST['export'] == 2) {
             $dump->tableData = true;
         }
         // Dump table data, default: false
         $dump->doDump(true, ++$i);
         $_final_data .= $dump->filestream . "\n\n";
     }
 }
 if ($_POST['output'] == '0') {
     // write the sql file
     $file_name = 'data/' . $_GET['db'] . '-' . date("D-m-y_h-i-s") . ".sql";
     $fp = fopen($file_name, "w");
     fwrite_stream($fp, $_final_data);
     fclose($fp);
 }
 if ($_POST['output'] == '1') {
     $_SESSION['file_sql'] = 'data/' . $_GET['db'] . '-' . date("D-m-y_h-i-s") . ".sql";
     $fp = fopen($_SESSION['file_sql'], "w");
     fwrite_stream($fp, $_final_data);
     $ziper = new zipfile();
Exemplo n.º 5
0
function do_export()
{
    if ($_GET["single-id"] > 0) {
        do_export_single_id();
        return;
    }
    $q = new mysql_squid_builder();
    $q->BD_CONNECT();
    $t = $_GET["t"];
    $LIST_TABLES_CATEGORIES = $q->LIST_TABLES_CATEGORIES();
    while (list($num, $ligne) = each($LIST_TABLES_CATEGORIES)) {
        $squidlogs[$num] = true;
    }
    $squidlogs["webfilter_rules"] = true;
    $squidlogs["webfilter_assoc_groups"] = true;
    $squidlogs["webfilter_blks"] = true;
    $squidlogs["webfilter_group"] = true;
    $squidlogs["webfilter_bannedexts"] = true;
    $squidlogs["webfilters_dtimes_blks"] = true;
    $squidlogs["webfilter_bannedextsdoms"] = true;
    $squidlogs["webfilter_termsg"] = true;
    $squidlogs["webfilter_blklnk"] = true;
    $squidlogs["webfilter_blkgp"] = true;
    $squidlogs["webfilter_blkcnt"] = true;
    $artica_backup["personal_categories"] = true;
    $dir = dirname(__FILE__) . "/ressources/logs/web/webfiltering.sql";
    $final = dirname(__FILE__) . "/ressources/logs/web/webfiltering.export";
    $compressed = dirname(__FILE__) . "/ressources/logs/web/webfiltering.gz";
    @unlink($dir);
    @unlink($final);
    @unlink($compressed);
    $databases["squidlogs"] = $squidlogs;
    $databases["artica_backup"] = $artica_backup;
    if (is_file($dir)) {
        @unlink($dir);
    }
    $dump = new phpMyDumper("squidlogs", $q->mysql_connection, "{$dir}", false, $squidlogs);
    $dump->doDump();
    if (!is_file($dir)) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<div style='font-size:18px;color:#d32d2d;margin-top:15px;margin-bottom:15px'>{failed}</div>");
        return;
    }
    $sock = new sockets();
    $DansGuardianDefaultMainRule = $sock->GET_INFO("DansGuardianDefaultMainRule");
    $array["SQL"] = @file_get_contents($dir);
    $array["DansGuardianDefaultMainRule"] = $DansGuardianDefaultMainRule;
    @file_put_contents($final, base64_encode(serialize($array)));
    compress($final, $compressed);
    $size = @filesize($compressed);
    @unlink($dir);
    @unlink($final);
    echo "\n\t\t<div style='margin-top:15px;margin-bottom:15px;text-align:center'>\t\n\t\t\t<a href=\"ressources/logs/web/webfiltering.gz\" \n\t\t\tstyle='text-decoration:underline;font-size:18px;font-weight:bold'>webfiltering.gz " . FormatBytes($size / 1024) . "</a>\n\t\t</div>\n\t\t\t<script>\n\t\t\tif(document.getElementById('text-{$t}')){\n\t\t\t\tdocument.getElementById('text-{$t}').innerHTML='';\n\t\t\t\n\t\t\t}\n\t\t\t\t\n\t\t\t</script>\n\t\t\t\n\t";
}
Exemplo n.º 6
0
function backupTable($tablename, $filename)
{
    if (isset($GLOBALS["ALREADYDONETABLE"][$tablename])) {
        return true;
    }
    $GLOBALS["ALREADYDONETABLE"][$tablename] = true;
    $unix = new unix();
    $q = new mysql_squid_builder();
    if (!$q->TABLE_EXISTS($tablename)) {
        return true;
    }
    $q->BD_CONNECT();
    $dump = new phpMyDumper("squidlogs", $q->mysql_connection, $filename, true, $tablename);
    if (!$dump->doDump()) {
        ufdbguard_admin_events("Fatal, unable to dump database {$ligne["tablename"]}", __FUNCTION__, __FILE__, __LINE__, "backup");
        return false;
    }
    $filesize = $unix->file_size($filename);
    if ($filesize < 200) {
        ufdbguard_admin_events("Fatal, {$filesize} bytes it seems there is an issue on {$tablename} table", __FUNCTION__, __FILE__, __LINE__, "backup");
        return false;
    }
    $q->QUERY_SQL("INSERT INTO webstats_backup (`tablename`,`filepath`,`filesize`) \n\tVALUES('{$tablename}','{$filename}','{$filesize}')");
    if (!$q->ok) {
        ufdbguard_admin_events("Fatal, MySQL error {$q->mysql_error} on webstats_backup", __FUNCTION__, __FILE__, __LINE__, "backup");
        return false;
    }
    $q->DELETE_TABLE($tablename);
    return true;
}