Пример #1
0
function today()
{
    if (isset($_GET["today"])) {
        $user = $_GET["today"];
        $t = "today";
        $Q1 = " AND DATE_FORMAT( zdate, '%Y-%m-%d' )=DATE_FORMAT( NOW(), '%Y-%m-%d' )";
    }
    if (isset($_GET["week"])) {
        $t = "week";
        $user = $_GET["week"];
        $Q1 = " AND WEEK( zdate)=WEEK( NOW()) AND YEAR(zdate)=YEAR(NOW())";
    }
    if (isset($_GET["month"])) {
        $t = "month";
        $user = $_GET["month"];
        $Q1 = " AND MONTH( zdate)=MONTH( NOW()) AND YEAR(zdate)=YEAR(NOW())";
    }
    $dansguardian_events = "dansguardian_events_" . date('Ym');
    $sql = "SELECT SUM(QuerySize) as tsize, sitename FROM {$dansguardian_events} WHERE CLIENT='{$user}'{$Q1} GROUP BY sitename ORDER BY SUM(QuerySize) DESC";
    $html = "\n\t<br>\n\t<center>\n\t<table style='width:500px;border:1px solid #CCCCCC'>\n\t<tr>\n\t\t<th colspan=2>{website}</th>\n\t\t<th>size</th>\n\t</tr>\n\t";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_events");
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $js = "Loadjs('squid.uris.stats.php?domain={$ligne["sitename"]}&user={$user}&t={$t}')";
        $html = $html . "\n\t<tr" . CellRollOver() . ">\n\t\t<td width=1%><img src='img/web-22.png'></td>\n\t\t<td style='font-size:13px' " . CellRollOver($js, "{display_queries_list}") . ">{$ligne["sitename"]}</td>\n\t\t<td style='font-size:13px'>" . FormatBytes($ligne["tsize"] / 1024) . "</td>\n\t</tr>\n\t";
    }
    $html = $html . "</table></center>";
    echo $html;
}
Пример #2
0
function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $q = new mysql();
    $database = "artica_events";
    $t = $_GET["t"];
    $search = '%';
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    $table = "last_boot";
    $data = array();
    $data['page'] = $page;
    $data['total'] = 0;
    $data['rows'] = array();
    $fontsize = 20;
    $style = "style='font-size:18px'";
    $dataX = unserialize($sock->GET_INFO("InfluxDBRestoreArray"));
    $c = 0;
    $tpl = new templates();
    while (list($path, $size) = each($dataX)) {
        $c++;
        $ms5 = md5($path);
        $color = "black";
        $size = FormatBytes(intval($size) / 1024);
        $data['rows'][] = array('id' => $ms5, 'cell' => array("<span {$style}>{$path}</a></span>", "<span {$style}>{$size}</a></span>"));
    }
    if ($c == 0) {
        json_error_show("no data");
    }
    $data['total'] = $c;
    echo json_encode($data);
}
Пример #3
0
function page()
{
    $sock = new sockets();
    $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetSquidRepo")));
    $tpl = new templates();
    $realsquidversion = $sock->getFrameWork("squid.php?full-version=yes");
    $many = texttooltip("{manual_update}", "position:left:{manual_update_proxy_explain}", "Loadjs('squid.compilation.status.php')", null, 0, "font-size:30px;");
    $html = "\n\t\t\t\n\t<div style='font-size:30px;margin-bottom:30px'>{available_versions} &nbsp;|&nbsp; {current}:&nbsp;{$realsquidversion} &nbsp;|&nbsp; {$many}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<th style='font-size:22px'>{version}</th>\t\t\n\t<th style='font-size:22px'>{filename}</th>\n\t<th style='font-size:22px'>{filesize}</th>\n\t<th style='font-size:22px'>&nbsp;</tf>\n\t</tr>\t\t\t\t\n\t";
    while (list($key, $array) = each($ArticaTechNetSquidRepo)) {
        $URL = $array["URL"];
        $VERSION = $array["VERSION"];
        $FILESIZE = $array["FILESIZE"];
        $FILENAME = $array["FILENAME"];
        $FILESIZE = FormatBytes($FILESIZE / 1024);
        $button = button("{update2}", "Loadjs('squid.update.progress.php?key={$key}&filename={$FILENAME}');", 22);
        if ($realsquidversion == $VERSION) {
            $button = "{current}";
        }
        if ($color == null) {
            $color = "#F2F0F1";
        } else {
            $color = null;
        }
        $html = $html . "\n\t\t<tr style='background-color:{$color};height:80px'>\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$VERSION}</td>\n\t\t\t<td style='font-size:22px;padding-left:10px'><a href=\"{$URL}\" target=_new style='text-decoration:underline'>{$FILENAME}</a></td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'>{$FILESIZE}</td>\t\n\t\t\t<td style='font-size:22px;padding-left:10px'><center>{$button}</center></td>\t\n\t\t</tr>\n\t\t";
    }
    $html = $html . "</table>";
    echo $tpl->_ENGINE_parse_body($html);
}
function section_websites_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $page = CurrentPageName();
    $table = "visited_sites_tot";
    $searchstring = string_to_flexquery("sites-search");
    $ORDER = $boot->TableOrder(array("size" => "ASC"));
    if ($q->COUNT_ROWS($table) == 0) {
        senderrors("no data");
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $md = md5(serialize($ligne));
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $sitenameenc = urlencode($ligne["familysite"]);
        $js = "Loadjs('miniadm.webstats.familysite.all.php?familysite={$sitenameenc}')";
        $link = $boot->trswitch($js);
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t\t<td style='font-size:16px' width=10% nowrap {$link}>{$ligne["familysite"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["hits"]}</td>\n\t\t\t<td style='font-size:16px' width=1% nowrap {$link}>{$ligne["size"]}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("familysite" => "{familysite}", "hits" => "{hits}", "size" => "{size}"), $tr);
}
Пример #5
0
function popup()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?squidclient-infos=yes")));
    while (list($index, $line) = each($datas)) {
        if (preg_match("#^.+?:\$#", $line)) {
            $html[] = "\n\t\t\t</div><div style='width:95%;margin-top:15px;' class=form>\n\t\t\t<div style='font-size:16px;font-weight:bold;width:100%;padding-right:20px;text-align:right'>{$line}<hr></div>";
            continue;
        }
        if (preg_match("#\\s+(.+?):(.+?)\$#", $line, $re)) {
            $re[2] = trim($re[2]);
            if (preg_match("#([0-9]+).*?KB#i", $re[2], $ri)) {
                $re[2] = FormatBytes($ri[1]);
            }
            $html[] = "<div style='font-size:14px;'>{$re[1]}:&nbsp;<strong>{$re[2]}</strong></div>";
            continue;
        }
        if (preg_match("#\\s+([0-9]+)\\s+(.+?)\$#", $line, $re)) {
            $html[] = "<div style='font-size:14px;'>{$re[2]}:&nbsp;<strong>{$re[1]}</strong></div>";
            continue;
        }
    }
    $html[] = "</div>";
    echo @implode("", $html);
}
Пример #6
0
function FileInfo($original_path)
{
    $path = $original_path;
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?filestat=" . base64_encode($path))));
    $type = base64_decode($sock->getFrameWork("cmd.php?filetype=" . base64_encode($path)));
    $permissions = $array["perms"]["human"];
    $permissions_dec = $array["perms"]["octal1"];
    $accessed = $array["time"]["accessed"];
    $modified = $array["time"]["modified"];
    $created = $array["time"]["created"];
    $file = $array["file"]["basename"];
    $permissions_g = $array["owner"]["group"]["name"] . ":" . $array["owner"]["owner"]["name"];
    $ext = Get_extension($file);
    $page = CurrentPageName();
    $cr = new SimpleCrypt($ldap->ldap_password);
    $path_encrypted = base64_encode($original_path);
    if ($array["size"]["blocks"] != null) {
        $download = Paragraphe("download-64.png", "{download}", "{download} {$file}<br>" . FormatBytes($array["size"]["size"] / 1024), "{$page}?download-file={$path_encrypted}");
    }
    $img = "img/ext/def.jpg";
    if (is_file("img/ext/{$ext}.jpg")) {
        $img = "img/ext/{$ext}.jpg";
    }
    $table = "\n\t<table>\n\t<tr>\n\t\t<td class=legend>{permission}:</td>\n\t\t<td><strong>{$permissions} {$permissions_g} ({$permissions_dec})</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{accessed}:</td>\n\t\t<td><strong>{$accessed}</td>\n\t</tr>\n<tr><td class=legend>{modified}:</td><td><strong>{$modified}</td></tr>\n<tr><td class=legend>{created}:</td><td><strong>{$created}</td></tr>\n<tr>\n\t<td class=legend>{size}:</td>\n\t<td><strong>{$array["size"]["size"]} bytes (" . FormatBytes($array["size"]["size"] / 1024) . ")</td>\n</tr>\n<tr>\n\t<td class=legend>blocks:</td>\n\t<td><strong>{$array["size"]["blocks"]}</td>\n</tr>\t\n<tr>\n\t<td class=legend>block size:</td>\n\t<td><strong>{$array["size"]["block_size"]}</td>\n</tr>\n</table>";
    if ($array["size"]["blocks"] == null) {
        $table = null;
    }
    $html = "\n<div style='font-size:11px;margin-top:3px;padding-top:5px;border-top:1px solid #CCCCCC;text-align:right;'><i>{$type}</i></div>\n<table style='width:100%'>\n<tr>\n<td width=1% valign='top'><img src='{$img}' style='margin:15px'></td>\n<td valign='top'>\n<hr>\n{$table}\n</td>\n<td valign='top'>\n{$download}\n</td>\n</tr>\n</table>";
    $tpl = new templates();
    return $tpl->_ENGINE_parse_body($html);
}
Пример #7
0
function table()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/MYSQLDB_STATUS";
    $tbl = unserialize(base64_decode(@file_get_contents($cachefile)));
    while (list($dbname, $array) = each($tbl)) {
        $t = $_GET["table"];
        $size = FormatBytes($array["size"] / 1024);
        $DEV = $array["INFO"]["DEV"];
        $TOTAL = FormatBytes($array["INFO"]["TOT"] / 1024);
        $USED = FormatBytes($array["INFO"]["USED"] / 1024);
        $AIV = FormatBytes($array["INFO"]["AIV"] / 1024);
        $POURC = $array["INFO"]["POURC"];
        $MOUNTED = $array["INFO"]["MOUNT"];
        $CleanMySQLLogs = $tpl->javascript_parse_text("{CleanMySQLLogs}");
        $dbnameTXT = $tpl->_ENGINE_parse_body("{{$dbname}}");
        $action = null;
        if ($dbname == "APP_MYSQL_ARTICA") {
            $action = imgtootltip("database-disconnect-64.png", null, "CleanMySQLLogs()");
        }
        $tr[] = "\n\t<tr>\n\t\t<td width=1% nowrap><img src='img/database-connect-settings-64.png'></td>\n\t\t<td style='font-size:18px'>{$dbnameTXT}</td>\n\t\t<td style='font-size:18px'>{$size}</td>\n\t\t<td style='font-size:18px'>{$MOUNTED}</td>\t\n\t\t<td style='font-size:18px'>{$USED}/{$TOTAL} ({$POURC}%)</td>\n\t\t<td style='font-size:18px' width=1% nowrap>{$action}</td>\n\t</tr>\n\t";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th colspan=2>{service}</th>\n\t\t\t\t\t<th >{size}</th>\n\t\t\t\t\t<th >{disk}</th>\n\t\t\t\t\t<th >{use}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n\t\t\t\t\t\n<script>\n\nvar xCleanMySQLLogs=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>10){alert(results);}\n\tLoadAjax('{$t}','{$page}?table={$t}');\n\t}\n\n\tfunction CleanMySQLLogs(){\n\t\tif(!confirm('{$CleanMySQLLogs}')){return;}\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('CleanMySQLLogs','yes');\n\t\tXHR.sendAndLoad('{$page}', 'POST',xCleanMySQLLogs);\t\t\n\t\t\n\t\t\n\t\t\t\t\t\n\t}\n</script>\n";
}
Пример #8
0
function status()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $OPENVPN_SERVER_CONNECT = $tpl->_ENGINE_parse_body("{OPENVPN_SERVER_CONNECT}");
    $sql = "SELECT * FROM vpnclient WHERE ID={$_GET["ID"]}";
    $q = new mysql();
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    $infos = "\n\t<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>ID:</td>\n\t\t<td><strong style='font-size:14px'>{$_GET["ID"]}</strong>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{connection_name}:</td>\n\t\t<td><strong style='font-size:14px'>{$ligne["connexion_name"]}</strong>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{openvpn_server}:</td>\n\t\t<td><strong style='font-size:14px'>{$ligne["servername"]}:{$ligne["serverport"]}</strong>\n\t</tr>\t\n\t\n\t\n\t";
    $sock = new sockets();
    $tbl = unserialize(base64_decode($sock->getFrameWork("cmd.php?openvpn-client-sesssions={$_GET["ID"]}")));
    while (list($num, $line) = each($tbl)) {
        if (preg_match("#(.+?),(.+?)\$#", $line, $re)) {
            if (preg_match("#bytes#", $re[1])) {
                $re[2] = FormatBytes($re[2] / 1024);
            }
            $re[1] = str_replace("Updated", "{updated_on}", $re[1]);
            $infos = $infos . "<tr>\n\t\t\t\t<td class=legend style='font-size:14px'>{$re[1]}:</td>\n\t\t\t\t<td><strong style='font-size:14px'>{$re[2]}</strong></td>\n\t\t\t</tr>";
        }
    }
    $infos = $infos . "</table>";
    $reload = LocalParagraphe("reconnect", "reconnect_openvpn_text", "ReconnectSession()", "48-refresh.png");
    if ($ligne["enabled"] == 1) {
        $disable = LocalParagraphe("disable", "disable_openvpn_connection", "DisableConnection()", "shutdown-computer-48.png");
    } else {
        $disable = LocalParagraphe("activate", "activate_openvpn_connection", "EnableConnection()", "48-run.png");
    }
    $delete = LocalParagraphe("delete", "delete_openvpn_connection", "DeleteConnection()", "delete-48.png");
    $config = LocalParagraphe("parameters", "edit_openvpn_connection", "EditConnection()", "rouage-48.png");
    $html = "\n\t<div id='client-status-id'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td valign='top' width=100%'>{$infos}\n\t\t<div style='text-align:right'>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshTab('main_openvpn_clientconf')") . "</div>\n\t\t\n\t\t</td>\n\t\t<td valign='top' width=1%><table class=form><tr><td>{$config}<br>{$reload}<br>{$disable}<br>{$delete}</td></tr></table></td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\n\tvar x_ReconnectSession= function (obj) {\n\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\tRefreshTab('main_openvpn_clientconf');\n\t\t\tif(document.getElementById('master-list')){RefreshOpenVPNMasterList();}\n\t\t}\t\n\t\t\n\tvar x_DeleteConnection= function (obj) {\n\t\t\tif(document.getElementById('main_openvpn_config')){RefreshTab('main_openvpn_config');}\n\t\t\tif(document.getElementById('master-list')){RefreshOpenVPNMasterList();}\n\t\t\tYahooWin3Hide();\n\t\t}\t\n\t\t\n\t\n\tfunction ReconnectSession(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('ReconnectSession','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\t\t\n\tfunction DisableConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('DisableConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\n\tfunction EnableConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('EnableConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ReconnectSession); \n\t\t} \n\n\tfunction DeleteConnection(){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('DeleteConnection','yes');\n\t\t\t\tXHR.appendData('ID','{$_GET["ID"]}');\n\t\t\t\tAnimateDiv('client-status-id');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteConnection); \n\t\t} \t\n\n\tfunction EditConnection(){\n\t\t\tLoadjs('openvpn.servers-connect.php?inline-js-id={$_GET["ID"]}');\n\t\t}\t\t\n\t\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #9
0
function lighttpd_status()
{
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $tpl = new templates();
    $page = CurrentPageName();
    $ini->loadString(base64_decode($sock->getFrameWork('services.php?lighttpd-status=yes')));
    $LIGHTTPD = DAEMON_STATUS_ROUND("LIGHTTPD", $ini, null, 1);
    $LIGHTTPD_PID = $ini->_params["LIGHTTPD"]["master_pid"];
    $FRAMEWORK = DAEMON_STATUS_ROUND("FRAMEWORK", $ini, null, 1);
    $FRAMEWORK_PID = $ini->_params["FRAMEWORK"]["master_pid"];
    $php_cgi_array = unserialize(base64_decode($sock->getFrameWork('services.php?php-cgi-array=yes')));
    $LIGHTTPD_AR[] = "<table style='width:99%' class=form>";
    while (list($pid, $array) = each($php_cgi_array[$LIGHTTPD_PID])) {
        $RSS = FormatBytes($array["RSS"]);
        $VM = FormatBytes($array["VM"]);
        $TTL = $array["TTL"];
        $LIGHTTPD_AR[] = "<tr>\n\t\t<td><strong style='font-size:12px'>PID:{$pid}</strong></td>\n\t\t<td><strong style='font-size:12px'>RSS:{$RSS}</strong></td>\n\t\t<td><strong style='font-size:12px'>VM:{$VM}</strong></td>\n\t\t<td><strong style='font-size:12px'>TTL:{$TTL}</strong></td>\n\t\t</tr>\n\t\t";
    }
    $LIGHTTPD_AR[] = "</table>";
    $LIGHTTPDF_AR[] = "<table style='width:99%' class=form>";
    while (list($pid, $array) = each($php_cgi_array[$FRAMEWORK_PID])) {
        $RSS = FormatBytes($array["RSS"]);
        $VM = FormatBytes($array["VM"]);
        $TTL = $array["TTL"];
        $LIGHTTPDF_AR[] = "<tr>\n\t\t<td><strong style='font-size:12px'>PID:{$pid}</strong></td>\n\t\t<td><strong style='font-size:12px'>RSS:{$RSS}</strong></td>\n\t\t<td><strong style='font-size:12px'>VM:{$VM}</strong></td>\n\t\t<td><strong style='font-size:12px'>TTL:{$TTL}</strong></td>\n\t\t</tr>\n\t\t";
    }
    $LIGHTTPDF_AR[] = "</table>";
    $html = "<table style='width:99%' class=form>\n\t<tr>\n\t\t<td>{$LIGHTTPD} " . @implode("\n", $LIGHTTPD_AR) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td><hr></td>\n\t</tr>\n\t<tr>\n\t\t<td>{$FRAMEWORK}" . @implode("\n", $LIGHTTPDF_AR) . "</td>\n\t</tr>\n\t</table>\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #10
0
function page()
{
    $sock = new sockets();
    $ArticaTechNetInfluxRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetProFTPDRepo")));
    $tpl = new templates();
    $version = $sock->GET_INFO("ProFTPDVersion");
    $manual_update = $tpl->javascript_parse_text("{manual_update}");
    $html = "\n\t\t\t\n\t<div style='font-size:30px;margin-bottom:30px'>{available_versions} &nbsp;|&nbsp; {current}:&nbsp;{$version}\n\t&nbsp;|&nbsp;<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('update.upload.php')\"\n\tstyle='text-decoration:underline'>{$manual_update}</a>\n\t&nbsp;|&nbsp;<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('influx.refresh.update.php')\"\n\tstyle='text-decoration:underline'>{refresh}</a>\n\t\n\t\n\t</div>\n\t<table style='width:100%'>\n\t<tr>\n\t<th style='font-size:22px'>{version}</th>\n\t<th style='font-size:22px'>{OS}</th>\n\t<th style='font-size:22px'>{filename}</th>\n\t<th style='font-size:22px'>{filesize}</th>\n\t<th style='font-size:22px'>&nbsp;</tf>\n\t</tr>\t\t\t\t\n\t";
    $color = null;
    while (list($key, $array) = each($ArticaTechNetInfluxRepo)) {
        while (list($OS, $MAIN) = each($array)) {
            $URL = $MAIN["URL"];
            $VERSION = $MAIN["VERSION"];
            $FILESIZE = $MAIN["FILESIZE"];
            $FILENAME = $MAIN["FILENAME"];
            $FILESIZE = FormatBytes($FILESIZE / 1024);
            $button = button("{update2}", "Loadjs('proftpd.update.progress.php?key={$key}&OS={$OS}&filename={$FILENAME}');", 32);
            if ($color == null) {
                $color = "#F2F0F1";
            } else {
                $color = null;
            }
            $html = $html . "\n\t\t<tr style='background-color:{$color};height:80px'>\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$VERSION}</center></td>\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$OS}</center></td>\n\t\t\t<td style='font-size:28px;padding-left:10px;text-align:right'><a href=\"{$URL}\" target=_new style='text-decoration:underline'>{$FILENAME}</a></td>\t\n\t\t\t<td style='font-size:28px;padding-left:10px;text-align:right'>{$FILESIZE}</td>\t\n\t\t\t<td style='font-size:28px;padding-left:10px'><center>{$button}</center></td>\t\n\t\t</tr>\n\t\t";
        }
    }
    $html = $html . "</table>";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #11
0
function build()
{
    $sock = new sockets();
    $unix = new unix();
    $sysctl = $unix->find_program("sysctl");
    $echo = $unix->find_program("echo");
    $HugePages = $sock->GET_INFO("HugePages");
    $KernelShmmax = $sock->GET_INFO("KernelShmmax");
    $meminfo = MemInfo();
    $HUGEPAGESIZE = intval($meminfo["HUGEPAGESIZE"]);
    $HUGEPAGESIZEBytes = $HUGEPAGESIZE;
    if (!is_numeric($HugePages)) {
        $HugePages = 0;
    }
    if (!is_numeric($KernelShmmax)) {
        $KernelShmmax = 0;
    }
    if ($HugePages > 0) {
        $HugePagesB = $HugePages * 1024;
        $HugePagesB = $HugePagesB * 1024;
        $HugePagesF = $HugePagesB / $HUGEPAGESIZEBytes;
        echo "HUGEPAGESIZE = {$HUGEPAGESIZE} ({$HUGEPAGESIZEBytes} bytes) " . FormatBytes($HUGEPAGESIZEBytes / 1024) . "\n";
        echo "HugePages = {$HugePages} Mb ({$HugePagesB} bytes)\n";
        echo "HugePages Final = {$HugePagesF} " . FormatBytes($HugePagesF / 1024) . " \n";
        $unix->sysctl("vm.nr_hugepages", $HugePagesF);
        shell_exec("{$sysctl} -w vm.nr_hugepages={$HugePagesF}");
        for ($i = 0; $i < 10; $i++) {
            shell_exec("{$echo} {$HugePagesF} > /proc/sys/vm/nr_hugepages");
            sleep(1);
        }
    }
    // sysctl
}
Пример #12
0
function disks_list()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $refresh = imgtootltip("refresh-32.png", "{refresh}", "refreshLoopList()");
    $delete_disk_confirm = $tpl->javascript_parse_text("{delete_disk_confirm}");
    $html = "\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th>{$refresh}</th>\n\t\t<th>{disk}</th>\n\t\t<th>{name}</th>\n\t\t<th>{size}</th>\n\t\t<th>dev</th>\n\t\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $q = new mysql();
    $sql = "SELECT * FROM loop_disks ORDER BY `size` DESC";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $disk = basename($ligne["path"]);
        $pathesc = urlencode($ligne["path"]);
        $size = FormatBytes($ligne["size"] * 1024);
        $img = "Database32.png";
        if ($ligne["loop_dev"] == null) {
            $img = "Database32-red.png";
            $ligne["loop_dev"] = "&nbsp;";
        }
        $delete = imgtootltip("delete-32.png", "{delete}", "LoopDel('{$ligne["path"]}')");
        $href = "<a href=\"javascript:blur()\" OnClick=\"javascript:LoopAddForm('{$ligne["path"]}')\"\n\t\tstyle='font-size:14px;font-weight:bold;text-decoration:underline'>";
        $href = null;
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t<td width=1%><img src='img/{$img}'></td>\n\t\t<td width=1% nowrap style='font-size:14px;font-weight:bold;'>{$href}{$disk}</a></td>\n\t\t<td width=1% nowrap style='font-size:14px;font-weight:bold;'>{$href}{$ligne["disk_name"]}</a></td>\n\t\t<td width=1% nowrap style='font-size:14px;font-weight:bold;'>{$href}{$size}</a></td>\n\t\t<td width=99% nowrap style='font-size:14px;font-weight:bold;'>{$ligne["loop_dev"]}</a></td>\n\t\t<td width=1% nowrap style='font-size:14px;font-weight:bold;'>{$delete}</td>\n\t\t</tr>\t\n\t\t<tr class={$classtr}>\n\t\t<td colspan=6 align='right'><i style='font-size:13px'>/automounts/{$ligne["disk_name"]}</i></td>\n\t\t</tr>\n\t\t";
    }
    $html = $tpl->_ENGINE_parse_body($html);
    echo "\n\t{$html}\n\t</table>\n\t<script>\n\t\tfunction RefreshTools(){\n\t\t\tLoadAjax('loop-tools','{$page}?tools=yes');\n\t\t\t}\n\t\t\n\tvar x_LoopDel= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\trefreshLoopList();\n\t\t}\t\n\t\t\t\t\t\n\t\t\n\t\tfunction LoopDel(path){\n\t\t\tif(confirm('{$delete_disk_confirm}')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('loop-del',path);\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_LoopDel);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfunction loopcheck(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('loopcheck','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_LoopDel);\t\t\n\t\t\n\t\t}\n\t\t\n\t\tRefreshTools();\n\t\t\n\t</script>";
}
function page()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $databases = $q->DATABASE_LIST();
    while (list($database, $line) = each($databases)) {
        $tbs = $tbs + $line[0];
        $tx = trim($line[1]);
        $re = explode("&nbsp;", $tx);
        $tsize = $re[0];
        $unit = $re[1];
        if ($unit == "KB") {
            $size = $size + $tsize;
        }
        if ($unit == "MB") {
            $tsize = intval($tsize) * 1024;
            $size = $size + $tsize;
        }
        if ($unit == "GB") {
            $tsize = intval($tsize) * 1024;
            $tsize = $tsize * 1024;
            $size = $size + $tsize;
        }
    }
    $text = $tpl->_ENGINE_parse_body("{INNODB_FILE_PER_TABLE_ASK}");
    $size = FormatBytes($size);
    $text = str_replace("%free", "<strong>{$size}</strong>", $text);
    $text = str_replace("%tablesnum", "<strong>{$tbs}</strong>", $text);
    $t = time();
    $html = "\n\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/database-connect-128.png'></td>\n\t\t<td valign='top' width=99% style='padding-left:20px'>\n\t\t<div style='font-size:18px;font-weight:bold'>InnoDB File per Table</div>\n\t\t<div id='{$t}-div'></div>\n\t\t<div style='font-size:14px'>{$text}</div>\n\t\t<div style='margin:10px;text-align:center'>" . button("{i_understand_continue}", "SaveContinue{$t}()", "18px") . "</div>\n\t\t<div style='margin:10px;text-align:center'>" . button("{convertto_innodb_file_per_table}", "ConvertInnodb{$t}()", "18px") . "</div>\n\t\t<div style='margin:10px;text-align:center'>\n\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:s_PopUpFull('http://www.mail-appliance.org/index.php?cID=278','1024','900');\"\n\t\tstyle='font-size:18px;'>{online_help}</a>\n\t\t\n\t\t\n\t\t</td>\n\t</tr>\n\t</table>\n\t\n\t<script>\n\t\tvar x_SaveContinue{$t}= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tdocument.location.href='admin.index.php';\n\t\t\t\n\t\t}\n\t\n\t\n\t\tfunction SaveContinue{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('InnoDBFilePerTableAsk','yes');\n\t\t\tAnimateDiv('{$t}-div');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveContinue{$t});\t\n\t\t}\n\t\t\n\t\tfunction ConvertInnodb{$t}(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ConvertInnoDB','yes');\n\t\t\tAnimateDiv('{$t}-div');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SaveContinue{$t});\t\t\t\n\t\t\n\t\t}\n\t\n\t</script>\n\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #14
0
function ShowProgress_js()
{
    $t = $_GET["t"];
    $tt = time();
    $page = CurrentPageName();
    $tpl = new templates();
    $titleAdd = null;
    $please_wait = $tpl->javascript_parse_text("{please_wait}");
    $sock = new sockets();
    $ISRunAR = unserialize(base64_decode($sock->getFrameWork("zarafa.php?restore-process-array=yes")));
    if (is_array($ISRunAR)) {
        $PID = intval($ISRunAR["PID"]);
        $TIME = $ISRunAR["TIME"];
        if ($ISRunAR["SIZE"] > 0) {
            $ISRunARS = FormatBytes($ISRunAR["SIZE"]);
        }
    }
    if ($PID > 0) {
        $titleAdd = $tpl->javascript_parse_text("{running} {since} {$TIME}Mn PID {$PID}");
    }
    header("content-type: application/x-javascript");
    $file = "/usr/share/artica-postfix/ressources/RestoreFromBackup_progress.progress";
    $ARRAY = unserialize(@file_get_contents($file));
    if (!is_array($ARRAY)) {
        echo "\n\t\tfunction Start{$tt}(){\n\t\t\tLoadjs('{$page}?ShowProgress-js=yes&t={$t}');\n\t\t}\n\t\tdocument.getElementById('title{$t}').innerHTML='{$please_wait}';\n\t\tsetTimeout('Start{$tt}()',3000);\n\t\t";
        return;
    }
    $text = $tpl->javascript_parse_text($ARRAY["TEXT"]);
    $prc = $ARRAY["POURC"];
    if ($prc > 99) {
        echo "\n\t\t\tdocument.getElementById('title{$t}').innerHTML='{$text}&nbsp;{$ISRunARS}';\n\t\t\t\$('#Status{$t}').progressbar({ value: {$prc} });\n\t\t\t";
        return;
    }
    echo "\n\tfunction Start{$tt}(){\n\t\t\n\t\tGetLogs{$t}();\n\t\tLoadjs('{$page}?ShowProgress-js=yes&t={$t}');\n\t}\n\t\n\tif(document.getElementById('title{$t}')){\n\t\tdocument.getElementById('title{$t}').innerHTML='{$text}&nbsp;{$ISRunARS}&nbsp;{$titleAdd}';\n\t\t\$('#Status{$t}').progressbar({ value: {$prc} });\n\t\tsetTimeout('Start{$tt}()',2000);\n\t}\n\t";
}
Пример #15
0
function start()
{
    $pidtime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    $pid = $unix->get_pid_from_file($pidFile);
    if ($unix->process_exists($pid)) {
        return;
    }
    @file_put_contents($pidFile, getmypid());
    $time = $unix->file_time_min($pidtime);
    if ($time < 5) {
        return;
    }
    @file_put_contents($pidtime, time());
    $free = $unix->find_program("free");
    $echo = $unix->find_program("echo");
    $sync = $unix->find_program("sync");
    $swapoff = $unix->find_program("swapoff");
    $swapon = $unix->find_program("swapon");
    exec("{$free} 2>&1", $results);
    $used = 0;
    $total = 0;
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#Swap:\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)#", $ligne, $re)) {
            $total = $re[1];
            $used = $re[2];
        }
    }
    if (!is_numeric($total)) {
        return;
    }
    if ($total == 0) {
        return;
    }
    if ($used == 0) {
        return;
    }
    if ($total == $used) {
        return;
    }
    $tot1 = $used / $total;
    $tot1 = $tot1 * 100;
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} - {$tot1}\n";
    }
    $perc = round($tot1);
    if ($GLOBALS["VERBOSE"]) {
        echo "Swap:{$used}/{$total} {$perc}%\n";
    }
    $t = time();
    $GLOBALS["ALL_SCORES"]++;
    shell_exec("{$swapoff} -a && {$swapon} -a");
    $usedTXT = FormatBytes($used);
    $report = $unix->ps_mem_report();
    $distance = $unix->distanceOfTimeInWords($t, time(), true);
    squid_admin_mysql(0, "System swap exceed rule: {$perc}%", "Used {$usedTXT}\nSystem cache was flushed took {$distance}\nThis means you did have enough memory for this computer.\n{$report}", __FILE__, __LINE__);
}
function tables_title(){
	$q=new mysql_squid_builder();
	$tpl=new templates();
	$array=$q->COUNT_ALL_TABLES();
	echo $tpl->_ENGINE_parse_body("
	<div style='float:right'>". imgtootltip("refresh-24.png","{refresh}","RefreshTableTitle{$_GET["t"]}()")."</div>		
	<div style='font-size:18px'>{current}: {$array[0]} Tables (".FormatBytes($array[1]/1024).")</div>");
	
}
Пример #17
0
function install($filename)
{
    $GLOBALS["PROGRESS_FILE"] = "/usr/share/artica-postfix/ressources/logs/squid.install.progress";
    $GLOBALS["LOG_FILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.install.progress.txt";
    $unix = new unix();
    $LINUX_CODE_NAME = $unix->LINUX_CODE_NAME();
    $LINUX_DISTRIBUTION = $unix->LINUX_DISTRIBUTION();
    $LINUX_VERS = $unix->LINUX_VERS();
    $LINUX_ARCHITECTURE = $unix->LINUX_ARCHITECTURE();
    $APACHEUSER = $unix->APACHE_SRC_ACCOUNT();
    $DebianVer = "debian{$LINUX_VERS[0]}";
    $TMP_DIR = $unix->TEMP_DIR();
    $ORGV = @file_get_contents("/usr/share/artica-postfix/VERSION");
    $PATCH_VER = null;
    $tarballs_file = "/usr/share/artica-postfix/ressources/conf/upload/{$filename}";
    echo "Package {$tarballs_file}\n";
    $size = filesize($tarballs_file);
    echo "Size....................: " . FormatBytes($size / 1024) . "\n";
    build_progress("Analyze...", 10);
    echo "Current system..........: {$LINUX_CODE_NAME} {$LINUX_DISTRIBUTION} {$LINUX_VERS[0]}/{$LINUX_VERS[1]} {$LINUX_ARCHITECTURE}\n";
    echo "Package.................: {$filename}\n";
    echo "Temp dir................: {$TMP_DIR}\n";
    if (!is_file($tarballs_file)) {
        echo "{$tarballs_file} no such file...\n";
        build_progress("No such file...", 110);
        return;
    }
    echo "Uncompressing {$tarballs_file}...\n";
    build_progress("{extracting} {$filename}...", 20);
    $chown = $unix->find_program("chown");
    $chmod = $unix->find_program("chmod");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $nohup = $unix->find_program("nohup");
    $php = $unix->LOCATE_PHP5_BIN();
    $squid = $unix->LOCATE_SQUID_BIN();
    build_progress("{extracting} {$filename}...", 50);
    system("{$tar} xf {$tarballs_file} -C /");
    echo "Removing {$tarballs_file}...\n";
    @unlink($tarballs_file);
    shell_exec("{$rm} -rf /usr/share/artica-postfix/ressources/conf/upload/*");
    @unlink(dirname(__FILE__) . "/ressources/logs/squid.compilation.params");
    build_progress("{restarting} Squid-cache...", 60);
    system("/etc/init.d/squid restart --force");
    build_progress("{reconfiguring} Squid-cache...", 65);
    system("{$php} /usr/share/artica-postfix/exec.squid.php --build --force");
    build_progress("{reconfiguring} {APP_UFDBGUARD}...", 70);
    system("{$php} /usr/share/artica-postfix/exec.squidguard.php --build --force");
    build_progress("{restarting} {APP_C_ICAP}...", 80);
    system("/etc/init.d/c-icap restart");
    build_progress("Refresh local versions...", 90);
    system('/usr/share/artica-postfix/bin/process1 --force --verbose --' . time());
    $squid_version = x_squid_version();
    build_progress("{success} v.{$squid_version}...", 100);
    echo "Starting......: " . date("H:i:s") . " Done you can close the screen....\n";
}
Пример #18
0
function page()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $users->MEM_TOTAL_INSTALLEE = FormatBytes($users->MEM_TOTAL_INSTALLEE);
    $t = time();
    $html = "\t<div style='width:99%' class=form id='mainid-{$t}'>\n\t<table style='width:100%'>\n\t<tr>\n\t\t\n\t\t<td valign='top'>\n\t\t\t<p style='font-size:15px'>\n\t\t\t<img src='img/report-warning-256.png' style='margin:10px;float:left'>\n\t\t\t<p style='font-size:16px'>{server}: CPU(s): {$users->CPU_NUMBER}, {memory}:{$users->MEM_TOTAL_INSTALLEE}</strong></p>\n\t\t\t<p style='font-size:15px'>{WARN_SQUID_STATS_PERFS}</p>\n\t\t\t</p>\n\t\t\t<table style='width:99%'>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2 style='font-size:16px;font-weight:bold'>{visit_links}:</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle' width=1%><img src='img/arrow-right-24.png'></td>\n\t\t\t\t<td width=99% align='left'><a href=\"javascript:blur();\" \n\t\t\t\t\tOnClick=\"javascript:s_PopUpFull('http://www.proxy-appliance.org/index.php?cID=233','1024','900');\"\n\t\t\t\t\tstyle='font-size:15px;font-weight:bold;text-decoration:underline'>{thewebproxy_appliance}</a>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign=middle' width=1%><img src='img/arrow-right-24.png'></td>\n\t\t\t\t<td width=99% align='left'><a href=\"javascript:blur();\" \n\t\t\t\t\tOnClick=\"javascript:s_PopUpFull('http://www.proxy-appliance.org/index.php?cID=203','1024','900');\"\n\t\t\t\t\tstyle='font-size:15px;font-weight:bold;text-decoration:underline'>{howtousesarg}</a>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign=middle' width=1%><img src='img/arrow-right-24.png'></td>\n\t\t\t\t<td width=99% align='left'><a href=\"javascript:blur();\" \n\t\t\t\t\tOnClick=\"javascript:s_PopUpFull('http://www.proxy-appliance.org/index.php?cID=245','1024','900');\"\n\t\t\t\t\tstyle='font-size:15px;font-weight:bold;text-decoration:underline'>{howtogenerateproxycsv}</a>\n\t\t\t\t</td>\n\t\t\t</tr>\t\n\t\t\t</table>\n\t\t\t\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tr style='height:15px'>\n\t\t\t\t<td align='center' style='font-size:18px;font-weight:bold'>{actions}:</td>\n\t\t\t</tr>\n\t\t\t<tr style='height:15px'>\n\t\t\t\t<td align='center'>" . button("{i_understand_continue}", "SquidWarnContinue()", "18px") . "</td> \n\t\t\t</tr>\n\t\t\t<tr style='height:15px'>\n\t\t\t\t<td align='center'>" . button("{stop_articastats}", "SquidStopArticaStats()", "18px") . "</td> \n\t\t\t</tr>\n\t\t\t</table>\t\t\t\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\tvar x_SquidWarnContinue= function (obj) {\n\t\t\tdocument.getElementById('mainid-{$t}').innerHTML='';\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tdocument.location.href='admin.index.php';\n\t\t}\t\t\t\n\t\tvar x_SquidStopArticaStats= function (obj) {\n\t\t\tdocument.getElementById('mainid-{$t}').innerHTML='';\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\tCacheOff();\n\t\t\tdocument.location.href='admin.index.php';\n\t\t\t\n\t\t}\t\t\n\t\n\t\tfunction SquidWarnContinue(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('SquidWarnContinue','yes');\n\t\t\tAnimateDiv('mainid-{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SquidWarnContinue);\t\t\n\n\t\t}\n\t\t\n\t\tfunction SquidStopArticaStats(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('SquidStopArticaStats','yes');\n\t\t\tAnimateDiv('mainid-{$t}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_SquidStopArticaStats);\t\t\n\t\t\n\t\t}\n\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #19
0
function download_popup()
{
    if (!is_file("/usr/share/artica-postfix/ressources/logs/web/nginx.dump.gz")) {
        echo FATAL_ERROR_SHOW_128("nginx.dump.gz no such file!");
        return;
    }
    $size = @filesize("ressources/logs/web/nginx.dump.gz");
    $size = FormatBytes($size / 1024);
    echo "<center style='margin:30px'><a href='ressources/logs/web/nginx.dump.gz'><img src='img/download-64.png'></a>\n\t<center style='margin:30px'>\n\t\t<a href='ressources/logs/web/nginx.dump.gz' style='font-size:18px;text-decoration:underline'>nginx.dump.gz ({$size})</a>\n\t</center>";
}
Пример #20
0
function popup_squidguard()
{
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?squidguard-db-status=yes")));
    $tpl = new templates();
    $html = "\n\t<div style='font-size:14px;'>{DANSGUARDIAN_DB_STATUS_EXPLAIN}</div>\n\t<div style='width:100%;height:350px;overflow:auto'>\n\t<table style='width:100%'>\n\t\t<tr>\n\t\t<th style='font-size:14px' nowrap>{category}</th>\n\t\t<th style='font-size:14px' nowrap>{domains}</th>\n\t\t<th style='font-size:14px' nowrap>{urls}</th>\n\t\t<th style='font-size:14px' nowrap>Regex</th>\n\t\t<th style='font-size:14px' nowrap>{date}</th>\n\t\t<th style='font-size:14px' nowrap>{squidguard_database_size}</th>\n\t</tr>";
    if (!is_array($datas)) {
        echo $tpl->_ENGINE_parse_body("<H2>{error_no_datas}</H2>");
        return;
    }
    while (list($path, $array) = each($datas)) {
        //	if($path==null){continue;}
        $category = squidguard_extract_category($path);
        $Narray[$category][$array["type"]]["linesn"] = $array["linesn"];
        $Narray[$category][$array["type"]]["size"] = $array["size"];
        $Narray[$category][$array["type"]]["date"] = $array["date"];
    }
    while (list($category, $array2) = each($Narray)) {
        if ($array2["expressionlist"]["linesn"] == null) {
            $array2["expressionlist"]["linesn"] = 0;
        }
        if ($array2["domainlist"]["linesn"] == null) {
            $array2["expressionlist"]["linesn"] = 0;
        }
        if ($array2["urllist"]["linesn"] == null) {
            $array2["expressionlist"]["linesn"] = 0;
        }
        if (is_array($array2["domainlist"])) {
            if ($array2["domainlist"]["size"] == null) {
                $not_compiled = texttooltip("{not_compiled}", "{compile_squidguard_databases}<hr><i>{compile_squidguard_databases_text}</i>", "Loadjs('squidguard.status.php?compile=yes')", 0, "color:#d32d2d;font-size:14px;font-weight:bold");
                $array2["domainlist"]["size"] = "<span style='color:#d32d2d'>{$not_compiled}</span>";
            } else {
                $array2["domainlist"]["size"] = FormatBytes($array2["domainlist"]["size"] / 1024);
            }
        } else {
            $array2["domainlist"]["size"] = "-";
        }
        if ($array2["domainlist"]["date"] == null) {
            $array2["domainlist"]["date"] = $array2["expressionlist"]["date"];
        }
        $date = date('d M y h:i', $array2["domainlist"]["date"]);
        if (preg_match("#personal-categories\\/(.+)#", $category, $re)) {
            $category = "{personal}: {$re[1]}";
        }
        if (preg_match("#web-filter-plus\\/BL\\/(.+)#", $category, $re)) {
            $category = "{professional}: {$re[1]}";
        }
        if (preg_match("#blacklist-artica\\/(.+)#", $category, $re)) {
            $category = "{artica_community}: {$re[1]}";
        }
        $html = $html . "\n\t\t<tr " . CellRollOver() . ">\n\t\t\t<td style='font-size:14px' nowrap><strong>{$category}</strong></td>\n\t\t\t<td style='font-size:14px'  align='right' width=1%><strong>{$array2["domainlist"]["linesn"]}</strong></td>\n\t\t\t<td style='font-size:14px'  align='right' width=1%>{$array2["urllist"]["linesn"]}</td>\n\t\t\t<td style='font-size:14px'  align='right' width=1%>{$array2["expressionlist"]["linesn"]}</td>\n\t\t\t<td style='font-size:14px'  align='right' width=1% nowrap>{$date}</td>\n\t\t\t<td style='font-size:14px'  align='right' width=1%>{$array2["domainlist"]["size"]}</td>\n\t\t</TR>\n\t\t\n\t\t";
    }
    $html = $html . "</table></div>";
    echo $tpl->_ENGINE_parse_body($html, 'squid.index.php');
}
Пример #21
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $confirm = $tpl->javascript_parse_text("{change_path_services_warn}");
    $sock = new sockets();
    $ARRAY = unserialize(base64_decode($sock->getFrameWork("system.php?critical-paths-locations=yes")));
    $html = "\n<div id='id-final-{$t}'>\n<div id='text-{$t}' style='font-size:18px' class=explain>{change_directories_paths_text}</div>\n<div style='width:98%' class=form>\n\t<table>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>Artica {logs_directory} (" . FormatBytes($ARRAY["/var/log/artica-postfix"]["SIZE"]) . "):</td>\n\t\t<td class=legend style='font-size:16px'>" . Field_text("varlogart-{$t}", $ARRAY["/var/log/artica-postfix"]["PATH"], "font-size:18px;width:95%") . "</td>\n\t\t<td width=1%>" . button_browse("varlogart-{$t}") . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>Proxy {logs_directory} (" . FormatBytes($ARRAY["/var/log/squid"]["SIZE"]) . "):</td>\n\t\t<td class=legend style='font-size:16px'>" . Field_text("varlog-{$t}", $ARRAY["/var/log/squid"]["PATH"], "font-size:18px;width:95%") . "</td>\n\t\t<td width=1%>" . button_browse("varlog-{$t}") . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{logs_backup} (" . FormatBytes($ARRAY["/home/logs-backup"]["SIZE"]) . "):</td>\n\t\t<td class=legend style='font-size:16px'>" . Field_text("logsbackup-{$t}", $ARRAY["/home/logs-backup"]["PATH"], "font-size:18px;width:95%") . "</td>\n\t\t<td width=1%>" . button_browse("logsbackup-{$t}") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{categories_databases}: (" . FormatBytes($ARRAY["/home/artica/categories_databases"]["SIZE"]) . ")</td>\n\t\t<td class=legend style='font-size:16px'>" . Field_text("categoriesdb-{$t}", $ARRAY["/home/artica/categories_databases"]["PATH"], "font-size:18px;width:95%") . "</td>\n\t\t<td width=1%>" . button_browse("categoriesdb-{$t}") . "</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:18px'>{webfiltering_databases} ICAP: (" . FormatBytes($ARRAY["/home/c-icap/blacklists"]["SIZE"]) . ")</td>\n\t\t<td class=legend style='font-size:16px'>" . Field_text("icapdb-{$t}", $ARRAY["/home/c-icap/blacklists"]["PATH"], "font-size:18px;width:95%") . "</td>\n\t\t<td width=1%>" . button_browse("icapdb-{$t}") . "</td>\n\t</tr>\t\n\t\t\t\t\n\t\t\t\t\n\t<tr>\n\t\t<td colspan=3 align='right'><hr>" . button("{apply}...", "Save{$t}()", "26") . "</td>\n\t</tr>\n</table>\n</div>\n<script>\nvar x_Save{$t}= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>3){alert(results);return;}\n\tLoadjs('squid.directories.progress.php');\n}\nfunction Save{$t}(){\n\tif(!confirm('{$confirm}')){return;}\n\tvar XHR = new XHRConnection();\n\tXHR.appendData('varlog',document.getElementById('varlog-{$t}').value);\n\tXHR.appendData('logsbackup',document.getElementById('logsbackup-{$t}').value);\n\tXHR.appendData('categoriesdb',document.getElementById('categoriesdb-{$t}').value);\n\tXHR.appendData('icapdb',document.getElementById('icapdb-{$t}').value);\n\tXHR.appendData('varlogart',document.getElementById('varlogart-{$t}').value);\n\t\n\t\n\tXHR.sendAndLoad('{$page}', 'POST',x_Save{$t});\n}\n\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #22
0
function step3()
{
    $page = CurrentPageName();
    $t = $_GET["t"];
    $sock = new sockets();
    $size = $sock->getFrameWork("squid.php?support-step3=yes");
    $size = FormatBytes($size / 1024);
    $tpl = new templates();
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td width=1%><img src='img/20-check.png'></td>\n\t\t<td  style='font-size:16px'><a href='ressources/support/support.tar.gz' style='font-size:16px;text-decoration:underline'>support.tar.gz ({$size})</a></td>\n\t</tr>\n\t</table>\n\t<script>\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function start()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $ini = new Bs_IniHandler();
    $t = time();
    if (!isset($_GET["t"])) {
        $_GET["t"] = $t;
    }
    if (!is_file("/usr/share/artica-postfix/ressources/logs/global.status.ini")) {
        if (!isset($_GET["wait"])) {
            $sock->getFrameWork("cmd.php?Global-Applications-Status=yes");
        }
        echo $tpl->_ENGINE_parse_body("<center style='margin-20px;font-size:20px'>{please_wait_waiting_services_status}</center>\n\t\t\t\t<script>\n\t\t\t\t\tfunction Wait{$t}(){\n\t\t\t\t\t\tif(!document.getElementById('{$t}')){return;}\n\t\t\t\t\t\tLoadAjaxRound('{$_GET["t"]}','{$page}?start=yes&={$t}&wait=yes');\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tsetTimeout('Wait{$t}()',1200);\n\t\t\t\t</script>");
        die;
    }
    $ini->loadFile("/usr/share/artica-postfix/ressources/logs/global.status.ini");
    $tr[] = "<div style='margin-top:20px'>";
    $tr[] = "<table style='width:100%'>";
    $tr[] = "<tr style='height:70px'>\n\t<th style='font-size:22px;' colspan=4>{services}</th>\n\t<th style='font-size:22px;' colspan=2>{processes}/{memory}</th>\n\t<th style='font-size:22px;'>{uptime}</th>\n\t<th style='font-size:22px;' colspan=2>{action}</th>\n\t</tr>";
    while (list($key, $array) = each($ini->_params)) {
        $icon = "ok48.png";
        $color = "black";
        $text = "{running}";
        $service_name = $array["service_name"];
        $service_disabled = intval($array["service_disabled"]);
        if ($service_disabled == 0) {
            continue;
        }
        $running = intval($array["running"]);
        $master_version = $array["master_version"];
        $processes_number = $array["processes_number"];
        $uptime = "{since}: {$array["uptime"]}";
        $master_memory = FormatBytes($array["master_memory"]);
        $service_cmd = urlencode($array["service_cmd"]);
        $start = imgtootltip("48-run.png", "{start}", "Loadjs('system.services.cmd.php?APPNAME={$service_name}&action=start&cmd={$service_cmd}&appcode={$key}')");
        $action = imgtootltip("stop-48.png", "{stop}", "Loadjs('system.services.cmd.php?APPNAME={$service_name}&action=stop&cmd={$service_cmd}&appcode={$key}')");
        $restart = imgtootltip("restart-48.png", "{restart}", "Loadjs('system.services.cmd.php?APPNAME={$service_name}&action=restart&cmd={$service_cmd}&appcode={$key}')");
        if ($running == 0) {
            $icon = "danger48.png";
            $color = "#d32d2d";
            $text = "{stopped}";
            $processes_number = 0;
            $action = $start;
            $uptime = "-";
        }
        $tr[] = "<tr style='height:70px'>\n\t\t\t\t<td style='font-size:22px;color:{$color}'><img src='img/{$icon}'></td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{{$service_name}}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$master_version}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$text}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$processes_number} {processes}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color};'>{$master_memory}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$uptime}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$action}</td>\n\t\t\t\t<td style='font-size:22px;color:{$color}'>{$restart}</td>\n\t\t\t</tr>";
    }
    $tr[] = "</table>";
    $tr[] = "</div>";
    echo $tpl->_ENGINE_parse_body(@implode("\n", $tr));
}
Пример #24
0
function status()
{
    $servername = $_GET["servername"];
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $table_name = "apache_stats_" . date('Ym');
    $sql = "SELECT * FROM {$table_name} WHERE servername='{$_GET["servername"]}' ORDER by zDate DESC LIMIT 0,1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
    $html = "\n\t<div style='font-size:16px'><div style='float:right'>" . imgtootltip("refresh-24.png", "{refresh}", "RfreshTabsFreewbs()") . "</div>{status}:{$servername}</div>\n\t<p>&nbsp;</p>\n\t<table style='width:100%' class=form>\n\t<tr>\n\t\t<td class=legend>{date}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>{$ligne["zDate"]}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{uptime}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>{$ligne["UPTIME"]}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{memory}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>" . FormatBytes($ligne["total_memory"] / 1024) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{total_traffic}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>" . FormatBytes($ligne["total_traffic"] / 1024) . "</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{requests_second}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>{$ligne["requests_second"]}/{second}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend>{traffic_second}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>" . FormatBytes($ligne["traffic_second"] / 1024) . "/{second}</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend>{traffic_request}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>" . FormatBytes($ligne["traffic_request"] / 1024) . "/{request}</td>\n\t</tr>\n\t</table>\t\n\t\n\t<div id='traffic-today'></div>\n\t\n\t\n\t<script>\n\t\tLoadAjax('traffic-today','{$page}?traffic-today=yes&servername={$_GET["servername"]}&group_id={$_REQUEST["group_id"]}&time=mn');\n\t\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
function page()
{
    $sock = new sockets();
    $EnableRemoteStatisticsAppliance = $sock->GET_INFO("EnableRemoteStatisticsAppliance");
    $MalwarePatrolDatabasesCount = $sock->getFrameWork("cmd.php?MalwarePatrolDatabasesCount=yes");
    if (GET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__)) {
        return;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $websitesnums = $q->COUNT_ROWS("visited_sites");
    $websitesnums = numberFormat($websitesnums, 0, "", " ");
    $sql = "DELETE FROM categorize WHERE LENGTH(pattern)=0";
    $q->QUERY_SQL($sql);
    $export = $q->COUNT_ROWS("categorize");
    $export = numberFormat($export, 0, "", " ");
    $categories = $q->COUNT_CATEGORIES();
    $categories = numberFormat($categories, 0, "", " ");
    $tablescat = $q->LIST_TABLES_CATEGORIES();
    $tablescatNUM = numberFormat(count($tablescat), 0, "", " ");
    $q = new mysql_squid_builder();
    $requests = $q->EVENTS_SUM();
    $requests = numberFormat($requests, 0, "", " ");
    $PhishingURIS = $q->COUNT_ROWS("uris_phishing");
    $PhishingURIS = numberFormat($PhishingURIS, 0, "", " ");
    $MalwaresURIS = $q->COUNT_ROWS("uris_malwares");
    $MalwaresURIS = numberFormat($MalwaresURIS, 0, "", " ");
    $Computers = $q->COUNT_ROWS("webfilters_nodes");
    $Computers = numberFormat($Computers, 0, "", " ");
    $DAYSNumbers = $q->COUNT_ROWS("tables_day");
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(totalsize) as tsize FROM tables_day"));
    $totalsize = FormatBytes($ligne["tsize"] / 1024);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT AVG(cache_perfs) as pourc FROM tables_day"));
    $pref = round($ligne["pourc"]);
    $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(sitename) as tcount FROM visited_sites WHERE LENGTH(category)=0"));
    $websitesnumsNot = numberFormat($ligne["tcount"], 0, "", " ");
    $CachePermformance = $q->CachePerfHour();
    if ($CachePermformance > -1) {
        $color = "#E01313";
        if ($CachePermformance > 20) {
            $color = "#6DBB6A";
        }
        $cachePerfText = "\n\t\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b style='color:{$color}'>{$CachePermformance}%</b> {cache_performance} ({now})</td>\n\t\t</tr>\n\t\t";
    }
    $mouse = "OnMouseOver=\";this.style.cursor='pointer';\" OnMouseOut=\";this.style.cursor='default';\"";
    $submenu = "\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$totalsize}</b> {downloaded_flow}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$pref}%</b> {cache_performance}</td>\n\t</tr>\n\t";
    $main_table = "\n\t<table style='width:98%' class=form>\n\t<tr><td style='font-size:16px'>{statistics}::{status}</td></tr>\n\t{$cachePerfText}\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;><b>{$DAYSNumbers}</b> {daysOfStatistics}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$requests}</b> {requests}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' style='font-size:14px'><b>{$Computers}</b> {computers}</td>\n\t</tr>\t\t\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b>{$websitesnums}</b> {visited_websites}</td>\n\t</tr>\t\n\n\t<tr>\n\t\t<td valign='top' style='font-size:14px;'><b>{$categories}</b> {websites_categorized}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$PhishingURIS}</b> {phishing_uris}</td>\n\t</tr>\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$MalwaresURIS}</b> {viruses_uris}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$MalwarePatrolDatabasesCount}</b> Malware Patrol</td>\n\t</tr>\t\t\t\t\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$websitesnumsNot}</b> {not_categorized}</td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td valign='top'  style='font-size:14px;'><b>{$tablescatNUM}</b> {categories}</td>\n\t</tr>\n\t</table>\t\n";
    $main_table = $tpl->_ENGINE_parse_body($main_table);
    SET_CACHED(__FILE__, __FUNCTION__, __FUNCTION__, $main_table);
    echo $main_table;
}
Пример #26
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $size = $sock->GET_INFO("SystemTotalSize");
    $DirectoryFSPath = $sock->GET_INFO("DirectoryFSPath");
    $move_fs_to = $tpl->javascript_parse_text("{move_fs_to}");
    $size = FormatBytes($size / 1024);
    $html = "\n\t<div style='width:98%' class=form>\n\t\t<div style='font-size:22px'>{move_filesystem}: {$size}</div>\n\t\t<div class=explain style='font-size:14px'>{move_filesystem_explain}</div>\t\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:16px'>{directory}:</td>\n\t\t\t<td>" . Field_text("DirectoryFSPath", $DirectoryFSPath, "width:220px;font-size:16px") . "</td>\n\t\t\t<td>" . button_browse("DirectoryFSPath") . "</td>\n\t\t</tr>\n\t\t<tr>\t\t\n\t\t\t<td colspan=3 align='right'><hr>" . button("{move}", "DirectoryFSPathSave()", 18) . "</td>\n\t\t</tr>\n\t\t</table>\n\t</div>\t\t\n<script>\nvar xDirectoryFSPathSave= function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>0){alert(results);}\n\tYahooWin3Hide();\n\t\n}\nfunction DirectoryFSPathSave(){\n\tvar path=document.getElementById('DirectoryFSPath').value;\n\tif(confirm('{$move_fs_to}:'+path+' ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DirectoryFSPath',path);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDirectoryFSPathSave);\n\t}\n}\t\t\t\t\n</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Пример #27
0
function action()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $sock->getFrameWork("fetchmail.php?export-table=yes");
    $target_file = "/usr/share/artica-postfix/ressources/logs/fetchmail-export.gz";
    if (!is_file($target_file)) {
        echo $tpl->_ENGINE_parse_body(FATAL_ERROR_SHOW_128("{failed}", "fetchmail-export.gz"));
        return;
    }
    $size = FormatBytes(@filesize($target_file) / 1024);
    echo "<center style='margin:10px;padding:10px'>\n\t\t\t<a href='ressources/logs/fetchmail-export.gz'><img src='img/128-import.png'><p>&nbsp;</p>\n\t\t\t<span style='font-size:22px;text-decoration:underline'>" . basename($target_file) . " - {$size}</span></a>\n\t\t\t</center>\n\t\t\t";
}
Пример #28
0
function BackupLogsMaxStoragePercent_info()
{
    $sock = new sockets();
    $tpl = new templates();
    $data = $sock->getFrameWork("system.php?BackupLogsMaxStoragePercent-info=yes");
    $DIRPART_INFO = unserialize(base64_decode($data));
    $percent = $_GET["BackupLogsMaxStoragePercent-info"] / 100;
    $TOTAL_PART = $DIRPART_INFO["TOT"] / 1024;
    $CURSIZE = $DIRPART_INFO["CURSIZE"];
    $TOTAL_PART_SIZE = FormatBytes($TOTAL_PART);
    $finalsize = FormatBytes($TOTAL_PART * $percent);
    $CURSIZE_TEXT = FormatBytes($CURSIZE / 1024);
    $line = "<div style='font-size:18px'><strong>{backup_folder} ({size}):{$TOTAL_PART_SIZE} {used}:{$CURSIZE_TEXT}/{$finalsize}</div>";
    echo $tpl->_ENGINE_parse_body($line);
}
Пример #29
0
function CleanLogs()
{
    cleanTmplogs();
    CleanDirLogs('/var/log');
    CleanDirLogs('/opt/artica/tmp');
    CleanDirLogs('/etc/artica-postfix/pids');
    CleanDirLogs('/opt/artica/install');
    phplogs();
    CleanClamav();
    $size = str_replace("&nbsp;", " ", FormatBytes($GLOBALS["DELETED_SIZE"]));
    echo "{$size} cleaned :  {$GLOBALS["DELETED_FILES"]} files\n";
    if ($GLOBALS["DELETED_SIZE"] > 500) {
        send_email_events("{$size} logs files cleaned", "{$GLOBALS["DELETED_FILES"]} files cleaned for {$size} free disk space", "logs_cleaning");
    }
}
Пример #30
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $sql = "SELECT * FROM quotaroot WHERE uid='{$_GET["uid"]}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $t = time();
    $sql = "SELECT * FROM repquota WHERE uid='{$_GET["uid"]}'";
    $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
    if (is_numeric($ligne2["blockused"])) {
        $status = "<div style='font-size:14px;color:#9F0000'>{used}: " . FormatBytes($ligne2["blockused"]) . "&nbsp;|&nbsp;{$ligne2["filesusers"]} {files}</div>";
    }
    $html = "\n\t{$status}\n\t<div id='{$t}'>\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{enabled}:</td>\n\t\t<td style='font-size:14px'>" . Field_checkbox("quota-enabled", 1, $ligne["enabled"], "EnableQutotaRott()") . "</tD>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{size}:{soft_limit}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("block-softlimit", $ligne["block-softlimit"], "font-size:14px;width:60px") . "&nbsp;MB</tD>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{size}:{hard_limit}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("block-hardlimit", $ligne["block-hardlimit"], "font-size:14px;width:60px") . "&nbsp;MB</tD>\n\t</tr>\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{filesnumber}:{soft_limit}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("inode-softlimit", $ligne["inode-softlimit"], "font-size:14px;width:60px") . "&nbsp;{files}</tD>\n\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{filesnumber}:{hard_limit}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("inode-hardlimit", $ligne["inode-hardlimit"], "font-size:14px;width:60px") . "&nbsp;{files}</tD>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:14px'>{grace_period}:</td>\n\t\t<td style='font-size:14px'>" . Field_text("GraceTime", 10080, "font-size:14px;width:60px") . "&nbsp;{minutes}</tD>\n\t</tr>\t\n\t\n\t\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . button("{apply}", "SaveQuotaRootUser()") . "</td>\n\t</tr>\n\t</table>\n\t</div>\n\t<script>\n\t\nvar x_SaveQuotaRootUser= function (obj) {\n\tvar tempvalue=obj.responseText;\n\tif(tempvalue.length>3){alert(tempvalue);}\n\tYahooWin4Hide();\n}\n\t\t\n\nfunction EnableQutotaRott(){\n\n\t\tdocument.getElementById('block-softlimit').disabled=true;\n\t\tdocument.getElementById('block-hardlimit').disabled=true;\n\t\tdocument.getElementById('inode-softlimit').disabled=true;\n\t\tdocument.getElementById('inode-hardlimit').disabled=true;\n\t\tdocument.getElementById('GraceTime').disabled=true;\n\tif(document.getElementById('quota-enabled').checked){\n\t\tdocument.getElementById('block-softlimit').disabled=false;\n\t\tdocument.getElementById('block-hardlimit').disabled=false;\n\t\tdocument.getElementById('inode-softlimit').disabled=false;\n\t\tdocument.getElementById('inode-hardlimit').disabled=false;\n\t\t//document.getElementById('GraceTime').disabled=false;\n\t\n\t}\n\n}\n\t\nfunction SaveQuotaRootUser(){\n  \t var XHR = new XHRConnection();\n     XHR.appendData('ou','{$_GET["ou"]}');\n     XHR.appendData('uid','{$_GET["uid"]}');\n\t XHR.appendData('block-softlimit',document.getElementById('block-softlimit').value);\n\t XHR.appendData('block-hardlimit',document.getElementById('block-hardlimit').value);\n\t XHR.appendData('inode-softlimit',document.getElementById('inode-softlimit').value);\n\t XHR.appendData('inode-hardlimit',document.getElementById('inode-hardlimit').value);\n\t XHR.appendData('GraceTime',document.getElementById('GraceTime').value);  \n\t if(document.getElementById('quota-enabled').checked){  XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n     AnimateDiv('{$t}');                                    \t\t      \t\n     XHR.sendAndLoad('{$page}', 'POST',x_SaveQuotaRootUser);\t\t  \n}\n\n\nEnableQutotaRott();\n</script>\t\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}