Example #1
0
function getPopupLogs()
{
    $sock = new sockets();
    if (isset($_GET["filter"])) {
        $tbl = unserialize(base64_decode($sock->getFrameWork("cmd.php?postfix-tail=yes&filter={$_GET["filter"]}")));
        $_COOKIE["postfix_filter"] = $_GET["filter"];
    } else {
        $tbl = unserialize(base64_decode($sock->getFrameWork('cmd.php?postfix-tail=yes')));
    }
    $tbl = array_reverse($tbl, TRUE);
    while (list($num, $val) = each($tbl)) {
        if (trim($val) != null) {
            $img = statusLogs($val);
            $html = $html . "<div style='black;margin-bottom:1px;padding:2px;border-bottom:1px dotted #CCCCCC;border-left:5px solid #CCCCCC;width:105%;margin-left:-30px'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='{$img}'></td><td><code style='font-size:10px'>{$val}</code></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</div>";
        }
    }
    echo $html;
}
Example #2
0
function maillog()
{
    include_once dirname(__FILE__) . "/ressources/class.status.logs.inc";
    $user = new usersMenus();
    $tpl = new Templates();
    if ($user->AsPostfixAdministrator == false) {
        echo DIV_SHADOW($tpl->_ENGINE_parse_body('{no privileges}'));
        exit;
    }
    $sock = new sockets();
    if ($_GET["maillog_filter"] != null) {
        switch ($_GET["maillog_filter"]) {
            case 'articaweb':
                $datas = file_get_contents(dirname(__FILE__) . '/ressources/logs/artica-web.log');
                break;
            case 'procmail':
                $datas = $sock->getfile('procmail_logs');
                break;
            default:
                $datas = $sock->getfile('maillog:' . $_GET["maillog_filter"]);
                break;
        }
    } else {
        $tbl = unserialize(base64_decode($sock->getFrameWork('cmd.php?postfix-tail=yes')));
    }
    $datas = htmlentities($datas);
    $tbl = explode("\n", $datas);
    $tbl = array_reverse($tbl, TRUE);
    $html = "<table style='width:100%'>";
    while (list($num, $val) = each($tbl)) {
        if (trim($val) != null) {
            if ($class == "rowA") {
                $class = "rowB";
            } else {
                $class = "rowA";
            }
            $html = $html . "<tr>\n\t\t<td width=1% style='border-bottom:1px dotted #CCCCCC' align='center'><img src='" . statusLogs($val) . "'></td>\n\t\t<td width=99%' style='border-bottom:1px dotted #CCCCCC;font-size:10px;'>{$val}</td>\n\t\t</tr>\n\t\t";
        }
    }
    $html = $html . "</table>";
    return $html;
}
function search()
{
    if (!CheckRights()) {
        senderror("{ERROR_NO_PRIVS}");
    }
    $boot = new boostrap_form();
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $tpl = new templates();
    $t = time();
    $query = base64_encode($_GET["search"]);
    if (!is_numeric($_POST["rp"])) {
        $_POST["rp"] = 500;
    }
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    krsort($array);
    $zDate = $tpl->_ENGINE_parse_body("{zDate}");
    $hostTXT = $tpl->_ENGINE_parse_body("{host}");
    $serviceTXT = $tpl->_ENGINE_parse_body("{servicew}");
    $eventsTXT = $tpl->_ENGINE_parse_body("{events}");
    while (list($index, $line) = each($array)) {
        $lineenc = base64_encode($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        $class = LineToClass($line);
        $img = statusLogs($line);
        $loupejs = "ZoomEvents('{$lineenc}')";
        $trSwitch = $boot->trswitch("blur()");
        $tr[] = "\n\t\t<tr id='{$id}' class={$class} {$trSwitch}>\n\t\t<td style='font-size:12px' {$trSwitch} width=1% nowrap><i class='icon-time'></i>&nbsp;{$date}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap><i class='icon-arrow-right'></i>&nbsp;{$host}</td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=1% nowrap>{$service}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t<td style='text-align:center;font-size:12px' width=1% nowrap><img src='{$img}'></td>\n\t\t<td style='font-size:12px' nowrap {$trSwitch} width=99% nowrap>{$line}</td>\n\t\t</tr>";
    }
    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>{$zDate}</th>\n\t\t\t\t\t<th>{$hostTXT}</th>\n\t\t\t\t\t<th>{$serviceTXT}</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th colspan=2>{$eventsTXT}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t\t\t</table>\n\t\t\t\t<script>\n\n\t</script>\n\t";
}
Example #4
0
function Logs()
{
    include_once dirname(__FILE__) . "/ressources/class.status.logs.inc";
    $tpl = new templates();
    $sock = new sockets();
    $datas = $sock->getfile("smtpscanner.log");
    $datas = htmlentities($datas);
    $tbl = explode("\n", $datas);
    $tbl = array_reverse($tbl, TRUE);
    echo "<table>";
    $class = "rowA";
    while (list($num, $val) = each($tbl)) {
        if ($class == "rowA") {
            $class = "rowB";
        } else {
            $class = "rowA";
        }
        if (trim($val) != null) {
            echo "<tr class={$class}>\n\t\t<td width=1%><img src='" . statusLogs($val) . "'></td>\n\t\t<td width=99%' style='font-size:10px;'>{$val}</td>\n\t\t</tr>\n\t\t";
        }
    }
    echo "</table>";
}
Example #5
0
function EmergencyStart()
{
    $service_cmd = $_GET["EmergencyStart"];
    $sock = new sockets();
    $datas = $sock->getfile("EmergencyStart:{$service_cmd}");
    $tbl = explode("\n", $datas);
    $tbl = array_reverse($tbl, TRUE);
    while (list($num, $val) = each($tbl)) {
        if (trim($val) != null) {
            if ($arr[md5($val)] == true) {
                continue;
            }
            $img = statusLogs($val);
            $html = $html . "\n\t\t\t<div style='black;margin-bottom:1px;padding:2px;border-bottom:1px dotted #CCCCCC;border-left:5px solid #CCCCCC;width:98%;'>\n\t\t\t<table style='width:100%'>\n\t\t\t<tr>\n\t\t\t<td width=1%><img src='img/fw_bold.gif'></td><td><code style='font-size:10px'>{$val}</code></td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t</div>";
            $arr[md5($val)] = true;
        }
    }
    echo "<div style='width:100%;height:400px;overflow:auto;'>{$html}</div>";
}
function events_list()
{
    include_once dirname(__FILE__) . "/ressources/class.status.logs.inc";
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_POST["query"]);
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&prefix=amavis")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        $lineOrg = $line;
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        $img = statusLogs($line);
        $linebb = base64_encode($lineOrg);
        $lineZom = "<a href=\"javascript:blur();\" OnClick=\"AmavisZoom('{$linebb}');\">{$line}</a>";
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t<span style='font-size:12px'>{$date}</span>", "<span style='font-size:12px'>{$host}</span>", "<span style='font-size:12px'>{$service}</span>", "<span style='font-size:12px'>{$pid}</span>", "<img src='{$img}'>", "<span style='font-size:12px'>{$lineZom}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
Example #7
0
function events_list()
{
    include_once dirname(__FILE__) . "/ressources/class.status.logs.inc";
    $tpl = new templates();
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_POST["query"]);
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&miltergrey-filter={$_GET["miltergrey-filter"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        $lineenc = base64_encode($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        if ($date == null) {
            if (preg_match("#([A-Za-z]+)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.+?)\\s+(.+?):(.+)#", $line, $re)) {
                $date = "{$re[1]} {$re[2]} {$re[3]}";
                $host = $re[4];
                $service = $re[5];
                $line = $re[6];
            }
        }
        if (trim($line) == null) {
            continue;
        }
        $img = statusLogs($line);
        $loupejs = "ZoomEvents('{$lineenc}')";
        $color = "black";
        if (preg_match("#([A-Z0-9]+): message-id=<(.+?)>#", $line, $re)) {
            $line = "{new_message} ID:{$re[1]} ({$re[2]})";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\s+from <(.*?)> rcpt <(.*?)>:\\s+autowhitelisted#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#skipping greylist because address (.*?)\\s+is whitelisted,.*?from=<(.*?)>,\\s+rcpt=<(.*?)>, addr=#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#skipping greylist because sender <(.*?)>\\s+is whitelisted,.*?from=<(.*?)>,\\s+rcpt=<(.*?)>, addr=#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\s+from =@(.*?)> rcpt <(.*?)>:\\s+autowhitelisted#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\s+from =(.*?)> rcpt <(.*?)>:\\s+autowhitelisted#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#NOQUEUE: milter-reject: RCPT from (.*?)\\[(.+?)\\].*?Greylisting in action.*?from=<(.*?)>\\s+to=<(.*?)>#", $line, $re)) {
            $line = "{delayed}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#777676";
        }
        if (preg_match("#NOQUEUE: reject: RCPT from (.*?)\\[(.+?)\\]: .*?Client host \\[(.+?)\\] blocked using (.+?)\\s+#", $line, $re)) {
            $line = "{dnsbl_service}: {$re[3]} blocked using <strong>{$re[4]}</strong> ({$re[1]})";
            $color = "#d32d2d";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\[(.+?)\\]\\s+from =@(.*?)> to <(.*?)>\\s+blacklisted#", $line, $re)) {
            $line = "{blacklisted}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#d32d2d";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\[(.+?)\\]\\s+from\\s+<(.*?)> to <(.*?)>\\s+blacklisted#", $line, $re)) {
            $line = "{blacklisted}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#d32d2d";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+\\[(.+?)\\]\\[(.+?)\\]\\s+from <(.*?)> to <(.*?)>\\s+delayed#", $line, $re)) {
            $line = "{delayed}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#777676";
        }
        if (preg_match("#milter-greylist:\\s+\\(.*:\\s+addr\\s+(.+?)\\[(.+?)\\]\\s+from <(.*?)> to <(.*?)>\\s+delayed#", $line, $re)) {
            $line = "{delayed}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#777676";
        }
        if (preg_match("#\\(.*\\):\\s+addr\\s+(.+?)\\s+from <(.*?)> rcpt <(.*?)>:\\s+autowhitelisted#", $line, $re)) {
            $line = "{whitelisted}: {$re[1]} {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#NOQUEUE: reject: RCPT from unknown\\[(.+?)\\]:.*?Client host rejected: cannot find your hostname.*?from=<(.*?)> to=<(.*?)>.*?helo=<(.*?)>#", $line, $re)) {
            $line = "{rejected}: Hostname not found {$re[1]} (HELO:{$re[4]}) {sender}:{$re[2]}  {to}: <strong>{$re[3]}</strong>";
            $color = "#d32d2d";
        }
        if (preg_match("#NOQUEUE: milter-reject: RCPT from (.*?)\\[(.+?)\\].*?from=<(.*?)>\\s+to=<(.*?)>#", $line, $re)) {
            $line = "{rejected}: {$re[2]} ({$re[2]}) {sender}:{$re[3]}  {to}: <strong>{$re[4]}</strong>";
            $color = "#d32d2d";
        }
        if (preg_match("#ESMTP::10024 \\/.*?:\\s+<(.+?)>\\s+->\\s+<(.+?)>\\s+SIZE=([0-9]+)#", $line, $re)) {
            $line = "Amavis {sender}: {$re[1]} {to}: <strong>{$re[2]}</strong> " . FormatBytes($re[3] / 1024);
        }
        if (preg_match("#FWD from.*?<(.+?)>\\s+->\\s+<(.+?)>#", $line, $re)) {
            $line = "Amavis {forward_to_postfix} {sender}: {$re[2]} {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#\\([0-9A-Z\\-]+\\)\\s+Checking:.*?\\[(.+?)\\]\\s+<(.+?)>\\s+->\\s+<(.+?)>#", $line, $re)) {
            $line = "Amavis {checking} Client:{$re[1]} {sender}: {$re[2]} {to}: <strong>{$re[3]}</strong>";
        }
        if (preg_match("#Passed CLEAN.*?<(.+?)>\\s+->\\s+<(.+?)>, Queue-ID: ([0-9A-Z]+)#", $line, $re)) {
            $line = "ID:{$re[3]} Amavis {pass} {sender}: {$re[1]} {to}: <strong>{$re[2]}</strong>";
        }
        if (preg_match("#([0-9A-Z]+):\\s+to=<(.+?)>,\\s+orig_to=<(.+?)>,\\s+relay=(.+?)\\[(.+?)\\].*?status=sent#", $line, $re)) {
            $line = "ID:{$re[1]} {transfered} to <strong>{$re[2]}</strong> ({$re[3]}) SMTP:{$re[5]} ({$re[4]})";
        }
        if (preg_match("#([0-9A-Z\\-]+): redirect: header Subject:.*?from=<(.*?)> to=<(.+?)>.*?:\\s+(.+)#", $line, $re)) {
            $line = "ID:{$re[1]} {smtp_rule} {transfered} to <strong>{$re[4]}</strong> ({$re[3]}) {sender}:{$re[2]}";
            $color = "#d32d2d";
        }
        if (preg_match("#([A-Z0-9]+):\\s+from=<(.+?)>,\\s+size=([0-9]+), nrcpt=([0-9]+).*?queue active#", $line, $re)) {
            $line = "ID:{$re[1]} {put_in_active_queue} {sender}: {$re['2']} " . FormatBytes($re[3] / 1024) . " {$re[4]} {recipients}";
        }
        if (preg_match("#([A-Z0-9]+):\\s+to=<(.+?)>,\\srelay=(.+?)\\[(.+?)\\]:([0-9]+).*?, status=sent#", $line, $re)) {
            $line = "ID:{$re[1]} {sended} {to}: <strong>{$re[2]}</strong> SMTP:{$re[4]}:{$re[5]} ({$re[3]})";
        }
        if (preg_match("#([0-9A-Z\\-]+): to=<(.*?)>,.*?status=deferred\\s+\\((.+?)\\)#", $line, $re)) {
            $line = "ID:{$re[1]} {to}: <strong>{$re[2]}</strong> ERROR {$re[3]}";
            $color = "#d32d2d";
        }
        $line = str_replace("removed", "{removed}", $line);
        $line = str_replace("SMTP:127.0.0.1:10024", "Amavis", $line);
        $line = $tpl->_ENGINE_parse_body($line);
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t<span style='font-size:16px;color:{$color};'>{$date}</span>", "<span style='font-size:16px;color:{$color}'>{$service}</span>", "<span style='font-size:16px;color:{$color}'>{$pid}</span>", "<center><img src='{$img}'></center>", "<span style='font-size:14px;color:{$color}'>{$line}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
function events_list()
{
    include_once dirname(__FILE__) . "/ressources/class.status.logs.inc";
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $search = base64_encode(string_to_flexregex());
    $sock->getFrameWork("postfix.php?maillog-postfix=yes&filter={$search}&maillog={$maillog_path}&rp={$_POST["rp"]}&sequence={$_GET["sequence"]}&failed={$_GET["failed"]}");
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/postlogs{$_GET["sequence"]}"));
    @unlink("/usr/share/artica-postfix/ressources/logs/web/postlogs{$_GET["sequence"]}");
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        if (!preg_match("#(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+postfix\\/(.+?)\\[([0-9]+)\\]:(.+)#i", $line, $re)) {
            continue;
        }
        $stylew = "normal";
        $color = "black";
        $date = strtotime("{$re[1]} {$re[2]} {$re[3]}");
        $serv = $re[4];
        $service = $re[5];
        $pid = $re[6];
        $ligne = trim($re[7]);
        $ligne = htmlentities($ligne);
        $zDate = date("m D H:i:s", $date);
        $img = statusLogs($line);
        $m5 = md5($line);
        if (preg_match("#warning#", $ligne)) {
            $color = "#EA8E09";
        }
        if (preg_match("#reject:#", $ligne)) {
            $color = "#EA0C09";
            $stylew = "bold";
        }
        if (preg_match("#listed by domain#", $ligne)) {
            $color = "#EA0C09";
        }
        if (preg_match("#Greylisting in action#", $ligne)) {
            $color = "#515151";
            $stylew = "bold";
        }
        if (preg_match("#status=sent#", $ligne)) {
            $color = "#028A29";
        }
        if (preg_match("#: removed#", $ligne)) {
            $color = "#028A29";
        }
        if (preg_match("#status=deferred#", $ligne)) {
            $color = "#EA0C09";
            $stylew = "bold";
        }
        if (preg_match("#Connection timed out#", $ligne)) {
            $color = "#EA0C09";
        }
        if (preg_match("#^([0-9A-Z]+):\\s+#", $ligne, $re)) {
            $instance = $re[1];
            $ligne = str_replace($re[1], "<a href=\"javascript:blur();\" \n\t\t\t\t\t\tOnClick=\"javascript:Loadjs('{$MyPage}?sequence-js=yes&sequence={$re[1]}')\"\n\t\t\t\t\t\tstyle='text-decoration:underline;font-size:12px;color:{$color};font-weight:{$stylew}'\n\t\t\t\t\t\t>{$re[1]}</a>\n\t\t\t\t\t\t", $ligne);
        }
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t\t\t\t<span style='font-size:12px;color:{$color};font-weight:{$stylew}'>{$zDate}</span>", "<span style='font-size:12px;color:{$color};font-weight:{$stylew}'>{$service}</span>", "<span style='font-size:12px;color:{$color};font-weight:{$stylew}'>{$pid}</span>", "<span style='font-size:12px;color:{$color};font-weight:{$stylew}'>{$ligne}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
function events_list()
{
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_POST["query"]);
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_POST["rp"]}&miltergrey-filter={$_GET["miltergrey-filter"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        $lineenc = base64_encode($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        if ($date == null) {
            if (preg_match("#([A-Za-z]+)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.+?)\\s+(.+?):(.+)#", $line, $re)) {
                $date = "{$re[1]} {$re[2]} {$re[3]}";
                $host = $re[4];
                $service = $re[5];
                $line = $re[6];
            }
        }
        $img = statusLogs($line);
        $loupejs = "ZoomEvents('{$lineenc}')";
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t<span style='font-size:12px'>{$date}</span>", "<span style='font-size:12px'>{$host}</span>", "<span style='font-size:12px'>{$service}</span>", "<span style='font-size:12px'>{$pid}</span>", "<img src='{$img}'>", "<span style='font-size:12px'>{$line}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
Example #10
0
function main_logs()
{
    $page = CurrentPageName();
    $sock = new sockets();
    $datas = $sock->getfile('ArticaBackupLogs');
    $tbl = explode("\n", $datas);
    $tbl = @array_reverse($tbl, TRUE);
    while (list($num, $val) = each($tbl)) {
        if (trim($val) != null) {
            $img = statusLogs($val);
            $html = $html . "\n\t\t\t<div style='black;margin-bottom:1px;padding:2px;border-bottom:1px dotted #CCCCCC;border-left:5px solid #CCCCCC;width:99%;margin-left:0px'>\n\t\t\t\t\t<table style='width:100%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t<td><code style='font-size:9px'>{$val}</code></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n\t\t\t</div>";
        }
    }
    $tpl = new templates();
    $html = main_tabs() . "\n\t<H5>{events}</H5>\n\t<div style='height:300px;overflow:auto;width:100%'>{$html}</div>";
    echo $tpl->_ENGINE_parse_body($html);
}
Example #11
0
function events_list()
{
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_POST["query"]);
    $array = unserialize(base64_decode($sock->getFrameWork("zarafa.php?audit-log=yes&filter={$query}&rp={$_POST["rp"]}&zarafa-filter={$_GET["zarafa-filter"]}&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        $m5 = md5($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        $service = str_replace("zarafa-", "", $service);
        $img = statusLogs($line);
        if (preg_match("#(user|ownername|username)='(.*?)'#", $line, $re)) {
            $line = str_replace($re[2], "<strong>{$re[2]}</strong>", $line);
        }
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t<span style='font-size:12px'>{$date}</span>", "<span style='font-size:12px'>{$host}</span>", "<span style='font-size:12px'>{$service}</span>", "<span style='font-size:12px'>{$pid}</span>", "<img src='{$img}'>", "<span style='font-size:12px'>{$line}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
include_once "ressources/class.ldap.inc";
include_once "ressources/class.sockets.inc";
$user = new usersMenus();
$tpl = new Templates();
if ($user->AsPostfixAdministrator == false) {
    echo $tpl->_ENGINE_parse_body('{no privileges}');
    exit;
}
$sock = new sockets();
$datas = $sock->getfile('procmail_logs');
if ($sock->error == true) {
    echo $tpl->_ENGINE_parse_body('{socket_error}');
    exit;
}
$datas = htmlentities($datas);
$tbl = explode("\n", $datas);
$tbl = array_reverse($tbl, TRUE);
$html = "<table style='width:100%'>";
while (list($num, $val) = each($tbl)) {
    if (trim($val) != null) {
        if ($class == "rowA") {
            $class = "rowB";
        } else {
            $class = "rowA";
        }
        $html = $html . "<tr>\n\t\t<td width=1% style='border-bottom:1px dotted #CCCCCC' align='center'><img src='" . statusLogs($val) . "'></td>\n\t\t<td width=99%' style='border-bottom:1px dotted #CCCCCC;font-size:10px;'>{$val}</td>\n\t\t</tr>\n\t\t";
    }
}
$html = $html . "</table>";
$tplusr = new template_users('{procmail_events}', $html, 0, 0, 0, 10);
echo $tplusr->web_page;
Example #13
0
function events_list()
{
    $sock = new sockets();
    $users = new usersMenus();
    $query = base64_encode(string_to_regex($_POST["query"]));
    $array = explode("\n", base64_decode($sock->getFrameWork("freeweb.php?query-logs=yes&servername={$_GET["servername"]}&filter={$query}&rp={$_POST["rp"]}&type={$_GET["type"]}")));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    while (list($index, $line) = each($array)) {
        $date = null;
        if (preg_match("#\\[(.+?)\\]\\s+\\[(.*?)\\]\\s+(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $errortype = $re[2];
            $line = $re[3];
            if (preg_match("#\\[client\\s+(.+?)\\]#", $line, $re)) {
                $line = str_replace($re[0], "", $line);
                $line = "[" . $re[1] . "] " . $line;
            }
        }
        if (preg_match("#(.+?) - (.*?) \\[(.+?)\\]\\s+(.+)#", $line, $re)) {
            $date = "{$re[3]}";
            $time = strtotime($date);
            if (date('Y-m-d', $time) == date("Y-m-d")) {
                $dateText = date("H:i:s", $time);
            } else {
                $dateText = date("H:i:s - l d", $time);
            }
            $errortype = $re[2];
            $line = "[" . $re[1] . "] " . $re[4];
        }
        $line = str_replace("HTTP/1.1", "", $line);
        $line = str_replace("HTTP/1.0", "", $line);
        $img = statusLogs($line);
        $m5 = md5($line);
        if (trim($dateText) == null) {
            if (preg_match("#(.+?)\\s+([0-9:]+)\\s+\\[(.+?)\\]\\s+([0-9]+)\\#[0-9]+:(.+)#", $line, $re)) {
                $re[1] = str_replace(date("Y/m/d"), "", $re[1]);
                $dateText = $re[1] . " " . $re[2];
                $errortype = $re[3];
                $line = $re[5];
            }
        }
        $data['rows'][] = array('id' => "dom{$m5}", 'cell' => array("\n\t\t\t\t\t\t<span style='font-size:12px'>{$dateText}</span>", "<span style='font-size:12px'>{$errortype}</span>", "<img src='{$img}'>", "<span style='font-size:12px'>{$line}</span>"));
    }
    $data['page'] = 1;
    $data['total'] = count($array);
    echo json_encode($data);
}
Example #14
0
function events_search()
{
    $tpl = new templates();
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_GET["search-records"]);
    if (!isset($_GET["rp"])) {
        $_GET["rp"] = 500;
    }
    $array = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp={$_GET["rp"]}&zarafa-filter=yes&mimedefang-filter={$_GET["mimedefang-filter"]}")));
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    } else {
        ksort($array);
    }
    $boot = new boostrap_form();
    while (list($index, $line) = each($array)) {
        $lineenc = base64_encode($line);
        if (preg_match("#^[a-zA-Z]+\\s+[0-9]+\\s+([0-9\\:]+)\\s+(.+?)\\s+(.+?)\\[([0-9]+)\\]:(.+)#", $line, $re)) {
            $date = "{$re[1]}";
            $host = $re[2];
            $service = $re[3];
            $pid = $re[4];
            $line = $re[5];
        }
        $loupejs = "ZoomEvents('{$lineenc}')";
        $img = statusLogs($line);
        $link = $boot->trswitch($loupejs);
        $tr[] = "\n\t\t<tr id='{$id}' style='font-size:12px'>\n\t\t<td {$link} nowrap><i class='icon-time'></i>&nbsp;{$date}</a></td>\n\t\t<td {$link} nowrap><i class='icon-info-sign'></i>&nbsp;{$host}</td>\n\t\t<td {$link} nowrap>{$service}</td>\n\t\t<td {$link} nowrap>{$pid}</td>\n\t\t<td style='text-align:center'><img src='{$img}'></td>\n\t\t<td {$link}'>{$line}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\t\n\t\t<table class='table table-bordered table-hover'>\n\t\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>{date}</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t<th>{events}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody>\n\t\t</table>\n<script>\n\tfunction ZoomEvents(content){\n\t\tRTMMail(650,'postfix.events.new.php?ZoomEvents='+content);\n\t}\n</script>";
}