Skip to content

Commit

Permalink
Fixes #4172 - Incorrect RSS URLs on news and incorrect SEF URL example.
Browse files Browse the repository at this point in the history
  • Loading branch information
CaMer0n committed May 20, 2020
1 parent 80c5bd7 commit 74a3735
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion e107_core/url/news/sef_url.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function admin()
'name' => LAN_EURL_CORE_NEWS, // Module name
'label' => LAN_EURL_NEWS_REWRITEX_LABEL, // Current profile name
'description' => LAN_EURL_NEWS_REWRITEX_DESCR, //
'examples' => array('{SITEURL}news/1/news-title')
'examples' => array('{SITEURL}news/view/1/news-category/news-title')
),
'generate' => array('table'=> 'news', 'primary'=>'news_id', 'input'=>'news_title', 'output'=>'news_sef'),
'form' => array(), // Under construction - additional configuration options
Expand Down
2 changes: 1 addition & 1 deletion e107_plugins/news/e_rss.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function data($parms=null)
$topic = (!empty($parms['id']) && is_numeric($parms['id'])) ? " AND news_category = ".intval($parms['id']) : '';
$limit = vartrue($parms['limit'],10);

$rssQuery = "SELECT n.*, u.user_id, u.user_name, u.user_email, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n
$rssQuery = "SELECT n.*, u.user_id, u.user_name, u.user_email, u.user_customtitle, nc.category_name, nc.category_sef, nc.category_icon FROM #news AS n
LEFT JOIN #user AS u ON n.news_author = u.user_id
LEFT JOIN #news_category AS nc ON n.news_category = nc.category_id
WHERE n.news_class IN (".USERCLASS_LIST.") AND NOT (n.news_class REGEXP ".$nobody_regexp.") AND n.news_start < ".time()." AND (n.news_end=0 || n.news_end>".time().") {$render} {$topic} ORDER BY n.news_datestamp DESC LIMIT 0,".$limit;
Expand Down
41 changes: 22 additions & 19 deletions e107_plugins/rss_menu/e_meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,41 @@
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/rss_menu/e_meta.php,v $
| $Revision$
| $Date$
| $Author$
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }

global $PLUGINS_DIRECTORY;

$tp = e107::getParser();
$sql = e107::getDb();

if(USER_AREA && $sql->select("rss", "*", "rss_class='0' AND rss_limit>0 ORDER BY rss_name"))
{

$tp = e107::getParser();
$sql = e107::getDb();

while($row = $sql->fetch())
{
if(strpos($row['rss_url'], "*") === false) // Wildcard topic_id's should not be listed
{
// $url = SITEURL.$PLUGINS_DIRECTORY."rss_menu/rss.php?".$tp->toHTML($row['rss_url'], TRUE, 'constants, no_hook, emotes_off').".2";
// $url .= ($row['rss_topicid']) ? ".".$row['rss_topicid'] : "";

$url2 = rtrim(SITEURL,'/') . e107::url('rss_menu','rss', $row);
$url4 = rtrim(SITEURL,'/') . e107::url('rss_menu','atom', $row);

$name = $tp->toHTML($row['rss_name'], TRUE, 'no_hook, emotes_off');

echo "<link rel='alternate' type='application/rss+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, 'utf-8')." ".htmlspecialchars($name, ENT_QUOTES, 'utf-8')."' href='".$url2."' />\n";
echo "<link rel='alternate' type='application/atom+xml' title='".htmlspecialchars(SITENAME, ENT_QUOTES, 'utf-8')." ".htmlspecialchars($name, ENT_QUOTES, 'utf-8')."' href='".$url4."' />\n";

$title = htmlspecialchars(SITENAME, ENT_QUOTES, 'utf-8')." ".htmlspecialchars($name, ENT_QUOTES, 'utf-8');

e107::link([
'rel' => 'alternate',
'type' => 'application/rss+xml',
'title' => $title,
'href' => e107::url('rss_menu','rss', $row, array('mode'=>'full'))
]);

e107::link([
'rel' => 'alternate',
'type' => 'application/atom+xml',
'title' => $title,
'href' => e107::url('rss_menu','atom', $row, array('mode'=>'full'))
]);

}
}

unset($name, $title);
}
?>

0 comments on commit 74a3735

Please sign in to comment.