updated 13/03/22
Played around with rss and you can try this - i noticed guests where not allowed to view so that may have stopped it so the download file might as well let me know
there was a couple of small errors in the rss but seems to be working now you can check your rss feed
here
replace apps/views/blocks/rss_block.php
<?php
if ($_SESSION['loggedin'] == true) {
// Enter Rss Feed Url eg $feedUrl = "http://localhost/M-BiTsy/rss?dllink=1";
$feedUrl = "";
Style::block_begin(Lang::T("RSS"));
if (!$feedUrl) { ?>
<p class="text-center"><small>This would need editing with an rss feed of your choice.</small></p> <?php
} else {
$domOBJ = new DOMDocument();
$domOBJ->load($feedUrl);
$content = $domOBJ->getElementsByTagName("item");
foreach ($content as $data) {
$title = $data->getElementsByTagName("title")->item(0)->nodeValue;
$link = $data->getElementsByTagName("link")->item(0)->nodeValue;
echo "<small>".CutName($title, 20)." <br> <a href='$link'>".CutName($link, 20)."</a></small><br><br>";
}
}
Style::block_end();
}
replace app/controller.rss.php
<?php
class Rss
{
public function __construct()
{
Auth::user(0, 0);
}
public function index()
{
$cat = $_GET["cat"];
$dllink = (int) $_GET["dllink"];
$passkey = $_GET["passkey"];
$incldead = $_GET["incldead"];
if (!get_row_count("users", "WHERE passkey=" . sqlesc($passkey))) {
$passkey = "";
}
$where = "";
$wherea = array();
if (!$incldead) {
$wherea[] = "visible='yes'";
}
if ($cat) {
$cats = implode(", ", array_unique(array_map("intval", explode(",", (string) $cat))));
$wherea[] = "category in ($cats)";
}
if (Validate::Id($_GET["user"])) {
$wherea[] = "owner=$_GET[user]";
}
if ($wherea) {
$where = "WHERE " . implode(" AND ", $wherea);
}
$limit = "LIMIT 50";
header( "Content-type: text/xml");
echo ('<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">');
echo ('
<channel>
<title>' . Config::get('SITENAME') . '</title>
<link>' . URLROOT . '</link>
<description>' . htmlspecialchars(Config::get('SITENAME')) . ' RSS Feed</description>');
$res = DB::run("SELECT torrents.id, torrents.name, torrents.size, torrents.category, torrents.added, torrents.leechers, torrents.seeders, categories.parent_cat as cat_parent, categories.name AS cat_name FROM torrents LEFT JOIN categories ON category = categories.id $where ORDER BY added DESC $limit");
while ($row = $res->fetch(PDO::FETCH_LAZY)) {
list($id, $name, $size, $category, $added, $leechers, $seeders, $catname) = $row;
//$guid = "".URLROOT . "/torrent?id=$id&hit=1";
if ($dllink) {
if ($passkey) {
$link = "".URLROOT."/download?id=$id&passkey=$passkey";
} else {
$link = "".URLROOT."/download?id=$id";
}
} else {
$link = "".URLROOT . "/torrent?id=$id&hit=1";
}
$pubdate = date("r", TimeDate::sql_timestamp_to_unix_timestamp($added));
echo ("
<item>
<title>" . htmlspecialchars($name) . "</title>
<guid>" . htmlspecialchars($link) . "</guid>
<link>" . htmlspecialchars($link) . "</link>
<pubDate>" . $pubdate . "</pubDate> <category> " . $row["cat_parent"] . ": " . $row["cat_name"] . "</category>
<description>Category: " . $row["cat_parent"] . ": " . $row["cat_name"] . " Size: " . mksize($size) . " Added: " . $added . " Seeders: " . $seeders . " Leechers: " . $leechers . "</description>
</item>");
}
echo ('
</channel>
</rss>');
}
public function custom()
{
$resqn = DB::raw('categories', 'id, name, parent_cat', '', 'ORDER BY parent_cat ASC, sort_index ASC');
$data = [
'title' => Lang::T("CUSTOM_RSS_XML_FEED"),
'resqn' => $resqn
];
View::render('rss/custom', $data, 'user');
}
public function submit()
{
if ($_POST) {
$params = array();
if ($cats = $_POST["cats"]) {
$catlist = array();
foreach ($cats as $cat) {
if (is_numeric($cat)) {
$catlist[] = $cat;
}
}
if ($catlist) {
$params[] = "cat=" . implode(",", $catlist);
}
}
if ($_POST["incldead"]) {
$params[] = "incldead=1";
}
if ($_POST["dllink"]) {
$params[] = "dllink=1";
}
if (!$_POST["cookies"] && $_SESSION['loggedin'] == true) {
$params[] = "passkey=".Users::get('passkey')."";
}
if ($params) {
$param = "?" . implode("&", $params);
} else {
$param = "";
}
$mss = "Your RSS link is: <a href=\"".URLROOT."/rss$param\">".URLROOT."/rss$param</a><br/><br/>";
Redirect::autolink(URLROOT, $mss);
}
}
}
Last edited by M-jay
on 2022-03-13 08:28:58