]> git.wh0rd.org - tt-rss.git/commitdiff
Merge branch 'master' of git://github.com/asalthobaity/Tiny-Tiny-RSS into asalthobait...
authorAndrew Dolgov <noreply@fakecake.org>
Thu, 14 Aug 2014 08:07:20 +0000 (12:07 +0400)
committerAndrew Dolgov <noreply@fakecake.org>
Thu, 14 Aug 2014 08:07:20 +0000 (12:07 +0400)
classes/pref/filters.php
include/functions.php
include/rssfuncs.php
js/tt-rss.js
plugins/af_comics/filters/af_comics_darklegacy.php [new file with mode: 0644]
plugins/af_comics/filters/af_comics_gocomics.php
plugins/af_fsckportal/init.php
plugins/mail/init.php

index cfc20e4192fa7f38c7150a5034e8f67604d21387..170c1a5277bedd7fb378c23e27102e3cf019970a 100644 (file)
@@ -164,7 +164,9 @@ class Pref_Filters extends Handler_Protected {
                while ($line = $this->dbh->fetch_assoc($result)) {
 
                        $where = sql_bool_to_bool($line["cat_filter"]) ?
-                               getCategoryTitle($line["cat_id"]) : getFeedTitle($line["feed_id"]);
+                               getCategoryTitle($line["cat_id"]) :
+                               ($line["feed_id"] ?
+                                       getFeedTitle($line["feed_id"]) : __("All feeds"));
 
 #                      $where = $line["cat_id"] . "/" . $line["feed_id"];
 
index c16172856bfd8a742aa195ee3f3a1464cd65316a..ee061eca7131b7eaa12bacab58875da4f6e074cb 100644 (file)
@@ -10,6 +10,7 @@
        $fetch_last_error = false;
        $fetch_last_error_code = false;
        $fetch_last_content_type = false;
+       $fetch_last_error_content = false; // curl only for the time being
        $fetch_curl_used = false;
        $suppress_debugging = false;
 
 
                global $fetch_last_error;
                global $fetch_last_error_code;
+               global $fetch_last_error_content;
                global $fetch_last_content_type;
                global $fetch_curl_used;
 
                                } else {
                                        $fetch_last_error = "HTTP Code: $http_code";
                                }
+                               $fetch_last_error_content = $contents;
                                curl_close($ch);
                                return false;
                        }
        function getFeedTitle($id, $cat = false) {
                if ($cat) {
                        return getCategoryTitle($id);
-               } else if ($id == 0) {
-                       return __("All feeds");
                } else if ($id == -1) {
                        return __("Starred articles");
                } else if ($id == -2) {
index cdc490cb09d9f0440455884c29252d5bf7d14d08..f657f8413fffe379bda3d14385ebc57ea02b453d 100644 (file)
 
                                foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) {
                                        $article = $plugin->hook_article_filter($article);
+
+                                       $article["stored"] = array("title" => $article["title"],
+                                               "content" => $article["content"],
+                                               "link" => $article["link"],
+                                               "tags" => $article["tags"],
+                                               "author" => $article["author"]);
                                }
 
                                $entry_tags = $article["tags"];
                                $entry_plugin_data = db_escape_string($article["plugin_data"]);
                                $entry_content = $article["content"]; // escaped below
 
-
                                _debug("plugin data: $entry_plugin_data", $debug_enabled);
 
                                if ($cache_images && is_writable(CACHE_DIR . '/images'))
index a66411d11d507f0e123d942756088e5e3b32789c..7d6f22f877e529a7a4f34cf6d70f9eedc922153e 100644 (file)
@@ -500,6 +500,10 @@ function init() {
                                if (!isCdmMode()) {
                                        _widescreen_mode = !_widescreen_mode;
 
+                                       // reset stored sizes because geometry changed
+                                       setCookie("ttrss_ci_width", 0);
+                                       setCookie("ttrss_ci_height", 0);
+
                                        switchPanelMode(_widescreen_mode);
                                }
                };
@@ -555,17 +559,6 @@ function init_second_stage() {
                                        {width: getCookie("ttrss_fh_width") + "px" });
                        }
 
-                       if (parseInt(getCookie("ttrss_ci_width")) > 0) {
-                               if (_widescreen_mode) {
-                                       dijit.byId("content-insert").domNode.setStyle(
-                                               {width: getCookie("ttrss_ci_width") + "px" });
-
-                               } else {
-                                       dijit.byId("content-insert").domNode.setStyle(
-                                               {height: getCookie("ttrss_ci_height") + "px" });
-                               }
-                       }
-
                        dijit.byId("main").resize();
 
                        var tmph = dojo.connect(dijit.byId('feeds-holder'), 'resize',
@@ -706,6 +699,10 @@ function quickMenuGo(opid) {
                        if (!isCdmMode()) {
                                _widescreen_mode = !_widescreen_mode;
 
+                               // reset stored sizes because geometry changed
+                               setCookie("ttrss_ci_width", 0);
+                               setCookie("ttrss_ci_height", 0);
+
                                switchPanelMode(_widescreen_mode);
                        }
                        break;
@@ -1077,6 +1074,11 @@ function switchPanelMode(wide) {
                                height: 'auto',
                                borderTopWidth: '0px' });
 
+                       if (parseInt(getCookie("ttrss_ci_width")) > 0) {
+                               dijit.byId("content-insert").domNode.setStyle(
+                                       {width: getCookie("ttrss_ci_width") + "px" });
+                       }
+
                        $("headlines-frame").setStyle({ borderBottomWidth: '0px' });
                        $("headlines-frame").addClassName("wide");
 
@@ -1088,6 +1090,11 @@ function switchPanelMode(wide) {
                                height: '50%',
                                borderTopWidth: '0px'});
 
+                       if (parseInt(getCookie("ttrss_ci_height")) > 0) {
+                               dijit.byId("content-insert").domNode.setStyle(
+                                       {height: getCookie("ttrss_ci_height") + "px" });
+                       }
+
                        $("headlines-frame").setStyle({ borderBottomWidth: '1px' });
                        $("headlines-frame").removeClassName("wide");
 
diff --git a/plugins/af_comics/filters/af_comics_darklegacy.php b/plugins/af_comics/filters/af_comics_darklegacy.php
new file mode 100644 (file)
index 0000000..d87a3da
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+class Af_Comics_DarkLegacy extends Af_ComicFilter {
+
+       function supported() {
+               return array("Dark Legacy Comics");
+       }
+
+       function process(&$article) {
+               $owner_uid = $article["owner_uid"];
+
+               if (strpos($article["guid"], "darklegacycomics.com") !== FALSE) {
+                        if (strpos($article["plugin_data"], "af_comics,$owner_uid:") === FALSE) {
+
+                                print "DLC!" . $article["link"] . "\n";
+
+                               $res = fetch_file_contents($article["link"], false, false, false,
+                                        false, false, 0,
+                                        "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)");
+
+                               global $fetch_last_error_content;
+
+                               if (!$res && $fetch_last_error_content)
+                                       $res = $fetch_last_error_content;
+
+                               $doc = new DOMDocument();
+                               @$doc->loadHTML($res);
+
+                               $basenode = false;
+
+                               if ($doc) {
+                                       $xpath = new DOMXPath($doc);
+                                       $basenode = $xpath->query('//div[@class="comic"]')->item(0);
+
+                                       if ($basenode) {
+
+                                               $article["content"] = $doc->saveXML($basenode);
+                                               $article["plugin_data"] = "af_comics,$owner_uid:" . $article["plugin_data"];
+                                       }
+                               }
+                       } else if (isset($article["stored"]["content"])) {
+                               $article["content"] = $article["stored"]["content"];
+                       }
+
+                        return true;
+               }
+
+               return false;
+       }
+}
+?>
index bd57c08ff0636238df4b52d5e65922bc54232f3e..d950dbe6b60d8eb1bae0147980b629c652a4b12b 100644 (file)
@@ -17,32 +17,28 @@ class Af_Comics_GoComics extends Af_ComicFilter {
 
                                if ($doc) {
                                        $xpath = new DOMXPath($doc);
-                                       $entries = $xpath->query('(//img[@src])'); // we might also check for img[@class='strip'] I guess...
+                                       $entries = $xpath->query("(//img[@class='strip'])");
 
                                        $matches = array();
 
-                                       foreach ($entries as $entry) {
-
-                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*width.*)/i", $entry->getAttribute("src"), $matches)) {
-
+                                       if ($entries->length > 1) { // if we have more than one match, then get the zoomed one, which is the second for gocomics
+                                               $entry = $entries->item(1); // get the second element (items start at 0)
+                                               if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
                                                        $entry->setAttribute("src", $matches[0]);
                                                        $basenode = $entry;
-                                                       break;
                                                }
                                        }
 
-                    if (!$basenode) {
-                        // fallback on the smaller version
-                        foreach ($entries as $entry) {
-
-                            if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
-
-                                $entry->setAttribute("src", $matches[0]);
-                                $basenode = $entry;
-                                break;
-                            }
-                        }
-                    }
+                                       if (!$basenode) {
+                                               // fallback on the smaller version
+                                               foreach ($entries as $entry) {
+                                                       if (preg_match("/(http:\/\/assets.amuniversal.com\/.*)/i", $entry->getAttribute("src"), $matches)) {
+                                                               $entry->setAttribute("src", $matches[0]);
+                                                               $basenode = $entry;
+                                                               break;
+                                                       }
+                                               }
+                                       }
 
                                        if ($basenode) {
                                                $article["content"] = $doc->saveXML($basenode);
index 4795fd8efbabe9f80bc2b30bd696737179aa6dd8..4a5490274fe112b1beef00b3e4060fd3a7707fe5 100644 (file)
@@ -32,8 +32,6 @@ class Af_Fsckportal extends Plugin {
                                $xpath = new DOMXPath($doc);
                                $entries = $xpath->query('(//img[@src]|//a[@href])');
 
-                               $matches = array();
-
                                foreach ($entries as $entry) {
                                        if (preg_match("/feedsportal.com/", $entry->getAttribute("src"))) {
                                                $entry->parentNode->removeChild($entry);
@@ -42,7 +40,7 @@ class Af_Fsckportal extends Plugin {
                                        }
                                }
 
-                               $article["content"] = $doc->saveXML($basenode);
+                               $article["content"] = $doc->saveXML();
                                $article["plugin_data"] = "fsckportal,$owner_uid:" . $article["plugin_data"];
 
                        }
index 12e591c54b8f11657039988bea23cb73a4c2a705..4b1989f5fab983ff5aa37a27de0b3b1e25fe34ed 100644 (file)
@@ -135,15 +135,6 @@ class Mail extends Plugin {
 
                print "<table width='100%'><tr><td>";
 
-               print __('From:');
-
-               print "</td><td>";
-
-               print "<input dojoType=\"dijit.form.TextBox\" disabled=\"1\" style=\"width : 30em;\"
-                               value=\"$user_name <$user_email>\">";
-
-               print "</td></tr><tr><td>";
-
                $addresslist = explode(",", $this->host->get($this, "addresslist"));
 
                print __('To:');
@@ -191,8 +182,8 @@ class Mail extends Plugin {
 
                $mail = new ttrssMailer();
 
-               $mail->From = strip_tags($_REQUEST['from_email']);
-               $mail->FromName = strip_tags($_REQUEST['from_name']);
+               $mail->AddReplyTo(strip_tags($_REQUEST['from_email']),
+                       strip_tags($_REQUEST['from_name']));
                //$mail->AddAddress($_REQUEST['destination']);
                $addresses = explode(';', $_REQUEST['destination']);
                foreach($addresses as $nextaddr)