예제 #1
0
function AddNewSchedule_save()
{
    $users = new usersMenus();
    $q = new mysql_meta();
    $tpl = new templates();
    $task = new system_tasks();
    $task_type = $task->tasks_array;
    $info = $tpl->javascript_parse_text($task_type[$_POST["TaskType"]]);
    $defaultdesc = replace_accents($info);
    if ($_POST["TimeDescription"] == null) {
        $_POST["TimeDescription"] = $defaultdesc . " : {$_POST["TimeText"]}";
    }
    $_POST["TimeDescription"] = mysql_escape_string2($_POST["TimeDescription"]);
    $sql = "INSERT IGNORE INTO system_schedules (TimeDescription,TimeText,TaskType,enabled,uuid) \n\tVALUES('{$_POST["TimeDescription"]}','{$_POST["TimeText"]}','{$_POST["TaskType"]}',1,'{$_POST["uuid"]}')";
    if ($_POST["ID"] > 0) {
        $sql = "UPDATE system_schedules SET \n\t\t\tTimeDescription='{$_POST["TimeDescription"]}',\n\t\t\tTimeText='{$_POST["TimeText"]}',\n\t\t\tTaskType='{$_POST["TaskType"]}' WHERE ID={$_POST["ID"]}\n\t\t\t";
    }
    if (!$q->TABLE_EXISTS("system_schedules")) {
        $q->BuildTables();
    }
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $sock = new sockets();
    $sock->getFrameWork("artica.php?build-meta-schedules=yes&uuid={$_POST["uuid"]}");
}
function search()
{
    $MyPage = CurrentPageName();
    $page = CurrentPageName();
    $tpl = new templates();
    $sock = new sockets();
    $q = new mysql_meta();
    $table = "metagroups";
    $table = "webfiltering_categories";
    $searchstring = string_to_flexquery();
    $page = 1;
    if (isset($_POST["sortname"])) {
        if ($_POST["sortname"] != null) {
            $ORDER = "ORDER BY `{$_POST["sortname"]}` {$_POST["sortorder"]}";
        }
    }
    if (isset($_POST['page'])) {
        $page = $_POST['page'];
    }
    $sql = "SELECT COUNT( * ) AS tcount FROM {$table} WHERE 1 {$searchstring}";
    $ligne = mysql_fetch_array($q->QUERY_SQL($sql));
    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);
    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";
    $style = " style='font-size:{$fontsize}px'";
    $styleHref = " style='font-size:{$fontsize}px;text-decoration:underline'";
    $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}");
    if (!$q->TABLE_EXISTS("webfiltering_categories_link")) {
        $q->BuildTables();
    }
    while ($ligne = mysql_fetch_assoc($results)) {
        $LOGSWHY = array();
        $overloaded = null;
        $loadcolor = "black";
        $StatHourColor = "black";
        $ColorTime = "black";
        $uuid = $ligne["uuid"];
        $category = $ligne["category"];
        $zmd5 = $ligne["zmd5"];
        $icon_warning_32 = "warning32.png";
        $icon_red_32 = "32-red.png";
        $icon_check_on = "check-32.png";
        $icon_check_off = "check-32-grey.png";
        $orgQuery = $_POST["query"];
        $sql = "SELECT zmd5 FROM `webfiltering_categories_link` WHERE category='{$category}' AND gpid={$_GET["ID"]}";
        $ligne2 = mysql_fetch_array($q->QUERY_SQL($sql));
        $icon = imgsimple($icon_check_off, "{link}", "Loadjs('{$MyPage}?link-js=yes&gpid={$_GET["ID"]}&category={$category}')");
        if ($ligne2["zmd5"] != null) {
            $icon = imgsimple($icon_check_on, "{unlink}", "Loadjs('{$MyPage}?link-js=yes&gpid={$_GET["ID"]}&category={$category}')");
        }
        $cell = array();
        $cell[] = "<span {$style}>{$category}</a></span>";
        $cell[] = "{$icon}";
        $data['rows'][] = array('id' => $ligne['zmd5'], 'cell' => $cell);
    }
    echo json_encode($data);
}