Exemplo n.º 1
0
function stats_var_spool()
{
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?stats-var-spool=yes")));
    if (!is_array($array)) {
        return;
    }
    $html = "\n\t<table style='width:99%' class=form>\n\t\t<tr>\n\t\t<td class=legend style='font-size:14px'>{size}:</td>\n\t\t<td>" . pourcentage($array["POURC"], "{$array["DISP"]}/{$array["SIZE"]}") . "</td>\n\t\t<td class=legend style='font-size:14px'>{$array["DISP"]}/{$array["SIZE"]}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t<td class=legend style='font-size:14px'>Inodes:</td>\n\t\t<td>" . pourcentage($array["IPOURC"]) . "</td>\n\t\t<td class=legend style='font-size:14px'>{$array["IDISP"]}/{$array["INODES"]}</td>\n\t\t</tr>\t\t\t\t\n\t</table>\t\n\t";
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body($html);
}
function popup()
{
    $sock = new sockets();
    $tpl = new templates();
    $page = CurrentPageName();
    $dev = $_GET["dev"];
    $devenc = base64_encode($dev);
    $array = unserialize(base64_decode($sock->getFrameWork("system.php?tune2fs-values={$devenc}")));
    $t = time();
    $LAST_MOUNTED_ON = $array["LAST_MOUNTED_ON"];
    $WARNING_LOOSE_DATA = $tpl->javascript_parse_text("{WARNING_LOOSE_DATA}");
    $INODES_SIZEZ[128] = 128;
    $INODES_SIZEZ[256] = 256;
    $INODES_SIZEZ[1024] = 1024;
    $html = "\n\t<div id='{$t}'></div>\t\t\n\t<table style='width:99%' class=form>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{used}:</td>\t\t\n\t\t<td style='font-size:16px;font-weight:bold'>{$array["INODES_USED"]}&nbsp;{files}</td>\n\t\t<td style='font-size:16px;font-weight:bold'>" . pourcentage($array["INODES_POURC"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>{inode_size}:</td>\t\t\n\t\t<td style='font-size:16px;font-weight:bold'>" . Field_array_Hash($INODES_SIZEZ, "INODE_SIZE", $array["INODE_SIZE"], null, '', 0, "font-size:16px") . "</td>\n\t\t<td style='font-size:16px;font-weight:bold'></td>\n\t</tr>\t\t\t\t\n\t<tr>\n\t\t<td class=legend style='font-size:16px'>Max:</td>\t\t\n\t\t<td style='font-size:16px;font-weight:bold'>" . Field_text("INODES_MAX", $array["INODES_MAX"], "font-size:16px;width:100px") . "&nbsp;{files}</td>\n\t\t<td style='font-size:16px;font-weight:bold'></td>\n\t</tr>\n\t<tr><td colspan=3 align='right'><hr>" . button("{apply}", "Save{$t}()", 18) . "</td></tr>\n\t\n\t</table>\t\n\n\t\t\t\t\n\t\t\t\t\n\t<script>\n\n\t\tfunction check{$t}(){\n\t\t\tvar LAST_MOUNTED_ON='{$LAST_MOUNTED_ON}';\n\t\t\tif(LAST_MOUNTED_ON=='/'){\n\t\t\t\tdocument.getElementById('INODES_MAX').disabled=true;\n\t\t\t\tdocument.getElementById('INODE_SIZE').disabled=true;\n\t\t\t}\n\t\t\n\t\t}\n\t\t\n\t\tvar x_save{$t}= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>5){alert(results);}\n\t\t\tLoadjs('{$page}?dev={$dev}');\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfunction Save{$t}(){\n\t\t\tvar LAST_MOUNTED_ON='{$LAST_MOUNTED_ON}';\n\t\t\tif(LAST_MOUNTED_ON=='/'){return;}\n\t\t\tif(confirm('{$WARNING_LOOSE_DATA}')){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('dev','{$devenc}');\n\t\t\t\tXHR.appendData('INODES_MAX',document.getElementById('INODES_MAX').value);\n\t\t\t\tXHR.appendData('INODE_SIZE',document.getElementById('INODE_SIZE').value);\n\t\t\t\tAnimateDiv('{$t}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_save{$t});\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\t\n\tcheck{$t}();";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 3
0
function squid_booster_smp($encoded)
{
    $sock = new sockets();
    $array = unserialize(base64_decode($encoded));
    if (!is_array($array)) {
        return;
    }
    if (count($array) == 0) {
        return;
    }
    $html[] = "\n\t\t\t<div style='min-height:115px'>\n\t\t\t<table>\n\t\t\t<tr><td colspan=2 style='font-size:14px;font-weight:bold'>Cache(s) Booster</td></tr>\n\t\t\t";
    while (list($proc, $pourc) = each($array)) {
        $html[] = "<tr>\n\t\t<td width=1% nowrap style='font-size:13px;font-weight:bold'>Proc #{$proc}</td><td width=1% nowrap>" . pourcentage($pourc) . "</td></tr>";
    }
    $html[] = "</table></div>";
    return RoundedLightGreen(@implode("\n", $html));
}
Exemplo n.º 4
0
function mem_status()
{
    $tpl = new templates();
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?postfix-mem-disk-status={$_GET["hostname"]}")));
    $MOUTED = $datas["MOUTED"];
    $TOTAL_MEMORY_MB = $datas["TOTAL_MEMORY_MB"];
    $TOTAL_MEMORY_MB_FREE = $datas["TOTAL_MEMORY_MB_FREE"];
    $pourc = round($TOTAL_MEMORY_MB_FREE / $TOTAL_MEMORY_MB * 100);
    $pourc_used = pourcentage($pourc);
    if ($MOUTED > 0) {
        $pourc = round($MOUTED / $TOTAL_MEMORY_MB_FREE * 100);
        $purc_mounted = pourcentage($pourc);
    }
    $html = "\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td style='font-size:11px'>{free}: </td>\n\t</tr>\n\t<td valign='top'>{$pourc_used}</td>\n\t</tr>\n\t<tr>\n\t\t<td valign='top' align='right'><i>{$TOTAL_MEMORY_MB_FREE}MB/{$TOTAL_MEMORY_MB}MB</i></td>\n\t</tr>\t\n\t<tr>\n\t\t<td colspan=2><hr></td>\n\t</tr>\n\t<tr>\n\t\t<td style='font-size:11px'>{postfix_tmpfs}:</td>\n\t</tr>\n\t\t<td valign='top'>{$purc_mounted}</td>\n\t</tr>\n\t</tr>\n\t\t<td valign='top' align='right'><i>{$MOUTED}MB/{$TOTAL_MEMORY_MB_FREE}MB</td>\n\t</tr>\t\n\t</table>\n\t\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-24.png", "{refresh}", "mem_status()") . "</div>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 5
0
function squid_cache_status()
{
    $page = CurrentPageName();
    $squid = new squidnodes($_GET["nodeid"]);
    $tpl = new templates();
    $q = new mysql_blackbox();
    $t = $_GET["t"];
    $sql = "SELECT * FROM cachestatus WHERE nodeid='{$_GET["nodeid"]}'";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H3>Error: {$q->mysql_error}</H3>";
        return;
    }
    //$squid->
    $tr[] = "\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/parameters2-64.png'></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top><strong style='font-size:14px'>\n\t\t\t\t\t\t\t<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('nodes.squid.caches32.parms.php?hostid={$_GET["hostid"]}&nodeid={$_GET["nodeid"]}');\"\n\t\t\t\t\t\t\tstyle='font-size:14px;text-decoration:underline;font-weight:bold'>\n\t\t\t\t\t\t\t{caches_parameters}</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><span style='font-size:14px'>{cache_parameters_node_explain}</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $tr[] = "\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/disk-64.png'></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top><strong style='font-size:14px'>" . basename($ligne["cachedir"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><strong style='font-size:14px'>" . FormatBytes($ligne["currentsize"]) . "/" . FormatBytes($ligne["maxsize"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>" . pourcentage($ligne["pourc"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    }
    $html = CompileTr2($tr);
    $html = $html . "<div style='width:100%;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('squid-caches-status{$t}','{$page}?squid-caches-status=yes&nodeid={$_GET["nodeid"]}');") . "</div>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 6
0
function popup_events()
{
    $sock = new sockets();
    $tpl = new templates();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?smtp-import-events=yes&ou={$_GET["ou"]}")));
    if (!is_array($datas)) {
        echo $tpl->_ENGINE_parse_body("<center><H3>{please_wait}</H3></center>");
        return;
    }
    $pourcent = $datas["POURC"];
    $html_pource = pourcentage($pourcent);
    krsort($datas["EVENTS"]);
    while (list($num, $line) = each($datas["EVENTS"])) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $tr = $tr . "\n\t\t<tr class={$classtr}>\n\t\t<td width=1%><img src='img/fw_bold.gif'></td>\n\t\t<td width=99% style='font-size:13px'>{$line}</td>\n\t\t</tr>\n\t\t";
    }
    $html = $html . "<hr>\n{$html_pource}\n<hr>\n<div style='height:350px;overflow:auto'>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView'>\n<thead class='thead'>\n\t<tr>\n\t<th colspan=2>{events}</th>\n\t\n\t</tr>\n</thead>\n<tbody class='tbody'>{$tr}</tbody></table></div>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 7
0
function popup()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $t = $_GET["t"];
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/squidlogs.stats";
    $array = unserialize(@file_get_contents($cachefile));
    if (!isset($array["squidlogs"])) {
        @unlink($cachefile);
    }
    $array = unserialize(@file_get_contents($cachefile));
    if (!is_array($array)) {
        $sock = new sockets();
        $sock->getFrameWork("squid.php?squidlogs-stats=yes");
        $tt = time();
        $html = "<center>\n\t\t\t\t<p style='font-size:18px;font-weight:bold'>{please_wait_while_calculate_informations}</p>\n\t\t\t\t<p>squidlogs.stats no such file...</p>\n\t\t\t\t<img src='img/wait_verybig_mini_red.gif'></center>\n\t\t\t</center>\n\t\t\t\t<script>\n\t\t\t\t\tfunction Wait{$tt}(){\n\t\t\t\t\t\tLoadAjax('main-{$t}','{$page}?popup=yes&t={$t}');\n\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\tsetTimeout(\" Wait{$tt}()\",5000);\n\t\t\t\t</script>\n\t\t";
        echo $tpl->_ENGINE_parse_body($html);
        return;
    }
    $array = unserialize(@file_get_contents("ressources/logs/web/squidlogs.stats"));
    $html = "\n\t<div class=explain style='font-size:14px'>{squidlogs_explain}</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td>\n\t\t\t<table style='width:100%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{hard_drive}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["squidlogs"]["DEV"]} </td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{hard_drive_status}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["squidlogs"]["OC"]}/{$array["squidlogs"]["SIZE"]}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'></td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>" . pourcentage($array["squidlogs"]["POURC"]) . "</td>\n\t\t\t</tr>\t\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{database_size}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["squidlogs"]["REALPATH"]}:<span style='text-align:right'><i>" . FormatBytes($array["squidlogs"]["PATHSIZE"] / 1024) . "</span></td>\n\t\t\t</tr>\t\n\t\t\t</table>\n\t\t</td>\n\t\t<td>\n\t\n\t\t</td>\n\t\t</tr>\n\t</table>\n\t<div class=explain style='font-size:14px'>{syslogstore_explain}</div>\t\n\t<table style='width:100%'>\n\t<tr>\n\t\t<td>\n\t\t\t<table style='width:100%' class=form>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{hard_drive}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["syslogstore"]["DEV"]} </td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{hard_drive_status}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["syslogstore"]["OC"]}/{$array["syslogstore"]["SIZE"]}</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'></td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>" . pourcentage($array["syslogstore"]["POURC"]) . "</td>\n\t\t\t</tr>\t\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=legend style='font-size:14px' valign='top'>{database_size}:</td>\n\t\t\t\t<td><strong style='font-size:14px;font-weight:bold'>{$array["syslogstore"]["REALPATH"]}:<span style='text-align:right'><i>" . FormatBytes($array["syslogstore"]["PATHSIZE"] / 1024) . "</span></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t\t<td valign='top'>\n\t\n\t\t\t</td>\n\t\t</tr>\n\t</table>\t\t\t\t\t\t\t\t\t\t\t\t\t\n";
    echo $tpl->_ENGINE_parse_body($html);
}
function progress_build()
{
    $tpl = new templates();
    echo "<center>";
    echo pourcentage($_GET["progress"]);
    echo "</center>";
    if ($_GET["progress"] == 100) {
        $tpl = new templates();
        echo $tpl->_ENGINE_parse_body("<center><hr><strong style='font-size:16px;color:#d32d2d;margin:15px'>{success}</strong><hr></center>");
        $_SESSION["WIZINSTANCE"] = array();
    }
}
function SafeBoxInfos($mapper)
{
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("cmd.php?DiskInfos={$mapper}")));
    $html = "<table style='width:100%'>\n\t<tr>\n\t\t<td>" . pourcentage($array["POURC"]) . "</td>\n\t</tr>\n\t<tr>\n\t<td align='left'>{free}:{$array["FREE"]}&nbsp;|&nbsp;{size}:{$array["SIZE"]}&nbsp;|&nbsp;{used}:{$array["USED"]}<br>\n\t<code>{$array["MOUNTED"]}</td>\n\t</tr>\n\t</table>\t\n\t\n\t";
    return $html;
}
Exemplo n.º 10
0
        echo pourcentage($nombre['npai'], $nombre['fait']);
        ?>
%;"><span>Adresse&nbsp;erronée&nbsp;:&nbsp;<?php 
        echo floor(pourcentage($nombre['npai'], $nombre['fait']));
        ?>
&nbsp;%</span></div><!--
    	 --></div>
    	    <?php 
    }
    ?>
    	    
    		<h4>Statistiques</h4>
    		
    		<ul class="statistiquesMission">
    			<li>Mission réalisée à <strong><?php 
    echo ceil(pourcentage($nombre['fait'], $nombre['total']));
    ?>
</strong>&nbsp;%.</li>
    			<li><strong><?php 
    echo number_format($nombre['total'], 0, ',', ' ');
    ?>
</strong>&nbsp;<?php 
    echo $data->get('mission_type') == 'porte' ? 'électeurs' : 'immeubles';
    ?>
 concernés par cette mission.</li>
    			<li>Il reste <strong><?php 
    echo number_format($nombre['attente'], 0, ',', ' ');
    ?>
</strong>&nbsp;<?php 
    echo $data->get('mission_type') == 'porte' ? 'électeurs' : 'immeubles';
    ?>
Exemplo n.º 11
0
function squid_cache_status()
{
    $sock = new sockets();
    $DisableAnyCache = $sock->GET_INFO("DisableAnyCache");
    if (!is_numeric($DisableAnyCache)) {
        $DisableAnyCache = 0;
    }
    if ($DisableAnyCache == 1) {
        return;
    }
    $page = CurrentPageName();
    $squid = new squidbee();
    $tpl = new templates();
    $t = time();
    $q = new mysql_squid_builder();
    $sql = "SELECT * FROM cachestatus WHERE uuid='{$_GET["uuid"]}'";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo "<H3>Error: {$this->mysql_error}</H3>";
        return;
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $strong = "<strong style='font-size:14px'>";
        if (basename($ligne["cachedir"]) == "cache_booster") {
            $strong = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.booster.php')\" style='font-size:14px;text-decoration:underline;font-weight:bold'>";
        }
        $delete = imgtootltip("disk-64-delete.png", "{delete_cache}", "squid32DeleteCache('" . base64_encode($ligne["cachedir"]) . "')");
        $NICKEL[$ligne["cachedir"]] = true;
        if ($ligne["cachedir"] == $squid->CACHE_PATH) {
            $cache_type = $squid->CACHE_TYPE;
            $delete = imgtootltip("disk-64-config.png", "{apply}", "Loadjs('{$page}?add-new-disk-js=yes&chdef=yes')");
        } else {
            $cache_type = $squid->cache_list[$ligne["cachedir"]]["cache_type"];
        }
        if ($ligne["cachedir"] != $squid->CACHE_PATH) {
            if (!isset($squid->cache_list[$ligne["cachedir"]])) {
                $delete = "<img src='img/disk-64-hide.png'>";
            }
        }
        $html = $html . "\n\t\t\t\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%>{$delete}</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top>{$strong}" . basename($ligne["cachedir"]) . "&nbsp;({$cache_type})</strong></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><strong style='font-size:14px'>" . FormatBytes($ligne["currentsize"]) . "/" . FormatBytes($ligne["maxsize"]) . "</strong><div>{$ligne["cachedir"]}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>" . pourcentage($ligne["pourc"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    }
    while (list($path, $array) = each($squid->cache_list)) {
        if (isset($NICKEL[$path])) {
            continue;
        }
        $unit = "&nbsp;MB";
        $maxcachesize = null;
        if ($array["cache_type"] == "rock") {
            $maxcachesize = "&nbsp;({max_objects_size} {$array["cache_maxsize"]}{$unit})";
        }
        if (is_numeric($array["cache_size"])) {
            if ($array["cache_size"] > 1000) {
                $array["cache_size"] = $array["cache_size"] / 1000;
                $unit = "&nbsp;GB";
            }
        }
        if ($array["cache_type"] == "rock") {
            continue;
        }
        $html = $html . "\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/disk-64-hide.png'></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top>{$strong}" . basename($path) . " ({$array["cache_type"]})</strong></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><strong style='font-size:14px'>{$array["cache_size"]}{$unit}/{$maxcachesize}</strong><div>{$path}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    }
    $html = $html . "\n\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('squid-caches-status','{$page}?squid-caches-status=yes&uuid={$_GET["uuid"]}');") . "</div>\n\t\n\t<script>\n\t\tfunction Squid32RefreshCacheStatusAuto{$t}(){\n\t\t\tif(document.getElementById('squid-caches-status')){\n\t\t\t\tLoadAjax('squid-caches-status','{$page}?squid-caches-status=yes&uuid={$_GET["uuid"]}');\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tsetTimeout('Squid32RefreshCacheStatusAuto{$t}',10000);\n\t\t\n\t</script>\n\t\n\n\t\t\n\t\n\t";
    $sock = new sockets();
    $sock->getFrameWork("squid.php?refresh-caches-infos=yes");
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 12
0
function ptx_status()
{
    $tpl = new templates();
    $sock = new sockets();
    $SquidBoosterMem = $sock->GET_INFO("SquidBoosterMem");
    if (!is_numeric($SquidBoosterMem)) {
        $SquidBoosterMem = 0;
    }
    $ptxt = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('squid.booster.php');\" \n\t\tstyle='font-size:12px;text-decoration:underline'>{squid_booster}</a>";
    if ($SquidBoosterMem > 0) {
        $pourc = $sock->getFrameWork("squid.php?boosterpourc=yes");
        $ptxt = "\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<td>{$ptxt}</td>\n\t\t\t\t<td>" . pourcentage($pourc) . "</td>\n\t\t\t</tr>\n\t\t</table>";
    }
    echo $tpl->_ENGINE_parse_body($ptxt);
}
Exemplo n.º 13
0
function categories_details_list()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sql = "SELECT * FROM updates_categories  WHERE filesize>0 AND categories='{$_GET["category-details-md"]}' ORDER BY progress";
    $q = new mysql();
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<H2>Fatal error {$sql}</H2>";
    }
    $num = mysql_num_rows($results);
    $html = "<center style='width:100%;height:450px;overflow:auto'>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshCategoryDetails()") . "</th>\n\t\t<th>{database}</th>\n\t\t<th>{filesize}</th>\n\t\t<th colspan=2>{status}</th>\n\t\t\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $color = "black";
        $filesize = FormatBytes($ligne["filesize"] / 1024);
        $purc = pourcentage(round($ligne["progress"]));
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%><img src=img/Database32.png></td>\n\t\t\t<td style='font-size:14px;font-weight:bold;color:{$color}'>{$ligne["filename"]}</td>\n\t\t\t<td style='font-size:14px;font-weight:bold;color:{$color}'>{$filesize}</td>\n\t\t\t<td style='font-size:14px;font-weight:bold;color:{$color}'>{$purc}</td>\n\t\t\t<td style='font-size:14px;font-weight:bold;color:{$color}'>{$ligne["subject"]}</td>\t\n\t\t</tr>";
    }
    $html = $html . "</table>\n\t\n\t<script>\n\t\tRefreshCategoryDetailsTitle();\n\t</script>";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 14
0
function main_cache_list()
{
    $squid = new squidbee();
    $usermenus = new usersMenus();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $cacheinfo = unserialize(base64_decode($sock->getFrameWork("cmd.php?squid-cache-infos=yes")));
    $stats = "<table style=width:100%>";
    if (is_array($cacheinfo)) {
        while (list($path, $array) = each($cacheinfo)) {
            $pourc = pourcentage($array["POURC"]);
            $currentsize = FormatBytes($array["CURRENT"]);
            $max = FormatBytes($array["MAX"]);
            $stats = $stats . "\n\t\t\t<tr>\n\t\t\t\t<td valign='top' style='font-size:11px;font-weight:bold' nowrap>{$path} ({$max})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top'>{$pourc}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valign='top' style='font-size:10px' align='right'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td align='right'><i>{used}:{$currentsize}</i>&nbsp;</td>\n\t\t\t\t\t<td width=1%>" . imgtootltip("ed_delete.gif", "{delete}", "DeleteCache('{$path}')") . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td valign='top'><hr></td>\n\t\t\t</tr>\n\t\t\t";
        }
    }
    $stats = $stats . "\n\t\t<tr>\n\t\t\t<td align='right' colspan=2>" . imgtootltip("database-48-add.png", "{add_cache_dir}", "AddCache('');") . "</td>\n\t\t</tr>\t\t\n\t\t</table>";
    echo $tpl->_ENGINE_parse_body($stats);
}
Exemplo n.º 15
0
function main_artica_apt_config()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $q = new mysql();
    $packagesNumber = $q->COUNT_ROWS("syspackages_updt", "artica_backup");
    $updatenowtext = $tpl->javascript_parse_text("{update_now}");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
        return;
    }
    if ($packagesNumber == 0) {
        echo $tpl->_ENGINE_parse_body("<table style='width:100%'><tr><td width=1%><img src='img/ok64.png'></td><td><H2>{system_is_uptodate}</H2></td></tr></table>");
        return;
    }
    $html = "<div style='font-size:16px'>{$packagesNumber} {system_packages_can_be_upgraded}</div>";
    $q = new mysql();
    $sql = "SELECT COUNT(*) as tcount FROM syspackages_updt WHERE upgrade=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $coche = $ligne["tcount"];
    if ($coche == $packagesNumber) {
        $coche = 1;
    } else {
        $coche = 0;
    }
    $refresh = imgtootltip('refresh-24.png', "{refresh}", "RefreshTab('main_config_artica_update');");
    $sql = "SELECT AVG(progress) AS tcount FROM syspackages_updt  WHERE upgrade=1";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $global_progress = $ligne["tcount"];
    $html = "<center>\n<div id='sys-update-button' style='text-align:center;margin:5px'></div>\n<table cellspacing='0' cellpadding='0' border='0' class='tableView' style='width:100%'>\n<thead class='thead'>\n\t<tr>\n\t\t<th width=1%>" . Field_checkbox("EnableDisableAllUpgradePackage", 1, $coche, "EnableDisableAllUpgradePackage()") . "</th>\n\t\t<th colspan=2>{packages}</th>\n\t\t<th style='background-color:white;margin:0;padding:0;border:1px solid black'>" . pourcentage(round($global_progress)) . "</th>\n\t\t<th width=1% align='center'>{$refresh}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>";
    $q = new mysql();
    $sql = "SELECT * FROM syspackages_updt ORDER BY package";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    while ($ligne = mysql_fetch_array($results, MYSQL_ASSOC)) {
        $progress = "&nbsp;";
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $md = md5($ligne["package"]);
        $select = Field_checkbox("{$md}", 1, $ligne["upgrade"], "EnableDisableUpgradePackage('{$md}','{$ligne["package"]}')");
        if ($ligne["upgrade"] == 1) {
            $progress = pourcentage($ligne["progress"]);
        }
        $color = "black";
        $html = $html . "\n\t\t<tr class={$classtr}>\n\t\t\t<td width=1%>{$select}</td>\n\t\t\t<td style='font-size:16px;font-weight:bold;color:{$color}' width=99%>{$ligne["package"]}</td>\n\t\t\t<td width=1% colspan=3>{$progress}</td>\n\t\t</tr>\n\t\t";
    }
    $html = $html . "</tbody></table>\n\t\n\t<script>\n\t\n\tvar x_EnableDisableAllUpgradePackage= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tRefreshTab('main_config_artica_update');\n\t\t\t}\n\tvar x_EnableDisableUpgradePackage= function (obj) {\n\t\t\tvar results=obj.responseText;\n\t\t\tif(results.length>0){alert(results);}\n\t\t\tsysbutton();\n\t\t\t}\t\t\t\t\t\t\n\t\n\t\n\tfunction EnableDisableAllUpgradePackage(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('EnableDisableAllUpgradePackage').checked){XHR.appendData('EnableDisableAllUpgradePackage',1);}else{XHR.appendData('EnableDisableAllUpgradePackage',0);}\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableAllUpgradePackage);\n    \t}\n    \t\n    function sysbutton(){\n    \tLoadAjaxTiny('sys-update-button','{$page}?sys-update-button=yes');\n    \n    }\n    \n    function EnableDisableUpgradePackage(id,pkg){\n    \tvar XHR = new XHRConnection();\n    \tif(document.getElementById(id).checked){XHR.appendData('enabled',1);}else{XHR.appendData('enabled',0);}\n    \tXHR.appendData('pkg',pkg);\n    \tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableUpgradePackage);\n    }\n    \n    function SysUpdateNow(){\n    \tif(confirm('{$updatenowtext} ?')){\n     \t\tvar XHR = new XHRConnection();\n    \t\tXHR.appendData('pkg-upgrade','yes');\n    \t\tXHR.sendAndLoad('{$page}', 'POST',x_EnableDisableAllUpgradePackage);   \t\n    \t}\n    }\n\t\t\t\t\n\tsysbutton();\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 16
0
function status()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $lvs = $_GET["lvs"];
    $vg = $_GET["vg"];
    $md = md5("{$vg}{$lvs}");
    $groupnamemd = md5($vg);
    $current_text = $tpl->javascript_parse_text("{current}:");
    $give_new_size_in_mb = $tpl->javascript_parse_text("{give_new_size_in_mb}:");
    $array = unserialize(base64_decode($sock->getFrameWork("lvm.php?lvdisplay=" . urlencode($vg))));
    $status = $array["/dev/{$vg}/{$lvs}"];
    $crrentsize = $status["CURRENT_SIZE"];
    if (is_numeric($crrentsize["POURC"])) {
        $free = FormatBytes($crrentsize["FREE"]);
        $currentsize = "\n\t<tr class=oddRow>\n\t\t<td style='font-size:14px' class=legend>{used}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>" . pourcentage($crrentsize["POURC"]) . "</td>\n\t\t</tr>\n\t\t\n\t<tr class=>\n\t\t<td style='font-size:14px' class=legend>{free}:</td>\n\t\t<td style='font-size:14px;font-weight:bold'>{$free}</td>\n\t\t</tr>\t\t\n\t\t";
    }
    $sizeMB = round($status["SIZE"] / 1024);
    $size = FormatBytes($status["SIZE"]);
    $status["INFOS"]["UUID"];
    if ($status["INFOS"]["UUID"] != null) {
        $autofs = new autofs();
        $hash = $autofs->list_byuuid($status["INFOS"]["UUID"]);
        if (count($hash) > 0) {
            $automount = "\n\t\t\t\t<tr class=oddRow>\n\t\t\t\t<td style='font-size:14px' class=legend>{automount}:</td>\n\t\t\t\t<td style='font-size:14px;font-weight:bold'>/automounts/{$vg}-{$lvs}</td>\n\t\t\t\t</tr>";
        }
    }
    if ($status["INFOS"]["UUID"] == null) {
        $status["INFOS"]["UUID"] = "&nbsp;";
    }
    $resize = "<a href=\"javascript:blur()\" OnClick=\"javascript:lvsresize()\" style='font-size:14px;font-weight:bold;text-decoration:underline'>";
    $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 colspan=2>{$vg}&nbsp;&raquo;&nbsp;{$lvs}</th>\n\t</tr>\n</thead>\n<tbody class='tbody'>\n<tr class=oddRow>\n\t<td style='font-size:14px' class=legend>{size}:</td>\n\t<td style='font-size:14px;font-weight:bold'>{$resize}&laquo;&nbsp;{$size}&nbsp;&raquo;</a></td>\n</tr>\n{$currentsize}\n<tr class=>\n\t<td style='font-size:14px' class=legend>{uuid}:</td>\n\t<td style='font-size:14px;font-weight:bold'>{$status["UUID"]}</td>\n</tr>\n<tr class=oddRow>\n\t<td style='font-size:14px' class=legend>{uuid}:</td>\n\t<td style='font-size:14px;font-weight:bold'>{$status["INFOS"]["UUID"]}</td>\n</tr>\n<tr class=>\n\t<td style='font-size:14px' class=legend>dev:</td>\n\t<td style='font-size:14px;font-weight:bold'>/dev/{$vg}/{$lvs}</td>\n</tr>\n{$automount}\n</table>\n\n<script>\n\tvar x_lvsresize= function (obj) {\n\t\tvar results=obj.responseText;\n\t\tif(results.length>0){alert(results);}\n\t\tRefreshTab('{$md}');\n\t\tExpanVG_{$groupnamemd}();\n\t}\t\n\n\tfunction lvsresize(){\n\t\tvar newsize=prompt('{$current_text}{$sizeMB}MB: {$give_new_size_in_mb}');\n\t\tif(newsize){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('lvsresize','yes');\n\t\t\tXHR.appendData('vg','{$vg}');\n\t\t\tXHR.appendData('lvs','{$lvs}');\n\t\t\tXHR.appendData('size',newsize);\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_lvsresize);\n\t\t\n\t\t}\n\t\n\t}\n\n</script>\n";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 17
0
function status()
{
    $t = $_GET["t"];
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $page = CurrentPageName();
    $ini->loadString(base64_decode($sock->getFrameWork('mimedefang.php?status=yes')));
    $APP_MIMEDEFANG = DAEMON_STATUS_ROUND("APP_MIMEDEFANG", $ini, null);
    $APP_MIMEDEFANGX = DAEMON_STATUS_ROUND("APP_MIMEDEFANGX", $ini, null);
    $Param = unserialize(base64_decode($sock->GET_INFO("MimeDefangServiceOptions")));
    if (!is_numeric($Param["MX_TMPFS"])) {
        $Param["MX_TMPFS"] = 0;
    }
    $tpl = new templates();
    if ($Param["MX_TMPFS"] > 5) {
        $array = unserialize(base64_decode($sock->getFrameWork("mimedefang.php?getramtmpfs=yes")));
        if (!is_numeric($array["PURC"])) {
            $array["PURC"] = 0;
        }
        if (!isset($array["SIZE"])) {
            $array["SIZE"] = "0M";
        }
        $tmpfs[] = "\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:16px' align='left'>tmpfs:</td>\n\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td valing='middle'>" . pourcentage($array["PURC"]) . "</td>\n\t\t\t\t<td style='font-size:14px'>{$array["PURC"]}%/{$array["SIZE"]}</td>\n\t\t\t</tr>\n\n\t\t\t";
    }
    $q = new mysql_mimedefang_builder();
    $attachments_storage = $q->COUNT_ROWS("storage");
    if ($attachments_storage > 0) {
        $sql = "SELECT SUM(filesize) as tcount FROM `storage`";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $size = FormatBytes($ligne["tcount"] / 1024);
        $tmpfs[] = "\n\t<tr>\n\t\t<td colspan=2>\n\t\t<hr>\n\t<table>\n\t\t<tr>\n\t\t\t<td style='font-size:16px' align='left'>{attachments_storage}:</td>\n\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-size:16px'><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('mimedefang.filehosting.table.php');\"\n\t\t\t\tstyle='font-size:16px;text-decoration:underline'>{$attachments_storage} {items} ({$size})</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t</td>\n\t</tr>\n\t\n\n\t\t\t";
    }
    if (count($tmpfs) > 0) {
        $tmpfs_builded = "<table style='width:30%;margin-top:15px' class=form>" . @implode("\n", $tmpfs) . "</table>";
    }
    $html = "<table style='width:99%' class=form>\n\t<tr>\n\t<td>{$APP_MIMEDEFANG}{$APP_MIMEDEFANGX}\n\t\t<center style='margin-top:10px;margin-bottom:10px;width:95%' class=form>\n\t\t<table style='width:70%'>\n\t\t<tbody>\n\t\t<tr>\n\t\t\t<td width=10% align='center;'>" . imgtootltip("32-stop.png", "{stop}", "Loadjs('{$page}?service-cmds=stop')") . "</td>\n\t\t\t<td width=10% align='center'>" . imgtootltip("restart-32.png", "{stop} & {start}", "Loadjs('{$page}?service-cmds=restart')") . "</td>\n\t\t\t<td width=10% align='center'>" . imgtootltip("32-run.png", "{start}", "Loadjs('{$page}?service-cmds=start')") . "</td>\n\t\t</tr>\n\t\t</tbody>\n\t\t</table>\n\t\t</center>\t\n\t\n\t</td>\n\t</tr>\n\t</table>\n\t<center>\n\t\t{$tmpfs_builded}\n\t</center>\n\t<div style='text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('status-{$t}','{$page}?status=yes&t={$t}');") . "</div>";
    echo $tpl->_ENGINE_parse_body($html);
}
function global_status_artica_db()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $date = GetLastUpdateDate();
    $users = new usersMenus();
    $sock = new sockets();
    $q = new mysql();
    $sql = "SELECT avg(progress) as pourcent FROM updates_categories  WHERE filesize>0";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    if (!is_numeric($ligne["pourcent"])) {
        $ligne["pourcent"] = 0;
    }
    $pourcent = round($ligne["pourcent"], 2);
    $purc = pourcentage($pourcent);
    $t = $_GET["t"];
    $dateDB = $sock->getFrameWork("squid.php?articadb-version=yes");
    $dateDB_text = $tpl->time_to_date($dateDB);
    $DB_STATUS = unserialize(base64_decode($sock->getFrameWork("ufdbguard.php?databases-percent=yes")));
    $DB_STATUS_TIME = $DB_STATUS["ARTICA"]["LAST_TIME"];
    $DB_STATUS_MAX = $DB_STATUS["ARTICA"]["MAX"];
    $DB_STATUS_COUNT = $DB_STATUS["ARTICA"]["COUNT"];
    $DB_STATUS_PERC = round($DB_STATUS_COUNT / $DB_STATUS_MAX * 100);
    $color = "color:black;";
    $sock = new sockets();
    $scheduledAR = unserialize(base64_decode($sock->getFrameWork("squid.php?schedule-maintenance-exec=yes")));
    $SquidDatabasesArticaEnable = $sock->GET_INFO("SquidDatabasesArticaEnable");
    if (!is_numeric($SquidDatabasesArticaEnable)) {
        $SquidDatabasesArticaEnable = 1;
    }
    if ($SquidDatabasesArticaEnable == 1) {
        $disable_text = "Artica&nbsp;{database}:&nbsp;{enabled}";
    } else {
        $disable_text = "Artica&nbsp;{database}:&nbsp;{disabled}";
        $color = "color:#B6ACAC";
    }
    $CORP_LICENSE = 1;
    if (!$users->CORP_LICENSE) {
        $CORP_LICENSE = 0;
        $SquidDatabasesArticaEnable = 0;
        $disable_text = "Artica&nbsp;{database}:&nbsp;<strong style='color:#BA1010'>{license_inactive}</strong>";
        $color = "color:#B6ACAC";
    }
    $running = "<br><i style='font-size:12px'>{update_task_stopped}</i>";
    if ($scheduledAR["RUNNING"]) {
        $running = "<br><i style='font-size:12px;color:#BA0000'>{update_currently_running_since} {$scheduledAR["TIME"]}Mn</i>";
    }
    $q = new mysql_squid_builder();
    $SQL_ALL_ITEMS = "SELECT SUM( TABLE_ROWS ) AS tcount FROM information_schema.tables WHERE table_schema = 'squidlogs' AND table_name LIKE 'category_%'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($SQL_ALL_ITEMS));
    if (!$q->ok) {
        echo "<H2>{$q->mysql_error}</H2>";
    }
    $itemsPerso = $ligne["tcount"];
    $itemsPerso = numberFormat($itemsPerso, 0, "", " ");
    $catz = new mysql_catz();
    $itemsArtica = numberFormat(intval(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_COUNT")));
    $q = new mysql_squid_builder();
    $backuped_items = $q->COUNT_ROWS("webfilters_backupeddbs");
    $sql = "SELECT SUM(size) as tszie FROM webfilters_backupeddbs";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $backuped_items_size = FormatBytes($ligne["tszie"] / 1024);
    $backuped_items_text = "{$backuped_items} {backup_containers} ({$backuped_items_size})";
    $tableau = "\n\t<div style='width:95%;min-height:254px' class=form>\n\t<table style='width:99%'>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:16px;{$color}'>{artica_databases}{$running}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold'>{youritems}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{$itemsPerso}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:14px' align='right'>\n\t\t\t\t<table style='width:2%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.backuped.databases.php');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{$backuped_items_text}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\t\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.restore.databases.php');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{restore_backup}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png' id='emptypersonaldbdiv'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('dansguardian2.restore.databases.php?empty-js=yes');\" \n\t\t\t\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{empty_database}</a>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('ufdbguard.databases.php?scripts=compile-schedule');\" style='font-size:12px;text-decoration:underline;{$color}'>{compilation_schedule}</a></td>\n\t\t\t\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t</table>\n\t\t\t</td>\t\t\t\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold;{$color}'>{articaitems}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold;{$color}'>{$itemsArtica} v.{$dateDB} <i style='font-size:11px'>{$dateDB_text}</i></td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:12px;font-weight:bold;{$color}'>{update_status}:</td>\n\t\t\t<td>" . pourcentage($DB_STATUS_PERC, 0, "green") . "</td>\n\t\t</tr>\t\t\n\n\t\t\n\n\t\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:14px' align='right'>\n\t\t\t<table style='width:2%'>\n\t\t\t<tbody>\n\t\t\t\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ArticaDBDisable();\" style='font-size:12px;text-decoration:underline;{$color}'>{$disable_text}</a></td>\n\t\t\t\t</tr>\t\t\t\t\t\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ArticaDBUpdateNow();\" style='font-size:12px;text-decoration:underline;{$color}'>{update_now}</a></td>\n\t\t\t</tr>\n\t\n\t\t\t\t\t\t\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t\n\t\t</tr>\n\t\t\t\n\t</tbody>\n\t</table>\n\t</div>\n\t<script>\n\tvar x_ArticaDBUpdateNow= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t    \tRefreshArticaDBStatus();\n\t\t}\t\n\n\t\tfunction ArticaDBUpdateNow(){\n\t\t\tvar CORP_LICENSE={$CORP_LICENSE};\n\t\t\tif(CORP_LICENSE==0){alert('license error');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-artica-status-update','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_ArticaDBUpdateNow);\n\t\t}\n\t\n\t\t\n\tvar xArticaDBDisable= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t    \tRefreshArticaDBStatus();\n\t\t}\t\n\n\t\t\n\t\tfunction ArticaDBDisable(){\n\t\t\tvar CORP_LICENSE={$CORP_LICENSE};\n\t\t\tif(CORP_LICENSE==0){alert('license error');return;}\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('global-artica-enable-update','{$SquidDatabasesArticaEnable}');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xArticaDBDisable);\t\t\n\t\t\n\t\t}\t\t\n\t</script>\n\t\n\t\n\t";
    $html = "<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/artica5-64.png'></td>\n\t\t<td valign='top' width=99%>{$tableau}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . imgtootltip("refresh-24.png", "{refresh}", "LoadAjax('artica-status-databases-{$t}','{$page}?global-artica-status-databases=yes&t={$t}');") . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\t\t\n\t\tLoadAjax('tlse-status-databases-{$t}','{$page}?global-tlse-status-databases=yes&t={$t}');\n\t</script>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 19
0
function iwlist()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    $WifiAPEnable = $sock->GET_INFO("WifiAPEnable");
    $sock = new sockets();
    if (!is_file("ressources/logs/iwlist.scan")) {
        $sock = new sockets();
        $sock->getFrameWork("cmd.php?iwlist=yes");
    } else {
        $f = file_get_time_min("ressources/logs/iwlist.scan");
        if ($f > 1) {
            $sock->getFrameWork("cmd.php?iwlist=yes");
        }
    }
    $users = new usersMenus();
    $array = unserialize(@file_get_contents("ressources/logs/iwlist.scan"));
    if (!is_array($array)) {
        echo $tpl->_ENGINE_parse_body("<H2>{NO_ESSID}</H2>");
        return;
    }
    $html = "\n\t\t<div style='margin:4px'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td align='right' width=99%'>\n\t\t\t<strong style='font-size:13px'>{enable_wifi_ap}</strong>\n\t\t\t</td>\n\t\t\t<td width=1%>" . Field_checkbox("WifiAPEnable", 1, $WifiAPEnable, "EditWifiAPEnable()") . "</td>\n\t\t</tr>\n\t\t</table>\n\t</div>\n\t<table style='width:100%'>\n\t<tr>\n\t\t<th colspan=2>{ESSID}</th>\n\t\t<th>{quality}</th>\n\t\t<th>{crypted}</th>\n\t\t<th>{bits_rate}</th>\n\t</tr>\n\t";
    if (is_array($array)) {
        while (list($num, $ligne) = each($array)) {
            $APNUM = $num;
            $QUALITY = $ligne["QUALITY"];
            $ESSID = $ligne["ESSID"];
            $KEY = $ligne["KEY"];
            if ($KEY) {
                $key = "<img src='img/22-key.png'>";
            } else {
                $key = "&nbsp;";
            }
            $RATES = explode(";", $ligne["RATES"]);
            $tooltip = "{connect}";
            while (list($a, $b) = each($RATES)) {
                $b = trim($b);
                $b = str_replace(" ", "&nbsp;", $b);
                if ($b != null) {
                    $RR[] = $b;
                }
            }
            if ($ligne["ESSID_SELECTED"]) {
                $wifiok = "<img src='img/wifi-ok-22.png'>";
            } else {
                $wifiok = "&nbsp;";
            }
            if ($users->WPA_SUPPLIANT_INSTALLED) {
                if ($WifiAPEnable == 1) {
                    $js = "WifiConnectAP('{$ESSID}')";
                } else {
                    $tooltip = "{WifiConnectAPDisabled}";
                }
            }
            $html = $html . "\n\t\t\t\t<tr " . CellRollOver($js, "{connect}") . ">\n\t\t\t\t<td width=1%>{$wifiok}</td>\n\t\t\t\t<td valign='middle' nowrap><strong style='font-size:14px'>{$ESSID}</strong></td>\n\t\t\t\t<td valign='top'>" . pourcentage($QUALITY) . "</td>\n\t\t\t\t<td width=1% align='center'>{$key}</td>\n\t\t\t\t<td valign='top' style='font-size:12px'>" . implode(" - ", $RR) . "</td>\n\t\t\t\t\n\t\t\t\t</tr>\n\t\t\t\t<tr><td colspan=5><hr></td></tr>\n\t\t\t\t";
            unset($RR);
        }
    }
    $html = $html . "</table>\n\t<div style='margin:5px;width:100%;text-align:right' >" . imgtootltip("32-refresh.png", "{refresh}", "RefreshTab('wifi_main_config');") . "</div>\n\t\n\t\n\t<script>\n\t\tfunction WifiConnectAP(ESSID){\n\t\t\tYahooWin(650,'{$page}?CONNECT='+ESSID,'{connect}::'+ESSID);\n\t\t}\n\t\t\n\t\tfunction x_EditWifiAPEnable(){\n\t\t\tRefreshTab('wifi_main_config');\n\t\t}\n\t\t\n\t\tfunction EditWifiAPEnable(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tif(document.getElementById('WifiAPEnable').checked){XHR.appendData('WifiAPEnable','1');}else{XHR.appendData('WifiAPEnable','0');}\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_EditWifiAPEnable);\n\t\t}\n\t\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body("{$html}");
}
Exemplo n.º 20
0
function squid_mem_status($ByExec = false)
{
    $sock = new sockets();
    $tpl = new templates();
    $page = CurrentPageName();
    $unix = new unix();
    $reboot = false;
    $users = new usersMenus();
    $cachefile = "/usr/share/artica-postfix/ressources/logs/web/squid_mem_status.html";
    $cacheSwap = "/usr/share/artica-postfix/ressources/logs/web/squid_swap_status.html";
    $cacheSwapT = "/usr/share/artica-postfix/ressources/logs/web/squid_swap_status.time";
    $pidFile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $unix = new unix();
    if ($ByExec) {
        $pid = $unix->get_pid_from_file($pidFile);
        if ($unix->process_exists($pid)) {
            if ($unix->PROCCESS_TIME_MIN($pid, 10) < 2) {
                return;
            }
        }
        @file_put_contents($pidFile, getmypid());
    }
    $squid_pid = SQUID_PID();
    if (!$unix->process_exists($squid_pid)) {
        if ($GLOBALS["OUTPUT"]) {
            echo "squid_mem_status(): Squid-Cache is not running\n";
        }
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/status.squid")) {
            @chmod("/usr/share/artica-postfix/ressources/logs/web/status.squid", 0777);
        }
        return;
    }
    $ttl = $unix->PROCCESS_TIME_MIN($squid_pid);
    if ($ttl < 3) {
        if ($GLOBALS["OUTPUT"]) {
            echo "squid_mem_status(): Squid-Cache is running since {$ttl}Mn, please wait at least 5mn\n";
        }
        if (is_file("/usr/share/artica-postfix/ressources/logs/web/status.squid")) {
            @chmod("/usr/share/artica-postfix/ressources/logs/web/status.squid", 0777);
        }
        return;
    }
    if ($GLOBALS["FORCE"]) {
        @unlink($cachefile);
        @unlink($cacheSwap);
        @unlink($cacheSwapT);
    }
    @unlink($cachefile);
    if ($users->WEBSTATS_APPLIANCE) {
        return null;
    }
    $datas = unserialize(base64_decode(squid_get_system_info()));
    $StoreDirs = unserialize(base64_decode(squid_get_storage_info()));
    $freebin = $unix->find_program("free");
    $MEMSEC = $datas["Memory usage for squid via mallinfo()"];
    $Total_space_in_arena = trim($MEMSEC["Total space in arena"]);
    $Total_in_use = trim($MEMSEC["Total in use"]);
    $InternalDataStructures = $datas["Internal Data Structures"];
    $StoreEntriesWithMemObjects = $InternalDataStructures["StoreEntries with MemObjects"];
    $HotObjectCacheItems = $InternalDataStructures["Hot Object Cache Items"];
    exec("{$freebin} -m 2>&1", $results);
    while (list($index, $ligne) = each($results)) {
        if (preg_match("#^Swap:\\s+([0-9]+)\\s+([0-9]+)#", $ligne, $re)) {
            $SwapTotal = $re[1];
            $SwapUsed = $re[2];
            $SwapPerc = $SwapUsed / $SwapTotal * 100;
            $SwapPerc = round($SwapPerc, 1);
            break;
        }
    }
    @unlink($cacheSwap);
    if ($SwapPerc > 40) {
        $cacheSwapTime = $unix->file_time_min($cacheSwapT);
        if ($cacheSwapTime > 30) {
            @unlink($cacheSwapT);
            @file_put_contents($cacheSwapT, time());
            squid_admin_mysql(1, "{high_swap_value} {$SwapPerc}%", "{high_swap_value_exceed_explain}");
        }
    }
    if ($SwapPerc > 10) {
        $swaphtml = "<div style='min-height:147px'>\n\t\t<table style='width:100%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td style='vertical-align:top'><img src='img/warning-panneau-42.png'></td>\n\t\t\t\t\t<td style='vertical-align:top'><div style='font-size:14px;font-weight:bold'>{high_swap_value} {$SwapPerc}%</div>\n\t\t\t\t\t<div style='font-weight:bold'>{high_swap_value_exceed_explain}</div>\n\t\t\t\t</tr>\n\t\t</table>\n\t\t</div>\t\t\t\t\n\t\t";
        @file_put_contents($cacheSwap, RoundedLightGreen($swaphtml));
        @chmod($cacheSwap, 0755);
    }
    $ConnectionInformationForSquid = $datas["Connection information for squid"];
    $NumberOfHTTPRequestsReceived = $ConnectionInformationForSquid["Number of HTTP requests received"];
    $AverageHTTPRequestsPerMinuteSinceStart = round($ConnectionInformationForSquid["Average HTTP requests per minute since start"]);
    $StorageMemSize = $datas["Cache information for squid"]["Storage Mem size"];
    $StorageMemCapacity = $datas["Cache information for squid"]["Storage Mem capacity"];
    preg_match("#^([0-9]+)\\s+([A-Z]+)#", trim($StorageMemSize), $re);
    $StorageMemSize = round($re[1] / 1024, 2);
    preg_match("#([0-9\\.]+)% used#", trim($StorageMemCapacity), $re);
    $StorageMemCapacityPourc = $re[1];
    preg_match("#^([0-9]+)\\s+([A-Z]+)#", trim($MEMSEC["Total space in arena"]), $re);
    if ($re[2] == "KB") {
        $Total_space_in_arena = round($Total_space_in_arena / 1024, 2);
    }
    if ($re[2] == "GB") {
        $Total_space_in_arena = round($Total_space_in_arena * 1024, 2);
    }
    preg_match("#^([0-9]+)\\s+([A-Z]+).*?([0-9\\.]+)%#", $Total_in_use, $re);
    $USED_VALUE = $re[1];
    $USED_UNIT = $re[2];
    $USED_PRC = $re[3];
    if ($USED_UNIT == "KB") {
        $USED_VALUE = round($USED_VALUE / 1024, 2);
    }
    if ($USED_UNIT == "GB") {
        $USED_VALUE = round($USED_VALUE * 1024, 2);
    }
    $NumberOfHTTPRequestsReceived = FormatNumber($NumberOfHTTPRequestsReceived);
    $HotObjectCacheItems = FormatNumber($HotObjectCacheItems);
    $StoreEntriesWithMemObjects = FormatNumber($StoreEntriesWithMemObjects);
    if (isset($StoreDirs["MEM"])) {
        $BigMem = $StoreDirs["MEM"]["SIZE"];
        $Items = $StoreDirs["MEM"]["ENTRIES"];
        if ($BigMem > 0) {
            $MemDir = "\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right' nowrap>{memory_cache}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>" . FormatBytes($BigMem) . " ({$Items} {items})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>" . pourcentage($StoreDirs["MEM"]["PERC"]) . "</td>\n\t\t\t</tr>\t";
        }
    }
    $usersC = 0;
    $ipzs = 0;
    $size = 0;
    $q = new mysql_squid_builder();
    $current_table = "quotahours_" . date('YmdH', time());
    if ($q->COUNT_ROWS($current_table) > 0) {
        $results = $q->QUERY_SQL("SELECT COUNT(uid) as tcount FROM {$current_table} GROUP BY uid");
        $usersC = mysql_num_rows($results);
        $results = $q->QUERY_SQL("SELECT COUNT(ipaddr) as tcount FROM {$current_table} GROUP BY ipaddr");
        $ipzs = mysql_num_rows($results);
        $ligne = mysql_fetch_array($q->QUERY_SQL("SELECT SUM(size) as size FROM {$current_table}"));
        if ($ligne["size"] > 0) {
            $size = FormatBytes($ligne["size"] / 1024);
        }
    }
    $imgRefresh = imgtootltip("20-refresh.png", "{refresh}", "Loadjs('squid.store.status.php',true)");
    $html = "\n\t<div style='min-height:147px'>\n\t\t<table style='width:100%'>\n\t\t\t{$MemDir}\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{memory}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$StorageMemSize}&nbsp;MB</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t<td>" . pourcentage($StorageMemCapacityPourc) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{objects}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$StoreEntriesWithMemObjects}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{hot_objects}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$HotObjectCacheItems}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{requests}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$NumberOfHTTPRequestsReceived} ({$AverageHTTPRequestsPerMinuteSinceStart} {requests}/{minute})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{members}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$usersC}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td style='font-weight:bold;font-size:12px' align='right'>{clients}:</td>\n\t\t\t\t<td style='font-weight:bold;font-size:12px'>{$ipzs} ({$size})</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t<td colspan=2 align='right'>{$imgRefresh}</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t</div>\n\t";
    @file_put_contents($cachefile, RoundedLightGreen($html));
    @chmod($cachefile, 0755);
    if (is_file("/usr/share/artica-postfix/ressources/logs/web/status.squid")) {
        @chmod("/usr/share/artica-postfix/ressources/logs/web/status.squid", 0777);
    }
}
Exemplo n.º 21
0
function lv_groups_list($group)
{
    if ($group == null) {
        return null;
    }
    $sock = new sockets();
    $datas = $sock->getFrameWork("cmd.php?lvm-lvs={$group}");
    $array = unserialize(base64_decode($datas));
    $all_lvs = unserialize(base64_decode($sock->getFrameWork("cmd.php?lvs-all=yes")));
    print_r($all_vgs);
    include 'ressources/usb.scan.inc';
    $html = "\n\t<br>\n\t<div style='width:100%;height:250px;overflow:auto'>\n\t<table style='width:100%'>";
    if (is_array($array)) {
        $partitions = "<table style='width:100%'>\n\t\t<tr>\n\t\t<th width=1%>&nbsp;</th>\n\t\t<th><strong style='font-size:12px'>{disk}</th>\n\t\t<th><strong style='font-size:12px' valign='middle'>&nbsp;</th>\n\t\t<th><strong style='font-size:12px' width=1% nowrap>{used}</th>\n\t\t<th><strong style='font-size:12px' width=1% nowrap>{size}</th>\n\t\t<th width=1% nowrap><strong style='font-size:12px' >{mounted}</th>\n\t\t<th>&nbsp;</th>\n\t\t\n\t\t</tr>";
        while (list($name, $size) = each($array)) {
            if ($name == null) {
                continue;
            }
            $count = $count + 1;
            $size = str_replace('.00', '', $size);
            $dev = "/dev/{$group}/{$name}";
            $name_mapper = str_replace("-", "--", $name);
            $mapper = "/dev/mapper/{$group}-{$name_mapper}";
            $diskInfos = unserialize(base64_decode($sock->getFrameWork("cmd.php?DiskInfos={$mapper}")));
            $js = "vgmanage('{$dev}')";
            $perc = pourcentage($diskInfos["POURC"]);
            $MOUNTED = $diskInfos["MOUNTED"];
            if ($diskInfos["USED"] == null) {
                $diskInfos["USED"] = 0;
            }
            $SIZE = $all_lvs[$name]["SIZE"];
            $delete = imgtootltip("database-48-delete.png", "{delete}", "Loadjs('lvm.vg.php?lvremove-js={$mapper}&group_name={$group}')");
            $show = imgtootltip("database-48.png", "{view}", $js);
            //lvremove('/dev/mapper/internet_backup-toto');
            $partitions = $partitions . "\n\t\t\n\t\t<tr>\n\t\t<td width=1%>{$show}</td>\n\t\t<td><strong style='font-size:12px'>{$name}</td>\n\t\t<td valign='middle'><strong style='font-size:12px' >{$perc}</td>\n\t\t<td width=1%  nowrap align='right'><strong style='font-size:12px' >{$diskInfos["USED"]}</td>\n\t\t<td width=1% nowrap align='right'><strong style='font-size:12px' >{$SIZE}</td>\n\t\t<td width=1% nowrap><strong style='font-size:12px'>{$MOUNTED}</td>\n\t\t<td width=1% nowrap><strong style='font-size:12px'>{$delete}</td>\n\t\t\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td colspan=7><hr></td>\n\t\t</tr>\n\t\t\n\t\t";
        }
        $partitions = $partitions . "</table>";
    }
    $tpl = new templates();
    $html = RoundedLightWhite($partitions);
    return $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 22
0
function database_status()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $arrayfile = "/usr/share/artica-postfix/ressources/logs/web/squiddb.size.db";
    if (!is_file($arrayfile)) {
        return;
    }
    $array = unserialize(@file_get_contents($arrayfile));
    $DBSIZE = $array["DBSIZE"];
    $TABLES_NUMBER = $array["TABLES_NUMBER"][0];
    $tr[] = Paragraphe32("empty_database", "empty_database_explain", "Loadjs('{$page}?remove-db-js=yes',true)", "database-32-delete.png");
    $tr[] = Paragraphe32("remove_numeric_members", "remove_numeric_members_explain", "Loadjs('{$page}?remove-numeric-members-js=yes',true)", "member-64-delete.png");
    $ff = "<div style='font-size:16px;margin-bottom:10px'>\n\t\t{$TABLES_NUMBER} Tables (" . FormatBytes($DBSIZE) . "/" . FormatBytes($array["SIZE"]) . ")\n\t\t<div style='margin-top:15px;margin-bottom:10px'>\n\t\t" . pourcentage($array["POURC"]) . "</div>\n\t\t</div>\n\t\t<div style='margin-bottom:10px'>" . @implode("<b>", $tr) . "</div>\n\t\t\t\t\n\t\t\t\t\n\t";
    echo $tpl->_ENGINE_parse_body($ff);
}
Exemplo n.º 23
0
function squid_cache_status()
{
    $sock = new sockets();
    $DisableAnyCache = $sock->GET_INFO("DisableAnyCache");
    if (!is_numeric($DisableAnyCache)) {
        $DisableAnyCache = 0;
    }
    if ($DisableAnyCache == 1) {
        return;
    }
    $page = CurrentPageName();
    $squid = new squidbee();
    $tpl = new templates();
    $t = time();
    $q = new mysql_squid_builder();
    $exec_squid_rebuild_cache_mem = unserialize(base64_decode($sock->getFrameWork("squid.php?exec_squid_rebuild_cache_mem=yes")));
    if (isset($exec_squid_rebuild_cache_mem["PID"])) {
        if ($exec_squid_rebuild_cache_mem["PID"] > 0) {
            $datas = @file_get_contents("ressources/logs/web/rebuild-cache.txt");
            $tt = time();
            $html = "\n\t\t\t\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('squid-caches-status','{$page}?squid-caches-status=yes&uuid={$_GET["uuid"]}');") . "</div>\n\t\t\t\t<table style='width:99%' class=form>\n\t\t\t\t<tr>\n\t\t\t\t\t<td width=1%><img src='img/wait_verybig_mini_red-48.gif'></td>\n\t\t\t\t\t<td style='font-size:16px'>{exec_squid_rebuild_cache_mem}</div>\n\t\t\t\t\t\t<div style='font-size:14px;font-weight:bold'>{pid}:{$exec_squid_rebuild_cache_mem["PID"]}, {since} {$exec_squid_rebuild_cache_mem["TIME"]}</div>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t</table>\t\n\t\t\t\t\t\n\t\t\t\t";
            $tb = array();
            $tb = explode("\n", $datas);
            krsort($tb);
            if (strlen($datas) > 100) {
                $html = $html . "<textarea style='margin-top:5px;font-family:Courier New;\n\tfont-weight:bold;width:100%;height:520px;border:5px solid #8E8E8E;overflow:auto;font-size:11.5px'\n\tid='textarea{$t}'>" . @implode("\n", $tb) . "</textarea>";
            }
            echo $tpl->_ENGINE_parse_body($html);
            return;
        }
    }
    $sql = "SELECT * FROM cachestatus WHERE uuid='{$_GET["uuid"]}'";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        senderror($q->mysql_error . "<br>{$sql}");
    }
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $strong = "<strong style='font-size:14px'>";
        if (basename($ligne["cachedir"]) == "cache_booster") {
            $strong = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.booster.php')\" style='font-size:14px;text-decoration:underline;font-weight:bold'>";
        }
        $delete = imgtootltip("disk-64-delete.png", "{delete_cache}", "squid32DeleteCache('" . base64_encode($ligne["cachedir"]) . "')");
        $NICKEL[$ligne["cachedir"]] = true;
        if ($ligne["cachedir"] == $squid->CACHE_PATH) {
            $cache_type = $squid->CACHE_TYPE;
            $delete = imgtootltip("disk-64-config.png", "{apply}", "Loadjs('{$page}?add-new-disk-js=yes&chdef=yes')");
        } else {
            $cache_type = $squid->cache_list[$ligne["cachedir"]]["cache_type"];
        }
        if ($ligne["cachedir"] != $squid->CACHE_PATH) {
            if (!isset($squid->cache_list[$ligne["cachedir"]])) {
                $delete = "<img src='img/disk-64-hide.png'>";
            }
        }
        $html = $html . "\n\t\t\t\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%>{$delete}</td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top>{$strong}" . basename($ligne["cachedir"]) . "&nbsp;({$cache_type})</strong></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><strong style='font-size:14px'>" . FormatBytes($ligne["currentsize"]) . "/" . FormatBytes($ligne["maxsize"]) . "</strong><div>{$ligne["cachedir"]}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>" . pourcentage($ligne["pourc"]) . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    }
    while (list($path, $array) = each($squid->cache_list)) {
        if (isset($NICKEL[$path])) {
            continue;
        }
        $unit = "&nbsp;MB";
        $maxcachesize = null;
        if ($array["cache_type"] == "rock") {
            $maxcachesize = "&nbsp;({max_objects_size} {$array["cache_maxsize"]}{$unit})";
        }
        if (is_numeric($array["cache_size"])) {
            if ($array["cache_size"] > 1000) {
                $array["cache_size"] = $array["cache_size"] / 1000;
                $unit = "&nbsp;GB";
            }
        }
        if ($array["cache_type"] == "rock") {
            continue;
        }
        $html = $html . "\n\t\t\t<table style='width:99%' class=form>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/disk-64-hide.png'></td>\n\t\t\t\t<td valign='top'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tbody>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign=top>{$strong}" . basename($path) . " ({$array["cache_type"]})</strong></a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'><strong style='font-size:14px'>{$array["cache_size"]}{$unit}/{$maxcachesize}</strong><div>{$path}</div></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td valign='top'>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>\n\t\t\t\t</td>\n\t\t\t</tr>\n\t\t\t</tbody>\n\t\t\t</table>";
    }
    $html = $html . "\n\t<div style='width:100%;text-align:right'>" . imgtootltip("refresh-32.png", "{refresh}", "LoadAjax('squid-caches-status','{$page}?squid-caches-status=yes&uuid={$_GET["uuid"]}');") . "</div>\n\t\n\t<script>\n\t\tfunction Squid32RefreshCacheStatusAuto{$t}(){\n\t\t\tif(document.getElementById('squid-caches-status')){\n\t\t\t\tLoadAjax('squid-caches-status','{$page}?squid-caches-status=yes&uuid={$_GET["uuid"]}');\n\t\t\t}\t\t\n\t\t}\n\t\t\n\t\tsetTimeout('Squid32RefreshCacheStatusAuto{$t}',10000);\n\t\t\n\t</script>\n\t\n\n\t\t\n\t\n\t";
    $sock = new sockets();
    $sock->getFrameWork("squid.php?refresh-caches-infos=yes");
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 24
0
function caches_infos($array)
{
    if (!is_array($array)) {
        return "<img src='img/cache-warning-48.png'>";
    }
    $pourc = pourcentage($array["POURC"]);
    $currentsize = FormatBytes($array["CURRENT"]);
    $max = FormatBytes($array["MAX"]);
    $html = "\n\t<table>\n\t<tr style='background-color:transparent'>\n\t\t<td style='border:0px'>{$pourc}</td>\n\t</tr>\n\t<tr style='background-color:transparent;border:0px'>\n\t<td align='right' style='border:0px'><i>{used}:{$currentsize}</i>&nbsp;</td>\n\t</tr>\n\t</table>\t\t\n\t";
    return $html;
}
Exemplo n.º 25
0
function install_status()
{
    $appname = $_GET["APPLI"];
    $users = new usersMenus();
    $page = CurrentPageName();
    $ini = new Bs_IniHandler();
    $sock = new sockets();
    $tpl = new templates();
    $dbg_exists = false;
    if (file_exists(dirname(__FILE__) . "/ressources/install/{$appname}.ini")) {
        $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
        $ini->loadString($data);
        $status = $ini->_params["INSTALL"]["STATUS"];
        $text_info = $ini->_params["INSTALL"]["INFO"];
        if (strlen($text_info) > 0) {
            $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
        }
    } else {
        if ($appname == "APP_SQUID2") {
            if (file_exists(dirname(__FILE__) . "/ressources/install/APP_SQUID.ini")) {
                $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
                $ini->loadString($data);
                $status = $ini->_params["INSTALL"]["STATUS"];
                $text_info = $ini->_params["INSTALL"]["INFO"];
                if (strlen($text_info) > 0) {
                    $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
                }
            }
        }
    }
    if ($status == null) {
        if ($appname == "APP_SQUID2") {
            if (file_exists(dirname(__FILE__) . "/ressources/install/APP_SQUID.ini")) {
                $data = file_get_contents(dirname(__FILE__) . "/ressources/install/{$appname}.ini");
                $ini->loadString($data);
                $status = $ini->_params["INSTALL"]["STATUS"];
                $text_info = $ini->_params["INSTALL"]["INFO"];
                if (strlen($text_info) > 0) {
                    $text_info = "<span style='color:black;font-size:10px'>{$text_info}...</span>";
                }
            }
        }
    }
    if ($appname == "APP_SQUID2") {
        $GlobalApplicationsStatus = $sock->APC_GET("GlobalApplicationsStatus", 2);
        if ($GlobalApplicationsStatus == null) {
            $GlobalApplicationsStatus = base64_decode($sock->getFrameWork('cmd.php?Global-Applications-Status=yes'));
            $sock->APC_SAVE("GlobalApplicationsStatus", $GlobalApplicationsStatus);
            $GLOBALS["GlobalApplicationsStatus"] = $GlobalApplicationsStatus;
        }
        $squid_version = ParseAppli($GlobalApplicationsStatus, "APP_SQUID");
        if (preg_match("#^([0-9]+)\\.([0-9]+)#", $squid_version, $re)) {
            $MAJOR = $re[1];
            $MINOR = $re[2];
        }
        if ($MAJOR == 3 && $MINOR == 1) {
            if ($users->LinuxDistriCode != "CENTOS") {
                $button31 = "<div style='margin-top:8px'>" . button("{install_upgrade} 3.1x", "Loadjs('setup.index.progress.php?product=APP_SQUID&start-install=yes')", 14) . "</div>";
            }
        }
    }
    if ($status == null) {
        $status = 0;
    }
    if ($status == 0) {
        if ($appname != "APP_SQUID2") {
            echo $tpl->_ENGINE_parse_body("<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product={$appname}&start-install=yes')", 14) . "{$button31}</center>");
            return;
        } else {
            if ($users->LinuxDistriCode != "CENTOS") {
                echo $tpl->_ENGINE_parse_body("<center style='margin:10px'>" . button("{install_upgrade}", "Loadjs('setup.index.progress.php?product={$appname}&start-install=yes')", 14) . "{$button31}</center>");
            }
            return;
        }
    }
    if ($status > 100) {
        $color = "#D32D2D";
        $status = 100;
        $text = '{failed}';
    } else {
        $color = "#5DD13D";
        $text = $status . '%';
    }
    if ($status == 0) {
        $color = "transparent";
    }
    $pourc = pourcentage($status);
    $html = "\n\t<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td>{$pourc}</td>\n\t\t<td style='font-size:12px;font-weight:bold;background-color:{$color}'>{$text}&nbsp;{$text_info}</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t<script>\n\tLoadAjaxTiny('is31','{$page}?is31=yes');\n\t</script>\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 26
0
function squid_info_status(){
	
	$sock=new sockets();
	$tpl=new templates();
	$page=CurrentPageName();
	$cachefile="/usr/share/artica-postfix/ressources/logs/web/SQUID_MGR_INFO.DB";
	if(!is_file($cachefile)){return;}
	$array=unserialize(@file_get_contents($cachefile));
	if(count($array)<3){return;}
	
	$TOTAL_REQUESTS=FormatNumber($array["TOTAL_REQUESTS"]);
	$AVERAGE_REQUESTS=FormatNumber(round($array["AVERAGE_REQUESTS"]/60))."/s";
	$ALL_CACHES=FormatBytes($array["ALL_CACHES"]);
	$ALL_CACHES_PERC=$array["ALL_CACHES_PERC"];
	$MEM_POURC=$array["MEM_POURC"];
	$CPU_PERC=$array["CPU_PERC"];
	$html="
	<div style='min-height:191px'>
	<table style='width:100%'>
	<tr>
		<td style='font-weight:bold;font-size:12px' align='right'>{running}:</td>
		<td style='font-weight:bold;font-size:12px'>{since} {$array["D"]}</td>
	</tr>
	<tr>
		<td style='font-weight:bold;font-size:12px' align='right'>{total_requests}:</td>
		<td style='font-weight:bold;font-size:12px'>$TOTAL_REQUESTS&nbsp;($AVERAGE_REQUESTS)</td>
	</tr>			
			
	<tr>
		<td style='font-weight:bold;font-size:12px' align='right' nowrap>{caches}:</td>
		<td style='font-weight:bold;font-size:12px'>$ALL_CACHES</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>". pourcentage($ALL_CACHES_PERC)."</td>
	</tr>	
	<tr>
		<td style='font-weight:bold;font-size:12px' align='right' nowrap>{memory_cache}:</td>
		<td style='font-weight:bold;font-size:12px'>$MEM_POURC%</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>". pourcentage($MEM_POURC)."</td>
	</tr>			
	<tr>
		<td style='font-weight:bold;font-size:12px' align='right' nowrap>{cpu}:</td>
		<td style='font-weight:bold;font-size:12px'>$CPU_PERC</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td>". pourcentage($CPU_PERC)."</td>
	</tr>	
	</table>
	<div style='text-align:right'><i style='text-align:right;font-size:11px'>{report}: {since}&nbsp;". distanceOfTimeInWords($array["F"],time())."</i></div>
	<div style='text-align:right'>". imgtootltip("20-refresh.png","{refresh}","LoadAjaxTiny('squid-info-status','$page?squid-info-status=yes');")."</div>			
	</div>";

	echo RoundedLightGreen($tpl->_ENGINE_parse_body($html));
	
	
	
}
Exemplo n.º 27
0
function title_caches_perf(){
	$tpl=new templates();
	$sql="SELECT SUM( size ) as tsize, cached FROM squid_cache_perfs GROUP BY cached LIMIT 0 , 3";
	$q=new mysql();
	$results=$q->QUERY_SQL($sql,"artica_events");
	
	while($ligne=@mysql_fetch_array($results,MYSQL_ASSOC)){
		
				if($ligne["cached"]==1){$cached_size=$ligne["tsize"];}
				if($ligne["cached"]==0){$not_cached_size=$ligne["tsize"];}
			}
	$sum=$cached_size+$not_cached_size;
	$pourcent=round(($cached_size/$sum)*100);
	$cachedTXT=$tpl->_ENGINE_parse_body("{cached}");
	$NOTcachedTXT=$tpl->_ENGINE_parse_body("{not_cached}");
	$title="$cachedTXT: ".FormatBytes($cached_size/1024)." - $NOTcachedTXT ".FormatBytes($not_cached_size/1024);
	$html="<table style='width:100%'>
	<tr>
		<td width=99%><div style='font-size:16px'>$title</div></td>
		<td width=1%><div style='font-size:16px'>{performance}:</div></td>
		<td width=1%>". pourcentage($pourcent)."</td>
	</tr>
	</table>
	";
	
	echo $tpl->_ENGINE_parse_body($html);
	
}
Exemplo n.º 28
0
function global_statistics_db()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $q = new mysql();
    $logo = "statistics2-64.png";
    $sock = new sockets();
    $sql = "SELECT * FROM `mysqldbs` WHERE databasename='squidlogs'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $databasename = $ligne["databasename"];
    $CountDeTables = $ligne["TableCount"];
    $DatabaseSize = $ligne["dbsize"];
    $DatabaseSize = FormatBytes($DatabaseSize / 1024);
    $CountDeTables = numberFormat($CountDeTables, 0, "", " ");
    $sql = "SELECT * FROM `mysqldbtables` WHERE tablename='webfilters_thumbnails' AND databasename='squidlogs'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
    $TableRows = $ligne["tableRows"];
    $TableSize = $ligne["tablesize"];
    $TableRows = numberFormat($TableRows, 0, '.', ' ', 3);
    $TableSize = FormatBytes($TableSize / 1024);
    $DB_STATUS = unserialize(base64_decode($sock->getFrameWork("ufdbguard.php?databases-percent=yes")));
    $DB_STATUS_TIME = $DB_STATUS["CATZ"]["LAST_TIME"];
    $DB_STATUS_MAX = $DB_STATUS["CATZ"]["MAX"];
    $DB_STATUS_COUNT = $DB_STATUS["CATZ"]["COUNT"];
    $DB_STATUS_PERC = round($DB_STATUS_COUNT / $DB_STATUS_MAX * 100);
    if ($DB_STATUS_PERC > 100) {
        $DB_STATUS_PERC = 100;
    }
    //$items=numberFormat($items,0,""," ");
    $tableau = "<div style='width:95%;min-height:254px' class=form>\n<table style='width:99%'>\n\t<tbody>\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:16px'>{statistics_database}</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold'>{tables}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{$CountDeTables} ({$DatabaseSize})</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:14px;font-weight:bold'>{thumbnails}:</td>\n\t\t\t<td style='font-size:14px;font-weight:bold'>{$TableRows} {items} ({$TableSize})</td>\n\t\t</tr>\t\t\t\n\t\t<tr>\n\t\t\t<td colspan=2 style='font-size:14px' align='right'>\n\t\t\t<table style='width:2%'>\n\t\t\t<tbody>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('squid.pagepeeker.php');\" style='font-size:12px;text-decoration:underline'>{thumbnails_parameters}</a></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t<td nowrap><a href=\"javascript:blur();\" OnClick=\"javascript:ScanThumbnails();\" style='font-size:12px;text-decoration:underline'>{scan_thumbnails}</a></td>\n\t\t\t</tr>\t\n\t\t\t<tr>\n\t\t\t\t<td width=1%><img src='img/arrow-right-16.png'>\n\t\t\t\t<td nowrap><a href=\"javascript:blur();\" \n\t\t\t\tOnClick=\"javascript:Loadjs('squid.update.events.php?category=thumbnails');\" \n\t\t\t\tstyle='font-size:12px;text-decoration:underline'>{events}</a></td>\n\t\t\t</tr>\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:12px;font-weight:bold;{$color}'>{update_status}:</td>\n\t\t\t<td>" . pourcentage($DB_STATUS_PERC, 0, "green") . "</td>\n\t\t</tr>\t\t\t\t\n\t</tbody>\n\t</table>\n\t</div>\n\t<script>\n\tvar xScanThumbnails= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t    \tRefreshArticaDBStatus();\n\t\t}\t\n\n\t\tfunction ScanThumbnails(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('ScanThumbnails','yes');\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',xScanThumbnails);\n\t\t}\n\t\t\n\t\tUnlockPage();\n\t\n\t</script>\n\t\n\t\n\t";
    $html = "<table style='width:100%'>\n\t<tbody>\n\t<tr>\n\t\t<td valign='top' width=1%><img src='img/{$logo}'></td>\n\t\t<td valign='top' width=99%>{$tableau}</td>\n\t</tr>\n\t<tr>\n\t\t<td colspan=2 align='right'><hr>" . imgtootltip("refresh-24.png", "{refresh}", "RefreshArticaDBStatus();") . "</td>\n\t</tr>\n\t</tbody>\n\t</table>\n\t\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}
Exemplo n.º 29
0
function status_table_list()
{
    $amavis = new amavis();
    $max_servers = $amavis->main_array["BEHAVIORS"]["max_servers"];
    $tpl = new templates();
    $page = CurrentPageName();
    $sock = new sockets();
    if (!is_file("/usr/share/artica-postfix/ressources/logs/amavis.infos.array")) {
        $sock->getFrameWork("cmd.php?amavis-watchdog=yes");
    }
    $datas = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/amavis.infos.array"));
    if (!is_array($datas)) {
        $sock->getFrameWork("cmd.php?amavis-watchdog=yes");
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $total;
    $data['rows'] = array();
    $childs = 0;
    $c = 0;
    while (list($pid, $array) = each($datas)) {
        $c++;
        $TYPE = $array["TYPE"];
        $CPU = $array["CPU"];
        $TIME = $array["TIME"];
        $RSS = $array["RSS"];
        $VMSIZE = $array["VMSIZE"];
        $color = "#5DD13D";
        if ($CPU > 75) {
            $color = "#F59C44";
        }
        if ($CPU > 85) {
            $color = "#D32D2D";
        }
        $childs_text = '-';
        if ($TYPE != "master") {
            if ($TYPE != "virgin") {
                if ($TYPE != "virgin child") {
                    $childs++;
                    $childs_text = $childs;
                }
            }
        }
        $pourc = pourcentage($CPU);
        $TOT_RSS = $TOT_RSS + $RSS;
        $TOT_VMSIZE = $TOT_VMSIZE + $VMSIZE;
        $pourc;
        $data['rows'][] = array('id' => $c, 'cell' => array("<span style='font-size:18px'>{$CPU}%</span>", "<span style='font-size:18px'>{$childs_text}</span>", "<span style='font-size:18px'>{$TYPE}</span>", "<span style='font-size:18px'>{$TIME}Mn</span>", "<span style='font-size:18px'>{$RSS}Mb</span>", "<span style='font-size:18px'>{$VMSIZE}Mb</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
Exemplo n.º 30
0
function cpustats()
{
    $tpl = new templates();
    $page = CurrentPageName();
    $filecache = "/usr/share/artica-postfix/ressources/logs/AllSquidKids.db";
    $MAIN = unserialize(@file_get_contents($filecache));
    while (list($CPU, $ARRAY) = each($MAIN)) {
        $requestsS = "{$ARRAY["5mn"]["client_http_requests"]} {requests}/s";
        $requestsT = FormatNumber($ARRAY["TOTAL"]["client_http_requests"]);
        $client_http_kbytes_in = "{$ARRAY["5mn"]["client_http_kbytes_in"]} Kbytes/s";
        $client_http_kbytes_out = "{$ARRAY["5mn"]["client_http_kbytes_out"]} Kbytes/s";
        $client_http_kbytes_inT = FormatBytes($ARRAY["TOTAL"]["client_http_kbytes_in"]);
        $client_http_kbytes_outT = FormatBytes($ARRAY["TOTAL"]["client_http_kbytes_out"]);
        $TOTAL = $TOTAL + $requestsT;
        $tr[] = $tpl->_ENGINE_parse_body("\n\t\t<div style='width:450px;border-radius:5px 5px 5px 5px;border:1px solid #CCCCCC;margin:15px;padding:5px'>\n\t\t<table style='width:100%'>\n\t\t<tr>\n\t\t\t<td style='width:68px;vertical-align:top'>\n\t\t\t\t<center>\n\t\t\t\t<img src='img/processor-64.png' style='margin-bottom:10px'>\n\t\t\t\t<span style='font-size:18px;font-weigth:bold'>C.P.U #{$CPU}</span>\n\t\t\t\t</center>\n\t\t\t</td>\n\t\t\t<td valign='top'>\n\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{requests}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$requestsT} <span style='font-size:11px'>{$requestsS}</span></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{inbound}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$client_http_kbytes_inT} <span style='font-size:11px'>{$client_http_kbytes_in}</span></td>\n\t\t\t\t\t</tr>\t\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{outbound}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>{$client_http_kbytes_outT} <span style='font-size:11px'>{$client_http_kbytes_out}</span></td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class=legend style='font-size:14px'>{cpu}:</td>\n\t\t\t\t\t\t<td style='font-size:14px;font-weight:bold'>" . pourcentage($ARRAY["5mn"]["CPU"]) . "</td>\n\t\t\t\t\t</tr>\t\t\t\t\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n\t\t</table></div>");
    }
    echo CompileTr2($tr) . "\n\t<center>\n\t<div id='CPUS-GP-1' style='width:600px;height:450px'></div>\n\t</center>\n\t\n\t<script>\n\t\tLoadjs('{$page}?CPUS-GP-1=yes&container=CPUS-GP-1&t={$t}',true);\n\t</script>";
}