Пример #1
0
function checkJob(&$job)
{
    $last_run = strftime(DB_DATE_FORMAT, time() - $job->interval);
    $count = sqll_value("SELECT COUNT(*) FROM `sys_cron` WHERE `name`='&1' AND `last_run`>'&2' AND `last_run`<=NOW()", 0, $job->name, $last_run);
    if ($count != 1) {
        $job->run();
        sqll("INSERT INTO `sys_cron` (`name`, `last_run`) VALUES ('&1', NOW()) ON DUPLICATE KEY UPDATE `last_run`=NOW()", $job->name);
    }
}
Пример #2
0
function checkJob(&$job)
{
    global $ignore_interval;
    $max_last_run = strftime(DB_DATE_FORMAT, time() - ($ignore_interval ? 0 : $job->interval));
    $count = sqll_value("SELECT COUNT(*)\n         FROM `sys_cron`\n         WHERE\n            `name` = '&1'\n            AND `last_run` > '&2'\n            AND `last_run` <= NOW()", 0, $job->name, $max_last_run);
    if ($count != 1) {
        $job->run();
        sqll("INSERT INTO `sys_cron` (`name`, `last_run`)\n             VALUES ('&1', NOW())\n             ON DUPLICATE KEY UPDATE `last_run` = NOW()", $job->name);
    }
}
Пример #3
0
function geodb_landkreisFromLocid($locid)
{
    if (!is_numeric($locid)) {
        return 0;
    }
    $locid = $locid + 0;
    $rs = sqll("SELECT `rb`.`text_val` `regierungsbezirk` FROM `geodb_textdata` `ct`, `geodb_textdata` `rb`, `geodb_hierarchies` `hr` WHERE `ct`.`loc_id`=`hr`.`loc_id` AND `hr`.`id_lvl5`=`rb`.`loc_id` AND `ct`.`text_type`=500100000 AND `rb`.`text_type`=500100000 AND `ct`.`loc_id`='&1' AND `hr`.`id_lvl5`!=0", $locid);
    if ($r = sql_fetch_array($rs)) {
        return $r['regierungsbezirk'];
    } else {
        return '';
    }
}
Пример #4
0
function getCacheIcon($user_id, $cache_id, $cache_status, $cache_userid, $iconname)
{
    $cacheicon_searchable = false;
    $cacheicon_type = "";
    $inactive = false;
    // mark if found
    if (isset($user_id)) {
        $found = 0;
        $resp = sqll("SELECT `type` FROM `cache_logs` WHERE `cache_id`='&1' AND `user_id`='&2' ORDER BY `type`", $cache_id, $user_id);
        while ($row = sql_fetch_assoc($resp)) {
            if ($found <= 0) {
                switch ($row['type']) {
                    case 1:
                    case 7:
                        $found = $row['type'];
                        $cacheicon_type = "-found";
                        $inactive = true;
                        break;
                    case 2:
                        $found = $row['type'];
                        $cacheicon_type = "-dnf";
                        break;
                }
            }
        }
    }
    if ($cache_userid == $user_id) {
        $cacheicon_type = "-owner";
        $inactive = true;
        switch ($cache_status) {
            case 1:
                $cacheicon_searchable = "-s";
                break;
            case 2:
                $cacheicon_searchable = "-n";
                break;
            case 3:
                $cacheicon_searchable = "-a";
                break;
            case 4:
                $cacheicon_searchable = "-a";
                break;
        }
    } else {
        switch ($cache_status) {
            case 1:
                $cacheicon_searchable = "-s";
                break;
            case 2:
                $inactive = true;
                $cacheicon_searchable = "-n";
                break;
            case 3:
                $inactive = true;
                $cacheicon_searchable = "-a";
                break;
            case 4:
                $inactive = true;
                $cacheicon_searchable = "-a";
                break;
        }
    }
    // cacheicon
    $iconname = mb_eregi_replace("\\..*", "", $iconname);
    $iconname .= $cacheicon_searchable . $cacheicon_type . ".gif";
    return array($iconname, $inactive);
}
Пример #5
0
 function save()
 {
     foreach ($this->nOptions as $record) {
         sqll("INSERT INTO `user_options` (`user_id`, `option_id`, `option_visible`, `option_value`) \r\n\t\t\t      VALUES ('&1', '&2', '&3', '&4') ON DUPLICATE KEY UPDATE `option_visible`='&3', `option_value`='&4'", $this->nUserId, $record['id'], $record['option_visible'], $this->tidy_html_description($record['option_value']));
     }
     return true;
 }