コード例 #1
0
ファイル: rss.php プロジェクト: hongz1125/devil
}
$itemsarr = $wherearr = array();
$rssarr = array('charset' => $_SCONFIG['charset'], 'title' => $_SCONFIG['sitename'], 'link' => S_URL_ALL, 'description' => $_SCONFIG['sitename'], 'copyright' => 'Copyright(C) ' . $_SCONFIG['sitename'], 'generator' => 'SupeSite', 'lastBuildDate' => sgmdate($_SGLOBAL['timestamp'], $rssdateformat), 'items' => array());
if (!empty($catid)) {
    $rssarr['title'] = $catvalue['name'];
    $rssarr['link'] = geturl('action/category/catid/' . $catvalue['catid'], 1);
    $rssarr['description'] = $catvalue['name'];
    $rssarr['copyright'] = 'Copyright(C) ' . $_SCONFIG['sitename'];
}
$itemsarr = getrss($catid);
if (!empty($itemsarr)) {
    foreach ($itemsarr as $key => $value) {
        $rssarr['items'][] = array('title' => $value['subject'], 'link' => geturl('action/viewnews/itemid/' . $value['itemid'], 1), 'description' => $value['message'], 'category' => $value['name'], 'author' => $value['username'], 'pubDate' => sgmdate($value['dateline'], $rssdateformat));
    }
}
showrss($rssarr);
function showrss($rssarr)
{
    header("Content-type: application/xml");
    echo '<?xml version="1.0" encoding="' . $rssarr['charset'] . '"?>
			<rss version="2.0">
			  <channel>
			    <title>' . $rssarr['title'] . '</title>
			    <link>' . $rssarr['link'] . '</link>
			    <description>' . $rssarr['description'] . '</description>
			    <copyright>' . $rssarr['copyright'] . '</copyright>
			    <generator>' . $rssarr['generator'] . '</generator>
			    <lastBuildDate>' . $rssarr['lastBuildDate'] . '</lastBuildDate>';
    if (!empty($rssarr['items'])) {
        foreach ($rssarr['items'] as $key => $value) {
            echo '<item>
コード例 #2
0
ファイル: main.php プロジェクト: squidjam/LightNEasy
function shownews($post_integra = 1, $post_cabecalho = 9, $comenta = 0, $categ = -1)
{
    global $newsmessage, $set, $pagenum, $prefix;
    if ($_GET['action'] == "delete" && is_intval($_GET['id']) && is_intval($_GET['commentid']) && $_SESSION['adminlevel'] > 3) {
        dbquery("DELETE FROM " . $prefix . "comments WHERE id=" . $_GET['commentid']);
    }
    if (isset($_GET['id'])) {
        if (!is_intval($_GET['id'])) {
            die("news - Aha! Clever!");
        } else {
            $noticia_numero = $_GET['id'];
        }
    }
    if ($noticia_numero != "") {
        $query = "SELECT titulo,data,noticia,autor,email,visto, reg FROM " . $prefix . "noticias WHERE reg=" . $noticia_numero;
        if ($categ > -1) {
            $query .= " AND cat=" . $categ;
        }
    } else {
        $query = "SELECT titulo, data, noticia, autor, email, visto, reg FROM " . $prefix . "noticias";
        if ($categ > -1) {
            $query .= " WHERE cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT 0, {$post_integra}";
    }
    $row = dbquery($query);
    $first = false;
    while ($row_db = fetch_array($row)) {
        $out .= show_one_news($row_db['titulo'], $row_db['data'], $row_db['noticia'], $row_db['autor'], $row_db['email']);
        //check if there are comments on this news
        $res = dbquery("SELECT * FROM " . $prefix . "comments WHERE newsid=" . $row_db['reg'] . " ORDER BY time DESC");
        $num = num_rows($res);
        if ($_GET['showcomments'] == "1" || $comenta == 2) {
            //show the comments
            $ff = true;
            $i = 0;
            while ($row1 = fetch_array($res)) {
                if ($ff) {
                    $out .= "<div class=\"LNEnews_comments\">" . $newsmessage[143] . ":</div>";
                    $ff = false;
                }
                $out .= "<div class=\"LNEnews_comment\">\n";
                if ($_SESSION['adminlevel'] > 3) {
                    $out .= "\n<form method=\"post\" action=\"\" class=\"delete\">\n";
                    $out .= "<input type=\"hidden\" name=\"newsid\" value=\"" . $row1['newsid'] . "\" />\n";
                    $out .= "<input type=\"hidden\" name=\"id\" value=\"" . $row1['id'] . "\" />\n";
                    $out .= "<input type=\"hidden\" name=\"submit\" value=\"deletecomment\" />\n";
                    $out .= "<input type=\"image\" name=\"aaa\" src=\"images/editdelete.png\" value=\"\" title=\"{$newsmessage['174']}\" style=\"border: none; background: transparent; width: 16px; height: 16px;\"/>\n";
                    $out .= "</form>\n";
                }
                $out .= "<span class=\"time\">" . $newsmessage[112] . " " . data_formatada($row1['time']) . "</span>";
                $out .= "<span class=\"text\">" . decode($row1['text']) . "</span>";
                $out .= "<span class=\"poster\">" . $newsmessage[144] . ": </span>\n";
                /*				if($row1['postermail']!="")
                					$out.="<span class=\"author\"><a href=\"mailto:".decode($row1['postermail'])."\">".stripslashes(decode($row1['poster']))."</a></span>"; 
                				else */
                $out .= "<span class=\"author\">" . stripslashes(decode($row1['poster'])) . "</span>";
                $out .= "</div>\n";
                unset($_GET['showcomments']);
            }
        } else {
            if ($num) {
                $out .= "<a href=\"" . $_SERVER['SCRIPT_NAME'] . "?page=" . $pagenum . "&amp;id=" . $row_db['reg'] . "&amp;showcomments=1\">" . $newsmessage[143] . ": " . $num . "</a><br />\n";
            }
        }
        $out .= "\n<br />";
        if (!$first && ($comenta == 2 || $comenta == 1 && $_SESSION['user'] != "")) {
            $out .= commentform($row_db[6]);
        }
        $first = true;
        $novo_visto = $row_db[5] + 1;
        $query_add = dbquery("UPDATE " . $prefix . "noticias SET visto = {$novo_visto} WHERE reg = " . $row_db[6]);
    }
    $post_cabecalho_s = $post_cabecalho + $post_integra;
    if ($noticia_numero != "") {
        $query = "SELECT titulo, reg ,data, visto FROM " . $prefix . "noticias WHERE reg != " . $noticia_numero;
        if ($categ > -1) {
            $query .= " AND cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT 0, " . $post_cabecalho_s;
    } else {
        $query = "SELECT titulo, reg ,data, visto FROM " . $prefix . "noticias";
        if ($categ > -1) {
            $query .= " WHERE cat=" . $categ;
        }
        $query .= " ORDER BY reg DESC LIMIT {$post_integra}, " . $post_cabecalho_s;
    }
    $query = dbquery($query);
    $GETarray = $_GET;
    $first = true;
    while ($row_db = fetch_array($query)) {
        if ($first) {
            $first = false;
            $out .= "<div align=\"center\"><span style=\"font-size: 85%; font-weight: bold;\">{$newsmessage['113']}</span></div>";
            $out .= "<table border='0' align='center'><tr><td>{$newsmessage['12']}</td><td>{$newsmessage['114']}</td><td>{$newsmessage['115']}</td></tr>";
        }
        $GETarray['id'] = $row_db[1];
        $GETarray['showcomments'] = "0";
        $call = $_SERVER['SCRIPT_NAME'] . "?" . http_build_query($GETarray, '', '&amp;');
        $out .= "<tr><td><a href=\"" . $call . "\">" . stripslashes(decode($row_db["0"])) . "</a></td><td>" . data_formatada($row_db["2"]) . "</td><td>" . $row_db["3"] . "</td></tr>";
    }
    if (!$first) {
        $out .= "</table>";
    }
    $out .= "<span class=\"rss\">" . showrss() . "</span>\n";
    return $out;
}