Ejemplo n.º 1
0
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";
}
Ejemplo n.º 2
0
function websites_popup_events_search()
{
    $tpl = new templates();
    $servername = $_GET["servername"];
    $port = $_GET["port"];
    $sock = new sockets();
    $search = urlencode($_GET["popup-webserver-events-search"]);
    $datas = unserialize(base64_decode($sock->getFrameWork("nginx.php?www-events=yes&servername={$servername}&port={$_GET["port"]}&search={$search}&type={$_GET["type"]}")));
    krsort($datas);
    $boot = new boostrap_form();
    while (list($key, $value) = each($datas)) {
        $class = LineToClass($value);
        $tr[] = "\n\t\t<tr class={$class}>\n\t\t<td style='vertical-align:middle;font-size:11px'>{$value}</td>\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{events}</th>\n\t\t\t</tr>\n\t\t\t</thead>" . @implode("", $tr) . "</table>");
}
Ejemplo n.º 3
0
function table_ufdb()
{
    if ($_GET["ufdb-logs"] != null) {
        $search = base64_encode($_GET["ufdb-logs"]);
        $search = "&search={$search}";
    }
    $sock = new sockets();
    $tables = unserialize(base64_decode($sock->getFrameWork("squid.php?ufdbguard-events=yes&rp=500{$search}")));
    if (count($tables) == 0) {
        senderror("no data");
    }
    krsort($tables);
    while (list($ID, $line) = each($tables)) {
        if (!preg_match('#(.+?)\\s+\\[(.+?)\\]\\s+(.+)#', $line, $re)) {
            continue;
        }
        $color = "black";
        $date = $re[1];
        $pid = $re[2];
        $event = $re[3];
        $class = LineToClass($event);
        $tr[] = "<tr class={$class}>\n\t\t<td nowrap style='font-size:12px'>{$date}</td>\n\t\t<td style='font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t<td style='font-size:12px'>{$event}</td>\n\t\t</tr>\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\t\t\t\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{date}</th>\n\t\t\t<th>PID</th>\n\t\t\t<th>{events}</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t\t") . @implode("\n", $tr) . " </tbody></table>";
}
Ejemplo n.º 4
0
function watchdog_events_search()
{
    $sock = new sockets();
    $boot = new boostrap_form();
    $tpl = new templates();
    $rp = $_GET["rp"];
    if (!is_numeric($rp)) {
        $rp = 250;
    }
    $search = urlencode($_GET["watchdog-events-search"]);
    $content = unserialize(base64_decode($sock->getFrameWork("squid.php?watchdog-logs=yes&rp={$rp}&search={$search}")));
    $boot = new boostrap_form();
    $c = 0;
    krsort($content);
    while (list($num, $ligne) = each($content)) {
        if (preg_match("#^(.+?)\\s+(.*?)\\s+\\[([0-9]+)\\](.*?)\$#", $ligne, $re)) {
            $date = $re[1] . " " . $re[2];
            $pid = $re[3];
            $ligne = $re[4];
        }
        $class = LineToClass($ligne);
        //$link=$boot->trswitch($jslink);
        $ligne = $tpl->javascript_parse_text("{$ligne}");
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t<td style='font-size:12px;' width=1% nowrap><i class='icon-time'></i>&nbsp;{$date}</a></td>\n\t\t<td style='font-size:12px;'>{$pid}</td>\n\t\t<td style='font-size:12px;'>{$ligne}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered'>\n\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>{events}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>";
}
function events_table()
{
    $tpl = new templates();
    $sock = new sockets();
    $pattern = base64_encode($_GET["search-events"]);
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->getFrameWork("system.php?squid-db-query={$pattern}")));
    krsort($datas);
    while (list($key, $line) = each($datas)) {
        $newdate = null;
        if (preg_match("#^([0-9]+)\\s+([0-9\\:]+)(.*)#", $line, $re)) {
            $y = substr($re[1], 0, 2);
            $m = substr($re[1], 2, 4);
            $d = substr($re[1], 4, 6);
            $datestr = date("Y") . "-{$m}-{$d} {$re[2]}";
            $time = strtotime($datestr);
            $line = $re[3];
            $newdate = date("Y l F d H:i:s");
        }
        $class = LineToClass($line);
        $line = htmlentities($line);
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t<td nowrap>{$newdate}</td>\n\t\t<td width=95%>{$line}</td>\n\t\t</tr>\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th width=1%>{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\n\t\t\t</table>";
}
function SearchLogs()
{
    $tpl = new templates();
    $q = new mysql();
    $tablename = "TaskSq{$_GET['ID']}";
    // $prefix="INSERT IGNORE INTO ufdbguard_admin_events (`zDate`,`function`,`filename`,`line`,`description`,`category`,`TASKID`) VALUES ";
    $searchstring = string_to_flexquery("SearchLogs");
    $sql = "SELECT * FROM {$tablename} WHERE 1 {$searchstring} ORDER BY zDate DESC LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        $tr[] = "<tr class=error><td colspan=2>{$q->mysql_error}</td></tr>";
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $class = null;
        $description = $ligne["description"];
        $class = LineToClass($description);
        $description = nl2br($description);
        $description = $tpl->_ENGINE_parse_body($description);
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t\t<td width=1% style='font-size:11px' nowrap>{$ligne['zDate']}</td>\n\t\t\t<td style='font-size:11px'>{$description}</td>\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th width=1%>{date}</th>\n\t\t\t\t\t<th width=98%>{events}</th>\n\t\t\t\t\t\n\t\t\t\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\n\t\t\t</table>";
}
Ejemplo n.º 7
0
function table()
{
    $_GET["query"] = url_decode_special_tool($_GET["query"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    if (!isset($_GET["rp"])) {
        $_GET["rp"] = 150;
    }
    if ($_GET["query"] != null) {
        $search = base64_encode($_POST["query"]);
        $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?cachelogs={$search}&rp={$_GET["rp"]}")));
        $total = count($datas);
    } else {
        $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?cachelogs=&rp={$_GET["rp"]}")));
        $total = count($datas);
    }
    while (list($key, $line) = each($datas)) {
        $line = trim($line);
        $lineS = $line;
        if (preg_match("#^([0-9\\.\\/\\s+\\:]+)\\s+([0-9\\:]+)#", $line, $re)) {
            $date = $re[1] . " " . $re[2];
            $line = str_replace($date, "", $line);
        }
        $class = LineToClass($line);
        $tr[] = "\n\t\t\t\t<tr class='{$class}'>\n\t\t\t\t\t<td>{$date}</td>\n\t\t\t\t\t<td>{$line}</td>\n\t\t\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\t\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>{event}</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\t\n\t\t\t</table>";
}
function syslog_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $pattern = base64_encode(string_to_flexregex("search"));
    $sock = new sockets();
    $removeService = false;
    if ($pattern != null) {
        $search = base64_encode($_POST["query"]);
        $sock->getFrameWork("cmd.php?syslog-query={$search}&prepend={$_GET["prepend"]}&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
        $total = count($array);
    } else {
        $sock->getFrameWork("cmd.php?syslog-query=&prepend={$_GET["prepend"]}&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
        $total = count($array);
    }
    if ($_POST["sortname"] != null) {
        if ($_POST["sortorder"] == "desc") {
            krsort($array);
        } else {
            ksort($array);
        }
    }
    $today = $tpl->_ENGINE_parse_body("{today}");
    $c = 0;
    while (list($key, $line) = each($array)) {
        if (trim($line) == null) {
            continue;
        }
        $date = null;
        $host = null;
        $service = null;
        $pid = null;
        $trClass = LineToClass($line);
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?)\\[([0-9]+)\\]:\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = $re[5];
            $pid = $re[6];
            $line = $re[7];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $tr[] = "\n\t\t\t<tr class={$trClass}>\n\t\t\t<td width=1% nowrap>{$date}</td>\n\t\t\t<td width=1% nowrap>{$service}</td>\n\t\t\t<td width=1% nowrap>{$pid}</td>\n\t\t\t<td width=80%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?):\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = $re[5];
            $pid = null;
            $line = $re[6];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $tr[] = "\n\t\t\t<tr class={$trClass}>\n\t\t\t<td width=1% nowrap>{$date}</td>\n\t\t\t<td width=1% nowrap>{$service}</td>\n\t\t\t<td width=1% nowrap>{$pid}</td>\n\t\t\t<td width=80%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
        $tr[] = "\n\t\t\t<tr class={$trClass}>\n\t\t\t\t<td width=1% nowrap>{$date}</td>\n\t\t\t\t<td width=1% nowrap>{$service}</td>\n\t\t\t\t<td width=1% nowrap>{$pid}</td>\n\t\t\t\t<td width=80%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered'>\n\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>{service}</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th>{event} ( {$total} {events} )</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>") . @implode("", $tr) . "</tbody>\n\t\t\t </table>\n\t\t\t ";
}
Ejemplo n.º 9
0
function search_events()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $total = 0;
    $pattern = base64_encode($_GET["search"]);
    $sock = new sockets();
    $removeService = false;
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["qtype"] == "service") {
        if ($_POST["query"] != null) {
            $_GET["prefix"] = $_POST["query"];
            $_POST["query"] = null;
        }
    }
    if ($_POST["qtype"] == "service") {
        if ($_POST["query"] != null) {
            $_GET["prefix"] = $_POST["query"];
            $_POST["query"] = null;
        }
    }
    if ($_GET["force-prefix"] != null) {
        if ($_POST["qtype"] == "service") {
            $_POST["query"] = null;
        }
        $_GET["prefix"] = $_GET["force-prefix"];
        $removeService = true;
    }
    if ($_GET["search-events"] != null) {
        $search = base64_encode($_GET["search-events"]);
        $sock->getFrameWork("cmd.php?syslog-query={$search}&prepend={$_GET["prepend"]}&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
        $total = count($array);
    } else {
        $sock->getFrameWork("cmd.php?syslog-query=&prepend={$_GET["prepend"]}&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
        $total = count($array);
    }
    krsort($array);
    $today = $tpl->_ENGINE_parse_body("{today}");
    $c = 0;
    while (list($key, $line) = each($array)) {
        if (trim($line) == null) {
            continue;
        }
        $date = null;
        $host = null;
        $service = null;
        $pid = null;
        $color = "black";
        $class = LineToClass($line);
        $style = "<span style='color:{$color}'>";
        $styleoff = "</span>";
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?)\\[([0-9]+)\\]:\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = strtolower($re[5]);
            $pid = $re[6];
            $line = $re[7];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $line = zClean($line);
            $tr[] = "\n\t\t\t<tr class='{$class}'>\n\t\t\t<td width=5% nowrap>{$date}</td>\n\t\t\t<td nowrap>{$service}</td>\n\t\t\t<td nowrap>{$pid}</td>\n\t\t\t<td width=95%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?):\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = strtolower($re[5]);
            $pid = null;
            $line = $re[6];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $line = zClean($line);
            $tr[] = "\n\t\t\t<tr class='{$class}'>\n\t\t\t<td width=5% nowrap>{$date}</td>\n\t\t\t<td nowrap>{$service}</td>\n\t\t\t<td nowrap>{$pid}</td>\n\t\t\t<td width=95%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
        $service = strtolower($re[5]);
        $line = zClean($line);
        $tr[] = "\n\t\t\t<tr class='{$class}'>\n\t\t\t<td width=5% nowrap>{$date}</td>\n\t\t\t<td nowrap>{$service}</td>\n\t\t\t<td nowrap>{$pid}</td>\n\t\t\t<td width=95%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th width=1%>{date}</th>\n\t\t\t\t\t<th width=1%>&nbsp;</th>\n\t\t\t\t\t<th width=1%>&nbsp;</th>\n\t\t\t\t\t<th width=99%>{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\n\t\t\t</table>";
}
function artica_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $title = $tpl->_ENGINE_parse_body("{event}");
    $q = new mysql();
    $searchstring = string_to_flexquery("search");
    $today = $tpl->_ENGINE_parse_body("{today}");
    $contextQ = "1";
    if ($_GET["context"] != null) {
        $contextQ = " category='{$_GET["context"]}'";
    }
    if ($q->TABLE_EXISTS("Taskev0", "artica_events")) {
        $sql = "SELECT *  FROM `Taskev0` WHERE {$contextQ} AND \n\tdescription LIKE '%" . string_to_sql_search($_GET["search"]) . "%' ORDER BY zDate DESC LIMIT 0,500";
    }
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        senderror($q->mysql_error . "<br>{$sql}");
    }
    $tt = date("Y-m-d");
    while ($ligne = mysql_fetch_assoc($results)) {
        $original_date = $ligne["zDate"];
        $ligne["zDate"] = str_replace($tt, $today, $ligne["zDate"]);
        $affiche_text = $ligne["description"];
        $trClass = LineToClass($affiche_text);
        $tooltip = "\n\t\t<div style='font-size:11px'>\n\t\t<strong>{date}:&nbsp;{$original_date}&nbsp;|&nbsp;\n\t\t<strong>{function}:&nbsp;{$ligne["function"]} in line {$ligne["line"]}</strong>&nbsp;|&nbsp;\n\t\t<strong>{process}:&nbsp;{$ligne["filename"]}</strong>";
        $tooltip = $tpl->_ENGINE_parse_body($tooltip);
        $tr[] = "\n\t\t<tr class={$trClass}>\n\t\t<td width=1% nowrap>{$ligne["zDate"]}</td>\n\t\t<td width=1% nowrap>{$ligne["category"]}</td>\n\t\t<td width=1% nowrap>{$affiche_text}{$tooltip}</td>\n\t\t</tr>\n\t\t";
    }
    $contextQ = "1";
    if ($_GET["context"] != null) {
        $contextQ = " context='{$_GET["context"]}'";
    }
    $sql = "SELECT *  FROM `events` WHERE {$contextQ} {$searchstring} ORDER BY zDate DESC LIMIT 0,1000";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        senderror($q->mysql_error . "<br>{$sql}");
    }
    $tt = date("Y-m-d");
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["process"] == null) {
            $ligne["process"] = "{unknown}";
        }
        $original_date = $ligne["zDate"];
        $ligne["zDate"] = str_replace($tt, $today, $ligne["zDate"]);
        if ($ligne["process"] == null) {
            $ligne["process"] = "{unknown}";
        }
        $ligne["context"] = $tpl->_ENGINE_parse_body($ligne["context"]);
        $ligne["content"] = $tpl->_ENGINE_parse_body($ligne["content"]);
        if (preg_match("#\\[.+?\\]:\\s+\\[.+?\\]:\\s+\\((.+?)\\)\\s+:(.+)#", $ligne["text"], $re)) {
            $ligne["text"] = $re[2];
            $computer = $re[1];
        }
        if (preg_match("#\\[.+?\\]:\\s+\\[.+?\\]:\\s+\\((.+?)\\)\\:\\s+(.+)#", $ligne["text"], $re)) {
            $ligne["text"] = $re[2];
            $computer = $re[1];
        }
        if (preg_match("#\\[.+?\\]:\\s+\\[.+?\\]:\\s+\\((.+?)\\)\\s+(.+)#", $ligne["text"], $re)) {
            $ligne["text"] = $re[2];
            $computer = $re[1];
        }
        if (preg_match("#\\[.+?\\]:\\s+\\[.+?\\]:\\((.+?)\\)\\s+(.+)#", $ligne["text"], $re)) {
            $ligne["text"] = $re[2];
            $computer = $re[1];
        }
        if (preg_match("#\\[.+?\\]:\\s+\\[.+?\\]:\\s+(.+)#", $ligne["text"], $re)) {
            $ligne["text"] = $re[1];
        }
        $affiche_text = $ligne["text"];
        $trClass = LineToClass($affiche_text);
        $tooltip = "\n\t\t<div style='font-size:11px'>\n\t\t\t<strong>{date}:&nbsp;{$original_date}&nbsp;|&nbsp;\n\t\t\t<strong>{computer}:&nbsp;{$computer}</strong>&nbsp;|&nbsp;\n\t\t\t<strong>{process}:&nbsp;{$ligne["process"]}</strong>";
        if (preg_match("#<body>(.+?)</body>#is", $ligne["content"], $re)) {
            $content = strip_tags($re[1]);
        } else {
            $content = strip_tags($ligne["content"]);
        }
        if (strlen($content) > 300) {
            $content = substr($content, 0, 290) . "...";
        }
        $ID = $ligne["ID"];
        $js = "articaShowEvent({$ID});";
        $color = "5C81A7";
        if (preg_match("#(error|fatal|unable)#i", $affiche_text)) {
            $color = "B50113";
        }
        $time = strtotime($original_date . " 00:00:00");
        $tooltip = $tpl->_ENGINE_parse_body($tooltip);
        $OBS = "<div style='font-weight:bold;margin:0px;padding:0px'>{$affiche_text}</div><div>{$content}</div>\n\t\t";
        $ligne["zDate"] = $tpl->_ENGINE_parse_body($ligne["zDate"]);
        $tr[] = "\n\t\t<tr class={$trClass}>\n\t\t<td width=1% nowrap>{$ligne["zDate"]}</td>\n\t\t<td width=1% nowrap>{$ligne["context"]}</td>\n\t\t<td width=1% nowrap>{$OBS}{$tooltip}</td>\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered'>\n\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>{context}</th>\n\t\t\t\t\t<th>{event}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>") . @implode("", $tr) . "</tbody>\n\t\t\t </table>\n<script>\n\t\t\t \t\t\nfunction articaShowEvent(ID){\n\t\t YahooWin6('900','artica.events.php?ShowID='+ID,'{$title}::'+ID);\n\t}\t\t\t\n\n</script>\n";
}
function events_search()
{
    $boot = new boostrap_form();
    $tpl = new templates();
    $q = new mysql();
    $t = time();
    if (isset($_GET["t"])) {
        $t = $_GET["t"];
    }
    $page = CurrentPageName();
    $table = "Taskev{$_GET['ID']}";
    $searchstring = string_to_flexquery("events-search");
    $ORDER = $boot->TableOrder(array("zDate" => "DESC"));
    if ($q->COUNT_ROWS($table, "artica_events") == 0) {
        senderrors("no data");
    }
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} ORDER BY {$ORDER} LIMIT 0,250";
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        senderrors($q->mysql_error . "<br>{$sql}");
    }
    $line = $tpl->_ENGINE_parse_body("{line}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $description = $tpl->_ENGINE_parse_body($ligne["description"]);
        $class = LineToClass($description);
        $description = str_replace("\n", "<br>", $description);
        $description = wordwrap($description, 150, "<br>");
        $description = str_replace("<br><br>", "<br>", $description);
        $ttim = strtotime($ligne['zDate']);
        $dateD = date('Y-m-d', $ttim);
        $function = "\n\t\t<div style='margin-top:-4px;margin-left:-5px'>\n\t\t\t<i style='font-size:11px'>{$ligne["filename"]}:{$ligne["function"]}() {$line} {$ligne["line"]}</i>\n\t\t</div>";
        $tr[] = "\n\t\t<tr id='{$md}' class='{$class}'>\n\t\t<td style='font-size:12px' width=1% nowrap>{$ligne["zDate"]}</td>\n\t\t<td style='font-size:12px' width=70% >{$description}{$function}</td>\n\t\t</tr>\n\t\t";
    }
    echo $boot->TableCompile(array("zDate" => "{date}", "description" => "{description}"), $tr);
}
Ejemplo n.º 12
0
function events_table()
{
    $sock = new sockets();
    $users = new usersMenus();
    $maillog_path = $users->maillog_path;
    $query = base64_encode($_GET["search-events"]);
    $datas = unserialize(base64_decode($sock->getFrameWork("postfix.php?query-maillog=yes&filter={$query}&maillog={$maillog_path}&rp=700&prefix=amavis")));
    $datas = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/query.mail.log"));
    krsort($array);
    $tpl = new templates();
    while (list($key, $line) = each($datas)) {
        $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];
        }
        $class = LineToClass($line);
        $line = htmlentities($line);
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t<td nowrap>{$date}</td>\n\t\t<td>{$pid}</td>\n\t\t<td>{$line}</td>\n\t\t</tr>\n\t\t";
    }
    $tpl = new templates();
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\n\t\n\t\t\t<thead>\n\t\t\t\t<tr>\n\t\t\t\t\t<th width=1%>{date}</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th>{event}</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\n\t\t\t</table>";
}
Ejemplo n.º 13
0
function table()
{
    $_GET["query"] = url_decode_special_tool($_GET["query"]);
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    if (!isset($_GET["rp"])) {
        $_GET["rp"] = 150;
    }
    if ($_GET["query"] != null) {
        $search = base64_encode($_GET["query"]);
        $sock->getFrameWork("cmd.php?syslog-query={$search}&prepend=ucarp&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $datas = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
    } else {
        $sock->getFrameWork("cmd.php?syslog-query=&prepend=ucarp&rp={$_POST["rp"]}&prefix={$_GET["prefix"]}");
        $datas = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/syslog.query"));
        $total = count($datas);
    }
    $today = $tpl->_ENGINE_parse_body("{today}");
    while (list($key, $line) = each($datas)) {
        $color = "black";
        if (preg_match("#(ERROR|WARN|FATAL|UNABLE|Failed|not found|denied)#i", $line)) {
            $color = "#D61010";
        }
        $style = "<span style='color:{$color}'>";
        $styleoff = "</span>";
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?)\\[([0-9]+)\\]:\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = $re[5];
            $pid = $re[6];
            $line = $re[7];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $class = LineToClass($line);
            $tr[] = "\n\t\t\t<tr class='{$class}'>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$date}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$host}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$service}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t\t<td style='font-size:12px' width=99%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
        if (preg_match("#^(.*?)\\s+([0-9]+)\\s+([0-9:]+)\\s+(.*?)\\s+(.*?):\\s+(.*)#", $line, $re)) {
            $date = "{$re[1]} {$re[2]} " . date('Y') . " {$re[3]}";
            $host = $re[4];
            $service = $re[5];
            $pid = null;
            $line = $re[6];
            $strtotime = strtotime($date);
            if (date("Y-m-d", $strtotime) == date("Y-m-d")) {
                $date = $today . " " . date('H:i:s', strtotime($date));
            } else {
                $date = date('m-d H:i:s', strtotime($date));
            }
            $class = LineToClass($line);
            $tr[] = "\n\t\t\t<tr class='{$class}'>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$date}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$host}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$service}</td>\n\t\t\t<td style='font-size:12px' width=1% nowrap>{$pid}</td>\n\t\t\t<td style='font-size:12px' width=99%>{$line}</td>\n\t\t\t</tr>\n\t\t\t";
            continue;
        }
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered'>\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>{host}</th>\n\t\t\t\t\t<th>&nbsp;</th>\n\t\t\t\t\t<th>PID</th>\n\t\t\t\t\t<th>{event}</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\n\t\t\t</table>";
}
Ejemplo n.º 14
0
function events_search()
{
    $tpl = new templates();
    $sock = new sockets();
    $search = urlencode($_GET["events-search"]);
    $datas = unserialize(base64_decode($sock->getFrameWork("haarp.php?access-events={$search}")));
    krsort($datas);
    $boot = new boostrap_form();
    while (list($key, $value) = each($datas)) {
        $class = LineToClass($value);
        $tr[] = "\n\t\t<tr class={$class}>\n\t\t<td style='vertical-align:middle'>{$value}</td>\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("\n\n\t\t\t<table class='table table-bordered table-hover'>\n\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t<th>{events}</th>\n\t\t\t</tr>\n\t\t\t</thead>" . @implode("", $tr) . "</table>");
}
Ejemplo n.º 15
0
function events_search()
{
    $sock = new sockets();
    $boot = new boostrap_form();
    $tpl = new templates();
    $rp = $_GET["rp"];
    if (!is_numeric($rp)) {
        $rp = 250;
    }
    $results = array();
    if (is_file("/usr/bin/sarg")) {
        exec("/usr/bin/sarg -v", $results);
    }
    while (list($num, $ligne) = each($results)) {
        if (preg_match("#SARG Version:(.+)#i", $ligne, $re)) {
            $sargv = $ligne;
        }
    }
    $search = urlencode($_GET["events-search"]);
    $content = unserialize(base64_decode($sock->getFrameWork("squid.php?sarg-log=yes&rp={$rp}&search={$search}")));
    $boot = new boostrap_form();
    $c = 0;
    krsort($content);
    $today = date("Y-m-d");
    while (list($num, $ligne) = each($content)) {
        if (preg_match("#^(.+?)\\s+(.*?)\\s+\\[([0-9]+)\\](.*?)\$#", $ligne, $re)) {
            $date = $re[1] . " " . $re[2];
            $pid = $re[3];
            $ligne = $re[4];
        }
        $class = LineToClass($ligne);
        //$link=$boot->trswitch($jslink);
        $ligne = $tpl->javascript_parse_text("{$ligne}");
        $date = str_replace($today, "", $date);
        $ligne = utf8_decode($ligne);
        $tr[] = "\n\t\t<tr class='{$class}'>\n\t\t<td style='font-size:12px;' width=1% nowrap><i class='icon-time'></i>&nbsp;{$date}</a></td>\n\t\t<td style='font-size:12px;' width=1% nowrap>{$pid}</td>\n\t\t<td style='font-size:12px;'width=99%>{$ligne}</td>\n\t\t</tr>";
    }
    $page = CurrentPageName();
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered'>\n\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>{events}&nbsp;&nbsp;{$sargv}</th>\n\t\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t <tbody>\n\t\t\t") . @implode("", $tr) . "</tbody></table>\n\n<script>\n\t\tvar x_RunSarg= function (obj) {\n\t\t\tvar tempvalue=obj.responseText;\n\t\t\tif(tempvalue.length>3){alert(tempvalue)};\n\t\t\t\n\t\t}\n\t\t\t\t\n\t\tfunction RunSarg(){\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('run-compile','yes');\t\n\t\t\tXHR.sendAndLoad('{$page}', 'POST',x_RunSarg);\t\n\t\t}\n</script>\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n";
}