コード例 #1
0
function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $q = new mysql();
    $database = "artica_events";
    $t = $_GET["t"];
    $search = '%';
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    $table = "last_boot";
    $data = array();
    $data['page'] = $page;
    $data['total'] = 0;
    $data['rows'] = array();
    $fontsize = 20;
    $style = "style='font-size:18px'";
    $dataX = unserialize($sock->GET_INFO("InfluxDBRestoreArray"));
    $c = 0;
    $tpl = new templates();
    while (list($path, $size) = each($dataX)) {
        $c++;
        $ms5 = md5($path);
        $color = "black";
        $size = FormatBytes(intval($size) / 1024);
        $data['rows'][] = array('id' => $ms5, 'cell' => array("<span {$style}>{$path}</a></span>", "<span {$style}>{$size}</a></span>"));
    }
    if ($c == 0) {
        json_error_show("no data");
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #2
0
function databases_items()
{
    $tpl = new templates();
    $sock = new sockets();
    $sock->getFrameWork("squid2.php?cached-kerberos-tickets=yes");
    $dataZ = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/kerberos-tickets-squid"));
    if (!is_array($dataZ)) {
        $dataZ = array();
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($dataZ);
    $data['rows'] = array();
    if (count($dataZ) == 0) {
        json_error_show("no data", 1);
    }
    $fontsize = "22";
    while (list($num, $DB) = each($dataZ)) {
        $color = "black";
        $date = strtotime($DB["DATE"]);
        $zdate = $tpl->time_to_date($date, true);
        $KVNO = $DB["NUM"];
        $TICKET = $DB["ticket"];
        if (!preg_match("#HTTP\\/#", $TICKET)) {
            $color = "#AFAFAF";
        }
        $data['rows'][] = array('id' => md5(serialize($DB)), 'cell' => array("<center style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$KVNO}</center>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$zdate}</a></span>", "<span style='font-size:18px;font-weight:normal;color:{$color}'>{$TICKET}</span>"));
    }
    echo json_encode($data);
}
コード例 #3
0
function popup_list()
{
    $ou = base64_decode($_GET["ou"]);
    $tpl = new templates();
    $gpid = $_GET["gpid"];
    if ($_POST["query"] != null) {
        $tofind = $_POST["query"];
    }
    $groups = new groups($gpid);
    $group_members = $groups->members_array;
    $ldap = new clladp();
    if ($tofind == null) {
        $tofind = '*';
    } else {
        $tofind = "*{$tofind}*";
    }
    $tofind = str_replace("**", "*", $tofind);
    $filter = "(&(objectClass=userAccount)(|(cn={$tofind})(mail={$tofind})(displayName={$tofind})(uid={$tofind}) (givenname={$tofind})))";
    $attrs = array("displayName", "uid", "mail", "givenname", "telephoneNumber", "title", "sn", "mozillaSecondEmail", "employeeNumber");
    $dn = "ou={$ou},dc=organizations,{$ldap->suffix}";
    $hash = $ldap->Ldap_search($dn, $filter, $attrs, 150);
    if (strlen(trim($ldap->ldap_last_error)) > 5) {
        json_error_show("Error:" . $ldap->ldap_last_error);
    }
    $number = $hash["count"];
    $data = array();
    $data['page'] = 1;
    $data['total'] = $number;
    $data['rows'] = array();
    $c = 0;
    for ($i = 0; $i < $number; $i++) {
        $exist = false;
        $userARR = $hash[$i];
        $uid = $userARR["uid"][0];
        if ($uid == null) {
            continue;
        }
        $md = md5($uid);
        $c++;
        if ($uid == "squidinternalauth") {
            continue;
        }
        if ($group_members[$uid]) {
            $exist = true;
        }
        $js = "add_already_member_add('" . base64_encode($uid) . "','{$md}');";
        $mail = texttooltip($userARR["mail"][0], "{add}:{$uid}", $js, null, 0, "font-size:13px");
        $color = "black";
        $add = imgsimple("arrow-right-24.png", "{add}:{$uid}", $js);
        if ($exist) {
            $add = "&nbsp;";
            $color = "#8a8a8a";
        }
        $data['rows'][] = array('id' => "uidS{$md}", 'cell' => array("<span style='font-size:14px;color:{$color}'>{$uid}</span>", "<span style='font-size:14px;color:{$color}'>{$mail}</span>", "<span style='font-size:14px;color:{$color}'>{$add}</span>"));
    }
    echo json_encode($data);
}
コード例 #4
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);
}
コード例 #5
0
ファイル: monit.php プロジェクト: BillTheBest/1.6.x
function items()
{
    //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_squid_builder();
    $t = $_GET["t"];
    $FORCE_FILTER = null;
    $cache_file = "/usr/share/artica-postfix/ressources/logs/web/monit.status.all";
    $sock = new sockets();
    if (!is_file($cache_file)) {
        $sock->getFrameWork("monit.php?chock-status=yes");
        json_error_show("No cache file");
    }
    $array = unserialize(@file_get_contents($cache_file));
    $sock->getFrameWork("monit.php?chock-status=yes");
    if (count($array) == 0) {
        json_error_show("No data");
    }
    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();
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $data = array();
    $data['page'] = $page;
    $data['total'] = count($array);
    $data['rows'] = array();
    while (list($product, $array2) = each($array)) {
        if (trim($product) == null) {
            continue;
        }
        $val = 0;
        $id = md5($product);
        $product = $tpl->_ENGINE_parse_body("{{$product}}");
        $status = $array2["status"];
        $uptime = $array2["uptime"];
        $children = $array2["children"];
        $mem = $array2["memory kilobytes total"];
        $cpu = $array2["cpu percent total"];
        $mem = FormatBytes($mem);
        $data['rows'][] = array('id' => "{$id}", 'cell' => array("<span style='font-size:14px;'>{$product}</a></span>", "<span style='font-size:14px;'>{$status}</span>", "<span style='font-size:14px;'>{$uptime}</span>", "<span style='font-size:14px;'>{$children}</span>", "<span style='font-size:14px;'>{$mem}</span>", "<span style='font-size:14px;'>{$cpu}</span>"));
    }
    echo json_encode($data);
}
コード例 #6
0
function show_list()
{
    $tpl = new templates();
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    $cpu = $_GET["cpu"];
    include_once dirname(__FILE__) . "/ressources/class.squid.manager.inc";
    $cache_manager = new cache_manager();
    $datas = explode("\n", $cache_manager->makeQuery("ntlmauthenticator"));
    if (!$cache_manager->ok) {
        json_error_show("Err!");
    }
    $CPU_NUMBER = 0;
    while (list($num, $ligne) = each($datas)) {
        if (preg_match("#by kid([0-9]+)#", $ligne, $re)) {
            $CPU_NUMBER = $re[1];
            continue;
        }
        if (!preg_match("#([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+([0-9]+)\\s+(.*?)\\s+([0-9\\.]+)#", $ligne, $re)) {
            continue;
        }
        $pid = $re[3];
        $rqs = $re[4];
        $rply = $re[5];
        $flags = $re[6];
        $time = $re[7];
        $MAIN[$CPU_NUMBER][$pid]["PID"] = $pid;
        $MAIN[$CPU_NUMBER][$pid]["RQS"] = $rqs;
        $MAIN[$CPU_NUMBER][$pid]["RPLY"] = $rply;
        $MAIN[$CPU_NUMBER][$pid]["FLAG"] = $flags;
        $MAIN[$CPU_NUMBER][$pid]["TIME"] = $time;
    }
    //print_r($MAIN);
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($MAIN[$cpu]);
    $data['rows'] = array();
    while (list($pid, $ligne) = each($MAIN[$cpu])) {
        $md5 = md5(serialize($ligne));
        $PID = numberFormat($ligne["PID"], 0, "", " ");
        $RQS = numberFormat($ligne["RQS"], 0, "", " ");
        $RPLY = numberFormat($ligne["RPLY"], 0, "", " ");
        $FLAG = $ligne["FLAG"];
        $TIME = $ligne["TIME"];
        $data['rows'][] = array('id' => $md5, 'cell' => array("<span style='font-size:16px'>{$PID}</a></span>", "<span style='font-size:16px'>{$RQS}</a></span>", "<span style='font-size:16px'>{$RPLY}</span>", "<span style='font-size:16px'>{$RQS}</span>", "<span style='font-size:16px'>{$FLAG}</span>", "<span style='font-size:16px'>{$TIME}</span>"));
    }
    echo json_encode($data);
}
コード例 #7
0
ファイル: syslog.dmesg.php プロジェクト: BillTheBest/1.6.x
function dmesg_search()
{
    $sock = new sockets();
    $array = unserialize(base64_decode($sock->getFrameWork("services.php?dmesg=yes")));
    if (!is_array($array)) {
        json_error_show("Fatal, no such data");
    }
    $search = string_to_regex($_POST["query"]);
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $pageEnd = $pageStart + $rp;
    if ($pageEnd <= 0) {
        $pageEnd = $rp;
    }
    //json_error_show("Start:$pageStart, end:$pageEnd");
    if ($_POST["sortorder"] == "desc") {
        krsort($array);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = count($array);
    $data['rows'] = array();
    $c = 0;
    while (list($key, $line) = each($array)) {
        if ($line == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#i", $line)) {
                continue;
            }
        }
        $c++;
        if ($c <= $pageStart) {
            continue;
        }
        if ($c > $pageEnd) {
            break;
        }
        $data['rows'][] = array('id' => md5($line), 'cell' => array("{$spanOn}{$line}</span>"));
    }
    echo json_encode($data);
}
コード例 #8
0
function item_rules()
{
    $t = $_GET["t"];
    $sock = new sockets();
    if ($_POST["query"] != null) {
        $search = "&search=" . base64_encode(string_to_regex($_POST["query"]));
    }
    $datas = unserialize(base64_decode($sock->getFrameWork("services.php?iptables-dump=yes&rp={$_POST["rp"]}{$search}")));
    if (count($datas) == 0) {
        json_error_show("No data");
    }
    $tpl = new templates();
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    $c = 0;
    while (list($num, $val) = each($datas)) {
        if (substr($val, 0, 1) == "#") {
            continue;
        }
        if (!preg_match("#(^[0-9]+)\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+)#", $val, $re)) {
            continue;
        }
        $index = $re[1];
        $target = $re[2];
        $protocol = $re[3];
        $opt = $re[4];
        $src = $re[5];
        $dest = $re[6];
        $c++;
        if (strpos($dest, "/") > 0) {
            $tt = explode("/", $dest);
            $dest = $tt[0];
        }
        if (preg_match("#(.+?)\\s+tcp(.+)#", $dest, $re)) {
            $dest = $re[1];
            $protocol = $re[2];
        }
        $protocol = str_replace("dpt:ssh", "SSH (22)", $protocol);
        $dest = str_replace("anywhere", "{anywhere}", $dest);
        $line = $tpl->_ENGINE_parse_body("{$target} {from} <strong>{$src}</strong> {to} {$dest} {protocol} {$protocol}");
        $del = imgsimple("delete-24.png", null, "Delete{$t}('{$index}')");
        $data['rows'][] = array('id' => "{$num}", 'cell' => array("<span style='font-size:12px;color:{$color}'>[{$index}]: {$line}</a></span>", "<span style='font-size:12px;color:{$color}'>{$del}</a></span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #9
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);
}
コード例 #10
0
ファイル: postfix.debug.php プロジェクト: brucewu16899/1.6.x
function search()
{
    $hostname = $_GET["hostname"];
    $tpl = new templates();
    $page = CurrentPageName();
    $main = new maincf_multi($_GET["hostname"]);
    $datas = unserialize(base64_decode($main->GET_BIGDATA("debug_peer_list")));
    if (count($datas) == 0) {
        json_error_show("No data...");
    }
    $t = $_GET["t"];
    if ($_POST["query"] != null) {
        $search = string_to_regex($_POST["query"]);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $total;
    $data['rows'] = array();
    $c = 0;
    while (list($num, $ligne) = each($datas)) {
        if ($num == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#i", $num)) {
                continue;
            }
        }
        $id = md5($num);
        $delete = imgsimple("delete-32.png", "{delete}", "debug_peer_list_del('{$num}','{$id}')");
        $c++;
        $data['rows'][] = array('id' => $id, 'cell' => array("<strong style='font-size:18px;style='color:{$color}'>{$href}{$num}</a></strong>", $delete));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #11
0
ファイル: sshd.tests.php プロジェクト: BillTheBest/1.6.x
function ssh_connect_list()
{
    $uid = $_GET["uid"];
    if (!is_file("ressources/logs/web/{$uid}.ssh")) {
        json_error_show("No lines...");
    }
    $f = file("ressources/logs/web/{$uid}.ssh");
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    if ($_POST["sortorder"] == "desc") {
        krsort($f);
    }
    if ($_POST["query"] != null) {
        $search = $_POST["query"];
        $search = str_replace(".", "\\.", $search);
        $search = str_replace("*", ".*?", $search);
    }
    $c = 0;
    while (list($num, $ligne) = each($f)) {
        $c++;
        if (!preg_match("#{$search}#", $ligne)) {
            continue;
        }
        if (preg_match("#Bytes per second#", $ligne)) {
            $ligne = "<strong style='color:blue'>{$ligne}</strong>";
        }
        if (preg_match("#Transferred: sent#", $ligne)) {
            $ligne = "<strong style='color:blue'>{$ligne}</strong>";
        }
        $data['rows'][] = array('id' => md5($ligne), 'cell' => array("{$ligne}"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #12
0
function items()
{
    $sock = new sockets();
    $datas = unserialize(base64_decode($sock->getFrameWork("squid.php?squid-sessions=yes")));
    if (count($datas) == 0) {
        json_error_show("No data");
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = 0;
    $data['rows'] = array();
    $c = 0;
    while (list($num, $val) = each($datas)) {
        if ($val["USER"] == null) {
            $val["USER"] = $val["CLIENT"];
        } else {
            $val["USER"] = $val["USER"] . "<br><i style='font-size:11px'>{$val["CLIENT"]}</i>";
        }
        $c++;
        $data['rows'][] = array('id' => "{$num}", 'cell' => array("<span style='font-size:12px;color:{$color}'>{$val["USER"]}</a></span>", "<span style='font-size:12px;color:{$color}'>{$val["URI"]}</a></span>", "<span style='font-size:12px;color:{$color}'>{$val["SINCE"]}</span>"));
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #13
0
ファイル: squid.browsers.php プロジェクト: BillTheBest/1.6.x
function items()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $RULEID = $_GET["RULEID"];
    $search = '%';
    $table = "UserAgents";
    $page = 1;
    if ($q->COUNT_ROWS($table) == 0) {
        json_error_show("No data");
    }
    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_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}");
        }
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}`";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}");
        }
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}");
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        $data['rows'][] = array('id' => $ligne[time()], 'cell' => array($sql, "", "", ""));
        json_encode($data);
        return;
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $pattern_enc = urlencode($ligne["pattern"]);
        $data['rows'][] = array('id' => md5($ligne["pattern"]), 'cell' => array("<span style='font-size:14px;'>{$ligne["pattern"]}</span>", imgtootltip("plus-24.png", null, "Loadjs('squid.browsers-rules.php?ruleid-js=0&pattern={$pattern_enc}');") . "</span>"));
    }
    echo json_encode($data);
}
コード例 #14
0
function groups_list()
{
    $tpl = new templates();
    $q = new mysql();
    $MyPage = CurrentPageName();
    $table = "activedirectorygroups";
    $database = "artica_backup";
    $page = 1;
    $FORCE_FILTER = "";
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show($tpl->_ENGINE_parse_body("TABLE:{$table}<br>{error_no_datas}"));
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["query"] != null) {
        $_POST["query"] = "*{$_POST["query"]}*";
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        if (strpos(" {$search}", "%") > 0) {
            $FILTER = "AND (`{$_POST["qtype"]}` LIKE '{$search}') {$FORCE_FILTER}";
        }
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FILTER}{$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}\n{$sql}");
        }
        $total = $ligne["TCOUNT"];
    } else {
        if ($FORCE_FILTER != null) {
            $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}";
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
            if (!$q->ok) {
                json_error_show("{$q->mysql_error}\n{$sql}");
            }
            $total = $ligne["TCOUNT"];
        } else {
            $total = $q->COUNT_ROWS($table, $database);
        }
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if ($FILTER == null) {
        $FILTER = $FORCE_FILTER;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$FILTER} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $ligne["group"] = utf8_decode($ligne["group"]);
        $data['rows'][] = array('id' => $ligne["gpid"], 'cell' => array("<img src='img/win7groups-32.png'>", "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?members-js=yes&gpid={$ligne["gpid"]}');\" style='font-size:16px;text-decoration:underline'>{$ligne["group"]}</span>", "<span style='font-size:18px'>{$ligne["UsersNum"]}</span>"));
    }
    echo json_encode($data);
}
コード例 #15
0
function find_member_active_directory()
{
    if ($_POST["query"] != null) {
        $search = $_POST["query"];
    }
    $GLOBALS["NOUSERSCOUNT"] = false;
    $ou = base64_decode($_GET["ou"]);
    $sock = new sockets();
    $page = CurrentPageName();
    $tpl = new templates();
    if ($_POST["qtype"] == "group") {
        $_POST["qtype"] = "groupname";
    }
    if ($_POST["qtype"] == "find-member") {
        $_POST["qtype"] = "groupname";
    }
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    if ($_POST["sortname"] == "pattern") {
        $_POST["sortname"] = "groupname";
    }
    $error = "No dn";
    if (strlen($_GET["dn"]) > 0) {
        $table = "activedirectory_groupsNames";
        $database = "artica_backup";
        $_GET["dn"] = urldecode($_GET["dn"]);
        $FORCE_FILTER = "AND oudn='{$_GET["dn"]}'";
        $error = null;
    }
    $styla = "style='font-size:14px;text-decoration:underline;font-weight:bold'";
    $styleNum = "style='font-size:16px;font-weight:bold'";
    $q = new mysql();
    if ($q->COUNT_ROWS($table, $database) == 0) {
        json_error_show("{$table}: No item {$error}", 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_flexquery();
    if ($search != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}<br>\n{$sql}", 1);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("No item: {$sql}", 1);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $total;
    $data['rows'] = array();
    $_GET["dn"] = urlencode($_GET["dn"]);
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $text = utf8_encode($ligne["description"]);
        $dn = urlencode($ligne["dn"]);
        $js = "javascript:Loadjs('domains.edit.group.php?js=yes&group-id={$dn}&ou={$_GET["ou"]}&dn={$_GET["dn"]}&encoded=yes&tt={$t}&ttt={$tt}')";
        $data['rows'][] = array('id' => md5($ligne["groupname"]), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$js}\" {$styla}>{$ligne["groupname"]}</a>", "<span {$styleNum}>{$ligne["UsersCount"]}</span>", "<span style='font-size:14px'>{$text}</span>", "&nbsp;"));
    }
    echo json_encode($data);
}
コード例 #16
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_squid_builder();
    $ID = $_GET["ID"];
    $FORCE_FILTER = null;
    $search = '%';
    $table = "webfilters_sqitems";
    $page = 1;
    if ($q->COUNT_ROWS($table) == 0) {
        json_error_show("no item");
    }
    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_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE gpid={$ID} {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE gpid={$ID} {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE gpid={$ID} {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        json_error_show($q->mysql_error);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no item");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $val = 0;
        $disable = Field_checkbox("itemid_{$ligne['ID']}", 1, $ligne["enabled"], "EnableDisableItem('{$ligne['ID']}')");
        $macname = $q->MAC_TO_NAME($ligne['pattern']);
        $ligne['pattern'] = utf8_encode($ligne['pattern']);
        $delete = imgtootltip("delete-24.png", "{delete} {$ligne['pattern']}", "DeleteGroupItem('{$ligne['ID']}')");
        $additional_text = null;
        if ($macname) {
            $additional_text = "<div style='font-size:10px'>{$macname}</div>";
        }
        $data['rows'][] = array('id' => "item{$ligne['ID']}", 'cell' => array("<span style='font-size:14px;font-weight:bold'>{$ligne['pattern']}</span>{$additional_text}", "<div style='padding-top:5px'>{$disable}</div>", $delete));
    }
    echo json_encode($data);
}
コード例 #17
0
function bridge_list(){
	$q=new mysql();
	$tpl=new templates();
	$database="artica_backup";
	$table="nics_bridge";
	$MyPage=CurrentPageName();
	$t=$_GET["t"];
	
	if(!$q->TABLE_EXISTS("nics_bridge", "artica_backup")){
		json_error_show("nics_bridge no such table...",1);
	}
	
	$sock=new sockets();
	$net=new networking();
	$ip=new IP();
	$interfaces=unserialize(base64_decode($sock->getFrameWork("cmd.php?ifconfig-interfaces=yes")));
	$ERROR_NO_PRIVS=$tpl->javascript_parse_text("{ERROR_NO_PRIVS}");
	$DisableNetworksManagement=$sock->GET_INFO("DisableNetworksManagement");
	if($DisableNetworksManagement==null){$DisableNetworksManagement=0;}
	
	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_flexquery();
	if($searchstring<>null){
		$sql="SELECT COUNT( * ) AS tcount FROM $table WHERE 1 $searchstring";
		$ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database));
		if(!$q->ok){json_error_show($q->mysql_error."<hr>".$sql,1);}
		$total = $ligne["tcount"];
	
	}else{
		$total = $q->COUNT_ROWS($table, $database);
	}
	
	if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
	if(!is_numeric($page)){$page=1;}
	if(!is_numeric($rp)){$rp=50;}
	$pageStart = ($page-1)*$rp;
	$limitSql = "LIMIT $pageStart, $rp";
	
	
	
	$sql="SELECT * FROM `$table` WHERE 1 $searchstring $ORDER $limitSql";
	$results = $q->QUERY_SQL($sql,$database);
	if(!$q->ok){json_error_show($q->mysql_error."<hr>".$sql,1);}
	
	
	$data = array();
	$data['page'] = $page;
	$data['total'] = $total;
	$data['rows'] = array();
	if(mysql_num_rows($results)==0){json_error_show("No rule set...",1);}
	
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$md=md5(serialize($ligne));
		$color="black";
		$ip=new IP();
		$cdir=$ligne["cdir"];
		$eth="br{$ligne["ID"]}";
		$eth_text="br{$ligne["ID"]}";
		
		if($ligne["cdir"]==null){
			$ligne["cdir"]=$net->array_TCP[$ligne["nic"]];
			$eth=$ligne["nic"];
		}
		
		if($ligne["cdir"]==null){
			$ligne["cdir"]=$net->array_TCP[$ligne["nic"]];
			$eth=$ligne["nic"];
		}
		$img="folder-network-48.png";
		
			
		$delete=imgsimple("delete-32.png",null,"Loadjs('$MyPage?network-bridge-delete-js={$ligne['ID']}&t=$t',true)");
		
		$js="Loadjs('$MyPage?network-bridge-js=yes&ID={$ligne['ID']}&t=$t',true);";
		$href="<a href=\"javascript:blur();\" OnClick=\"javascript:$js\" style='font-size:18px;color:$color;font-weight:normal;text-decoration:underline'>";
	
		
		$a=$ip->parseCIDR($cdir);
		if($a[0]==0){
			$img="warning-panneau-24.png";
			$cdir="<span style='color:red'>$cdir</span>";
		}
		$delete=imgsimple("delete-32.png",null,"Loadjs('$MyPage?network-bridge-delete-js={$ligne['ID']}&t=$t',true)");
	
		$js="Loadjs('$MyPage?network-bridge-js=yes&ID={$ligne['ID']}&t=$t',true);";
		$href="<a href=\"javascript:blur();\" OnClick=\"javascript:$js\" style='font-size:18px;color:$color;font-weight:normal;text-decoration:underline'>";
		$bridgedTo=bridgedTo($ligne["ID"]);
		$data['rows'][] = array(
			'id' => $ligne['ID'],
			'cell' => array(
				"<span style='font-size:18px;font-weight:bold;color:$color'>{$ligne['ID']}</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>$href$eth_text</a></span>",
				"
				<span style='margin:5px;float:right'>
					<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('$MyPage?network-bridge-associates-js=yes&ID={$ligne['ID']}&t=$t',true);\">
					<img src='img/add-32.png'></a>
				</span>		
				<span style='font-size:18px;font-weight:normal;color:$color'>

				{$ligne["name"]}
				$bridgedTo
				
				</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>{$ligne["ipaddr"]}</span>",
				"<span style='font-size:18px;font-weight:normal;color:$color'>{$ligne["netmask"]}</span>",
				$delete
			)
		);
	}
	
	
echo json_encode($data);
}	
コード例 #18
0
function firewall_rules(){
	$tpl=new templates();
	$MyPage=CurrentPageName();
	$q=new mysql();
	$database="artica_backup";
	$search='%';
	$table="iptables";
	$page=1;
	$ORDER=null;
	$FORCE="flux='INPUT'";
	$allow=null;
	
	$total=0;
	if($q->COUNT_ROWS($table,$database)==0){json_error_show("no data");;}
	
	if($_POST["query"]<>null){
		$search="%{$_POST["query"]}%";
		$search=str_replace("*", "%", $search);
		$search=str_replace("%%", "%", $search);
		$search=str_replace("%%", "%", $search);
	}else{
		$search="%";
	}
	if(is_numeric($_GET["allow"])){$allow="AND allow={$_GET["allow"]}";}
	
	
	if(preg_match("#service=(.+)#", $_POST["qtype"],$re)){
		$servcie="AND `service`='{$re[1]}'";
		
	}
	$FORCE="(flux='INPUT' $allow $servcie  AND `servername` LIKE '$search') OR (flux='INPUT' $allow $servcie AND `serverip` LIKE '$search')";
	
	
	
	
	if(isset($_POST["sortname"])){if($_POST["sortname"]<>null){$ORDER="ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";}}	
	if(isset($_POST['page'])) {$page = $_POST['page'];}
	
	
	
	
	$table="(SELECT * FROM iptables WHERE ($FORCE)) as t";
	$sql="SELECT COUNT(*) as TCOUNT FROM $table";
	$ligne=mysql_fetch_array($q->QUERY_SQL($sql,$database));
	$total = $ligne["TCOUNT"];
		
	
	if (isset($_POST['rp'])) {$rp = $_POST['rp'];}	
	
	$pageStart = ($page-1)*$rp;
	$limitSql = "LIMIT $pageStart, $rp";
	
	$sql="SELECT * FROM $table $ORDER $limitSql";	
	writelogs($sql,__FUNCTION__,__FILE__,__LINE__);
	$results = $q->QUERY_SQL($sql,$database);
	if(mysql_num_rows($results)==0){json_error_show("no data $sql");}
		
	$data = array();
	$data['page'] = $page;
	$data['total'] = $total;
	$data['rows'] = array();
	
	if(!$q->ok){json_error_show($q->mysql_error);}	
	$updated_from_community=$tpl->_ENGINE_parse_body("{updated_from_community}");
	$ports=$tpl->_ENGINE_parse_body("{ports}");
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$mouse="OnMouseOver=\"this.style.cursor='pointer'\" OnMouseOut=\"this.style.cursor='default'\"";
		$linkstyle="style='text-decoration:underline'";
		$id=$ligne["rulemd5"];
		if($ligne["servername"]==null){$ligne["servername"]=$ligne["serverip"];}
		$link="iptables_edit_rules('{$ligne["rulemd5"]}');";
		$disable=Field_checkbox("enabled_{$ligne["ID"]}",0,$ligne["disable"],"FirewallDisableRUle('{$ligne["ID"]}')");
		$log=Field_checkbox("log_{$ligne["ID"]}",1,$ligne["log"],"EnableLog('{$ligne["ID"]}')");
		$delete=imgtootltip("delete-32.png","{delete}","IptableDelete('{$ligne["rulemd5"]}')");
		$tooltip_add=null;
		if($ligne["events_block"]<>null){$ligne["events_block"]="<div style=font-size:12px> ".nl2br($ligne["events_block"])."</div>";}
		$icon="32-black-computer.png";
		if($ligne["community"]==1){
			$icon="32-black-computer-grey.png";
			$delete="<img src='img/delete-32-grey.png'>";
			$tooltip_add="<strong style=font-size:12px> $updated_from_community</strong><br>";
			$link="blur();";
			$mouse=null;
			$linkstyle=null;
		}
		
		$css2="style='border:0px;padding:0px;margin:0px;background-color:transparent;border-bottom:0px;vertical-align:middle' $mouse";
		
		if($ligne["service"]==null){$icon="32-black-computer.png";$link=null;}
		
		$subtext=$tpl->_ENGINE_parse_body("<div><i><span style='color:#660002;font-weight:bold'>{$ligne["serverip"]}</span> {added_on} {$ligne["saved_date"]}</i></div>");
		$port=$ligne["local_port"];
		if($ligne["multiples_ports"]<>null){$port=$ligne["multiples_ports"];}
		if($port==0){$port="{all}";}
		if(preg_match("#Range:(.+)#", $ligne["serverip"],$re)){
			$icon="datasource-32-grey.png";
			$link=null;
			$ligne["serverip"]=$re[1];
			$ligne["servername"]=$re[1];
		}
		
		$textAllow=$tpl->_ENGINE_parse_body("<span style='color:#660002;'>{deny}:</span>");
		if($ligne["allow"]==1){
			$icon="32-white-computer.png";
			$textAllow=$tpl->_ENGINE_parse_body("<span style='color:#4DA14C'>{allow}:</span>");
		}
		
		$port=$tpl->_ENGINE_parse_body($port);
		

		$final="<div $mouse OnClick=\"javascript:$link\"><strong style='font-size:14px'><code $linkstyle>$textAllow{$ligne["servername"]}</code></strong></div>$subtext<div><code>$ports:$port</code></div>{$ligne["events_block"]}$tooltip_add</div>";
		
	$data['rows'][] = array(
		'id' => $id,
		'cell' => array(
			"<img src='img/$icon' valign='middle'>",
			"<span style='font-size:12px'>$final</span>",
			"<div style='font-size:13px;padding-top:10px'>$disable</span>",
			"<div style='font-size:13px;padding-top:10px'>$log</span>",
			"<span style='font-size:13px'>$delete</span>",
		 
	
		)
		);
	}
	
	
echo json_encode($data);		

}
コード例 #19
0
function alias_list()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $t = $_GET["t"];
    $search = '%';
    $table = "freewebs_openbasedir";
    $database = "artica_backup";
    $page = 1;
    $FORCE_FILTER = " servername='{$_GET["servername"]}'";
    if (!$q->TABLE_EXISTS("freewebs_openbasedir", "artica_backup")) {
        json_error_show("freewebs_openbasedir no such table");
    }
    if ($q->COUNT_ROWS("freewebs_openbasedir", 'artica_backup') == 0) {
        json_error_show("No data");
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["query"] != null) {
        $_POST["query"] = "*" . $_POST["query"] . "*";
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    if (!$q->ok) {
        json_error_show($q->mysql_error);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show($q->mysql_error);
    }
    $sock = new sockets();
    while ($ligne = mysql_fetch_assoc($results)) {
        $delete = imgsimple("delete-24.png", "{delete}", "FreeWebDelAlias{$t}('{$ligne["ID"]}')");
        $data['rows'][] = array('id' => "{$ligne["ID"]}", 'cell' => array("<span style='font-size:16px;'>{$ligne["directory"]}</a></span>", $delete));
    }
    echo json_encode($data);
}
コード例 #20
0
ファイル: squid.dns.items.php プロジェクト: BillTheBest/1.6.x
function hosts()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $t = $_GET["t"];
    $search = '%';
    $table = "dnsmasq_records";
    $page = 1;
    $FORCE_FILTER = null;
    $total = 0;
    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_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        $total = $ligne["TCOUNT"];
    } else {
        $total = $q->COUNT_ROWS("dnsmasq_records");
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    if (is_numeric($rp)) {
        $limitSql = "LIMIT {$pageStart}, {$rp}";
    }
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$FORCE_FILTER} {$ORDER} {$limitSql}";
    $results = $q->QUERY_SQL($sql);
    $no_rule = $tpl->_ENGINE_parse_body("{no data}");
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        if (strpos($q->mysql_error, "doesn't exist") > 0) {
            $q->CheckTables();
            $results = $q->QUERY_SQL($sql);
        }
    }
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $fontsize = "16";
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $delete = imgsimple("delete-32.png", null, "Loadjs('{$MyPage}?delete-host-js=yes&ID={$ligne["ID"]}&t={$t}&tt={$_GET["tt"]}')");
        $editjs = "<a href=\"javascript:blur();\"\n\t\tOnClick=\"javascript:Loadjs('{$MyPage}?host-js=yes&ID={$ligne["ID"]}&t={$t}',true);\"\n\t\tstyle='font-size:{$fontsize}px;font-weight:bold;color:{$color};text-decoration:underline'>";
        $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT COUNT(ID) as tcount FROM dnsmasq_cname WHERE recordid='{$ligne["ID"]}'"));
        $hostname = $ligne["hostname"];
        $ipaddr = $ligne["ipaddr"];
        $Items = $ligne2["tcount"];
        $data['rows'][] = array('id' => $ligne['ID'], 'cell' => array("<span style='font-size:{$fontsize}px;font-weight:bold;color:{$color}'>{$editjs}{$hostname}</a><br><i style='font-size:12px'>&nbsp;{$grouptype}</i></span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$ipaddr}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$Items}</span>", "<span style='font-size:{$fontsize}px;font-weight:normal;color:{$color}'>{$delete}</span>"));
    }
    echo json_encode($data);
}
コード例 #21
0
ファイル: cyrus.mailboxes.php プロジェクト: BillTheBest/1.6.x
function items()
{
    $cyrus = new cyrus();
    $array = $cyrus->ListUsersBoxes($_POST["query"], $_GET["domain"]);
    if (!is_array($array)) {
        json_error_show("No mailbox");
    }
    if (count($array) == 0) {
        json_error_show("No mailbox");
    }
    $t = $_GET["t"];
    $c = 0;
    $data = array();
    $data['page'] = 1;
    $data['total'] = count($array);
    $data['rows'] = array();
    $search = null;
    if ($_POST["query"] != null) {
        $search = string_to_regex($_POST["query"]);
    }
    while (list($mailbox_name, $ligne) = each($array)) {
        $mailbox_name = trim($mailbox_name);
        if ($mailbox_name == null) {
            continue;
        }
        if ($search != null) {
            if (!preg_match("#{$search}#", $ligne)) {
                continue;
            }
        }
        if ($_GET["domain"] != null) {
            $mailbox_name = "{$mailbox_name}@{$_GET["domain"]}";
        }
        $delete = imgsimple("delete-24.png", "", "DeleteRealMailBox{$t}('{$mailbox_name}','" . md5($ligne) . "');");
        $c++;
        $data['rows'][] = array('id' => md5($ligne), 'cell' => array("<span style='font-size:16px;color:{$color}'><img src='img/32-mailbox.png'></span>", "<span style='font-size:16px;color:{$color}'>{$mailbox_name}</a></span>", "<span style='font-size:16px;color:{$color}'>{$delete}</a></span>"));
    }
    if ($c == 0) {
        json_error_show("No mailbox");
    }
    $data['total'] = $c;
    echo json_encode($data);
}
コード例 #22
0
function search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_meta();
    $search = '%';
    $table = "(SELECT * FROM system_schedules WHERE `uuid`='{$_GET["uuid"]}') as t";
    $page = 1;
    $ORDER = "ORDER BY ID DESC";
    $sock = new sockets();
    $DisableSquidDefaultSchedule = $sock->GET_INFO("DisableSquidDefaultSchedule");
    if (!is_numeric($DisableSquidDefaultSchedule)) {
        $DisableSquidDefaultSchedule = 0;
    }
    $schedules = new system_tasks();
    $ForceTaskType = $_GET["ForceTaskType"];
    if (!is_numeric($ForceTaskType)) {
        $ForceTaskType = 0;
    }
    $total = 0;
    $FORCE = 1;
    if ($ForceTaskType > 0) {
        $FORCE = "TaskType={$ForceTaskType}";
    }
    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_flexquery();
    $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$FORCE} {$searchstring}";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    $total = $ligne["TCOUNT"];
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    if (is_numeric($rp)) {
        $limitSql = "LIMIT {$pageStart}, {$rp}";
    }
    $sql = "SELECT *  FROM {$table} WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show("no schedule");
    }
    $q2 = new mysql();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no schedule", 1);
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $color = "black";
        $events = "&nbsp;";
        $md5 = md5("SquidTask{$ligne['ID']}");
        $TaskType = $ligne["TaskType"];
        $jstaskexplain = $tpl->javascript_parse_text($schedules->tasks_array[$ligne["TaskType"]]);
        $ligne["TaskType"] = $tpl->_ENGINE_parse_body($schedules->tasks_array[$ligne["TaskType"]]);
        $TimeDescription = $ligne["TimeDescription"];
        $enable = Field_checkbox($md5, 1, $ligne["enabled"], "SystemTaskEnable('{$md5}',{$ligne['ID']})");
        $delete = imgtootltip("delete-24.png", "{delete} {$ligne['ID']}", "SquidTaskDelete('{$ligne['ID']}')");
        $run = $tpl->_ENGINE_parse_body(imgtootltip("24-run.png", "{run} {$ligne['ID']}", "SystemTaskRun('{$ligne['ID']}','{$jstaskexplain}')"));
        if ($ligne["enabled"] == 0) {
            $color = "#A0A0A0";
        }
        $tablename = "Taskev{$ligne['ID']}";
        if (!$q->TABLE_EXISTS($tablename, "artica_events")) {
            $events = imgsimple("delete_disabled.png");
        } else {
            $evs = $q2->COUNT_ROWS($tablename, "artica_events");
            if ($evs > 0) {
                $events = imgsimple("events-24.png", "{events} {$ligne['ID']}", "Loadjs('squid.update.events.php?taskid={$ligne['ID']}&table={$tablename}')");
            }
        }
        $explainTXT = $tpl->_ENGINE_parse_body($schedules->tasks_explain_array[$TaskType]);
        $TimeText = $tpl->_ENGINE_parse_body($schedules->PatternToHuman($ligne["TimeText"]));
        $TimeText = str_replace("<br>", "", $TimeText);
        if (preg_match("#(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)\\s+(.+?)#", $TimeDescription, $re)) {
            $TimeDescription = $TimeText;
            $TimeText = null;
        }
        $span = "<a href=\"javascript:blur();\" OnClick=\"javascript:Loadjs('{$MyPage}?AddNewSchedule-js=yes&ID={$ligne['ID']}');\"\n\t\t style='font-size:16px;font-weight:bold;color:{$color};text-decoration:underline'>";
        $ligne["TimeDescription"] = utf8_encode($ligne["TimeDescription"]);
        $ligne["TaskType"] = utf8_encode($ligne["TaskType"]);
        //rowSquidTask
        $data['rows'][] = array('id' => "SquidTask" . $ligne['ID'], 'cell' => array("{$span}{$ligne['ID']}</a>", "{$span}{$ligne["TaskType"]}</a>", "{$span}{$TimeDescription}</a>\n\t\t<div style='font-size:11px'><i>{$explainTXT}</i></div>", "<div style='margin-top:5px'>{$enable}</div>", $delete));
    }
    echo json_encode($data);
}
コード例 #23
0
function showlist()
{
    $page = 1;
    $q = new mysql_squid_builder();
    $table = "(SELECT MAC FROM UserAutDB GROUP BY MAC) as t";
    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_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    if (isset($_GET["verbose"])) {
        echo "<hr><code>{$sql}</code></hr>";
    }
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        json_error_show($q->mysql_error, 1);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("{$table} no data", 1);
    }
    $data = array();
    $data['page'] = 1;
    $data['total'] = $total;
    $data['rows'] = array();
    while ($ligne = mysql_fetch_assoc($results)) {
        $mac = $ligne["MAC"];
        $ipaddr = ListIps($mac);
        $Listuid = Listuid($mac);
        $Listhostname = Listhostname($mac);
        $macser = urlencode($mac);
        $link = "<a href=\"javascript:blur();\" \n\t\tOnClick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC={$macser}')\"\n\t\tstyle='font-size:16px;text-decoration:underline'>";
        if (isset($_GET["callback"])) {
            $icon = imgtootltip("arrow-blue-left-24.png", null, "{$_GET["callback"]}('','{$mac}')");
        }
        $data['rows'][] = array('id' => md5(serialize($ligne)), 'cell' => array("<span style='font-size:16px'>{$link}{$mac}</a></span>", "<span style='font-size:16px'>{$ipaddr}</span>", "<span style='font-size:16px'>{$Listuid}</span>", "<span style='font-size:16px'>{$Listhostname}</span>", "<span style='font-size:16px'>{$icon}</span>"));
    }
    echo json_encode($data);
}
コード例 #24
0
function search()
{
    $Mypage = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $table = "webfilters_backupeddbs";
    $search = '%';
    $page = 1;
    $WHERE = "1";
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if ($_POST["query"] != null) {
        $_POST["query"] = "*{$_POST["query"]}*";
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND (`{$_POST["qtype"]}` LIKE '{$search}')";
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE {$WHERE} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["tcount"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE {$WHERE} {$ADD2}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE {$WHERE} {$searchstring} {$ORDER} {$limitSql}";
    $line = $tpl->_ENGINE_parse_body("{line}");
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (mysql_num_rows($results) == 0) {
        json_error_show("No data");
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $id = md5($ligne["filepath"]);
        $fullpath = base64_encode($ligne["filepath"]);
        $ligne["filepath"] = basename($ligne["filepath"]);
        $ligne["size"] = FormatBytes($ligne["size"] / 1024);
        $delete = imgsimple("delete-24.png", null, "BackupedItemsDelete('{$ligne["filepath"]}','{$fullpath}','{$id}')");
        $link = "<a href=\"{$Mypage}?f={$ligne["filepath"]}\" style='font-size:14px;text-decoration:underline'>";
        $data['rows'][] = array('id' => $id, 'cell' => array("<span style='font-size:14px'>{$ligne["zDate"]}</span>", "<span style='font-size:14px'>{$link}{$ligne["filepath"]}</a></span>", "<span style='font-size:14px'>{$ligne["size"]}</span>", $delete));
    }
    echo json_encode($data);
}
コード例 #25
0
function main_search()
{
    $MyPage = CurrentPageName();
    $main = new maincf_multi();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql();
    $t = $_GET["t"];
    $table = "sender_dependent_relay_host";
    $searchstring = string_to_flexquery();
    $page = 1;
    $table = "(SELECT * FROM sender_dependent_relay_host WHERE `hostname`='{$_GET["hostname"]}' ORDER by zOrders) 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 ($searchstring != null) {
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
        }
        $total = $ligne["tcount"];
    } else {
        $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_backup"));
        if (!$q->ok) {
            json_error_show("Mysql Error [" . __LINE__ . "]: <br>{$q->mysql_error}.<br>{$sql}", 1);
        }
        $total = $ligne["tcount"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql} ";
    $results = $q->QUERY_SQL($sql, "artica_backup");
    if (!$q->ok) {
        if ($q->mysql_error != null) {
            json_error_show(date("H:i:s") . "<br>SORT:{$_POST["sortname"]}:<br>Mysql Error [L." . __LINE__ . "]: {$q->mysql_error}<br>{$sql}", 1);
        }
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $fontsize = "22";
    $free_text = $tpl->javascript_parse_text("{free}");
    $computers = $tpl->javascript_parse_text("{computers}");
    $overloaded_text = $tpl->javascript_parse_text("{overloaded}");
    $orders_text = $tpl->javascript_parse_text("{orders}");
    $directories_monitor = $tpl->javascript_parse_text("{directories_monitor}");
    $dns_destination = $tpl->javascript_parse_text("{direct_mode}");
    $all_others_domains = $tpl->javascript_parse_text("{all_others_domains}");
    while ($ligne = mysql_fetch_assoc($results)) {
        $LOGSWHY = array();
        $overloaded = null;
        $loadcolor = "black";
        $StatHourColor = "black";
        $ColorTime = "black";
        $hostname = $ligne["hostname"];
        $domain = $ligne["domain"];
        $zmd5 = $ligne["zmd5"];
        $relay = $ligne["relay"];
        $relay_port = $ligne["relay_port"];
        $lookups = $ligne["lookups"];
        $relay_text = $main->RelayToPattern($relay, $relay_port, $lookups);
        $icon_grey = "ok32-grey.png";
        $icon_warning_32 = "warning32.png";
        $icon_red_32 = "32-red.png";
        $icon = "ok-32.png";
        $icon_f = $icon_grey;
        if ($ligne["enabled"] == 0) {
            $ColorTime = "#8a8a8a";
        }
        $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline;color:{$ColorTime}'";
        $style = " style='font-size:{$fontsize}px;color:{$ColorTime}'";
        $urijs = "Loadjs('{$MyPage}?item-js=yes&zmd5={$zmd5}&hostname={$hostname}');";
        $link = "<a href=\"javascript:blur();\" OnClick=\"javascript:{$urijs}\" {$styleHref}>";
        $orders = imgtootltip("48-settings.png", null, "Loadjs('artica-meta.menus.php?gpid={$ligne["ID"]}');");
        $delete = imgtootltip("delete-32.png", null, "Loadjs('{$MyPage}?item-delete-js={$zmd5}')");
        $up = imgsimple("arrow-up-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','up')");
        $down = imgsimple("arrow-down-32.png", null, "MoveSubRuleLinks{$t}('{$zmd5}','down')");
        if ($ligne["directmode"] == 1) {
            $relay_text = "{$dns_destination}";
        }
        if ($ligne["enabledauth"] == 1) {
            $icon_f = $icon;
        }
        if ($domain == "*") {
            $domain = $all_others_domains;
        }
        $cell = array();
        $cell[] = "<span {$style}>{$link}{$domain}</a></span>";
        $cell[] = "<span {$style}>{$link}{$relay_text}</a></span>";
        $cell[] = "<span {$style}><img src='img/{$icon_f}'></a></span>";
        $cell[] = "<span {$style}>{$up}</a></span>";
        $cell[] = "<span {$style}>{$down}</a></span>";
        $cell[] = "<span {$style}>{$delete}</a></span>";
        $data['rows'][] = array('id' => $ligne['uuid'], 'cell' => $cell);
    }
    echo json_encode($data);
}
コード例 #26
0
function showlist(){
	$page=1;
	$q=new mysql_squid_builder();
	$table=date("Ymd")."_daccess";

	if($_GET["uuid"]<>null){
		$q=new mysql_meta();
		$table="{$_GET["uuid"]}_CACHED_SITES";
	}



	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_flexquery();
	if($searchstring<>null){
		$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE 1 $searchstring";
		$ligne=mysql_fetch_array($q->QUERY_SQL($sql,"artica_events"));
		$total = $ligne["TCOUNT"];

	}else{
		$sql="SELECT COUNT(*) as TCOUNT FROM $table";
		$ligne=mysql_fetch_array($q->QUERY_SQL($sql,"artica_events"));
		$total = $ligne["TCOUNT"];
	}

	if (isset($_POST['rp'])) {$rp = $_POST['rp'];}
	if(!is_numeric($rp)){$rp=50;}


	$pageStart = ($page-1)*$rp;
	$limitSql = "LIMIT $pageStart, $rp";



	$sql="SELECT *  FROM $table WHERE 1 $searchstring $ORDER $limitSql";

	if(isset($_GET["verbose"])){echo "<hr><code>$sql</code></hr>";}
	$results = $q->QUERY_SQL($sql,"artica_events");

	if(!$q->ok){json_error_show($q->mysql_error,1);}

	if(mysql_num_rows($results)==0){
		json_error_show("$table no data",1);
	}




	$data = array();
	$data['page'] = 1;
	$data['total'] = mysql_num_rows($results);
	$data['rows'] = array();

	//if(mysql_num_rows($results)==0){$data['rows'][] = array('id' => $ligne[time()],'cell' => array($sql,"", "",""));}

	while ($ligne = mysql_fetch_assoc($results)) {
		$familysite=$ligne["familysite"];
		$size=FormatBytes($ligne["size"]/1024);
		$hits=FormatNumber($ligne["hits"]);
		
		$macenc=urlencode($ligne["MAC"]);
		$macuri="<a href=\"javascript:blur();\" 
		Onclick=\"javascript:Loadjs('squid.nodes.php?node-infos-js=yes&MAC=$macenc',true);\"
		style='text-decoration:underline;font-size:18px'>";

		if(strlen($ligne["hour"])==1){$ligne["hour"]="0{$ligne["hour"]}";}
			
		$data['rows'][] = array(
				'id' => md5(serialize($ligne)),
				'cell' => array(
						"<span style='font-size:16px'>{$ligne["hour"]}h</span>",
						"<span style='font-size:16px'>$familysite</span>",
						"<span style='font-size:16px'>{$ligne["category"]}</span>",
						"<span style='font-size:16px'>{$ligne["uid"]}</span>",
						"<span style='font-size:16px'>{$ligne["ipaddr"]}</span>",
						"<span style='font-size:16px'>$macuri{$ligne["MAC"]}</a></span>",
						"<span style='font-size:16px'>$hits</span>",
						"<span style='font-size:16px'>$size</span>"
				)
		);

	}


	echo json_encode($data);
}
コード例 #27
0
ファイル: nginx.peer.www.php プロジェクト: BillTheBest/1.6.x
function list_items()
{
    $STATUS = unserialize(@file_get_contents("/usr/share/artica-postfix/ressources/logs/web/nginx.status.acl"));
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $all_text = $tpl->_ENGINE_parse_body("{all}");
    $GLOBALS["CLASS_TPL"] = $tpl;
    $q = new mysql_squid_builder();
    $OrgPage = "miniadmin.proxy.reverse.php";
    $sock = new sockets();
    $EnableFreeWeb = intval($sock->GET_INFO("EnableFreeWeb"));
    if (!$q->FIELD_EXISTS("reverse_www", "zOrder")) {
        $q->QUERY_SQL("ALTER TABLE `reverse_www` ADD `zOrder` smallint(100) NOT NULL default '0'");
        if (!$q->ok) {
            echo $q->mysql_error_html();
        }
    }
    $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=0&t={$_GET["t"]}')");
    $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&ID={$ligne["ID"]}&dir=1&t={$_GET["t"]}')");
    $FORCE = "cache_peer_id={$_GET["ID"]}";
    $search = '%';
    $table = "reverse_www";
    $page = 1;
    $freeweb_compile_background = $tpl->javascript_parse_text("{freeweb_compile_background}");
    $reset_admin_password = $tpl->javascript_parse_text("{reset_admin_password}");
    $delete_freeweb_text = $tpl->javascript_parse_text("{delete_freeweb_text}");
    $delete_freeweb_nginx_text = $tpl->javascript_parse_text("{delete_freeweb_nginx_text}");
    $delete_freeweb_dnstext = $tpl->javascript_parse_text("{delete_freeweb_dnstext}");
    $total = 0;
    if ($q->COUNT_ROWS($table, "artica_backup") == 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_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
        $total = $ligne["TCOUNT"];
    } else {
        if (strlen($FORCE) > 2) {
            $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE}";
            $ligne = mysql_fetch_array($q->QUERY_SQL($sql, "artica_events"));
            $total = $ligne["TCOUNT"];
        } else {
            $total = $q->COUNT_ROWS($table, "artica_events");
        }
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric($rp)) {
        $rp = 50;
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE {$FORCE} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, "artica_events");
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}", 1);
    }
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    $CurrentPage = CurrentPageName();
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data");
    }
    $searchstring = string_to_flexquery();
    if (!AdminPrivs()) {
        $sql = "SELECT reverse_www.* FROM reverse_www,reverse_privs\n\t\tWHERE reverse_privs.servername=reverse_www.servername\n\t\tAND reverse_privs.uid='{$_SESSION["uid"]}' {$searchstring} ORDER BY servername LIMIT 0,250";
    }
    $results = $q->QUERY_SQL($sql, 'artica_backup');
    if (!$q->ok) {
        json_error_show($q->mysql_error . "<br>{$sql}");
    }
    $q1 = new mysql();
    $t = time();
    while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) {
        $servername = $ligne["servername"];
        $explain_text = NGINX_EXPLAIN_REVERSE($ligne["servername"]);
        $icon = "clound-in-64.png";
        $freewebicon = "64-firewall-search.png";
        $color = "black";
        $status = array();
        $portText = null;
        $md = md5(serialize($ligne));
        $RedirectQueries = $ligne["RedirectQueries"];
        $default_server = $ligne["default_server"];
        $SiteEnabled = $ligne["enabled"];
        $servername_enc = urlencode($servername);
        $Compile = imgsimple("apply-48.png", null, "Loadjs('nginx.single.progress.php?servername={$servername_enc}')");
        $limit_rate = $ligne["limit_rate"];
        $limit_rate_after = $ligne["limit_rate_after"];
        $DeleteFreeWeb = "Loadjs('{$MyPage}?unlink-websites-js=yes&servername={$servername_enc}&md={$md}')";
        $icon2 = imgsimple("reconfigure-48.png", null, "Loadjs('miniadmin.proxy.reverse.reconfigure.php?servername={$servername_enc}')");
        $up = imgsimple("arrow-up-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=0&t={$_GET["t"]}')");
        $down = imgsimple("arrow-down-32.png", null, "Loadjs('{$MyPage}?move-item-js=yes&servername={$servername_enc}&dir=1&t={$_GET["t"]}')");
        if ($ligne["DenyConf"] == 1) {
            $icon = "hearth-blocked-64.png";
        }
        if ($SiteEnabled == 0) {
            $icon = "domain-main-64-grey.png";
            $color = "#8a8a8a";
            $icon2 = "&nbsp;";
        }
        $delete = imgsimple("delete-48.png", null, $DeleteFreeWeb);
        $jsedit = imgsimple($icon, null, "Loadjs('nginx.site.php?servername={$servername_enc}')");
        $jsEditWW = $jsedit;
        $jseditA = $jsedit;
        $jseditC = imgsimple("script-48.png", null, "Loadjs('nginx.script.php?website-script-js=yes&servername={$servername_enc}')");
        if ($limit_rate > 0) {
            $limit_rate_after_caption = $tpl->_ENGINE_parse_body("{limit_rate_after_caption}");
            $limit_rate_after_caption = str_replace("%s", "{$limit_rate}MB/s", $limit_rate_after_caption);
            $limit_rate_after_caption = str_replace("%f", "{$limit_rate_after}MB", $limit_rate_after_caption);
            $status[] = "<br><span style='font-size:12px;font-weight:bold;color:#EEB853'>{$limit_rate_after_caption}</span>";
        }
        if (count($status) > 0) {
            $status_text = $tpl->_ENGINE_parse_body("<div style='font-size:12px'>" . @implode("", $status) . "</div>");
        }
        $FreeWebText = null;
        if ($EnableFreeWeb == 0) {
            if ($ligne["ipaddr"] == "127.0.0.1") {
                $ligne["ipaddr"] = "{error}";
            }
            if ($ligne["cache_peer_id"] == 0) {
                $ligne["cache_peer_id"] = -1;
            }
        }
        if ($ligne["owa"] == 1) {
            $freewebicon = "exchange-2010-64.png";
        }
        if ($ligne["poolid"] > 0) {
            $freewebicon = "64-cluster.png";
            $ligne2 = mysql_fetch_array($q->QUERY_SQL("SELECT poolname FROM nginx_pools WHERE ID='{$ligne["poolid"]}'"));
            $ligne["ipaddr"] = $ligne2["poolname"];
        }
        $stats = null;
        $FinalDestination = "{$ligne["ipaddr"]}{$FreeWebText}";
        if ($default_server == 1) {
            $servername = "{$servername} ({$all_text} * )";
            $icon = "free-web-64.png";
            if ($SiteEnabled == 0) {
                $icon = "free-web-64-grey.png";
            }
        }
        $data['rows'][] = array('id' => $ligne['categorykey'], 'cell' => array("{$jseditC}", "<a href=\"javascript:blur();\"\n\t\t\t\t\t\t\tstyle='font-size:18px;font-weight:bold;text-decoration:underline'\n\t\t\t\t\t\t\tOnClick=\"javascript:Loadjs('nginx.site.php?servername={$servername_enc}')\">{$servername}{$portText}</a>\n\t\t\t\t\t\t\t<br>{$status_text}\n\t\t\t\t\t\t\t{$explain_text}", $Compile, $delete));
    }
    echo json_encode($data);
}
コード例 #28
0
ファイル: setup.index.php プロジェクト: articatech/artica
function software_list_by_family()
{
    $sock = new sockets();
    $ARTICA_MAKE_STATUS = unserialize(base64_decode($sock->getFrameWork("services.php?ARTICA-MAKE=yes")));
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql();
    $search = '%';
    $table = "setup_center";
    $page = 1;
    $ORDER = "ORDER BY ID DESC";
    $database = "artica_backup";
    if ($_GET["FAMILY"] != null) {
        $_POST["qtype"] = $_GET["FAMILY"];
        if ($_POST["query"] == null) {
            $_POST["query"] = "*";
        }
    }
    $SOFTWARE_REMOVABLE = array("APP_POSTFIX" => true, "APP_SCANNED_ONLY" => true, "APP_SAMBA" => true, "APP_SAMBA35" => true, "APP_SAMBA36" => true, "APP_DNSMASQ" => true);
    $total = 0;
    if ($q->COUNT_ROWS($table, $database) == 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 ($_POST["query"] != null) {
        $_POST["query"] = "*" . $_POST["query"] . "*";
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("**", "*", $_POST["query"]);
        $_POST["query"] = str_replace("*", "%", $_POST["query"]);
        $search = $_POST["query"];
        $searchstring = "AND ( (FAMILY='{$_POST["qtype"]}' AND CODE_NAME_STRING LIKE '{$search}') OR (FAMILY='{$_POST["qtype"]}' AND CODE_NAME LIKE '{$search}'))";
        if ($_POST["qtype"] == "softwares") {
            $searchstring = "AND ( (CODE_NAME_STRING LIKE '{$search}') OR (CODE_NAME LIKE '{$search}'))";
        }
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1 {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}<hr>{$sql}", 1);
        }
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE 1";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}<hr>{$sql}", 1);
        }
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    if ($OnlyEnabled) {
        $limitSql = null;
    }
    $sql = "SELECT *  FROM `{$table}` WHERE 1 {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql, $database);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show("{$q->mysql_error}<hr>{$sql}", 1);
    }
    $span = "<span style='font-size:14px;font-weight:bold'>";
    $span18 = "<span style='font-size:18px;font-weight:bold'>";
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["CODE_NAME"] == "APP_OPENDKIM") {
            continue;
        }
        $productname = $ligne["CODE_NAME_STRING"];
        if (trim($productname) == null) {
            $productname = "{{$ligne["CODE_NAME"]}}";
        }
        if ($classtr == "oddRow") {
            $classtr = null;
        } else {
            $classtr = "oddRow";
        }
        $color = "black";
        $events = "&nbsp;";
        $progress = null;
        $install = imgsimple("32-install-soft.png", "{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')");
        $ID = md5(serialize($ligne));
        if ($ligne["nextversionstring"] == null) {
            $ligne["nextversionstring"] = "0.0.0";
        }
        $CODE_NAME_ABOUT = "&nbsp;";
        if (strlen($ligne["CODE_NAME_ABOUT"]) > 2) {
            $CODE_NAME_ABOUT = "<div style='font-size:10px'>{{$ligne["CODE_NAME_ABOUT"]}}</div>";
        }
        if ($ligne["curversionstring"] == null) {
            $color = "#8a8a8a";
            $full = base64_encode($tpl->_ENGINE_parse_body("{product_not_installed_explain}"));
            $ligne["curversionstring"] = $tpl->_ENGINE_parse_body("<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('admin.index.php?json-error-js={$full}');\" \n\t\t\tstyle=\"font-size:10px;font-weight:normal;nodiv;text-decoration:underline\">{product_not_installed_explain}</a>");
        }
        $full = base64_encode($tpl->_ENGINE_parse_body("{codename_setup_explain}&nbsp;{$ligne["CODE_NAME"]}"));
        $exp_codename = "<a href=\"javascript:blur();\" Onclick=\"javascript:Loadjs('admin.index.php?json-error-js={$full}');\" \n\t\tstyle=\"font-size:10px;font-weight:normal;nodiv;text-decoration:underline\">{$ligne["CODE_NAME"]}</a>";
        if ($ligne["CODE_NAME"] == "APP_CYRUS_IMAP") {
            $install = "<img src='img/32-install-soft-grey.png'>";
        }
        if ($ligne["upgrade"] == 1) {
            $install = imgsimple("software-synchronize-32.png", "{failed}:{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')");
            $progress = "<div style='float:right'><strong style='color:#E14542'>{$ligne["progress"]}% - {$ligne["progress_text"]}</strong></div><div></div>";
        }
        if ($ligne["progress"] > 100) {
            $install = imgsimple("software-remove-32.png", "{failed}:{install_upgrade}", "ApplicationSetup('{$ligne["CODE_NAME"]}')");
        }
        if (strlen($ligne["events"]) > 5) {
            $events = imgsimple("events-32.png", "{events}", "Loadjs('{$MyPage}?events-js=yes&CODE_NAME={$ligne["CODE_NAME"]}')");
        } else {
            if (is_file("ressources/install/{$ligne["CODE_NAME"]}.dbg")) {
                $events = imgsimple("events-32.png", "{events}", "Loadjs('{$MyPage}?events-js=yes&CODE_NAME={$ligne["CODE_NAME"]}')");
            }
        }
        $runningsinc = null;
        if (isset($ARTICA_MAKE_STATUS[$ligne["CODE_NAME"]])) {
            $install = "<img src=img/ajax-loader.gif>";
            $runningsinc = "<div><i style='font-weight:bold;color:black'>{running}: {since}: {$ARTICA_MAKE_STATUS[$ligne["CODE_NAME"]]}</i></div>";
        }
        $uninstall = imgsimple("check-32-grey.png");
        if ($SOFTWARE_REMOVABLE[$ligne["CODE_NAME"]]) {
            $uninstall = imgsimple("software-remove-32.png", null, "Loadjs('setup.index.php?remove-app-js=yes&app={$ligne["CODE_NAME"]}");
        }
        $data['rows'][] = array('id' => $ID, 'cell' => array($install, $tpl->_ENGINE_parse_body("<span style='font-size:14px;font-weight:bold;color:{$color}'>{$productname}\n\t\t<div style='font-size:11px'><i style='font-size:10px;font-weight:normal'>{codename}:{$exp_codename}</i>&nbsp;|&nbsp;<i style='font-size:10px;font-weight:normal'>{SUBFAMILY_{$ligne["SUBFAMILY"]}}</i>{$progress}{$runningsinc}</div>\n\t\t</span>"), "{$span18}{$ligne["curversionstring"]}</a></span>", "{$span18}{$ligne["nextversionstring"]}</a></span>", $events, "{$span}{$CODE_NAME_ABOUT}</a></span>", $uninstall));
    }
    echo json_encode($data);
}
コード例 #29
0
ファイル: squid.rdpproxy.php プロジェクト: articatech/artica
function accounts_search()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $sock = new sockets();
    $q = new mysql_squid_builder();
    $t = $_GET["t"];
    $tt = $_GET["tt"];
    $search = '%';
    $table = "rdpproxy_items";
    $page = 1;
    $data = array();
    $data['rows'] = array();
    $FORCE_FILTER = "userid='{$_GET["ID"]}'";
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (!$q->TABLE_EXISTS($table)) {
        $sql = "CREATE TABLE IF NOT EXISTS `squidlogs`.`rdpproxy_items` (\n\t\t\t`ID` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,\n\t\t\t`userid` BIGINT(11),\n\t\t\t`service` VARCHAR(128) ,\n\t\t\t`rhost` VARCHAR(128),\n\t\t\t`username` VARCHAR(128),\n\t\t\t`domain` VARCHAR(128),\n\t\t\t`password` VARCHAR(128),\n\t\t\t`servicetype` VARCHAR(15),\n\t\t\t`serviceport` smallint(15),\n\t\t\t`alive` INT UNSIGNED NOT NULL,\n\t\t\t`is_rec` smallint(1),\n\t\t\t KEY `username`(`username`),\n\t\t\t KEY `password`(`password`),\n\t\t\t KEY `service`(`service`),\n\t\t\t KEY `rhost`(`rhost`),\n\t\t\t KEY `userid`(`userid`)\n\t\t\t )  ENGINE = MYISAM;";
        $q->QUERY_SQL($sql);
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}", 1);
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $searchstring = string_to_flexquery();
    if ($searchstring != null) {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}", 1);
        }
        $total = $ligne["TCOUNT"];
    } else {
        $sql = "SELECT COUNT(*) as TCOUNT FROM `rdpproxy_items` WHERE {$FORCE_FILTER}";
        $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
        if (!$q->ok) {
            json_error_show("{$q->mysql_error}", 1);
        }
        $total = $ligne["TCOUNT"];
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT *  FROM `{$table}` WHERE {$FORCE_FILTER} {$searchstring} {$ORDER} {$limitSql}";
    writelogs($sql, __FUNCTION__, __FILE__, __LINE__);
    $results = $q->QUERY_SQL($sql);
    if (!$q->ok) {
        json_error_show("{$q->mysql_error},{$sql}", 1);
    }
    $data['page'] = $page;
    $data['total'] = $total;
    if (mysql_num_rows($results) == 0) {
        json_error_show("no data", 1);
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $val = 0;
        $color = "black";
        $download = "&nbsp;";
        $delete = imgsimple("delete-48.png", null, "ItemsDelete{$tt}('{$ligne['ID']}')");
        $href = "<a href=\"javascript:blur();\"\n\t\t\t\t\t\tOnClick=\"javascript:Loadjs('{$MyPage}?accounts-js=yes&userid={$_GET["ID"]}&ID={$ligne['ID']}&t={$t}&tt={$tt}');\"\n\t\t\t\t\t\tstyle=\"font-size:22px;text-decoration:underline;color:{$color}\">";
        $img = "computer-windows-48.png";
        if ($ligne['servicetype'] == "RDP") {
            if (!fsock_perform($ligne['rhost'], 3389)) {
                $img = "computer-windows-48-red.png";
            } else {
                $download = "<a href=\"{$MyPage}?rdp-download={$ligne['ID']}\"><img src='img/download-48.png'></a>";
            }
        }
        $data['rows'][] = array('id' => "ACC{$ligne['ID']}", 'cell' => array("\n\t\t\t\t\t\t<center><img src='img/{$img}'></center>", "{$href}{$ligne['service']}</a>", "{$href}{$ligne['username']}/{$ligne['service']}</a>", "{$href}{$ligne['rhost']}</a>", "<center{$href}{$ligne['servicetype']}</a></center>", "<center>{$download}</center>", "<center>{$delete}</center>"));
    }
    echo json_encode($data);
}
コード例 #30
0
function rules_proxies_search(){
	//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_squid_builder();
	$acl=new squid_acls();
	$ID=$_GET["ID"];
	$t0=$_GET["t"];
	$t=$_GET["tt"];
	$FORCE="aclid=$ID";

	$search='%';
	$table="wpad_destination";

	$page=1;

	if($q->COUNT_ROWS($table)==0){json_error_show("No datas");}

	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_flexquery();
	if($searchstring<>null){
		$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE $FORCE $searchstring";
		$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
		$total = $ligne["TCOUNT"];

	}else{
		$sql="SELECT COUNT(*) as TCOUNT FROM $table WHERE $FORCE";
		$ligne=mysql_fetch_array($q->QUERY_SQL($sql));
		$total = $ligne["TCOUNT"];
	}

	if (isset($_POST['rp'])) {$rp = $_POST['rp'];}



	$pageStart = ($page-1)*$rp;
	$limitSql = "LIMIT $pageStart, $rp";

	$sql="SELECT *  FROM $table WHERE $FORCE $searchstring $ORDER $limitSql";

	$results = $q->QUERY_SQL($sql);
	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($q->mysql_error);}
	
	
	while ($ligne = mysql_fetch_assoc($results)) {
		$val=0;
		$mkey=$ligne["zmd5"];
		$delete=imgsimple("delete-32.png",null,"DeleteObjectLinks$t('$mkey')");
		
		$up=imgsimple("arrow-up-32.png",null,"MoveObjectLinks$t('$mkey','up')");
		$down=imgsimple("arrow-down-32.png",null,"MoveObjectLinks$t('$mkey','down')");
		
		$data['rows'][] = array(
				'id' => "$mkey",
				'cell' => array(
						"<span style='font-size:16px;font-weight:bold'><a href=\"javascript:blur();\" 
							OnClick=\"javascript:MoveObjectLinksAsk$t('$mkey','{$ligne["zorder"]}')\"
							style='font-size:16px;font-weight:bold;text-decoration:underline'
							>[{$ligne["zorder"]}]</a></span>",
						"<span style='font-size:16px;font-weight:bold'>{$ligne["proxyserver"]}</span>",
						"<span style='font-size:16px;font-weight:bold'>{$ligne["proxyport"]}</span>",
						"<span style='font-size:16px;font-weight:bold'>$up</span>",
						"<span style='font-size:16px;font-weight:bold'>$down</span>",
						
						
						$delete)
		);
	}
	echo json_encode($data);
}