mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Add a filter for RSS
This commit is contained in:
parent
10230e1386
commit
dbe33da7ba
2 changed files with 46 additions and 50 deletions
|
@ -3,58 +3,53 @@ header("Content-Type: application/rss+xml; charset=UTF8");
|
||||||
|
|
||||||
|
|
||||||
require_once '../videos/configuration.php';
|
require_once '../videos/configuration.php';
|
||||||
|
require_once '../objects/video.php';
|
||||||
|
|
||||||
$db = mysqli_connect($mysqlHost,$mysqlUser,$mysqlPass,$mysqlDatabase);
|
$db = mysqli_connect($mysqlHost, $mysqlUser, $mysqlPass, $mysqlDatabase);
|
||||||
|
$query = $db->query("SELECT * FROM `videos` WHERE `videos`.`status` = 'a' ORDER BY `videos`.`created` DESC LIMIT 50");
|
||||||
|
// send $_GET['catName'] to be able to filter by category
|
||||||
|
$rows = Video::getAllVideos("viewable");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$query = $db->query("SELECT * FROM `videos` WHERE `videos`.`status` = 'a' ORDER BY `videos`.`created` DESC LIMIT 10");
|
echo'<?xml version="1.0" encoding="UTF-8"?>'
|
||||||
|
?>
|
||||||
if ($db->affected_rows >= 1) {
|
|
||||||
echo'<?xml version="1.0" encoding="UTF-8"?>'?>
|
|
||||||
|
|
||||||
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:atom="http://www.w3.org/2005/Atom"
|
xmlns:atom="http://www.w3.org/2005/Atom"
|
||||||
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
|
||||||
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
|
xmlns:slash="http://purl.org/rss/1.0/modules/slash/">
|
||||||
|
|
||||||
<channel>
|
|
||||||
<title>RSS YouPHPTube</title>
|
|
||||||
<description>Rss Feed</description>
|
|
||||||
<link><?php echo $global['webSiteRootURL'] ;?></link>
|
|
||||||
<sy:updatePeriod>hourly</sy:updatePeriod>
|
|
||||||
<sy:updateFrequency>1</sy:updateFrequency>
|
|
||||||
|
|
||||||
<image>
|
|
||||||
<title>RSS Feed</title>
|
|
||||||
<url><?php echo $global['webSiteRootURL'] ;?>videos/userPhoto/logo.png</url>
|
|
||||||
<link><?php echo $global['webSiteRootURL'] ;?></link>
|
|
||||||
<width>144</width>
|
|
||||||
<height>40</height>
|
|
||||||
<description>YouPHPTube versione rss</description>
|
|
||||||
</image>
|
|
||||||
|
|
||||||
<?php
|
|
||||||
while ($row = $query->fetch_assoc()) {
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
||||||
<item>
|
<channel>
|
||||||
<title><?php echo htmlspecialchars ($row['title']); ?></title>
|
<title>RSS <?php echo $config->getWebSiteTitle(); ?></title>
|
||||||
<description><?php echo htmlspecialchars ($row['description']); ?></description>
|
<description>Rss Feed</description>
|
||||||
<link> <?php
|
<link><?php echo $global['webSiteRootURL']; ?></link>
|
||||||
echo $global['webSiteRootURL'] ;?>video/<?php echo $row['clean_title']; ?></link>
|
<sy:updatePeriod>hourly</sy:updatePeriod>
|
||||||
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
|
<sy:updateFrequency>1</sy:updateFrequency>
|
||||||
</item>
|
|
||||||
|
<image>
|
||||||
<?php
|
<title>RSS Feed</title>
|
||||||
}
|
<url><?php echo $global['webSiteRootURL']; ?>videos/userPhoto/logo.png</url>
|
||||||
?>
|
<link><?php echo $global['webSiteRootURL']; ?></link>
|
||||||
</channel>
|
<width>144</width>
|
||||||
|
<height>40</height>
|
||||||
|
<description>YouPHPTube versione rss</description>
|
||||||
|
</image>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
|
||||||
|
} {
|
||||||
|
?>
|
||||||
|
<item>
|
||||||
|
<title><?php echo htmlspecialchars($row['title']); ?></title>
|
||||||
|
<description><?php echo htmlspecialchars(nl2br($row['description'])); ?></description>
|
||||||
|
<link> <?php echo $global['webSiteRootURL']; ?>video/<?php echo $row['clean_title']; ?></link>
|
||||||
|
<pubDate><?php echo date('r', strtotime($row['created'])); ?></pubDate>
|
||||||
|
</item>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
|
@ -180,8 +180,9 @@ require_once $global['systemRootPath'] . 'objects/category.php'; ?>
|
||||||
"commands": function (column, row)
|
"commands": function (column, row)
|
||||||
{
|
{
|
||||||
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __("Edit"); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
|
var editBtn = '<button type="button" class="btn btn-xs btn-default command-edit" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __("Edit"); ?>"><span class="glyphicon glyphicon-edit" aria-hidden="true"></span></button>'
|
||||||
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + ' data-toggle="tooltip" data-placement="left" title="<?php echo __("Delete"); ?>"><span class="glyphicon glyphicon-erase" aria-hidden="true"></span></button>';
|
var deleteBtn = '<button type="button" class="btn btn-default btn-xs command-delete" data-row-id="' + row.id + '" data-toggle="tooltip" data-placement="left" title="<?php echo __("Delete"); ?>"><span class="glyphicon glyphicon-erase" aria-hidden="true"></span></button>';
|
||||||
return editBtn + deleteBtn;
|
var rssBtn = '<a class="btn btn-info btn-xs" target="_blank" href="<?php echo $global['webSiteRootURL']; ?>feed/?catName=' + row.clean_name + '" ><i class="fas fa-rss-square"></i></a>';
|
||||||
|
return editBtn + deleteBtn+rssBtn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).on("loaded.rs.jquery.bootgrid", function () {
|
}).on("loaded.rs.jquery.bootgrid", function () {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue