コード例 #1
0
ファイル: cyrus.quota.php プロジェクト: BillTheBest/1.6.x
function logs()
{
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $logfile = "/usr/share/artica-postfix/ressources/logs/web/cyrquota.log";
    $searchstring = urlencode(string_to_flexregex());
    if (!isset($_POST["rp"])) {
        $_POST["rp"] = 100;
    }
    $sock->getFrameWork('cyrus.php?cyrquota=yes');
    $tpl = new templates();
    if ($GLOBALS["VERBOSE"]) {
        echo "<H1>Filesize:" . filesize($logfile) . "</H1>\n";
    }
    $results = explode("\n", @file_get_contents($logfile));
    @unlink($logfile);
    if (count($results) == 0) {
        json_error_show("no data");
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($results);
    $data['rows'] = array();
    $c = 0;
    while (list($num, $line) = each($results)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        $color = "black";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$line}<hr>";
        }
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#", $line)) {
                continue;
            }
        }
        if (!preg_match('#(.*?)\\s+(.*?)\\s+(.*?)\\s+user\\/(.+)#', $line, $re)) {
            continue;
        }
        if (trim($re[1]) == null) {
            $re[1] = $tpl->javascript_parse_text("{illimited}");
        }
        if (trim($re[2]) != null) {
            $re[2] = $re[2] . "%";
        }
        if (is_numeric($re[1])) {
            $re[1] = FormatBytes($re[1]);
        }
        $mkey = md5($line);
        $c++;
        $data['rows'][] = array('id' => "{$mkey}", 'cell' => array("<span style='font-size:18px;font-weight:normal;color:{$color}'>{$re[4]}</span>", "<span style='font-size:18px;font-weight:normal;color:{$color}'>{$re[1]}</span>", "<span style='font-size:18px;font-weight:normal;color:{$color}'>{$re[2]}</center>", "<span style='font-size:18px;font-weight:normal;color:{$color}'>{$re[3]}</center>"));
    }
    $data['total'] = count($data['rows']);
    if (count($data['rows']) == 0) {
        json_error_show("no data");
    }
    echo json_encode($data);
}
コード例 #2
0
function showlist()
{
    $page = 1;
    $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/CurrentSizesUsers.db"));
    $duration = date("H:i:s", $ActiveRequestsR["TIME_BUILD"]);
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $q = new mysql_squid_builder();
    $searchstring = string_to_flexregex();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));}
    $c = 0;
    while (list($member, $mainarray) = each($ActiveRequestsR["ALL"])) {
        if ($searchstring != null) {
            if ($_POST["qtype"] == "uid") {
                if (!preg_match("#{$searchstring}#i", $member)) {
                    continue;
                }
            }
        }
        while (list($time, $size) = each($mainarray)) {
            if (!preg_match("#[0-9]+-[0-9]+#", $time)) {
                continue;
            }
            if ($searchstring != null) {
                if ($_POST["qtype"] == "day") {
                    if (!preg_match("#{$searchstring}#i", $time)) {
                        continue;
                    }
                }
            }
            $c++;
            $sizeText = "{$size} Bytes";
            if ($size > 1023) {
                $sizeText = FormatBytes($size / 1024);
            }
            $data['rows'][] = array('id' => md5(serialize($mainarray)), 'cell' => array("<span style='font-size:16px'>{$time}</span>", "<span style='font-size:16px'>{$member}</span>", "<span style='font-size:16px'>{$sizeText}</span>", "<span style='font-size:16px'>{$duration}</span>"));
        }
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #3
0
ファイル: cyrus.events.php プロジェクト: BillTheBest/1.6.x
function logs()
{
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $logfile = "/usr/share/artica-postfix/ressources/logs/web/cyrus.log";
    $searchstring = urlencode(string_to_flexregex());
    if (!isset($_POST["rp"])) {
        $_POST["rp"] = 100;
    }
    $sock->getFrameWork("cyrus.php?cyrus-events=yes&rp={$_POST["rp"]}&search={$searchstring}");
    $tpl = new templates();
    $results = explode("\n", @file_get_contents($logfile));
    @unlink($logfile);
    if (count($results) == 0) {
        json_error_show("no data");
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($results);
    $data['rows'] = array();
    $q = new mysql_squid_builder();
    krsort($results);
    $c = 0;
    while (list($num, $line) = each($results)) {
        $line = trim($line);
        if ($line == null) {
            continue;
        }
        $color = "black";
        if ($GLOBALS["VERBOSE"]) {
            echo "{$line}<hr>";
        }
        if (preg_match("#(.*?)\\s+([0-9]+)\\s+([0-9\\:]+)\\s+.*?cyrus\\/(.*?)\\[.*?\\]:\\s+(.*)#", $line, $re)) {
            $date = strtotime("{$re[1]} {$re[2]} {$re[3]}");
            $datetext = time_to_date($date, true);
            if ($GLOBALS["VERBOSE"]) {
                print_r($re);
            }
            $service = $re[4];
            $line = trim($re[5]);
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "{$line}<hr>";
        }
        $mkey = md5($line);
        $c++;
        $data['rows'][] = array('id' => "{$mkey}", 'cell' => array("<span style='font-size:12px;font-weight:normal;color:{$color}'>{$datetext}</span>", "<span style='font-size:12px;font-weight:normal;color:{$color}'>{$service}</span>", "<span style='font-size:12px;font-weight:normal;color:{$color}'>{$line}</center>"));
    }
    if (count($c) == 0) {
        json_error_show("no data");
    }
    echo json_encode($data);
}
コード例 #4
0
ファイル: squid.catz.php プロジェクト: BillTheBest/1.6.x
function search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexregex();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $CATZ_ARRAY = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_CATZ"));
    $CATZ_ITEMS = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/UFDB_ARTICA_COUNTZ"));
    unset($CATZ_ARRAY["TIME"]);
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($CATZ_ARRAY);
    $data['rows'] = array();
    $catz = new mysql_catz();
    $TransArray = $catz->TransArray();
    $c = 0;
    while (list($tablename, $size) = each($CATZ_ARRAY)) {
        $items = intval($CATZ_ITEMS[$tablename]);
        $size = $size / 1024;
        $size = FormatBytes($size);
        if (isset($TransArray[$tablename])) {
            $tablename = $TransArray[$tablename];
        }
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#", $tablename)) {
                continue;
            }
        }
        $c++;
        $items = FormatNumber($items);
        $data['rows'][] = array('id' => md5($tablename), 'cell' => array("<strong style='font-size:18px;color:{$color}'>{$tablename}</strong>", "<div style='font-size:18px;font-weight:normal;color:{$color}'>{$size}</div>", "<div style='font-size:18px;font-weight:normal;color:{$color}'>{$items}</div>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #5
0
function rows_table()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $sock = new sockets();
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $search = string_to_flexregex();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $content = unserialize(base64_decode($sock->getFrameWork("squid.php?watchdog-auth=yes&rp={$rp}&ID={$_GET["ID"]}")));
    $c = 0;
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    krsort($content);
    while (list($num, $ligne) = each($content)) {
        $color = "black";
        if (preg_match("#^(.+?)\\s+(.*?)\\s+\\[([0-9]+)\\](.*?)\$#", $ligne, $re)) {
            $date = $re[1] . " " . $re[2];
            $pid = $re[3];
            $ligne = $re[4];
        }
        $ligne = str_replace("\n", "<br>", $ligne);
        $ligne = $tpl->javascript_parse_text("{$ligne}");
        if ($search != null) {
            if (!preg_match("#{$search}#i", $ligne)) {
                continue;
            }
        }
        $c++;
        $data['rows'][] = array('id' => md5($ligne), 'cell' => array("<span style='font-size:12px;color:{$color}'>{$date}</span>", "<span style='font-size:12px;color:{$color}'>{$pid}</span>", "<span style='font-size:12px;color:{$color}'>{$ligne}</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #6
0
ファイル: ufdbcat.events.php プロジェクト: BillTheBest/1.6.x
function search()
{
    $Mypage = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $rp = 150;
    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'];
    }
    $search = string_to_flexregex();
    $sock->getFrameWork("squid.php?ufdbcat-logs=yes&search=" . urlencode($search) . "&rp={$rp}");
    $array = explode("\n", @file_get_contents("/usr/share/artica-postfix/ressources/logs/web/ufdbcat.log"));
    $style = "style='font-size:14px;'";
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = $page;
    $data['rows'] = array();
    krsort($array);
    $c = 0;
    while (list($num, $ligne) = each($array)) {
        if (!preg_match("#(.+?)\\[([0-9]+)\\]\\s+(.*)#", $ligne, $re)) {
            continue;
        }
        $date = $re[1];
        $pid = $re[2];
        $event = $re[3];
        $c++;
        $data['rows'][] = array('id' => md5("{$ligne["zDate"]}{$ligne["description"]}"), 'cell' => array("<span {$style}>{$date}</span>", "<span {$style}>{$pid}</span>", "<span {$style}>{$event}</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #7
0
function servers_list()
{
    $tpl = new templates();
    $main = new maincf_multi($_GET["hostname"], $_GET["ou"]);
    $hash = unserialize(base64_decode($main->GET_BIGDATA("check_client_access")));
    if (!is_array($hash) or count($hash) == 0) {
        json_error_show("no rule");
    }
    $page = 1;
    $search = string_to_flexregex();
    $c = 0;
    while (list($ipaddr, $action) = each($hash)) {
        if (trim($ipaddr) == null) {
            continue;
        }
        if (isset($aL[$ipaddr])) {
            continue;
        }
        $md5 = md5("{$ipaddr}{$action}");
        if ($search != null) {
            if (!preg_match("#{$search}#", $ipaddr)) {
                continue;
            }
        }
        $aL[$md5] = true;
        $img = "48-server.png";
        if ($action == "REJECT") {
            $img = '48-server-ban.png';
        }
        $c++;
        $delete = imgsimple('delete-48.png', '{delete}', "DeleteServer{$_GET["t"]}('{$ipaddr}');");
        $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:16px;font-weight:bold'><img src='img/{$img}'></a></span>", "<span style='font-size:32px'>{$ipaddr} ({$action})</a></span>", $delete));
    }
    $data['page'] = $page;
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #8
0
function groups_list()
{
    $userid = $_GET["userid"];
    $t = $_GET["t"];
    if ($_GET["dn"] != null) {
        if (strpos($_GET["dn"], ",") == 0) {
            $_GET["dn"] = base64_decode($_GET["dn"]);
        }
    }
    if (substr($userid, strlen($userid) - 1, 1) == '$') {
        $users = new computers($userid);
    } else {
        $users = new user($userid, $_GET["dn"]);
    }
    $ou = $users->ou;
    $groups = $users->Groups_list();
    $priv = new usersMenus();
    $sambagroups = array("515" => true, "548" => true, "544" => true, "551" => true, "512" => true, "514" => true, "513" => true, 550 => true, 552 => true);
    if ($users->AsActiveDirectoryMember) {
        $priv->EnableManageUsersTroughActiveDirectory = true;
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($groups);
    $data['rows'] = array();
    $search = string_to_flexregex();
    if (count($groups) == 0) {
        json_error_show("no data");
    }
    $c = 0;
    while (list($num, $ligne) = each($groups)) {
        if ($search != null) {
            if (!preg_match("#{$search}#i", $ligne)) {
                continue;
            }
        }
        $delete = imgsimple('32-group-delete-icon.png', '{DISCONNECT_FROM_GROUP} ' . $ligne, "DeleteUserGroup{$t}({$num})");
        $privileges = imgsimple("members-priv-32.png", '{privileges}', "Loadjs('domains.edit.group.php?GroupPrivilegesjs={$num}')");
        $md5 = md5($ligne);
        if ($priv->EnableManageUsersTroughActiveDirectory) {
            $delete = imgsimple('32-group-delete-icon-grey.png', '{DISCONNECT_FROM_GROUP} ' . $ligne);
            $privileges = imgsimple("members-priv-32-grey.png", '{privileges}');
        }
        if (!is_numeric($num)) {
            $num = urlencode($num);
        }
        $groupjs = "Loadjs('domains.edit.group.php?ou={$ou}&js=yes&group-id={$num}&t={$t}')";
        if ($sambagroups[$ligne]) {
            $privileges = null;
            $groupjs = null;
        }
        if ($priv->AllowAddUsers == false) {
            $delete = "&nbsp;";
            $groupjs = null;
        }
        $c++;
        $data['rows'][] = array('id' => $md5, 'cell' => array(imgsimple("group-32.png", null, $groupjs), "<span style='font-size:16px;'>\t\t\n\t\t\t\t\t\t<a href=\"javascript:blur();\" \n\t\t\t\t\t\t\tOnClick=\"javascript:{$groupjs}\" \n\t\t\t\t\t\t\tstyle='font-size:18px;font-weight:bold;text-decoration:underline'>{$ligne}</a></span>", "<span style='font-size:16px;'>{$privileges}</span>", "<span style='font-size:16px;'>{$delete}</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #9
0
function policies_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $t = time();
    $html = "<p class=text-info>{amavis_users_policies_explain}</p>";
    $boot = new boostrap_form();
    $user = new user($_SESSION["uid"]);
    $mails = $user->HASH_ALL_MAILS;
    $amavis = new amavisdb();
    $search = string_to_flexregex();
    while (list($b, $email) = each($mails)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $email)) {
                continue;
            }
        }
        $id = $amavis->policyid_from_mail($email);
        $ligne = $amavis->policy_array($id);
        $policy_name = $ligne["policy_name"];
        $tr[] = "\n\t\t<tr id='{$id}' " . $boot->trswitch("Loadjs('{$page}?policy-email-js={$email}')") . ">\n\t\t<td width=30%><i class='icon-envelope'></i> {$email}</td>\n\t\t<td width=30%><i class='icon-filter'></i> {$policy_name}</td>\n\t\t<td width=1%><i class='icon-eye-open'></i> {$ligne["spam_tag_level"]}</td>\n\t\t<td width=1%><i class='icon-fire'></i> {$ligne["spam_tag2_level"]}</td>\n\t\t<td width=1%><i class='icon-trash'></i> {$ligne["spam_kill_level"]}</td>\n\t\t\n\t\t</tr>\n\t\t";
    }
    echo $tpl->_ENGINE_parse_body("<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>{email} &laquo;{$_SESSION["uid"]}&raquo;</th>\n\t\t\t\t<th>{policy}</th>\n\t\t\t\t<th width=1% nowrap>TAG {level}</th>\n\t\t\t\t<th width=1% nowrap>QUAR {level}</th>\n\t\t\t\t<th width=1% nowrap>KILL {level}</th>\n\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>";
}
コード例 #10
0
function items_list()
{
    //ini_set('html_errors',0);ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string','');ini_set('error_append_string','');
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $ID = $_GET["aclid"];
    $aclid = $_GET["aclid"];
    $acl = new squid_acls();
    $t0 = $_GET["t"];
    $database = "artica_backup";
    $search = '%';
    $table = "ext_time_quota_acl_link";
    $FORCE_FILTER = null;
    $page = 1;
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show("No datas");
    }
    $table = "(SELECT *  FROM ext_time_quota_acl_link WHERE ruleid={$aclid}) as t";
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE 1 {$FORCE_FILTER} {$ORDER} {$limitSql}";
    if ($GLOBALS["VERBOSE"]) {
        echo $sql . "<br>\n";
    }
    $results = $q->QUERY_SQL($sql, $database);
    $total = mysql_num_rows($results);
    if (!$q->ok) {
        json_error_show($q->mysql_error . "\n{$sql}");
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show("No item");
    }
    $rules = $tpl->_ENGINE_parse_body("{rules}");
    $q2 = new mysql_squid_builder();
    $acl = new squid_acls_groups();
    if ($_POST["qtype"] == "GroupName") {
        if ($_POST["query"] != null) {
            $searchGroupName = string_to_flexregex();
        }
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $val = 0;
        $mkey = $ligne["zmd5"];
        $color = "black";
        if ($ligne["enabled"] == 0) {
            $color = "#8a8a8a";
        }
        $arrayF = $acl->FlexArray($ligne["groupid"], $ligne["enabled"]);
        $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks{$t0}('{$mkey}')");
        $enable = Field_checkbox("enable-{$mkey}", 1, $ligne["enabled"], "ChangeEnabled{$t0}('{$mkey}')");
        $data['rows'][] = array('id' => "{$mkey}", 'cell' => array($arrayF["ROW"], "<span style='font-size:14px;font-weight:bold;color:{$color}'>{$arrayF["ITEMS"]}</span>", $enable, $delete));
    }
    echo json_encode($data);
}
コード例 #11
0
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);
}
コード例 #12
0
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 ";
}
コード例 #13
0
function showlist()
{
    $page = 1;
    $sock = new sockets();
    $sock->getFrameWork("squid.php?shock-active-requests=yes");
    $ActiveRequestsR = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/active_requests.inc"));
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $q = new mysql_squid_builder();
    $searchstring = string_to_flexregex();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    //if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));}
    $c = 0;
    while (list($num, $ligne) = each($ActiveRequestsR["connections"])) {
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#", serialize($ligne))) {
                continue;
            }
        }
        $c++;
        $ipaddr = $ligne["IPS"];
        $uri = $ligne["uri"];
        $arrayURI = parse_url($uri);
        $familysite = $arrayURI["host"];
        $uid = $ligne["USERS"];
        $bytes = $ligne["bytes"];
        $seconds = $ligne["seconds"];
        $avg_speed = $bytes / 1024;
        if ($seconds > 0) {
            $avg_speed /= $seconds;
        }
        $duration = duration($seconds);
        $size = FormatBytes($bytes / 1024);
        $data['rows'][] = array('id' => md5(serialize($ligne)), 'cell' => array("<span style='font-size:14px'>{$uid}</span>", "<span style='font-size:14px'>{$ipaddr}</span>", "<span style='font-size:14px'>{$familysite}</span>", "<span style='font-size:14px'>{$size}</span>", "<span style='font-size:14px'>{$duration}</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #14
0
function uamallowed_search()
{
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $searchstring = string_to_flexregex();
    $ChilliConf = unserialize(base64_decode($sock->GET_INFO("ChilliConf")));
    $t = time();
    if (!isset($ChilliConf["uamallowed"])) {
        $ChilliConf["uamallowed"] = array();
    }
    if (!is_array($ChilliConf["uamallowed"])) {
        $ChilliConf["uamallowed"] = array();
    }
    while (list($num, $ligne) = each($ChilliConf["uamallowed"])) {
        $md = md5(serialize($num));
        $servername = $num;
        $servername_enc = urlencode($servername);
        $delete = imgtootltip("delete-64.png", null, "Delete{$t}('{$servername}','{$md}')");
        $tr[] = "\n\t\t<tr id='{$md}'>\n\t\t<td width=1% nowrap style='vertical-align:middle'><img src='img/folder-network-64.png'></td>\n\t\t<td width=80% style='vertical-align:middle'><span style='font-size:18px;font-weight:bold'>{$servername}</span></td>\n\t\t<td width=1% nowrap style='vertical-align:middle'>{$delete}</td>\n\t\t</tr>\n\t\t";
    }
    $page = CurrentPageName();
    $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}");
    $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}");
    $deleteTXT = $tpl->javascript_parse_text("{delete}");
    $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}");
    echo $tpl->_ENGINE_parse_body("\n<table class='table table-bordered table-hover'>\n<thead>\n\t<tr>\n\t\t<th colspan=2>{allowed_networks}</th>\n\t\t<th>&nbsp;</th>\n\t</tr>\n</thead>\n<tbody>") . @implode("", $tr) . "</tbody></table>\n<script>\nvar FreeWebIDMEM{$t}='';\nvar xDelete{$t}=function (obj) {\n\tvar results=obj.responseText;\n\tif(results.length>10){alert(results);return;}\n\t\$('#'+FreeWebIDMEM{$t}).remove();\n}\n\t\nfunction Delete{$t}(id,md){\n\tFreeWebIDMEM{$t}=md;\n\tif(confirm('{$deleteTXT} \"'+id+'\" ?')){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('uamallowed-delete',id);\n\t\tXHR.sendAndLoad('{$page}', 'POST',xDelete{$t});\n\t\t}\n}\n</script>";
}
コード例 #15
0
function content_search()
{
    $MyPage = CurrentPageName();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_meta();
    $table = "snapshots";
    $database = null;
    $ID = $_GET["ID"];
    if (!$q->TABLE_EXISTS($table, $database)) {
        json_error_show("no data - no table");
    }
    $searchstring = string_to_flexquery();
    $page = 1;
    $q = new mysql_meta();
    $sql = "SELECT `content` FROM {$table} WHERE ID='{$ID}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
    $MAIN = unserialize($ligne["content"]);
    $size_content = strlen($ligne["content"]);
    if (!is_array($MAIN)) {
        json_error_show("no data ID:{$ID} Size:{$size_content}");
    }
    $searchstring = string_to_flexregex();
    $total = count($MAIN);
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $fontsize = "22";
    $style = " style='font-size:{$fontsize}px'";
    $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline'";
    $c = 0;
    while (list($filename, $size) = each($MAIN)) {
        $sizeText = "{$size} Bytes";
        if ($size > 1024) {
            $sizeText = FormatBytes($size / 1024);
        }
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#i", $filename . "{$sizeText}")) {
                continue;
            }
        }
        $c++;
        $key = md5($filename);
        $size = FormatBytes($size / 1024);
        $cell = array();
        $cell[] = "<span {$style}>{$filename}</a></span>";
        $cell[] = "<span {$style}>{$sizeText}</a></span>";
        $data['rows'][] = array('id' => $key, 'cell' => $cell);
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #16
0
ファイル: system.ldap.php プロジェクト: BillTheBest/1.6.x
function popup_net_search()
{
    $sock = new sockets();
    $MyPage = CurrentPageName();
    $net = new networking();
    $nets = $net->ALL_IPS_GET_ARRAY();
    $SavedNets = explode("\n", $sock->GET_INFO('LdapListenIPAddr'));
    $search = string_to_flexregex();
    $SavedNets[] = "127.0.0.1";
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    $c = 0;
    while (list($line, $key) = each($SavedNets)) {
        $key = trim($key);
        if ($key == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#i", $key)) {
                continue;
            }
        }
        $keyEnc = urlencode($key);
        $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?delete-js={$keyEnc}')");
        $c++;
        if ($key == "127.0.0.1") {
            $delete = null;
        }
        $data['rows'][] = array('id' => $keyEnc, 'cell' => array("<span style='font-size:28px'>{$key}</span>", $delete));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #17
0
function interfaces_search()
{
    $sock = new sockets();
    $tpl = new templates();
    $tcp = new networking();
    $datas = unserialize(base64_decode($sock->getFrameWork("cmd.php?list-nics=yes")));
    $snortInterfaces = array();
    $LXCEthLocked = $sock->GET_INFO("LXCEthLocked");
    $EnableipV6 = $sock->GET_INFO("EnableipV6");
    if (!is_numeric($EnableipV6)) {
        $EnableipV6 = 0;
    }
    $ASDEBIAN = 0;
    if ($users->AS_DEBIAN_FAMILY) {
        $ASDEBIAN = 1;
    }
    if (!is_numeric($LXCEthLocked)) {
        $LXCEthLocked = 0;
    }
    $users = new usersMenus();
    $GLOBALS["AsSystemAdministrator"] = $users->AsSystemAdministrator;
    $LXCInterface = $sock->GET_INFO("LXCInterface");
    $DisableNetworksManagement = $sock->GET_INFO("DisableNetworksManagement");
    $OVHNetConfig = $sock->GET_INFO("OVHNetConfig");
    if (!is_numeric($OVHNetConfig)) {
        $OVHNetConfig = 0;
    }
    if (!is_numeric($DisableNetworksManagement)) {
        $DisableNetworksManagement = 0;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $apply_network_configuration = $tpl->_ENGINE_parse_body("{apply_network_configuration}");
    $ERROR_NO_PRIVS = $tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
    $apply_network_configuration_warn = $tpl->javascript_parse_text("{apply_network_configuration_warn}");
    $users = new usersMenus();
    if ($users->SNORT_INSTALLED) {
        $EnableSnort = $sock->GET_INFO("EnableSnort");
        if ($EnableSnort == 1) {
            $snortInterfaces = unserialize(base64_decode($sock->GET_INFO("SnortNics")));
        }
    }
    $searchstring = string_to_flexregex("search-interfaces");
    while (list($num, $val) = each($datas)) {
        writelogs("Found: {$val}", __FUNCTION__, __FILE__, __LINE__);
        $val = trim($val);
        if (preg_match('#master#', $val)) {
            continue;
        }
        if (preg_match("#^veth.+?#", $val)) {
            continue;
        }
        if (preg_match("#^tunl[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^dummy[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^gre[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^ip6tnl[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^sit[0-9]+#", $val)) {
            continue;
        }
        if (preg_match("#^vlan[0-9]+#", $val)) {
            continue;
        }
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#", $val)) {
                continue;
            }
        }
        $nic = new system_nic();
        if (!$nic->unconfigured) {
            if ($LXCEthLocked == 1) {
                if ($val == $LXCInterface) {
                    writelogs("LXCEthLocked:{$LXCEthLocked}; {$val}=={$LXCInterface} -> abort", __FUNCTION__, __FILE__, __LINE__);
                    continue;
                }
            }
        }
        if (trim($val) == null) {
            continue;
        }
        $tr[] = NicBuildTR($val);
    }
    if ($searchstring == null) {
        $tr[] = NicBuildTR("tun0");
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\t\t<table class='table table-bordered table-hover'>\n\t\n\t\t\t<thead>\n\t\t\t\t\n\t\t<tr>\n\t\t<th colspan=2 width=1% nowrap>{interface}</th>\n\t\t<th>{tcp_address}</th>\n\t\t<th>{mac_addr}</th>\n\t\t<th>{gateway}</th>\n\t\t<th>{netmask}</th>\n\t\t</tr>\n\t\t\t\t\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";
}
コード例 #18
0
function localdomain_search()
{
    $users = new usersMenus();
    $page = CurrentPageName();
    $t = time();
    $tpl = new templates();
    $ldap = new clladp();
    $are_you_sure_to_delete = $tpl->javascript_parse_text("{are_you_sure_to_delete}");
    if ($users->AsPostfixAdministrator) {
        $hash = $ldap->hash_get_all_local_domains();
    } else {
        $hash = $ldap->Hash_associated_domains($_SESSION["ou"]);
    }
    $search = string_to_flexregex("localdomain-search");
    while (list($domain, $ligne) = each($hash)) {
        $id = md5($domain);
        $delete = imgsimple("delete-32.png", null, "DeleteLocalDomain{$t}('{$domain}','{$id}')");
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t\t<td style='font-size:18px'><i class='icon-globe'></i>&nbsp;{$domain}</td>\n\t\t\t<td style='text-align:center'>{$delete}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t\n\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 style='width:99%'>{domains}</th>\n\t\t\t\t\t<th>&nbsp;</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<script>\n\tvar xmem{$t}='';\n\tvar xDeleteLocalDomain{$t}= function (obj) {\t\n\t\tvar tempvalue=obj.responseText;\n\t\tif(tempvalue.length>3){alert(tempvalue); return;};\n\t\t\$('#'+xmem{$t}).remove();\n\t}\t\t\t\n\t\t\t\t\n\t\tfunction DeleteLocalDomain{$t}(domain,id){\n\t\t\txmem{$t}=id;\n\t\t\tif(confirm('{$are_you_sure_to_delete} '+domain)){\n\t\t\t\tvar XHR = new XHRConnection();\n\t\t\t\tXHR.appendData('localdomain-remove',domain);\n\t\t\t\tXHR.appendData('ou','{$_SESSION["ou"]}');\n\t\t\t\tXHR.sendAndLoad('{$page}', 'POST',xDeleteLocalDomain{$t});\t\n\t\t\t}\n\t\t}\n\t\t\t\t\n</script>";
}
コード例 #19
0
ファイル: freeweb.zpush.php プロジェクト: BillTheBest/1.6.x
function items()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $freeweb = new freeweb($_GET["servername"]);
    $page = 1;
    $t = $_GET["t"];
    $search = '%';
    $total = 0;
    $params = $freeweb->Params["ZPUSH"]["STORES"];
    if (count($params) == 0) {
        json_error_show("No data", 1);
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $search = string_to_flexregex();
    $c = 0;
    while (list($ID, $folder) = each($params)) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $folder["F"])) {
                continue;
            }
        }
        $type = "{$folder["T"]}";
        $img = "icon_mailfolder.gif";
        if ($type == "SYNC_FOLDER_TYPE_USER_APPOINTMENT") {
            $img = "icon_calendar.gif";
        }
        if ($type == "SYNC_FOLDER_TYPE_USER_CONTACT") {
            $img = "icon_contact.gif";
        }
        $delete = imgtootltip("delete-24.png", null, "StoreDelete{$t}('{$ID}')");
        $c++;
        $data['rows'][] = array('id' => $ID, 'cell' => array("<img src='img/{$img}'>", "<span style='font-size:18px'>{$folder["U"]}::{$folder["F"]}</span>\n\t\t\t\t\t\t<div style='text-align:right;font-size:12px'>{$ID}</div>\n\t\t\t\t\t\t", $delete));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #20
0
function popup_list()
{
    $ou = $_GET["ou"];
    $group = new groups();
    $ou_con = base64_decode($_GET["ou"]);
    if ($ou_con != null) {
        $_GET["ou"] = $ou_con;
    }
    $hash_group = $group->list_of_groups($_GET["ou"], 1);
    $hash_group[null] = "{no_group}";
    $uid = $_GET["uid"];
    $t = $_GET["tt"];
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($hash_group);
    $data['rows'] = array();
    $search = string_to_flexregex();
    $c = 0;
    while (list($num, $ligne) = each($hash_group)) {
        $md5 = md5($ligne);
        if ($search != null) {
            if (!preg_match("#{$search}#i", $ligne)) {
                continue;
            }
        }
        $c++;
        $data['rows'][] = array('id' => $md5, 'cell' => array(imgsimple("group-32.png", null, "AddAjaxPopUpGroupV2{$t}('{$ou}','{$uid}',{$num},'{$ligne}')"), "<span style='font-size:16px;'>\n\t\t\t\t\t\t<a href=\"javascript:blur();\"\n\t\t\t\t\t\tOnClick=\"javascript:AddAjaxPopUpGroupV2{$t}('{$ou}','{$uid}',{$num},'{$ligne}');\"\n\t\t\t\t\t\tstyle='font-size:18px;font-weight:bold;text-decoration:underline'>{$ligne} ({$num})</a></span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #21
0
ファイル: system.boots.php プロジェクト: BillTheBest/1.6.x
function search_sysalert()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $total = 0;
    $sql = "SELECT `content` FROM sys_alerts WHERE zmd5='{$_GET["md5"]}'";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
    $results = explode("\n", $ligne["content"]);
    if (count($results) == 0) {
        json_error_show("no data", 1);
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexregex();
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 1;
    }
    $pageStart = ($page - 1) * $rp;
    $data = array();
    $data['page'] = $page;
    $data['total'] = count($data);
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    $c = 0;
    while (list($index, $line) = each($results)) {
        if ($searchstring != null) {
            if (!preg_match("#{$searchstring}#", $line)) {
                continue;
            }
        }
        if (!preg_match("#(.*?)\\s+([0-9]+)\\s+([0-9\\.]+)\\s+([0-9\\.]+)\\s+([0-9]+)\\s+([0-9]+)\\s+(.*?)\\s+(.*?)\\s+(.+?)\\s+([0-9\\:]+)\\s+(.*)#", $line, $re)) {
            continue;
        }
        $c++;
        $user = $re[1];
        $pid = $re[2];
        $CPU = $re[3];
        $MEM = $re[4];
        $VSZ = FormatBytes($re[5]);
        $RSS = FormatBytes($re[6]);
        $pTIME = $re[10];
        $pcmd = $re[11];
        $CPUINT = intval($CPU);
        if ($_GET["CPU"] == 1) {
            if ($CPUINT < 2) {
                continue;
            }
        }
        if ($CPU == "0") {
            if ($MEM == "0") {
                continue;
            }
        }
        if (strlen($CPU) == 1) {
            $CPU = "{$CPU}.0";
        }
        if (strlen($MEM) == 1) {
            $MEM = "{$MEM}.0";
        }
        $pcmd = str_replace("/usr/bin/php5 /usr/share/artica-postfix/", "", $pcmd);
        $pcmd = str_replace("/bin/sh -c /usr/bin/ionice -c2 -n7 /usr/bin/nice --adjustment=19 ", "", $pcmd);
        $pcmd = str_replace("/usr/bin/php -q /usr/share/artica-postfix/", "", $pcmd);
        $pcmd = str_replace("php5 /usr/share/artica-postfix/", "", $pcmd);
        $pcmd = str_replace("/usr/sbin/apache2 -f /etc/artica-postfix/httpd.conf -k start", "Apache (Web interface)", $pcmd);
        $pcmd = str_replace("/usr/sbin/slapd -4 -h ldapi://%2Fvar%2Frun%2Fslapd%2Fslapd.sock ldap://127.0.0.1:389/ -f /etc/ldap/slapd.conf -u root -g root -l local4", "OpenLDAP Server.. ", $pcmd);
        $pcmd = str_replace("/usr/sbin/mysqld --pid-file=/var/run/mysqld/mysqld.pid --log-error=/var/lib/mysql/mysqld.err --socket=/var/run/mysqld/mysqld.sock --datadir=/var/lib/mysql", "MySQL Server... ", $pcmd);
        $pcmd = str_replace("/usr/bin/ufdbguardd -c /etc/squid3/ufdbGuard.conf -U squid", "WebFiltering service...", $pcmd);
        $pcmd = str_replace("/usr/sbin/mysqld --defaults-file=/opt/squidsql/my.cnf --innodb=OFF --user=root --pid-file=/var/run/squid-db.pid --basedir=/opt/squidsql --datadir=/opt/squidsql/data --socket=/var/run/mysqld/squid-db.sock --general-log-file=/opt/squidsql/general_log.log --slow-query-log-file=/opt/squidsql/slow-query.log --log-error=/opt/squidsql/error.log", "MySQL Statistics service... ", $pcmd);
        $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array($user, $pid, "{$CPU}%", "{$MEM}%", $VSZ, $RSS, $pTIME, $pcmd));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #22
0
function debug_search(){
	$tpl=new templates();
	$MyPage=CurrentPageName();
	$sock=new sockets();
	
	
	$searchstring=urlencode(string_to_flexregex());
	$datas=explode("\n",base64_decode($sock->getFrameWork("squid.php?proxy-pac-debug=yes&searchstring=$searchstring")));
	$pageStart = 1;
	
	
	
	if(count($datas)==0){json_error_show("no data");}
	
	krsort($datas);
	$data = array();
	$data['page'] = 1;
	$data['total'] = 1;
	$data['rows'] = array();
	
	
	
	while (list ($num, $ligne) = each ($datas) ){

	
	
		$data['rows'][] = array(
				'id' => md5($ligne),
				'cell' => array("$ligne")
		);
	}
	echo json_encode($data);
}
コード例 #23
0
function who_items()
{
    $t = $_GET["t"];
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $users = new usersMenus();
    $sock = new sockets();
    $youtubeid = $_GET["youtubeid"];
    $searchstring = string_to_flexregex("who-items");
    $table = "youtube_all";
    $page = 1;
    $FORCE_FILTER = " AND ";
    if ($searchstring != null) {
        $searchstring = "{$searchstring}";
    }
    $sql = "SELECT zDate,uid,MAC,youtubeid,SUM(hits) as hits FROM {$table} GROUP BY youtubeid,zDate,uid,MAC HAVING youtubeid='{$youtubeid}' {$searchstring} ORDER BY zDate DESC LIMIT 0,250";
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        throw new Exception("ERROR {$q->mysql_error} `{$sql}`", 500);
    }
    $boot = new boostrap_form();
    while ($ligne = mysql_fetch_assoc($results)) {
        $zmd5 = md5(serialize($ligne));
        $color = "black";
        $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}')";
        $link = $boot->trswitch($urljsSIT);
        $jsvideo = $boot->trswitch("Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}');");
        $urljsSIT = "Loadjs('miniadm.webstats.youtubeid.php?youtubeid={$youtubeid}&xtime={$_GET["xtime"]}');";
        $link = $boot->trswitch($urljsSIT);
        $ligne["hits"] = numberFormat($ligne["hits"], 0, "", " ");
        $urljsSIT = null;
        $link = null;
        $xtime = strtotime($ligne["zDate"] . " 00:00:00");
        $linkuid = $boot->trswitch("Loadjs('miniadm.webstats.ByMember.ByYoutubeByHour.php?filterBy=uid&xtime={$xtime}&value={$ligne["uid"]}&youtubeid={$youtubeid}')");
        $linkMAC = $boot->trswitch("Loadjs('miniadm.webstats.ByMember.ByYoutubeByHour.php?filterBy=MAC&xtime={$xtime}&value={$ligne["MAC"]}&youtubeid={$youtubeid}')");
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td {$link} nowrap><i class='icon-time'></i>&nbsp;{$ligne["zDate"]}</td>\n\t\t<td {$linkuid}><i class='icon-info-sign'></i>&nbsp;{$ligne["uid"]}</td>\n\t\t<td {$linkMAC}><i class='icon-info-sign'></i>&nbsp;{$ligne["MAC"]}</td>\n\t\t<td {$link}><i class='icon-info-sign'></i>&nbsp;{$ligne["hits"]}</td>\n\t\t</tr>";
    }
    echo $tpl->_ENGINE_parse_body("\n\t<table class='table table-bordered table-hover'>\n\t\t<thead>\n\t\t\t<tr>\n\t\t\t\t<th>{zDate}</th>\n\t\t\t\t<th>{member}</th>\n\t\t\t\t<th>{MAC}</th>\n\t\t\t\t<th>{hits}</th>\n\t\t\t</tr>\n\t\t</thead>\n\t<tbody>\n\t") . @implode("", $tr) . "</tbody></table>";
}
コード例 #24
0
function PostfixAddFallBackerserverList()
{
    $main = new maincf_multi($_GET["hostname"]);
    $tpl = new templates();
    $Mypage = CurrentPageName();
    $add = imgtootltip("plus-24.png", "{add_server_domain}", "PostfixAddFallBackServer()");
    $hash = explode(',', $main->GET_BIGDATA("smtp_fallback_relay"));
    $tool = new DomainsTools();
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($hash);
    $data['rows'] = array();
    $search = string_to_flexregex();
    $c = 0;
    if (is_array($hash)) {
        while (list($index, $ligne) = each($hash)) {
            if ($ligne == null) {
                continue;
            }
            $arr = $tool->transport_maps_explode("smtp:{$ligne}");
            if ($search != null) {
                if (!preg_match("#{$search}#", $arr[1])) {
                    continue;
                }
            }
            $cell_up = "<td width=1%>" . imgsimple('arrow_up.gif', '{up}', "PostfixAddFallBackServerMove('{$index}','up')") . "</td>";
            $cell_down = "<td width=1%>" . imgsimple('arrow_down.gif', '{down}', "PostfixAddFallBackServerMove('{$index}','down')") . "</td>";
            $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<code style='font-size:14px'><a href=\"javascript:PostfixAddFallBackServer('{$index}');\">{$arr[1]}</a></code>", "<span style='font-size:14px;color:{$color};'>{$arr[2]}</span>", "<span style='font-size:14px;color:{$color};'>{$arr[3]}</span>", "<span style='font-size:14px;color:{$color};'><table><tr>{$cell_up}{$cell_down}</tr></table></span>", imgsimple("delete-32.png", '{delete}', "PostfixAddFallBackerserverDelete('{$index}')")));
            $c++;
        }
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #25
0
function page_localdomains_search()
{
    $conf = new dnsmasq();
    $tpl = new templates();
    $page = CurrentPageName();
    $Params = $conf->ARTICA_ARRAY["LOCALNET"];
    if (count($Params) == 0) {
        $ldap = new clladp();
        $hash = $ldap->AllDomains();
        $hash["localdomain"] = "localdomain";
        $hash["localhost.localdomain"] = "localhost.localdomain";
        while (list($key, $line) = each($hash)) {
            $conf->ARTICA_ARRAY["LOCALNET"][$key] = 0;
        }
        $conf->SaveConf();
    }
    $data = array();
    $data['page'] = 0;
    $data['total'] = count($conf->ARTICA_ARRAY["LOCALNET"]);
    $data['rows'] = array();
    $search = null;
    ksort($conf->ARTICA_ARRAY["LOCALNET"]);
    $search = string_to_flexregex();
    while (list($domain, $enabled) = each($conf->ARTICA_ARRAY["LOCALNET"])) {
        if ($search != null) {
            if (!preg_match("#{$search}#", $domain)) {
                continue;
            }
        }
        $domain_plus = null;
        $md5 = md5($domain);
        $enable = Field_checkbox($md5, 1, $enabled, "DnsMasqLocalDomainEnable('{$domain}','{$md5}')");
        $delete = imgtootltip("delete-32.png", "{delete} {$domain}", "DnsMasqLocalDomainDelete('{$domain}')");
        $color = "black";
        if ($enabled == 0) {
            $color = "#D0D0D0";
        }
        if (isset($conf->ARTICA_ARRAY["RRDNS"][$domain])) {
            $domain_plus = " &raquo;&raquo;<i>{$conf->ARTICA_ARRAY["RRDNS"][$domain]}</i>";
        }
        $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:22px;color:{$color}'>{$domain}{$domain_plus}</span>", $enable, $delete));
    }
    echo json_encode($data);
}
コード例 #26
0
function table_list()
{
    $tpl = new templates();
    $sock = new sockets();
    $MyPage = CurrentPageName();
    $query = urlencode(string_to_flexregex());
    $sock->getFrameWork("network.php?conntrack=yes&rp={$_POST["rp"]}&qtype={$_POST["qtype"]}&query={$query}");
    $MAIN = unserialize(@file_get_contents("ressources/logs/web/conntrack.inc"));
    $q = new mysql_squid_builder();
    unset($q->acl_GroupType_iptables["arp"]);
    while (list($mkey, $ligne) = each($q->acl_GroupType_iptables)) {
        $tt[] = "( webfilters_sqgroups.GroupType='{$mkey}')";
    }
    $sql = "SELECT ID,GroupName FROM webfilters_sqgroups WHERE 1 AND (" . @implode(" OR ", $tt) . ") ORDER BY GroupName";
    if (!isset($_SESSION["webfilters_sqgroups_iptables"])) {
        $_SESSION["webfilters_sqgroups_iptables"][null] = "{CopyTo}";
        $results = $q->QUERY_SQL($sql);
        $fgroupts[null] = "{select}";
        while ($ligne = mysql_fetch_assoc($results)) {
            $_SESSION["webfilters_sqgroups_iptables"][$ligne["ID"]] = $ligne["GroupName"];
        }
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($MAIN);
    $data['rows'] = array();
    if (count($MAIN) == 0) {
        json_error_show("no data");
    }
    $arrow_right = "<img src='img/arrow-right-32.png'>";
    $style = "<span style='font-size:16px'>";
    while (list($mkey, $ligne) = each($MAIN)) {
        $val = 0;
        $mkey = $ligne["mkey"];
        $delete = imgsimple("delete-24.png", null, "DeleteObjectLinks('{$mkey}')");
        $ligne["dst2"] = gethostbyaddr($ligne["dst"]);
        $field_FROM = Field_array_Hash($_SESSION["webfilters_sqgroups_iptables"], "fgrp{$mkey}", null, null, null, 0, "font-size:16px");
        $field_to = Field_array_Hash($_SESSION["webfilters_sqgroups_iptables"], "tgrp{$mkey}", null, null, null, 0, "font-size:16px");
        $srcenc = urlencode($ligne["src"]);
        $ok_FROM = imgsimple("ok-blue-left-42.png", null, "Loadjs('{$MyPage}?add-item-to=yes&mkey=fgrp{$mkey}&pattern={$srcenc}')");
        $dstenc = urlencode($ligne["dst"]);
        $ok_To = imgsimple("ok-blue-left-42.png", null, "Loadjs('{$MyPage}?add-item-to=yes&mkey=tgrp{$mkey}&pattern={$dstenc}')");
        $pattern = $_GET["pattern"];
        $gpid = $_GET["gpid"];
        $data['rows'][] = array('id' => "{$mkey}", 'cell' => array("{$style}{$ligne["proto"]}</span>", "{$style}{$ligne["src"]}:{$ligne["sport"]}</span>", $field_FROM, $ok_FROM, $arrow_right, "{$style}{$ligne["dst"]}:{$ligne["dport"]}</span><div style='font-size:12px'>{$ligne["dst2"]}</div>", $field_to, $ok_To, "{$style}{$ligne["status"]}</span>", $delete));
    }
    echo json_encode($data);
}
コード例 #27
0
function categories_search()
{
    $tpl = new templates();
    $catz = new mysql_catz();
    $tables = $catz->LIST_TABLES_CATEGORIES();
    $dans = new dansguardian_rules();
    $dans->LoadBlackListes();
    $search = string_to_flexregex("categories-search");
    $TransArray = $catz->TransArray();
    while (list($key, $value) = each($tables)) {
        $categoryname = $TransArray[$key];
        $text_category = $tpl->_ENGINE_parse_body($dans->array_blacksites[$categoryname]);
        if (!isset($dans->array_blacksites[$categoryname])) {
            continue;
        }
        if ($dans->array_pics[$categoryname] != null) {
            $pic = "<img src='img/{$dans->array_pics[$categoryname]}'>";
        } else {
            $pic = "&nbsp;";
        }
        $CTCOUNT = $catz->COUNT_ROWS($key);
        if ($CTCOUNT == 0) {
            continue;
        }
        $items = numberFormat($CTCOUNT, 0);
        if ($search != null) {
            if (!preg_match("#{$search}#", $categoryname)) {
                if (!preg_match("#{$search}#", $text_category)) {
                    continue;
                }
            }
        }
        $tr[] = "\n\t\t<tr id='{$id}'>\n\t\t<td width=1% nowrap>{$pic}</td>\n\t\t<td><i class='icon-globe'></i>&nbsp;<strong>{$categoryname}</strong><div>{$text_category}</div></td>\n\t\t<td nowrap><i class='icon-info-sign'></i>&nbsp;<span style='font-size:18px'>{$items}</span></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 colspan=2>{category}</th>\n\t\t\t\t\t<th>{websites}</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>";
}
コード例 #28
0
ファイル: samba.index.php プロジェクト: BillTheBest/1.6.x
function shared_folders_list()
{
    $tpl = new templates();
    $samba = new samba();
    $folders = $samba->main_folders;
    if (!is_array($folders)) {
        json_error_show("No shared folders", 1);
    }
    $dustbins = $samba->LOAD_RECYCLES_BIN();
    $search = string_to_flexregex();
    $q2 = new mysql();
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $banned = $tpl->_ENGINE_parse_body("{banned_files}");
    $c = 0;
    while (list($FOLDER, $ligne) = each($folders)) {
        if (trim($FOLDER) == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#i", $FOLDER)) {
                continue;
            }
        }
        $FOLDER_url = urlencode($FOLDER);
        $md = md5($FOLDER);
        $propertiesjs = "FolderProp('{$FOLDER_url}')";
        $c++;
        $delete = imgsimple('dustbin-48.png', null, "FolderDelete('{$FOLDER}')");
        if ($samba->main_array[$FOLDER]["path"] == "/home/netlogon") {
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if ($samba->main_array[$FOLDER]["path"] == "/home/export/profile") {
            $properties = null;
            $delete = "&nbsp;";
        }
        if ($FOLDER == "homes") {
            $properties = null;
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if ($FOLDER == "printers") {
            $properties = null;
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if ($FOLDER == "print\$") {
            $properties = null;
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if ($FOLDER == "netlogon") {
            $properties = null;
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if (trim($FOLDER == "profiles.V2")) {
            $properties = null;
            $propertiesjs = null;
            $delete = "&nbsp;";
        }
        if ($FOLDER == "profile") {
            $properties = null;
            $delete = "&nbsp;";
            $propertiesjs = null;
        }
        if ($FOLDER == "profiles") {
            $properties = null;
            $delete = "&nbsp;";
            $propertiesjs = null;
        }
        $icon = "folder-granted-properties-48.png";
        if ($propertiesjs == null) {
            $icon = "folder-granted-properties-48-grey.png";
        }
        if (strpos($samba->main_array[$FOLDER]["root preexec"], "exec.samba.php --usb-mount") > 0) {
            $icon = "usb-share-48.png";
        }
        if (strpos("   " . $samba->main_array[$FOLDER]["path"], "/automounts/") > 0) {
            $icon = "usb-share-48.png";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $trash = "&nbsp;";
        if ($dustbins[$FOLDER]) {
            $trash = imgsimple("trash-48.png", null, "Loadjs('samba.recycle.php?sharename={$FOLDER}')");
        }
        $FOLDER = trim($FOLDER);
        $href = "<a href=\"javascript:blur()\" OnClick=\"javascript:{$propertiesjs}\" style='font-size:16px;text-decoration:underline;font-weight:bold'>";
        // *******************************************************
        $fBanned = array();
        $banned_explain = null;
        $md5 = md5(trim($samba->main_array[$FOLDER]["path"]));
        $sql = "SELECT `files` FROM samba_veto_files WHERE md5path='{$md5}'";
        $results2 = $q2->QUERY_SQL($sql, "artica_backup");
        while ($ligne2 = mysql_fetch_assoc($results2)) {
            $pattern = trim($ligne2["files"]);
            if ($pattern == null) {
                continue;
            }
            if (isset($alredy[$pattern])) {
                continue;
            }
            $fBanned[] = $pattern;
        }
        if (count($fBanned) > 0) {
            $banned_explain = "<div style='font-size:10px'>{$banned}: " . @implode(", ", $fBanned) . "</div>";
        }
        // *******************************************************
        $data['rows'][] = array('id' => $md, 'cell' => array(imgsimple($icon, null, $propertiesjs), "<div style='padding-top:10px'>{$href}{$FOLDER}</a></span>", $trash, "<div style='padding-top:10px'><strong>\n\t\t\t\t<code style='font-size:16px'>{$samba->main_array[$FOLDER]["path"]}</a></code>\n\t\t\t\t</strong>\n\t\t\t\t{$banned_explain}\n\t\t\t</div>", $delete));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #29
0
function find_member()
{
    $ldap = new clladp();
    if ($ldap->IsKerbAuth()) {
        find_member_active_directory();
        return;
    }
    if ($_POST["qtype"] == "find-member") {
        $tofind = $_POST["query"];
    }
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    if ($_SESSION["uid"] == -100) {
        $ou = $_GET["ou"];
    } else {
        $ou = $_SESSION["ou"];
    }
    $sock = new sockets();
    if (is_base64_encoded($ou)) {
        $ou = base64_decode($ou);
    }
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $tofind = str_replace('***', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $tofind = str_replace('**', '*', $tofind);
    $EnableManageUsersTroughActiveDirectory = $sock->GET_INFO("EnableManageUsersTroughActiveDirectory");
    if (!is_numeric($EnableManageUsersTroughActiveDirectory)) {
        $EnableManageUsersTroughActiveDirectory = 0;
    }
    $tofind = str_replace(".", '\\.', $tofind);
    $tofind = str_replace("*", '.*?', $tofind);
    $ldap = new clladp();
    writelogs("FIND {$tofind} IN OU \"{$ou}\"", __FUNCTION__, __FILE__, __LINE__);
    if (!$ldap->IsOUUnderActiveDirectory($ou)) {
        if ($EnableManageUsersTroughActiveDirectory == 1) {
            $GLOBALS["NOUSERSCOUNT"] = true;
            $ldap = new ldapAD();
            writelogs("[{$tofind}]: ->hash_get_groups_from_ou_mysql({$ou},{$tofind}) ", __FUNCTION__, __FILE__);
            $hash = $ldap->hash_get_groups_from_ou_mysql($ou, $tofind, true);
        } else {
            $ldap = new clladp();
            $hash = $ldap->hash_groups($ou, 1);
        }
    } else {
        $hash = find_member_active_directory();
        $ldap->EnableManageUsersTroughActiveDirectory = true;
        $GLOBALS["NOUSERSCOUNT"] = true;
    }
    $number = count($hash);
    $data = array();
    $data['page'] = 0;
    $data['total'] = $number;
    $data['rows'] = array();
    $styla = "style='font-size:14px;text-decoration:underline;font-weight:bold'";
    $styleNum = "style='font-size:16px;font-weight:bold'";
    $search = string_to_flexregex();
    if (is_array($hash)) {
        while (list($num, $line) = each($hash)) {
            if (strtolower($line) == 'default_group') {
                continue;
            }
            if (strlen($search) > 2) {
                if (!preg_match("#{$search}#", $line)) {
                    continue;
                }
            }
            $text = null;
            $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$num}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')";
            $delete = imgsimple("delete-24.png", "{delete} {$num}", "Loadjs('domains.delete.group.php?gpid={$num}')");
            if (!$GLOBALS["NOUSERSCOUNT"]) {
                $delete = "&nbsp;";
                $gp = new groups($num);
                $members = count($gp->members_array);
                if ($gp->description != null) {
                    $text = $gp->description;
                }
                $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>{$members}</span>", "<span style='font-size:14px'>{$text}</span>", $delete));
            } else {
                if (is_array($line)) {
                    if ($line["description"] != null) {
                        $text = $line["description"];
                    }
                    if (strlen($search) > 2) {
                        if (!preg_match("#{$search}#", $line["groupname"])) {
                            continue;
                        }
                    }
                    if (!is_numeric($line["gid"])) {
                        $delete = imgsimple("delete-24-grey.png");
                    }
                    $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$line["gid"]}&ou={$_GET["ou"]}&encoded=yes&tt={$t}&ttt={$tt}')";
                    $data['rows'][] = array('id' => md5($line["groupname"]), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line["groupname"]}</a>", "<span {$styleNum}>{$line["UsersCount"]}</span>", "<span style='font-size:14px'>{$text}</span>", $delete));
                } else {
                    $data['rows'][] = array('id' => $line, 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$line}</a>", "<span {$styleNum}>?</span>", "<span style='font-size:14px'></span>", $delete));
                }
            }
        }
    }
    echo json_encode($data);
}
コード例 #30
0
function logs(){
	$MyPage=CurrentPageName();
	$sock=new sockets();
	$logfile="/usr/share/artica-postfix/ressources/logs/web/iptables.log";
	$searchstring=urlencode(string_to_flexregex());
	if(!isset($_POST["rp"])){$_POST["rp"]=100;}
	$sock->getFrameWork("network.php?iptables-events=yes&eth={$_GET["eth"]}&rp={$_POST["rp"]}&search=$searchstring");
	$tpl=new templates();
	$results=explode("\n",@file_get_contents($logfile));
	@unlink($logfile);
	
	if(count($results)==0){json_error_show("no data");}
	
	$data = array();
	$data['page'] = 1;
	$data['total'] = count($results);
	$data['rows'] = array();
	$q=new mysql_squid_builder();
	krsort($results);
	$c=0;
	while (list ($num, $line) = each ($results)){
		$line=trim($line);
		if($line==null){continue;}
		$MACIN="-";
		$MACOUT="-";
		$SRC="-";
		$color="black";
		if($GLOBALS["VERBOSE"]){echo "$line<hr>";}
		
		if(preg_match("#(.+?)\s+([0-9]+)\s+([0-9\:]+)\s+.*?\](.*)#",$line,$re)){
			$date=strtotime("{$re[1]} {$re[2]} {$re[3]}");
			$datetext=time_to_date($date,true);
			if($GLOBALS["VERBOSE"]){print_r($re);}
			$line=trim($re[4]);
		}
		if($GLOBALS["VERBOSE"]){echo "$line<hr>";}
		//  ARTICA-FW-ID-8:IN= OUT=br1 SRC=192.168.1.1 DST=192.168.1.135 
		//LEN=52 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=TCP SPT=8080 DPT=51484 WINDOW=14600 
		//RES=0x00 ACK SYN URGP=0", $subject))
		
		$lineZ=explode(" ",$line);
		
		while (list ($a, $b) = each ($lineZ)){
			if(!preg_match("#(.+)=(.*)#", $b,$re)){continue;}
			$MAIN[$re[1]]=$re[2];
			
		}
		

		$IN=$MAIN["IN"];
		$OUT=$MAIN["OUT"];
		$PHYSIN=$MAIN["PHYSIN"];
		$PHYSOUT=$MAIN["PHYSOUT"];
		$MAC=$MAIN["MAC"];
		$SRC=$MAIN["SRC"];
		$DST=$MAIN["DST"];
		$SPT=$MAIN["SPT"];
		$DPT=$MAIN["DPT"];
		$PROTO=$MAIN["PROTO"];
		$TABLE=$MAIN["TABLE"];
		$ACTION=$MAIN["ACTION"];
		$AID=$MAIN["AID"];
		if($AID<>null){
			$AID_TABLE=explode("/",$AID);
			if($GLOBALS["VERBOSE"]){echo "<hr>".print_r($AID_TABLE)."<hr>";}
			$RULE_ID=$AID_TABLE[0];
			if(preg_match("#([0-9]+)#", $RULE_ID,$rz)){$RULE_ID=$rz[1];}
			$ACTION=$AID_TABLE[2];
			$ACTION_SOURCE=$ACTION;
			$TABLE=$AID_TABLE[1];
			$MAIN["ID"]=$RULE_ID;
			$MAIN["ACTION"]=$ACTION_SOURCE;
			$MAIN["TABLE"]=$TABLE;
			
		}
		
		if($TABLE==null){$TABLE="none";}
		if($ACTION==null){$ACTION="none";}
		$TABLE=$tpl->javascript_parse_text("{{$TABLE}}");
		$ACTION=$tpl->javascript_parse_text("{{$ACTION}}");
		
		//Aug 13 15:30:49 router kernel: [1918085.984702] ARTICA-FW-ID-1:IN=br1 OUT= PHYSIN=eth0 MAC=01:00:5e:00:00:01:00:17:33:f6:95:f4:08:00 SRC=172.16.255.254 DST=224.0.0.1 LEN=28 TOS=0x10 PREC=0x80 TTL=1 ID=37754 PROTO=2
		if($IN==null){$IN="-";}
		if($OUT==null){$OUT="-";}
		if($PHYSIN==null){$PHYSIN="-";}
		if($MACIN==null){$MACIN="-";}
		if($MACOUT==null){$MACOUT="-";}
		if($SRC==null){$SRC="-";}
		if($PHYSOUT==null){$PHYSOUT="-";}
		if($SPT==null){$SPT="-";}
		if($DPT==null){$DPT="-";}
		
		if(preg_match("#(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?)#", $MAC,$ri)){
			$MACIN="{$ri[1]}:{$ri[2]}:{$ri[3]}:{$ri[4]}:{$ri[5]}:{$ri[6]}";
		   $MACOUT="{$ri[7]}:{$ri[8]}:{$ri[9]}:{$ri[10]}:{$ri[11]}:{$ri[12]}";
			
		}
		$MAIN["MAC - IN"]=$MACIN;
		$MAIN["MAC - OUT"]=$MACOUT;
		
		
		$ICONS["LOG"]="22-logs.png";
		$ICONS["REJECT"]="22-red.png";
		$ICONS["DROP"]="22-red.png";
		$ICONS["RETURN"]="ok22.png";
		$ICONS["ACCEPT"]="ok22.png";
		$ICONS["DROP"]="22-red.png";
		$ICONS["MARK"]="22-red.png";
		$ICONS["FORWARD"]="forwd_22.png";
		
		$image=$ICONS[$ACTION_SOURCE];
		if(is_numeric($PROTO)){$color="#D11C2F";$image="22-warn.png";}
		
		
		$uri=urlencode(base64_encode(serialize($MAIN)));
		$javascript="href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('$MyPage?zoom-js=$uri');\" style='font-size:12px;font-weight:normal;color:$color;text-decoration:underline'";
		
			
		$mkey=md5($line);
		$c++;
		$data['rows'][] = array(
				'id' => "$mkey",
				'cell' => array(
						"<span style='font-size:12px;font-weight:normal;color:$color'>$datetext</span>",
						"<center style='font-size:12px;font-weight:normal;color:$color'><img src=img/$image></center>",
						"<a $javascript>$TABLE</a>",
						"<span style='font-size:12px;font-weight:normal;color:$color'>$RULE_ID</span>",
						"<a $javascript>$IN/$PHYSIN</a>",
						"<span style='font-size:12px;font-weight:normal;color:$color'>$SRC:$SPT/$MACIN</span>",
						"<span style='font-size:12px;font-weight:normal;color:$color'>$OUT/$PHYSOUT</span>",
						"<a $javascript>$DST:$DPT/$MACOUT</span>",
						"<span style='font-size:12px;font-weight:normal;color:$color'>$PROTO</span>",
					)
		);
		
	}
	if(count($c)==0){json_error_show("no data");}
	echo json_encode($data);
	
}