Пример #1
0
/**
 *
 *
 * @param unknown $params
 * @param unknown $bBlog  (reference)
 * @return unknown
 */
function smarty_function_getrss($params, &$bBlog)
{
    $outputcharset = 'UTF8';
    if (isset($params['id'])) {
        $rssrow = $bBlog->get_row("select * from " . T_RSS . " where url<>'' and id='" . $params['id'] . "'");
    } else {
        // get random one
        $rssrow = $bBlog->get_row("select * from " . T_RSS . " where url<>'' order by rand(" . time() . ") limit 0,1");
    }
    if (!isset($params['limit'])) {
        $params['limit'] = 20;
    }
    return get_rss($rssrow->url, $rssrow->input_charset, $outputcharset, $params['limit']);
}
Пример #2
0
/**
 *
 *
 * @param unknown $bBlog (reference)
 */
function admin_plugin_rss_run(&$bBlog)
{
    $pole = "";
    for ($i = 1; $i < 10; $i++) {
        if (isset($_POST['sending']) && $_POST['sending'] == "true") {
            $id = $_POST[id . $i];
            $ch = $_POST[ch . $i];
            $update_query = "UPDATE " . T_RSS . " SET `url` = '" . $id . "',`input_charset` = '" . $ch . "' WHERE `id` = '" . $i . "' LIMIT 1 ;";
            $bBlog->query($update_query);
        }
        $query = "select * from " . T_RSS . " where id=" . $i . ";";
        $row = $bBlog->get_row($query);
        $rssurl = $row->url;
        $w1250 = "";
        if ($row->input_charset == "W1250") {
            $w1250 = " selected";
        }
        $utf8 = "";
        if ($row->input_charset == "UTF8") {
            $utf8 = " selected";
        }
        if ($i / 2 == floor($i / 2)) {
            $class = 'high';
        } else {
            $class = 'low';
        }
        $pole .= '<tr class="' . $class . '"><td>' . $i . '</td><td><input type="text" name="id' . $i . '" size="20" value="' . $rssurl . '" class="text" /></td><td><select name="ch' . $i . '">';
        $pole .= '<option>I88592</option>';
        $pole .= '<option' . $w1250 . '>W1250</option>';
        $pole .= '<option' . $utf8 . '>UTF8</option>';
        $pole .= '</select></td></tr>';
    }
    $bBlog->assign('pole', $pole);
}