예제 #1
0
파일: linking.php 프로젝트: cbsistem/nexos
function get_rss($url)
{
    trigger_error('The function get_rss() is deprecated in Dragonfly. Please change your call to CPG_RSS::read()', E_USER_WARNING);
    require_once CORE_PATH . 'classes/rss.php';
    return CPG_RSS::read($url);
}
예제 #2
0
파일: blocks.php 프로젝트: cbsistem/nexos
function BlocksEditSave($bid)
{
    global $prefix, $db;
    if (!Security::check_post()) {
        cpg_error(_SEC_ERROR);
    }
    $update['title'] = $_POST['title'];
    $update['content'] = $_POST['content'];
    $update['url'] = empty($_POST['url']) ? '' : $_POST['url'];
    $oldposition = $_POST['oldposition'];
    $update['bposition'] = $_POST['bposition'];
    $update['active'] = $_POST['active'];
    $update['refresh'] = isset($_POST['refresh']) ? intval($_POST['refresh']) : 0;
    $update['blanguage'] = $_POST['blanguage'];
    $update['blockfile'] = empty($_POST['blockfile']) ? '' : $_POST['blockfile'];
    $update['view'] = intval($_POST['view']);
    $update['weight'] = intval($_POST['weight']);
    $update['in_module'] = '';
    if ($update['url'] != '') {
        $update['time'] = time();
        if (0 !== stripos($update['url'], 'http://')) {
            $update['url'] = 'http://' . $update['url'];
        }
        require_once CORE_PATH . 'classes/rss.php';
        if (!($update['content'] = CPG_RSS::format(CPG_RSS::read($update['url'])))) {
            rssfail();
            return;
        }
    }
    # can be removed
    if ($oldposition != $update['bposition']) {
        $db->sql_query('UPDATE ' . $prefix . '_blocks SET weight=weight+1 WHERE weight>=' . $update['weight'] . " AND bposition='{$update['bposition']}'");
        $db->sql_query('UPDATE ' . $prefix . '_blocks SET weight=weight-1 WHERE weight>' . $update['weight'] . " AND bposition='{$oldposition}'");
    }
    $db->sql_update($prefix . '_blocks', $update, 'bid=' . $bid);
    $count = empty($_POST['in_module']) ? 0 : count($_POST['in_module']);
    for ($i = 0; $i < $count; $i++) {
        if (!intval($_POST['in_module'][$i])) {
            continue;
        } else {
            $new_in_modules[intval($_POST['in_module'][$i])] = intval($_POST['in_module'][$i]);
        }
    }
    $table_data = array();
    # select all data
    $result = $db->sql_query('SELECT a.mid, a.bid, MAX(b.weight) FROM ' . $prefix . '_blocks_custom a, ' . $prefix . '_blocks_custom b GROUP BY a.mid, a.bid');
    if ($db->sql_numrows($result)) {
        while ($row = $db->sql_fetchrow($result, SQL_NUM)) {
            # block is there but module id has not been posted so delete from it
            if ($row[1] == $bid && !isset($new_in_modules[$row[0]])) {
                $db->sql_uquery('DELETE FROM ' . $prefix . "_blocks_custom WHERE bid={$bid} AND mid=" . $row[0]);
                $db->sql_uquery('UPDATE ' . $prefix . "_blocks_custom SET weight=weight-1 WHERE weight>{$row[2]} AND mid=" . $row[0]);
            } else {
                if ($row[1] == $bid && isset($new_in_modules[$row[0]])) {
                    # module id has been posted and it exists within the table: clearing posteded data
                    $new_in_modules[$row[0]] = '';
                }
            }
            if (!isset($table_data[$row[0]])) {
                # save what we need for later use
                $table_data[$row[0]] = $row[2];
            }
        }
        $db->sql_freeresult($result);
    }
    $values = array();
    # insert anything left from the posted data
    if (!empty($new_in_modules)) {
        foreach ($new_in_modules as $mid) {
            if (!empty($mid)) {
                $values[] = "('{$bid}', '{$mid}', '{$update['bposition']}', '" . ($table_data[$mid] + 1) . "')";
            }
        }
    }
    if (!empty($values)) {
        $db->sql_uquery('INSERT INTO ' . $prefix . '_blocks_custom (bid, mid, side, weight) VALUES ' . implode(',', $values));
    }
    Cache::array_delete('blocks_list');
    URL::redirect(URL::admin('blocks'));
}
예제 #3
0
파일: rss.php 프로젝트: cbsistem/nexos
 function display($url, $items_limit = 10)
 {
     return CPG_RSS::format(CPG_RSS::read($url, $items_limit));
 }
예제 #4
0
파일: blocks.php 프로젝트: cbsistem/nexos
 private function rss($side, &$block)
 {
     global $db, $prefix;
     if ($block['time'] < time() - $block['refresh']) {
         require_once CORE_PATH . 'classes/rss.php';
         if (!($block['content'] = CPG_RSS::format(CPG_RSS::read($block['url'])))) {
             return trigger_error(_RSSPROBLEM . ' (' . $block['title'] . ')', E_USER_WARNING);
         }
         $db->sql_query('UPDATE ' . $prefix . '_blocks SET content=\'' . Fix_Quotes($block['content']) . '\', time=\'' . time() . '\' WHERE bid=\'' . $block['bid'] . '\'');
     }
     $this->assign($side, $block);
 }