Exemplo n.º 1
0
function popup_main()
{
    $tpl = new templates();
    echo "<div id='main_config_cf_datas'>";
    main_config();
    echo "</div>";
    echo "<div id='main_maincf_datas'>";
    main_table();
    echo "</div>";
}
    item_delete();
    exit;
}
if (isset($_GET["apply_sender_routing_rule-js"])) {
    apply_sender_routing_rule_js();
    exit;
}
if (isset($_POST["apply_sender_routing_rule"])) {
    apply_sender_routing_rule();
    exit;
}
if (isset($_GET["item-auth"])) {
    item_auth();
    exit;
}
main_table();
// table sender_dependent_relay_host SENDER_DEPENDENT_RELAY_HOST
function item_delete_js()
{
    header("content-type: application/x-javascript");
    $zmd5 = $_GET["item-delete-js"];
    $t = time();
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT domain FROM sender_dependent_relay_host WHERE zmd5='{$zmd5}'", "artica_backup"));
    $title = $tpl->javascript_parse_text($ligne["domain"]);
    $text = $tpl->javascript_parse_text("{item}: {$title} - {delete} ?");
    $html = "\nvar xcall{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\t\$('#SENDER_DEPENDENT_RELAY_HOST').flexReload();\n}\n\nfunction xFunct{$t}(){\n\tif(!confirm('{$text}')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('item-delete','{$zmd5}');\n\tLockPage();\n\tXHR.sendAndLoad('{$page}', 'POST',xcall{$t});\n}\n\nxFunct{$t}();\n";
    echo $html;
}
function UsersSizeByHour()
{
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid";
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".time";
    $pid = @file_get_contents($pidfile);
    if (systemMaxOverloaded()) {
        events("UsersSizeByHour:: systemMaxOverloaded {$GLOBALS["SYSTEM_INTERNAL_LOAD"]} !!! -> DIE", __LINE__);
        return;
    }
    $unix = new unix();
    $mypid = getmypid();
    if ($unix->process_exists($pid, basename(__FILE__))) {
        if ($pid != $mypid) {
            $time = $unix->PROCCESS_TIME_MIN($pid);
            events("Already executed pid {$pid} since {$time}mn-> DIE");
            if ($GLOBALS["VERBOSE"]) {
                echo "Already executed pid {$pid} since {$time}mn\n";
            }
            die;
        }
    }
    events("Starting pid [{$mypid}]...");
    @file_put_contents($pidfile, $mypid);
    $timefile = $unix->file_time_min($pidtime);
    events("Timelock:{$timefile} Mn");
    if (!$GLOBALS["VERBOSE"]) {
        if ($timefile < 10) {
            events("Only each 10mn :current {$timefile}Mn");
            if ($GLOBALS["VERBOSE"]) {
                echo "Only each 10mn\n";
            }
            return;
        }
    }
    @unlink($pidtime);
    @file_put_contents($pidtime, time());
    // VF /var/log/artica-postfix/squid/queues/RTTSize;
    $q = new mysql_squid_builder();
    $q->CreateUserSizeRTTTable();
    $RTTSIZEPATH = "/var/log/artica-postfix/squid-RTTSize/" . date("YmdH");
    if (!is_file($RTTSIZEPATH)) {
        events("{$RTTSIZEPATH} no such file...");
        events("UserSizeRTT_oldfiles()");
        UserSizeRTT_oldfiles();
        events("main_table()");
        main_table();
        return;
    }
    if (!$q->TABLE_EXISTS("UserSizeRTT")) {
        events("Fatal UserSizeRTT no such table, die()");
        ufdbguard_admin_events("Fatal UserSizeRTT no such table, die();", __FUNCTION__, __FILE__, __LINE__, "stats");
        return;
    }
    events("{$RTTSIZEPATH} = " . FormatBytes(@filesize($RTTSIZEPATH) / 1024));
    $RTTSIZEARRAY = unserialize(@file_get_contents($RTTSIZEPATH));
    RTTSizeArray($RTTSIZEARRAY);
    //$prefix="INSERT IGNORE INTO UserSizeRTT (`zMD5`,`uid`,`zdate`,`ipaddr`,`hostname`,`account`,`MAC`,`UserAgent`,`size`) VALUES";
    //if($mac==null){$mac=$this->GetMacFromIP($ip);}
}
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.maincf.multi.inc');
	if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
	

	
	$user=new usersMenus();
	if($user->AsPostfixAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	
	
	if(isset($_GET["list"])){popup_list();exit;}
	if(isset($_GET["popup"])){main_table();exit;}
	if(isset($_GET["smtpd_sasl_exceptions_networks_add"])){add();exit;}
	if(isset($_GET["smtpd_sasl_exceptions_networks_del"])){del();exit;}
	
	
	
	if(isset($_GET["popup-toolbox"])){toolbox();exit;}
	if(isset($_GET["smtpd_sasl_exceptions_mynet"])){smtpd_sasl_exceptions_mynet_save();exit;}
	
	js();
	
	
function js(){
if(GET_CACHED(__FILE__,__FUNCTION__,null)){return null;}
$prefix="smtpd_sasl_exceptions_networks_";
$page=CurrentPageName();