示例#1
0
文件: microxml.php 项目: philum/cms
function server()
{
    list($dr, $nod) = split_right('/', $_GET['table'], 1);
    $main = msql_read($dr, $nod, '');
    //p($main);
    if ($main) {
        $dscrp = flux_xml($main);
    }
    $host = $_SERVER['HTTP_HOST'];
    //$dscrp=str_replace('users/','http://'.$host.'/users/',$dscrp);
    //$dscrp=str_replace('img/','http://'.$host.'/img/',$dscrp);
    $xml = '<' . '?xml version="1.0" encoding="utf-8" ?' . '>' . "\n";
    //iso-8859-1//
    $xml .= '<rss version="2.0">' . "\n";
    $xml .= '<channel>' . "\n";
    $xml .= '<title>http://' . $host . '/msql/' . $_GET['table'] . '</title>' . "\n";
    $xml .= '<link>http://' . $host . '/</link>' . "\n";
    $xml .= '<description>' . count($main) . ' entries</description>' . "\n";
    $xml .= $dscrp;
    $xml .= '</channel>' . "\n";
    $xml .= '</rss>' . "\n";
    //$xml.='</xml>'."\n";
    if ($_GET['bz2']) {
        return bzcompress($xml);
    }
    if ($_GET["b64"]) {
        return base64_encode($xml);
    }
    return utf8_encode($xml);
}
示例#2
0
文件: rss1.php 项目: philum/cms
    $xml .= "<id>" . $id . "</id>\n";
    $xml .= "<img>" . $data[3] . "</img>\n";
    /*	if($data[3]){$xml.="<image><url>".$gmi."</url>
    		<title>".$data[2]."</title><link>".$url."</link></image>\n";}*/
    $xml .= "</item>" . "\n\n";
    return $xml;
}
//
if ($_GET['preview']) {
    $data = flux_data();
} else {
    $data = msql_read('', $_SESSION['qb'] . '_cache', '', 1);
}
if (is_array($data)) {
    foreach ($data as $k => $v) {
        $dscrp .= flux_xml($k, $v);
    }
}
$nb_arts = count($data);
$last_art = $v;
$nb_days = round((time() - ($v[0] ? $v[0] : $v['day'])) / 86400);
$varlist = "variables: hub/read/tag/topic/order(day DESC)/preview(yes-full)/nbj(number)/brut/";
//header("Content-Type: text/xml");
$xml = '<' . '?xml version="1.0" encoding="iso-8859-1" ?' . ">\n";
// standalone="yes"
$xml .= '<rss version="2.0">' . "\n";
//$xml.=' xml:lang="fr" xmlns:content="http://purl.org/rss/1.0/modules/content/"';
$xml .= '<channel>' . "\n";
$xml .= '<title>http://' . $_SERVER['HTTP_HOST'] . '/' . $_SESSION['qb'] . '</title>' . "\n";
$xml .= '<link>http://' . $_SERVER['HTTP_HOST'] . '/' . $_SESSION['qb'] . '/</link>' . "\n";
if ($nb_arts > 1) {
示例#3
0
文件: rss.php 项目: philum/cms
function plug_rss($hub, $preview)
{
    if ($hub) {
        $_GET['hub'] = $hub;
    }
    if ($preview == '=' or !$preview) {
        $preview = 2;
    }
    if (!$hub) {
        return slct_menus(ses('mn'), '/plug/rss/', '', '', '', 'kv');
    }
    require_once '../prog/lib.php';
    req('pop,art');
    require '../plug/sys.php';
    require '../plug/lib.php';
    $fnod = $_SESSION["qb"] . '_cache';
    $main = msql_read_b('users', $fnod, '', 1);
    $nb_arts = count($main);
    $lastid = lastid('qda');
    $last_art = $main[$lastid];
    $newest = key($main);
    $oldest = array_pop($main);
    $nb_days = round((time() - $oldest[0]) / 86400);
    $cache = 1;
    $f = '../plug/_data/' . $_SESSION["qb"] . '_' . $newest . '_' . $preview . '.xml';
    if (is_file($f) && !$_GET['rebuild'] && $cache) {
        return read_file($f);
    } else {
        $http = host();
        if ($preview) {
            req('tri,pop,art');
        }
        //spe,mod
        $xml .= '<' . '?xml version="1.0" encoding="iso-8859-1"?' . '>' . "\n";
        $xml .= '<rss version="2.0">' . "\n";
        $xml .= '<channel>' . "\n";
        $xml .= bal('title', $_SESSION['qb']) . "\n";
        $xml .= bal('link', $http) . "\n";
        $xml .= bal('description', $nb_arts . ' articles / ' . $nb_days . ' days - preview=' . $preview . ' - static url=' . $http . substr($f, 2)) . "\n";
        $xml .= bal('language', 'fr') . "\n";
        $xml .= bal('lastBuildDate', date("r", $last_art[0])) . "\n";
        if ($main) {
            $xml .= flux_xml($main, $preview) . "\n";
        }
        $xml .= '</channel>' . "\n";
        $xml .= '</rss>' . "\n";
        write_file($f, $xml);
        rss_del_old($newest);
    }
    //eye
    eye('rss');
    return $xml;
}