diff options
Diffstat (limited to 'classes')
-rw-r--r-- | classes/dlg.php | 47 | ||||
-rw-r--r-- | classes/feeditem/rss.php | 8 | ||||
-rw-r--r-- | classes/feedparser.php | 6 | ||||
-rw-r--r-- | classes/feeds.php | 1 | ||||
-rw-r--r-- | classes/handler/public.php | 46 | ||||
-rw-r--r-- | classes/pluginhandler.php | 4 | ||||
-rw-r--r-- | classes/pluginhost.php | 1 | ||||
-rw-r--r-- | classes/pref/prefs.php | 1 |
8 files changed, 59 insertions, 55 deletions
diff --git a/classes/dlg.php b/classes/dlg.php index 25a194bed..e3931bc3a 100644 --- a/classes/dlg.php +++ b/classes/dlg.php @@ -220,52 +220,5 @@ class Dlg extends Handler_Protected { //return; } - function newVersion() { - - $version_data = check_for_update(); - $version = $version_data['version']; - $id = $version_data['version_id']; - - if ($version && $id) { - print "<div class='tagCloudContainer'>"; - - print T_sprintf("New version of Tiny Tiny RSS is available (%s).", - "<b>$version</b>"); - - print "</div>"; - - $details = "http://tt-rss.org/redmine/versions/$id"; - $download = "http://tt-rss.org/#Download"; - - print "<p align='center'>".__("You can update using built-in updater in the Preferences or by using update.php")."</p>"; - - print "<div style='text-align : center'>"; - print "<button dojoType=\"dijit.form.Button\" - onclick=\"return window.open('$details')\">".__("See the release notes")."</button>"; - print "<button dojoType=\"dijit.form.Button\" - onclick=\"return window.open('$download')\">".__("Download")."</button>"; - print "<button dojoType=\"dijit.form.Button\" - onclick=\"return dijit.byId('newVersionDlg').hide()\">". - __('Close this window')."</button>"; - - } else { - print "<div class='tagCloudContainer'>"; - - print "<p align='center'>".__("Error receiving version information or no new version available.")."</p>"; - - print "</div>"; - - print "<div style='text-align : center'>"; - print "<button dojoType=\"dijit.form.Button\" - onclick=\"return dijit.byId('newVersionDlg').hide()\">". - __('Close this window')."</button>"; - print "</div>"; - - } - print "</div>"; - - } - - } ?> diff --git a/classes/feeditem/rss.php b/classes/feeditem/rss.php index c9a7467cd..27a364b81 100644 --- a/classes/feeditem/rss.php +++ b/classes/feeditem/rss.php @@ -51,6 +51,14 @@ class FeedItem_RSS extends FeedItem_Common { } function get_title() { + $title = $this->xpath->query("title", $this->elem)->item(0); + + if ($title) { + return trim($title->nodeValue); + } + + // if the document has a default namespace then querying for + // title would fail because of reasons so let's try the old way $title = $this->elem->getElementsByTagName("title")->item(0); if ($title) { diff --git a/classes/feedparser.php b/classes/feedparser.php index 239fdb7a6..9247bf450 100644 --- a/classes/feedparser.php +++ b/classes/feedparser.php @@ -115,6 +115,7 @@ class FeedParser { $this->type = $this::FEED_RSS; break; case "feed": + case "atom:feed": $this->type = $this::FEED_ATOM; break; default: @@ -141,8 +142,13 @@ class FeedParser { $link = $xpath->query("//atom:feed/atom:link[not(@rel)]")->item(0); if (!$link) + $link = $xpath->query("//atom:feed/atom:link[@rel='alternate']")->item(0); + + if (!$link) $link = $xpath->query("//atom03:feed/atom03:link[not(@rel)]")->item(0); + if (!$link) + $link = $xpath->query("//atom03:feed/atom03:link[@rel='alternate']")->item(0); if ($link && $link->hasAttributes()) { $this->link = $link->getAttribute("href"); diff --git a/classes/feeds.php b/classes/feeds.php index 5ec109614..52c3be97f 100644 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -580,6 +580,7 @@ class Feeds extends Handler_Protected { onclick=\"return cdmClicked(event, $id);\" class=\"titleWrap $hlc_suffix\"> <a class=\"title $hlc_suffix\" + title=\"".htmlspecialchars($line["title"])."\" target=\"_blank\" href=\"". htmlspecialchars($line["link"])."\">". $line["title"] . diff --git a/classes/handler/public.php b/classes/handler/public.php index 34d577441..46c74041c 100644 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -101,8 +101,7 @@ class Handler_Public extends Handler { $tpl->setVariable('ARTICLE_ID', htmlspecialchars($orig_guid ? $line['link'] : - get_self_url_prefix() . - "/public.php?url=" . urlencode($line['link'])), true); + $this->make_article_tag_uri($line['id'], $line['date_entered'])), true); $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); @@ -125,7 +124,7 @@ class Handler_Public extends Handler { $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); - $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true); + $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url'] ? $line["site_url"] : get_self_url_prefix()), true); $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title'] ? $line['feed_title'] : $feed_title), true); $tags = get_article_tags($line["id"], $owner_uid); @@ -140,7 +139,7 @@ class Handler_Public extends Handler { foreach ($enclosures as $e) { $type = htmlspecialchars($e['content_type']); $url = htmlspecialchars($e['content_url']); - $length = $e['duration']; + $length = $e['duration'] ? $e['duration'] : 1; $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true); $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true); @@ -707,7 +706,7 @@ class Handler_Public extends Handler { function index() { header("Content-Type: text/plain"); - print json_encode(array("error" => array("code" => 7))); + print error_json(13); } function forgotpass() { @@ -1002,5 +1001,42 @@ class Handler_Public extends Handler { <?php } + function cached_image() { + @$hash = basename($_GET['hash']); + + if ($hash) { + + $filename = CACHE_DIR . '/images/' . $hash . '.png'; + + if (file_exists($filename)) { + /* See if we can use X-Sendfile */ + $xsendfile = false; + if (function_exists('apache_get_modules') && + array_search('mod_xsendfile', apache_get_modules())) + $xsendfile = true; + + if ($xsendfile) { + header("X-Sendfile: $filename"); + header("Content-type: application/octet-stream"); + header('Content-Disposition: attachment; filename="' . basename($filename) . '"'); + } else { + header("Content-type: image/png"); + $stamp = gmdate("D, d M Y H:i:s", filemtime($filename)). " GMT"; + header("Last-Modified: $stamp", true); + readfile($filename); + } + } else { + header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); + echo "File not found."; + } + } + } + + private function make_article_tag_uri($id, $timestamp) { + + $timestamp = date("Y-m-d", strtotime($timestamp)); + + return "tag:" . parse_url(get_self_url_prefix(), PHP_URL_HOST) . ",$timestamp:/$id"; + } } ?> diff --git a/classes/pluginhandler.php b/classes/pluginhandler.php index 690305165..5ca5c17d3 100644 --- a/classes/pluginhandler.php +++ b/classes/pluginhandler.php @@ -11,10 +11,10 @@ class PluginHandler extends Handler_Protected { if (method_exists($plugin, $method)) { $plugin->$method(); } else { - print json_encode(array("error" => "METHOD_NOT_FOUND")); + print error_json(13); } } else { - print json_encode(array("error" => "PLUGIN_NOT_FOUND")); + print error_json(14); } } } diff --git a/classes/pluginhost.php b/classes/pluginhost.php index 1ad7afd60..457698291 100644 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -43,6 +43,7 @@ class PluginHost { const HOOK_FORMAT_ENCLOSURES = 26; const HOOK_SUBSCRIBE_FEED = 27; const HOOK_HEADLINES_BEFORE = 28; + const HOOK_RENDER_ENCLOSURE = 29; const KIND_ALL = 1; const KIND_SYSTEM = 2; diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index da11f55e1..096260bfb 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -23,7 +23,6 @@ class Pref_Prefs extends Handler_Protected { $this->pref_help = array( "ALLOW_DUPLICATE_POSTS" => array(__("Allow duplicate articles"), ""), - "AUTO_ASSIGN_LABELS" => array(__("Assign articles to labels automatically"), ""), "BLACKLISTED_TAGS" => array(__("Blacklisted tags"), __("When auto-detecting tags in articles these tags will not be applied (comma-separated list).")), "CDM_AUTO_CATCHUP" => array(__("Automatically mark articles as read"), __("This option enables marking articles as read automatically while you scroll article list.")), "CDM_EXPANDED" => array(__("Automatically expand articles in combined mode"), ""), |