Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Valid RSS file TTv3
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2019-12-19 21:06:29
I forgot all about the RSS file for v3, so I just edited my old 2.08 that I fixed a long time ago. The RSS in v3 does not work properly. try this one. It has the code for prettyphoto in it, but if you dont use prettyphoto, dont worry about it, nothing changes. I also included images in RSS, if you dont like that, just remove the CDATA
rss.php

<?php
//
//  TorrentTrader v3
//   $LastChangedDate: 2019-12-19
//      $LastChangedBy: MicroMonkey
// Validated at: http://feedvalidator.org
//
require_once("backend/functions.php");
dbconn();

if (isset($_GET["custom"])){
  stdhead(T_("CUSTOM_RSS_XML_FEED"));
  begin_frame(T_("CUSTOM_RSS_XML_FEED"));

  $rqt = "SELECT id, name, parent_cat FROM categories ORDER BY parent_cat ASC, sort_index ASC";
  $resqn = SQL_Query_exec($rqt);

  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"] && $CURUSER)
        $params[] = "passkey=$CURUSER[passkey]";

     if ($params)
        $param = "?".implode("&amp;", $params);
     else
        $param = "";

     echo "Your RSS link is: <a href=\"$site_config[SITEURL]/rss.php$param\">$site_config[SITEURL]/rss.php$param</a><br/><br/>";
  }
  ?>
  What is RSS? Take a look at the <a href="http://wikipedia.org/wiki/RSS_%28file_format%29"target= "blank">Wiki</a> to <a href="http://wikipedia.org/wiki/RSS_%28file_format%29"target= "blank">learn more</a>.<br /><br />

  <form action="rss.php?custom" method="post">
  <table border="0" cellpadding="5" cellspacing="0" class="table_table">
  <tr>
     <td class="table_col1" valign="top">Categories:</td>
     <td class="table_col2" valign="top">(Leave blank for All)<br /><br />
     <?php while ($row = mysqli_fetch_array($resqn)) {
        echo '<input type="checkbox" name="cats[]" value="'.$row['id'].'" /> '.htmlspecialchars("$row[parent_cat] - $row[name]").'<br />';
     }
     ?>
     </td>
  </tr>
  <tr>
     <td class="table_col1"><?php echo T_("FEED_TYPE");?>:</td>
     <td class="table_col2">
        <input type="radio" name="dllink" value="1" checked="checked" /> Download link<br />
        <input type="radio" name="dllink" value="0" /> Details link<br />
     </td>
  </tr>
  <tr>
     <td class="table_col1"><?php echo T_("LOGIN_TYPE");?>:</td>
     <td class="table_col2">
          <input type="radio" name="cookies" value="0" checked="checked" /> Alternative (Passkey)<br/>
        <input type="radio" name="cookies" value="1"  /> Standard (cookies)<br/>

       </td>
  </tr>
  <tr>
     <td class="table_col1"><?php echo T_("INCLUDE_DEAD");?>:</td>
     <td class="table_col2"><input type="checkbox" name="incldead" value="1" /></td>
  </tr>
  <tr>
     <td colspan="2" align="center"><input type="submit" value="Get Link" /></td>
  </tr>
  </table>
  </form>
  <br /><br />
  <div align="left">
  Quick information regarding our RSS:
  <ul>
  <li>Our RSS feeds are properly validated by true RSS 2.0 XML Parsing Standards. Visit <a rel="prettyPhoto[iframes]" href="https://www.feedvalidator.org/check.cgi?url=<?php echo ''.$site_config["SITEURL"].'' ?>/rss.php?iframe=true" target= "blank">FeedValidator.org</a> to validate.</li>
  <li>Our feeds display only the latest 50 uploaded Torrents as default.</li>
  </ul>
  </div>
  <?php
  end_frame();
  stdfoot();
  die();
}

$cat = $_GET["cat"];
$dllink  = (int)$_GET["dllink"];

$passkey = $_GET["passkey"];
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 (is_valid_id($_GET["user"])) {
  $wherea[] = "owner=$_GET[user]";
}

if ($wherea)
  $where = "WHERE ".implode(" AND ", $wherea);


$limit = "LIMIT 50";

// start the RSS feed output
header("Content-Type: application/rss+xml; charset=$site_config[CHARSET]");

echo("<?xml version='1.0' encoding='$site_config[CHARSET]'?>");
echo("<rss version='2.0' xmlns:atom='http://www.w3.org/2005/Atom'><channel><generator>" . htmlspecialchars($site_config["SITENAME"]) . " RSS 2.0</generator><language>en</language>" .
"<title>" . $site_config["SITENAME"] . "</title><description>" . htmlspecialchars($site_config["SITENAME"]) . " RSS Feed</description><link>" . $site_config["SITEURL"] . "</link><copyright>Copyright " . htmlspecialchars($site_config["SITENAME"]) . "</copyright><pubDate>".date("r")."</pubDate>");

$res = SQL_Query_exec("SELECT torrents.descr, torrents.image1, 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");
?>
<atom:link href='<?php echo ''.$site_config["SITEURL"].'' ?>/rss.php' rel='self' type='application/rss+xml' />
<?php
while ($row = mysqli_fetch_array ($res)){
  list($descr,$image1,$id,$name,$size,$category,$added,$leechers,$seeders,$catname) = $row;

  if ($dllink) {
     if ($passkey)
        $link = "$site_config[SITEURL]/download.php?id=$id&amp;passkey=$passkey";
     else
        $link = "$site_config[SITEURL]/download.php?id=$id";
  } else {
     $link = $site_config["SITEURL"]."/torrents-details.php?id=$id&amp;hit=1";
  }

  $pubdate = date("r", sql_timestamp_to_unix_timestamp($added));

//    echo("<item><title>" . htmlspecialchars($name) . "</title><guid>" . $link . "</guid><link>" . $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 ("<item><title>" . htmlspecialchars($name) . "</title><guid>" . $link . "</guid><link>" . $link . "</link><pubDate>" . $pubdate . "</pubDate><category> " . $row["cat_parent"] . ": " . $row["cat_name"] . "</category><description> Category: " . $row["cat_name"] . "  Size: " . mksize($size) . " Added: " . $added . " There are " . $seeders . "  seeders   and  " . $leechers . " leechers <![CDATA[<br/>]]><![CDATA[<img src=/uploads/images/".$image1.">]]><![CDATA[<br/>]]>".$descr."</description></item>");
}
echo("</channel></rss>");
?>

TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
2019-12-20 02:59:03
Woww!   big thanks (y)
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 1
  • Members: 0
  • Guests online: 1
  • Comments: 3
  • Messages: 1,728