Ejemplo n.º 1
0
function websitelist()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $table = "webtests";
    $country_select = null;
    $search = '%';
    $page = 1;
    $total = 0;
    if ($q->COUNT_ROWS($table) == 0) {
        $data['page'] = $page;
        $data['total'] = $total;
        $data['rows'] = array();
        echo json_encode($data);
        return;
    }
    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 (isset($_GET["p**n-macro"])) {
        $f = explode(",", "sex,boobs,penis,pussy,c**t,p**n,anal,teen,latina,cum,amateur,bondage,babe,bbw,bukkake,hentai,g******g,orgy,strip,pov,asian,nipple,t**s,b*****b,mature,squirt,shemale,nude,c**k,breast,virgin,chicks,escort,facial,horny,o****m,gay,lesbian,xxx,f**k,dick");
        while (list($index, $items) = each($f)) {
            if ($items == null) {
                continue;
            }
            $GR[] = "( `sitename` LIKE '%{$items}%')";
        }
        $table = "(SELECT *  FROM webtests WHERE 1 AND ( " . @implode(" OR ", $GR) . " ) ) as t";
    }
    if ($searchstring != null) {
        $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring}";
        $results = $q->QUERY_SQL($sql);
        $total = mysql_num_rows($results);
        writelogs("{$sql} = `{$total}`", __FUNCTION__, __FILE__, __LINE__);
    } else {
        if (!isset($_GET["p**n-macro"])) {
            $total = $q->COUNT_ROWS($table);
        } else {
            $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring}";
            $results = $q->QUERY_SQL($sql);
            $total = mysql_num_rows($results);
        }
        writelogs("{$sql} = `{$total}`", __FUNCTION__, __FILE__, __LINE__);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    if (!is_numeric(v)) {
        $rp = 1;
    }
    $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);
    $data = array();
    $data['page'] = $page;
    $data['total'] = $total;
    $data['rows'] = array();
    if (!$q->ok) {
        json_error_show($q->mysql_error . " {$sql}", 1);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show($q->mysql_error, 1);
    }
    writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
    $button = null;
    $arrayCtaz[null] = " --";
    $dans = new dansguardian_rules();
    while (list($categoryA, $rows) = each($dans->array_blacksites)) {
        $arrayCtaz[$categoryA] = $categoryA;
    }
    ksort($arrayCtaz);
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["sitename"] == "http:") {
            $q->QUERY_SQL("DELETE FROM {$table} WHERE sitename='{$ligne["sitename"]}'");
            continue;
        }
        $button = null;
        if (trim($ligne["category"]) != null) {
            $md = md5($ligne["sitename"]);
            $fff = base64_encode(serialize(array($ligne["sitename"], $ligne["category"])));
            $button = imgsimple("plus-24.png", "{$ligne["sitename"]} = {$ligne["category"]}", "ffCatAdd('{$md}','{$fff}')");
        }
        $delte = imgtootltip("delete-24.png", "{delete} {$ligne["sitename"]}", "DeleteTestCatSitename('{$ligne["sitename"]}')");
        $jscat = "javascript:Loadjs('squid.categorize.php?www={$ligne['sitename']}&day=&week=&month=')";
        if ($ligne["checked"] == 1) {
            $button = "<img src='img/error-24.png'>";
        }
        if (trim($ligne["category"]) == null) {
            $ligne["category"] = proposal("{$ligne['sitename']}");
        }
        $country = $ligne["Country"];
        if ($country != null) {
            $country = "<div>{$country}</div>";
        }
        $encodesite = urlencode($ligne['sitename']);
        $google = "<a href=\"http://www.google.com/search?q={$encodesite}&ie=utf-8&oe=utf-8&\" target='_blank'><img src='img/Google-18.png' style='float:right'></a>";
        $md = md5($ligne['sitename']);
        $fieldCatz = Field_array_Hash($arrayCtaz, "cat-{$md}");
        $button = imgsimple("arrow-blue-left-24.png", null, "performChoose('{$md}','{$ligne['sitename']}')");
        $data['rows'][] = array('id' => md5($ligne['sitename']), 'cell' => array("<a href=\"javascript:blur();\" OnClick=\"{$jscat}\" style='font-size:11px;font-weight:bold;text-decoration:underline'>{$ligne['zDate']}</span>", "{$google}<a href=\"javascript:blur();\" OnClick=\"{$jscat}\" style='font-size:11px;font-weight:bold;text-decoration:underline'>{$ligne['sitename']}</a></span>\n\t\t\t\t {$country} ", "<span style='font-size:11px;font-weight:bold'>{$ligne["category"]}</span>", $fieldCatz, $button, $delte));
    }
    echo json_encode($data);
}
function websitelist()
{
    $tpl = new templates();
    $MyPage = CurrentPageName();
    $q = new mysql_squid_builder();
    $table = "webtests";
    $country_select = null;
    $search = '%';
    $page = 1;
    $total = 0;
    $FORCE = null;
    if ($q->COUNT_ROWS($table) == 0) {
        $data['page'] = $page;
        $data['total'] = $total;
        $data['rows'] = array();
        echo json_encode($data);
        return;
    }
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    if (isset($_GET["fix-search-domain"])) {
        $FORCE = "AND family='{$_GET["fix-search-domain"]}'";
    }
    if ($_POST["query"] != null or $FORCE != null) {
        $_POST["query"] = "*" . trim($_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 * FROM {$table} WHERE 1 {$FORCE} {$searchstring}";
        $results = $q->QUERY_SQL($sql);
        $total = mysql_num_rows($results);
        writelogs("{$sql} = `{$total}`", __FUNCTION__, __FILE__, __LINE__);
    } else {
        $total = $q->COUNT_ROWS($table);
        writelogs("{$sql} = `{$total}`", __FUNCTION__, __FILE__, __LINE__);
    }
    if (isset($_POST['rp'])) {
        $rp = $_POST['rp'];
    }
    $pageStart = ($page - 1) * $rp;
    $limitSql = "LIMIT {$pageStart}, {$rp}";
    $sql = "SELECT * FROM {$table} WHERE 1 {$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($q->mysql_error, 1);
    }
    if (mysql_num_rows($results) == 0) {
        json_error_show($q->mysql_error, 1);
    }
    writelogs("{$sql}", __FUNCTION__, __FILE__, __LINE__);
    $button = null;
    while ($ligne = mysql_fetch_assoc($results)) {
        if ($ligne["sitename"] == "http:") {
            $q->QUERY_SQL("DELETE FROM {$table} WHERE sitename='{$ligne["sitename"]}'");
            continue;
        }
        $button = null;
        if (trim($ligne["category"]) != null) {
            $md = md5($ligne["sitename"]);
            $fff = base64_encode(serialize(array($ligne["sitename"], $ligne["category"])));
            $button = imgtootltip("plus-24.png", "{$ligne["sitename"]} = {$ligne["category"]}", "ffCatAdd('{$md}','{$fff}')");
        }
        $delte = imgtootltip("delete-24.png", "{delete} {$ligne["sitename"]}", "DeleteTestCatSitename('{$ligne["sitename"]}')");
        $jscat = "javascript:Loadjs('squid.categorize.php?www={$ligne['sitename']}&day=&week=&month=')";
        if ($ligne["checked"] == 1) {
            $button = "<img src='img/error-24.png'>";
        }
        if (trim($ligne["category"]) == null) {
            $ligne["category"] = proposal("{$ligne['sitename']}");
        }
        $country = $ligne["Country"];
        if ($country != null) {
            $country = "<div>{$country}</div>";
        }
        $data['rows'][] = array('id' => md5($ligne['sitename']), 'cell' => array("{$ligne['zDate']}</span>", "<a href=\"javascript:blur();\" OnClick=\"{$jscat}\" style='font-size:11px;font-weight:bold;text-decoration:underline'>{$ligne['sitename']}</a></span>{$country}", "<span style='font-size:11px;font-weight:bold'>{$ligne["category"]}</span>", $button, $delte));
    }
    echo json_encode($data);
}