Exemple #1
0
function UpdateUtilityPatternDate()
{
    $unix = new unix();
    $base = $_GET["path"];
    if ($base == null) {
        $base = UpdateUtilityPatternDatePath();
    }
    writelogs_framework("Found {$base}", __FUNCTION__, __FILE__, __LINE__);
    if (!is_file($base)) {
        writelogs_framework("{$base} no such file", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    $f = explode("\n", @file_get_contents($base));
    $reg = '#UpdateDate="([0-9]+)\\s+([0-9]+)"#';
    while (list($num, $ligne) = each($f)) {
        if (preg_match($reg, $ligne, $re)) {
            writelogs_framework("Found {$re[1]} {$re[2]}", __FUNCTION__, __FILE__, __LINE__);
            echo "<articadatascgi>" . base64_encode(trim($re[1]) . ";" . trim($re[2])) . "</articadatascgi>";
            return;
        }
    }
    writelogs_framework("Not found", __FUNCTION__, __FILE__, __LINE__);
}
Exemple #2
0
function dbsize()
{
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    $refresh = $_GET["refresh"];
    $arrayfile = "/usr/share/artica-postfix/ressources/logs/web/UpdateUtilitySize.size.db";
    $array = unserialize(@file_get_contents($arrayfile));
    if (!is_array($array)) {
        $sock->getFrameWork("services.php?UpdateUtility-dbsize=yes");
        echo "<script>LoadAjaxTiny('{$refresh}','{$page}?dbsize=yes&refresh={$refresh}')</script>";
        return;
    }
    if (isset($_GET["recalc"])) {
        $sock->getFrameWork("services.php?UpdateUtility-dbsize=yes");
        $array = unserialize(@file_get_contents($arrayfile));
    }
    $arrayT["DBSIZE"] = $array["DBSIZE"];
    $t = time();
    $color = "black";
    $UpdateUtilityUseLoop = $sock->GET_INFO("UpdateUtilityUseLoop");
    if (!is_numeric($UpdateUtilityUseLoop)) {
        $UpdateUtilityUseLoop = 0;
    }
    $SIZEDSK = "<td nowrap style='font-weight:bold;font-size:24px'>" . FormatBytes($array["SIZE"]) . "</td>";
    $SIZEDSKU = "<td nowrap style='font-weight:bold;font-size:24px'>" . FormatBytes($array["USED"]) . "</td>";
    $SIZEDSKA = "<td nowrap style='font-weight:bold;font-size:24px;color:{$color}'>" . FormatBytes($array["AIVA"]) . " {$array["POURC"]}%</td>";
    if ($UpdateUtilityUseLoop == 1) {
        $sql = "SELECT `path`,`loop_dev` FROM loop_disks WHERE `disk_name`='UpdateUtility'";
        $q = new mysql();
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        $array = unserialize(base64_decode($sock->getFrameWork("system.php?tune2fs-values=" . base64_encode($ligne["loop_dev"]) . "&dirscan=" . base64_encode("/automounts/UpdateUtility"))));
        $array["IPOURC"] = $array["INODES_POURC"];
        $array["IUSED"] = $array["INODES_USED"];
        $array["ISIZE"] = $array["INODES_MAX"];
        $SIZEDSK = "<td nowrap style='font-weight:bold;font-size:24px'>" . $array["SIZE"] . "</td>";
        $SIZEDSKU = "<td nowrap style='font-weight:bold;font-size:24px'>" . $array["USED"] . "</td>";
        $array["POURC"] = 100 - $array["POURC"];
        $SIZEDSKA = "<td nowrap style='font-weight:bold;font-size:24px;color:{$color}'>{$array["AIVA"]} {$array["POURC"]}%</td>";
    }
    if ($array["IPOURC"] > 99) {
        $color = "red";
    }
    if ($array["POURC"] > 99) {
        $color = "red";
    }
    $DBSIZE_COLOR = "#46a346";
    if ($arrayT["DBSIZE"] < 10240) {
        $DBSIZE_COLOR = "#898989";
    }
    $path = UpdateUtilityPatternDatePath();
    $pattern_dateU = base64_decode($sock->getFrameWork("cmd.php?UpdateUtility-pattern-date=yes&path=" . urlencode($path)));
    $pattern_date_orgU = $pattern_dateU;
    if ($pattern_dateU != null) {
        $day = substr($pattern_dateU, 0, 2);
        $month = substr($pattern_dateU, 2, 2);
        $year = substr($pattern_dateU, 4, 4);
        $re = explode(";", $pattern_date_orgU);
        $time = $re[1];
        $H = substr($time, 0, 2);
        $M = substr($time, 2, 2);
        $pattern_dateU = "{$year}/{$month}/{$day} {$H}:{$M}:00";
    } else {
        $pattern_dateU = "-";
    }
    $html = "\n\n\t<table style='width:100%;margin-top:20px'>\n\t\t<tr>\n\t\t\t<td class=legend style='font-size:24px;font-weight:bold;color:{$DBSIZE_COLOR}' valign='top'>{pattern_version}:</td>\n\t\t\t<td style='font-size:24px;font-weight:bold;color:{$DBSIZE_COLOR}'>{$pattern_dateU}</td>\n\t\t</tr>\t\n\t<tr>\n\t\t<td class=legend style='font-size:24px;color:{$DBSIZE_COLOR}'>{current_size}:</td>\n\t\t<td nowrap style='font-weight:bold;font-size:24px;color:{$DBSIZE_COLOR}'>" . FormatBytes($arrayT["DBSIZE"]) . "</td>\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{hard_drive}:</td>\n\t\t{$SIZEDSK}\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{used}:</td>\n\t\t{$SIZEDSKU}\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>{free}:</td>\n\t\t{$SIZEDSKA}\n\t\t\n\t</tr>\n\t<tr>\n\t\t<td class=legend style='font-size:24px'>inodes:</td>\n\t\t<td nowrap style='font-weight:bold;font-size:24px;color:{$color}'>{$array["IUSED"]}/{$array["ISIZE"]} ({$array["IPOURC"]}%)</td>\n\t</tr>\t\n\t\n\t<tr>\n\t\t<td colspan=2 align='right'>" . imgtootltip("20-refresh.png", "{refresh}", "UpdateUtilityStatus()") . "</td>\n\t</tr>\n\t</table>\n\t\t\n\t<div style='margin-top:15px;text-align:right'>" . button("{update_now}", "UpdateUtilityStartTask()", 22) . "</div>\n\n\t";
    echo $tpl->_ENGINE_parse_body($html);
}