Пример #1
0
function cn_modify_online_own_hits()
{
    if ($expire = getoption('client_online')) {
        $online = cn_touch_get(cn_path_construct(SERVDIR, 'cdata') . 'online.php');
        return intval($online['%'][CLIENT_IP]);
    }
    return '';
}
Пример #2
0
    unlink($cdata_news . $afile);
}
// Remove old indexes
foreach ($indexes as $index) {
    if (file_exists($index)) {
        unlink($index);
    }
}
// Scan news file
$files = scan_dir(cn_path_construct(SERVDIR, 'cdata', 'news'), '\\d+-\\d+-\\d+');
// Add overall news
$news_index = array();
$draft_index = array();
$archive_index = array();
foreach ($files as $news_file) {
    $dt = cn_touch_get(cn_path_construct(SERVDIR, 'cdata', 'news') . $news_file);
    foreach ($dt as $id => $data) {
        // checks news existing in archive
        if ($afn = is_news_inarchive($id, $archive_data)) {
            $archive_index[$afn][$id] = db_index_create($data);
        }
        // checks draft
        if ($data['st'] == 'd') {
            $draft_index[$id] = db_index_create($data);
        } else {
            $news_index[$id] = db_index_create($data);
        }
    }
}
db_index_save($draft_index, 'draft');
db_index_save($news_index);
Пример #3
0
function db_news_load($location)
{
    if (substr($location, 0, 4) == '1970') {
        return array();
    }
    return cn_touch_get(SERVDIR . path_construct('cdata', 'news', $location . '.php'));
}