当前位置: 首页>>代码示例>>PHP>>正文


PHP string_to_flexregex函数代码示例

本文整理汇总了PHP中string_to_flexregex函数的典型用法代码示例。如果您正苦于以下问题:PHP string_to_flexregex函数的具体用法?PHP string_to_flexregex怎么用?PHP string_to_flexregex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了string_to_flexregex函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: logs

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:60,代码来源:cyrus.quota.php

示例2: showlist

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:59,代码来源:squid.active.requests.members.day.php

示例3: logs

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:53,代码来源:cyrus.events.php

示例4: search

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:squid.catz.php

示例5: rows_table

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:44,代码来源:squid.auth-objects-events.php

示例6: search

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:41,代码来源:ufdbcat.events.php

示例7: servers_list

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:37,代码来源:domains.postfix.multi.reject.php

示例8: groups_list

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:61,代码来源:domains.edit.user.groups.php

示例9: policies_search

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>";
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:24,代码来源:miniadm.messaging.amavis.php

示例10: items_list

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:73,代码来源:squid.ext_time_quota_acl_groups.php

示例11: events_list

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);
}
开发者ID:articatech,项目名称:artica,代码行数:68,代码来源:postfix.realtime.monitor.php

示例12: syslog_search

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 ";
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:69,代码来源:miniadm.system.syslog-query.php

示例13: showlist

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);
}
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:55,代码来源:squid.active.requests.php

示例14: uamallowed_search

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>";
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:28,代码来源:miniadmin.webfiltering.coova.php

示例15: content_search

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);
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:62,代码来源:artica-meta.snapshots.php


注:本文中的string_to_flexregex函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。