|
|
@ -5,26 +5,23 @@ class Article extends Handler_Protected {
|
|
|
|
const ARTICLE_KIND_YOUTUBE = 3;
|
|
|
|
const ARTICLE_KIND_YOUTUBE = 3;
|
|
|
|
|
|
|
|
|
|
|
|
function redirect() {
|
|
|
|
function redirect() {
|
|
|
|
$id = (int) clean($_REQUEST['id'] ?? 0);
|
|
|
|
$article = ORM::for_table('ttrss_entries')
|
|
|
|
|
|
|
|
->table_alias('e')
|
|
|
|
$sth = $this->pdo->prepare("SELECT link FROM ttrss_entries, ttrss_user_entries
|
|
|
|
->join('ttrss_user_entries', [ 'ref_id', '=', 'e.id'], 'ue')
|
|
|
|
WHERE id = ? AND id = ref_id AND owner_uid = ?
|
|
|
|
->where('ue.owner_uid', $_SESSION['uid'])
|
|
|
|
LIMIT 1");
|
|
|
|
->find_one($_REQUEST['id']);
|
|
|
|
$sth->execute([$id, $_SESSION['uid']]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($row = $sth->fetch()) {
|
|
|
|
if ($article) {
|
|
|
|
$article_url = UrlHelper::validate(str_replace("\n", "", $row['link']));
|
|
|
|
$article_url = UrlHelper::validate($article->link);
|
|
|
|
|
|
|
|
|
|
|
|
if ($article_url) {
|
|
|
|
if ($article_url) {
|
|
|
|
header("Location: $article_url");
|
|
|
|
header("Location: $article_url");
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
|
|
|
|
|
|
|
print "URL of article $id is blank.";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
print_error(__("Article not found."));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
|
|
|
|
|
|
|
|
print "Article not found or has an empty URL.";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static function _create_published_article($title, $url, $content, $labels_str,
|
|
|
|
static function _create_published_article($title, $url, $content, $labels_str,
|
|
|
|