]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #761 from wallabag/dev 1.7.1
authorNicolas Lœuillet <nicolas@loeuillet.org>
Tue, 15 Jul 2014 09:49:24 +0000 (11:49 +0200)
committerNicolas Lœuillet <nicolas@loeuillet.org>
Tue, 15 Jul 2014 09:49:24 +0000 (11:49 +0200)
1.7.1

17 files changed:
inc/3rdparty/libraries/PHPePub/EPub.php
inc/3rdparty/libraries/feedwriter/FeedWriter.php
inc/3rdparty/libraries/readability/Readability.php [changed mode: 0644->0755]
inc/3rdparty/makefulltextfeed.php
inc/3rdparty/makefulltextfeedHelpers.php
inc/3rdparty/simple_html_dom.php [changed mode: 0644->0755]
inc/3rdparty/site_config/standard/.about.com.txt [new file with mode: 0644]
inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt [new file with mode: 0644]
inc/3rdparty/site_config/standard/politico.com.txt [changed mode: 0644->0755]
inc/poche/Database.class.php
inc/poche/Poche.class.php
inc/poche/Tools.class.php
inc/poche/config.inc.default.php
index.php
install/poche.sqlite [changed mode: 0755->0644]
locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo [changed mode: 0755->0644]
locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po [changed mode: 0755->0644]

index f1f41bd50b2ba68c5dc9e6aad8f75b79430a8cbc..d9b990b7a8a03afe47f5039b1d2382db76866fad 100644 (file)
@@ -41,6 +41,8 @@ class EPub {
 
     private $bookVersion = EPub::BOOK_VERSION_EPUB2;
 
+    private $debugInside = FALSE;
+
        public $maxImageWidth = 768;
     public $maxImageHeight = 1024;
 
@@ -132,10 +134,14 @@ class EPub {
      *
      * @return void
      */
-    function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) {
+    function __construct($bookVersion = EPub::BOOK_VERSION_EPUB2, $debugInside = FALSE, $languageCode = "en", $writingDirection = EPub::DIRECTION_LEFT_TO_RIGHT) {
         include_once("Zip.php");
                include_once("Logger.php");
 
+        if (!$debugInside) {
+            error_reporting(E_ERROR | E_PARSE);
+        }
+
                $this->bookVersion = $bookVersion;
                $this->writingDirection = $writingDirection;
                $this->languageCode = $languageCode;
index aa064afba3ca0bd6914ac6e5fd1e3fff2d39ef81..9446cddfeda84d1c8dd3b609c530f92b73b1d581 100755 (executable)
@@ -2,6 +2,7 @@
 define('RSS2', 1, true);\r
 define('JSON', 2, true);\r
 define('JSONP', 3, true);\r
+define('ATOM', 4, true);\r
 \r
  /**\r
  * Univarsel Feed Writer class\r
old mode 100644 (file)
new mode 100755 (executable)
index d0f09d7..4fa3ba6
@@ -679,6 +679,7 @@ class Readability
                                } else {
                                        $topCandidate->innerHTML = $page->documentElement->innerHTML;
                                        $page->documentElement->innerHTML = '';
+                                       $this->reinitBody();
                                        $page->documentElement->appendChild($topCandidate);
                                }
                        } else {
@@ -794,8 +795,7 @@ class Readability
                {
                        // TODO: find out why element disappears sometimes, e.g. for this URL http://www.businessinsider.com/6-hedge-fund-etfs-for-average-investors-2011-7
                        // in the meantime, we check and create an empty element if it's not there.
-                       if (!isset($this->body->childNodes)) $this->body = $this->dom->createElement('body');
-                       $this->body->innerHTML = $this->bodyCache;
+                       $this->reinitBody();
                        
                        if ($this->flagIsActive(self::FLAG_STRIP_UNLIKELYS)) {
                                $this->removeFlag(self::FLAG_STRIP_UNLIKELYS);
@@ -1134,5 +1134,18 @@ class Readability
        public function removeFlag($flag) {
                $this->flags = $this->flags & ~$flag;
        }
+       
+       /**\r
+        * Will recreate previously deleted body property\r
+        *\r
+        * @return void\r
+        */\r
+       protected function reinitBody() {\r
+               if (!isset($this->body->childNodes)) {\r
+                       $this->body = $this->dom->createElement('body');
+                       $this->body->innerHTML = $this->bodyCache;\r
+               }\r
+       }
+               
 }
 ?>
\ No newline at end of file
index 7a56be8c7c967cec629d0129feb3bb72d4ee8249..a081f88b29f6800dab4cd2249366e35d45cd33dd 100755 (executable)
@@ -28,7 +28,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 // Request this file passing it a web page or feed URL in the querystring: makefulltextfeed.php?url=example.org/article\r
 // For more request parameters, see http://help.fivefilters.org/customer/portal/articles/226660-usage\r
 \r
-error_reporting(E_ALL ^ E_NOTICE);\r
+//error_reporting(E_ALL ^ E_NOTICE);\r
 ini_set("display_errors", 1);\r
 @set_time_limit(120);\r
 \r
@@ -671,7 +671,11 @@ foreach ($items as $key => $item) {
                        $html .= $item->get_description();\r
                } else {\r
                        $readability->clean($content_block, 'select');\r
-                       if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block);\r
+                       // get base URL\r
+                       $base_url = get_base_url($readability->dom);\r
+                       if (!$base_url) $base_url = $effective_url;\r
+                       // rewrite URLs\r
+                       if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block);\r
                        // footnotes\r
                        if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) {\r
                                $readability->addFootnotes($content_block);\r
index 4e985372c27b7f0780d54535acf3401b6c24087b..ac872ab85910a5a0bed6a08bfb822b7b8aadf9b1 100755 (executable)
@@ -377,3 +377,13 @@ function debug($msg) {
                flush();
        }
 }
+
+function get_base_url($dom) {\r
+       $xpath = new DOMXPath($dom);\r
+       $base_url = @$xpath->evaluate('string(//head/base/@href)', $dom);\r
+       if ($base_url !== '') {\r
+               return $base_url;\r
+       } else {\r
+               return false;\r
+       }\r
+}
old mode 100644 (file)
new mode 100755 (executable)
index 43b94e5..9b73b10
@@ -34,7 +34,7 @@
  * @author S.C. Chen <me578022@gmail.com>\r
  * @author John Schlick\r
  * @author Rus Carroll\r
- * @version 1.5 ($Rev: 202 $)\r
+ * @version 1.5 ($Rev: 210 $)\r
  * @package PlaceLocalInclude\r
  * @subpackage simple_html_dom\r
  */\r
@@ -269,7 +269,10 @@ class simple_html_dom_node
                {\r
                        return $this->children;\r
                }\r
-               if (isset($this->children[$idx])) return $this->children[$idx];\r
+               if (isset($this->children[$idx]))\r
+               {\r
+                       return $this->children[$idx];\r
+               }\r
                return null;\r
        }\r
 \r
@@ -330,14 +333,14 @@ class simple_html_dom_node
        function find_ancestor_tag($tag)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }\r
+               if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }\r
 \r
                // Start by including ourselves in the comparison.\r
                $returnDom = $this;\r
 \r
                while (!is_null($returnDom))\r
                {\r
-                       if (is_object($debug_object)) { $debug_object->debugLog(2, "Current tag is: " . $returnDom->tag); }\r
+                       if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }\r
 \r
                        if ($returnDom->tag == $tag)\r
                        {\r
@@ -374,7 +377,7 @@ class simple_html_dom_node
                                        $text = " with text: " . $this->text;\r
                                }\r
                        }\r
-                       $debug_object->debugLog(1, 'Innertext of tag: ' . $this->tag . $text);\r
+                       $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);\r
                }\r
 \r
                if ($this->tag==='root') return $this->innertext();\r
@@ -532,7 +535,9 @@ class simple_html_dom_node
                        foreach ($head as $k=>$v)\r
                        {\r
                                if (!isset($found_keys[$k]))\r
+                               {\r
                                        $found_keys[$k] = 1;\r
+                               }\r
                        }\r
                }\r
 \r
@@ -554,7 +559,7 @@ class simple_html_dom_node
        protected function seek($selector, &$ret, $lowercase=false)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }\r
+               if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }\r
 \r
                list($tag, $key, $val, $exp, $no_key) = $selector;\r
 \r
@@ -615,7 +620,7 @@ class simple_html_dom_node
                                        // this is a normal search, we want the value of that attribute of the tag.\r
                                        $nodeKeyValue = $node->attr[$key];\r
                                }\r
-                               if (is_object($debug_object)) {$debug_object->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}\r
 \r
                                //PaperG - If lowercase is set, do a case insensitive test of the value of the selector.\r
                                if ($lowercase) {\r
@@ -623,7 +628,7 @@ class simple_html_dom_node
                                } else {\r
                                        $check = $this->match($exp, $val, $nodeKeyValue);\r
                                }\r
-                               if (is_object($debug_object)) {$debug_object->debugLog(2, "after match: " . ($check ? "true" : "false"));}\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}\r
 \r
                                // handle multiple class\r
                                if (!$check && strcasecmp($key, 'class')===0) {\r
@@ -645,12 +650,12 @@ class simple_html_dom_node
                        unset($node);\r
                }\r
                // It's passed by reference so this is actually what this function returns.\r
-               if (is_object($debug_object)) {$debug_object->debugLog(1, "EXIT - ret: ", $ret);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}\r
        }\r
 \r
        protected function match($exp, $pattern, $value) {\r
                global $debug_object;\r
-               if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}\r
 \r
                switch ($exp) {\r
                        case '=':\r
@@ -672,7 +677,7 @@ class simple_html_dom_node
 \r
        protected function parse_selector($selector_string) {\r
                global $debug_object;\r
-               if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}\r
 \r
                // pattern of CSS selectors, modified from mootools\r
                // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.\r
@@ -683,7 +688,7 @@ class simple_html_dom_node
 //             $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";\r
                $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";\r
                preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);\r
-               if (is_object($debug_object)) {$debug_object->debugLog(2, "Matches Array: ", $matches);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}\r
 \r
                $selectors = array();\r
                $result = array();\r
@@ -718,12 +723,14 @@ class simple_html_dom_node
                return $selectors;\r
        }\r
 \r
-       function __get($name) {\r
+       function __get($name)\r
+       {\r
                if (isset($this->attr[$name]))\r
                {\r
                        return $this->convert_text($this->attr[$name]);\r
                }\r
-               switch ($name) {\r
+               switch ($name)\r
+               {\r
                        case 'outertext': return $this->outertext();\r
                        case 'innertext': return $this->innertext();\r
                        case 'plaintext': return $this->text();\r
@@ -732,22 +739,30 @@ class simple_html_dom_node
                }\r
        }\r
 \r
-       function __set($name, $value) {\r
-               switch ($name) {\r
+       function __set($name, $value)\r
+       {\r
+               global $debug_object;\r
+               if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}\r
+\r
+               switch ($name)\r
+               {\r
                        case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;\r
                        case 'innertext':\r
                                if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;\r
                                return $this->_[HDOM_INFO_INNER] = $value;\r
                }\r
-               if (!isset($this->attr[$name])) {\r
+               if (!isset($this->attr[$name]))\r
+               {\r
                        $this->_[HDOM_INFO_SPACE][] = array(' ', '', '');\r
                        $this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;\r
                }\r
                $this->attr[$name] = $value;\r
        }\r
 \r
-       function __isset($name) {\r
-               switch ($name) {\r
+       function __isset($name)\r
+       {\r
+               switch ($name)\r
+               {\r
                        case 'outertext': return true;\r
                        case 'innertext': return true;\r
                        case 'plaintext': return true;\r
@@ -765,7 +780,7 @@ class simple_html_dom_node
        function convert_text($text)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}\r
 \r
                $converted_text = $text;\r
 \r
@@ -777,7 +792,7 @@ class simple_html_dom_node
                        $sourceCharset = strtoupper($this->dom->_charset);\r
                        $targetCharset = strtoupper($this->dom->_target_charset);\r
                }\r
-               if (is_object($debug_object)) {$debug_object->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}\r
 \r
                if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))\r
                {\r
@@ -1045,10 +1060,10 @@ class simple_html_dom
 \r
                // prepare\r
                $this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);\r
-               // strip out comments\r
-               $this->remove_noise("'<!--(.*?)-->'is");\r
                // strip out cdata\r
                $this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);\r
+               // strip out comments\r
+               $this->remove_noise("'<!--(.*?)-->'is");\r
                // Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037\r
                // Script tags removal now preceeds style tag removal.\r
                // strip out <script> tags\r
@@ -1078,10 +1093,15 @@ class simple_html_dom
        // load html from file\r
        function load_file()\r
        {\r
+         //external error: NOT related to dom loading\r
+         $extError=error_get_last();\r
+\r
                $args = func_get_args();\r
                $this->load(call_user_func_array('file_get_contents', $args), true);\r
+\r
                // Throw an error if we can't properly load the dom.\r
-               if (($error=error_get_last())!==null) {\r
+               $error=error_get_last();\r
+               if ($error!==$extError) {\r
                        $this->clear();\r
                        return false;\r
                }\r
@@ -1198,22 +1218,22 @@ class simple_html_dom
                        if ($success)\r
                        {\r
                                $charset = $matches[1];\r
-                               if (is_object($debug_object)) {$debug_object->debugLog(2, 'header content-type found charset of: ' . $charset);}\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}\r
                        }\r
 \r
                }\r
 \r
                if (empty($charset))\r
                {\r
-                       $el = $this->root->find('meta[http-equiv=Content-Type]',0);\r
+                       $el = $this->root->find('meta[http-equiv=Content-Type]',0, true);\r
                        if (!empty($el))\r
                        {\r
                                $fullvalue = $el->content;\r
-                               if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag found' . $fullvalue);}\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}\r
 \r
                                if (!empty($fullvalue))\r
                                {\r
-                                       $success = preg_match('/charset=(.+)/', $fullvalue, $matches);\r
+                                       $success = preg_match('/charset=(.+)/i', $fullvalue, $matches);\r
                                        if ($success)\r
                                        {\r
                                                $charset = $matches[1];\r
@@ -1221,7 +1241,7 @@ class simple_html_dom
                                        else\r
                                        {\r
                                                // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1\r
-                                               if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}\r
+                                               if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}\r
                                                $charset = 'ISO-8859-1';\r
                                        }\r
                                }\r
@@ -1231,14 +1251,19 @@ class simple_html_dom
                // If we couldn't find a charset above, then lets try to detect one based on the text we got...\r
                if (empty($charset))\r
                {\r
-                       // Have php try to detect the encoding from the text given to us.\r
-                       $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );\r
-                       if (is_object($debug_object)) {$debug_object->debugLog(2, 'mb_detect found: ' . $charset);}\r
+                       // Use this in case mb_detect_charset isn't installed/loaded on this machine.\r
+                       $charset = false;\r
+                       if (function_exists('mb_detect_encoding'))\r
+                       {\r
+                               // Have php try to detect the encoding from the text given to us.\r
+                               $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}\r
+                       }\r
 \r
                        // and if this doesn't work...  then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need...\r
                        if ($charset === false)\r
                        {\r
-                               if (is_object($debug_object)) {$debug_object->debugLog(2, 'since mb_detect failed - using default of utf-8');}\r
+                               if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}\r
                                $charset = 'UTF-8';\r
                        }\r
                }\r
@@ -1246,11 +1271,11 @@ class simple_html_dom
                // Since CP1252 is a superset, if we get one of it's subsets, we want it instead.\r
                if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))\r
                {\r
-                       if (is_object($debug_object)) {$debug_object->debugLog(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}\r
+                       if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}\r
                        $charset = 'CP1252';\r
                }\r
 \r
-               if (is_object($debug_object)) {$debug_object->debugLog(1, 'EXIT - ' . $charset);}\r
+               if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}\r
 \r
                return $this->_charset = $charset;\r
        }\r
@@ -1616,14 +1641,14 @@ class simple_html_dom
        protected function remove_noise($pattern, $remove_tag=false)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }\r
+               if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }\r
 \r
                $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);\r
 \r
                for ($i=$count-1; $i>-1; --$i)\r
                {\r
                        $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);\r
-                       if (is_object($debug_object)) { $debug_object->debugLog(2, 'key is: ' . $key); }\r
+                       if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }\r
                        $idx = ($remove_tag) ? 0 : 1;\r
                        $this->noise[$key] = $matches[$i][$idx][0];\r
                        $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));\r
@@ -1641,7 +1666,7 @@ class simple_html_dom
        function restore_noise($text)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }\r
+               if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }\r
 \r
                while (($pos=strpos($text, '___noise___'))!==false)\r
                {\r
@@ -1649,7 +1674,7 @@ class simple_html_dom
                        if (strlen($text) > $pos+15)\r
                        {\r
                                $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];\r
-                               if (is_object($debug_object)) { $debug_object->debugLog(2, 'located key of: ' . $key); }\r
+                               if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }\r
 \r
                                if (isset($this->noise[$key]))\r
                                {\r
@@ -1674,7 +1699,7 @@ class simple_html_dom
        function search_noise($text)\r
        {\r
                global $debug_object;\r
-               if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }\r
+               if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }\r
 \r
                foreach($this->noise as $noiseElement)\r
                {\r
diff --git a/inc/3rdparty/site_config/standard/.about.com.txt b/inc/3rdparty/site_config/standard/.about.com.txt
new file mode 100644 (file)
index 0000000..e1ebaee
--- /dev/null
@@ -0,0 +1,14 @@
+body: //div[@id='articlebody']
+title: //h1
+author: //p[@id='by']//a
+
+next_page_link: //span[@class='next']/a
+# Not the same as below!
+
+prune: yes
+tidy: no
+
+# Annoying 'next' links plainly inside the article body
+strip: //*[text()[contains(.,'Next: ')]]
+
+test_url: http://psychology.about.com/od/theoriesofpersonality/ss/defensemech.htm
diff --git a/inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt b/inc/3rdparty/site_config/standard/moo.nac.uci.edu.txt
new file mode 100644 (file)
index 0000000..24c949e
--- /dev/null
@@ -0,0 +1,9 @@
+title: //div[@id='header']//h1[1]
+
+body: //div[@id='content']
+
+strip_id_or_class: toc
+
+prune: no
+
+test_url: http://moo.nac.uci.edu/~hjm/HOWTO_move_data.html
old mode 100644 (file)
new mode 100755 (executable)
index 121fd5b..c5302d1
@@ -4,10 +4,14 @@ body://div[contains(@class,"story-text")]
 # Why doesn't this work? next_page_link://ul[contains(@class,"pagination")]/li/a[@rel="next"]\r
 \r
 next_page_link://ul[contains(@class,"pagination")]/li[contains(@class, "current")]/following-sibling::node()/a\r
+next_page_link://div[contains(@class,"pagination")]/ol/li[contains(@class, "current")]/following-sibling::node()/a\r
 date://meta[@name="publish_date"]/@content\r
 \r
 strip://div[contains(@class, "breadcrumbs")]\r
 strip://a[contains(@class, "hidden")]\r
 strip://div[contains(@class, "story-embed")]\r
 strip://div[contains(@class, "story-text")]//p/a[contains(text(), "Also on POLITICO:")]/..
+strip://div[contains(@class, "story-interrupt")]\r
+strip://footer[contains(@class, "author-bio")]\r
+\r
 test_url: http://www.politico.com/news/stories/0712/78105.html
\ No newline at end of file
index 9e901974952ce952739d89c876a12dadc8cdce2f..11cccb7238d9d6a6e16695386152a25fc6789fa8 100755 (executable)
@@ -409,6 +409,7 @@ class Database {
     public function add($url, $title, $content, $user_id, $isFavorite=0, $isRead=0) {
         $sql_action = 'INSERT INTO entries ( url, title, content, user_id, is_fav, is_read ) VALUES (?, ?, ?, ?, ?, ?)';
         $params_action = array($url, $title, $content, $user_id, $isFavorite, $isRead);
+
         if ( !$this->executeQuery($sql_action, $params_action) ) {
           $id = null;
         }
@@ -487,7 +488,7 @@ class Database {
         $sql =
             "SELECT entries.* FROM entries
             LEFT JOIN tags_entries ON tags_entries.entry_id=entries.id
-            WHERE tags_entries.tag_id = ? AND entries.user_id=?";
+            WHERE tags_entries.tag_id = ? AND entries.user_id=? ORDER by entries.id DESC";
         $query = $this->executeQuery($sql, array($tag_id, $user_id));
         $entries = $query->fetchAll();
 
index 37cf66a3ef9d12382658615c24b2b7016bf49fff..09a9f5ff85276423a29b505312d2f1cec66ead8a 100755 (executable)
@@ -1083,11 +1083,10 @@ class Poche
         $config = $this->store->getConfigUser($user_id);
 
         if ($config == null) {
-            die(_('User with this id (' . $user_id . ') does not exist.'));
+            die(sprintf(_('User with this id (%d) does not exist.'), $user_id));
         }
 
-        if (!in_array($type, $allowed_types) ||
-            $token != $config['token']) {
+        if (!in_array($type, $allowed_types) || $token != $config['token']) {
             die(_('Uh, there is a problem while generating feeds.'));
         }
         // Check the token
@@ -1145,17 +1144,18 @@ class Poche
       $config = HTMLPurifier_Config::createDefault();
       $config->set('Cache.SerializerPath', CACHE);
       $config->set('HTML.SafeIframe', true);
+
       //allow YouTube, Vimeo and dailymotion videos
       $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/|www\.dailymotion\.com/embed/video/)%');
 
       return new HTMLPurifier($config);
     }
-    
+
     /**
      * handle epub
      */
     public function createEpub() {
-       
+
         switch ($_GET['method']) {
             case 'id':
                 $entryID = filter_var($_GET['id'],FILTER_SANITIZE_NUMBER_INT);
@@ -1191,7 +1191,7 @@ class Poche
                 break;
             case 'default':
                 die(_('Uh, there is a problem while generating epub.'));
-            
+
         }
 
         $content_start =
@@ -1204,19 +1204,18 @@ class Poche
         . "<body>\n";
 
         $bookEnd = "</body>\n</html>\n";
-        
+
         $log = new Logger("wallabag", TRUE);
         $fileDir = CACHE;
-
         
-        $book = new EPub(EPub::BOOK_VERSION_EPUB3);
+        $book = new EPub(EPub::BOOK_VERSION_EPUB3, DEBUG_POCHE);
         $log->logLine("new EPub()");
         $log->logLine("EPub class version: " . EPub::VERSION);
         $log->logLine("EPub Req. Zip version: " . EPub::REQ_ZIP_VERSION);
         $log->logLine("Zip version: " . Zip::VERSION);
         $log->logLine("getCurrentServerURL: " . $book->getCurrentServerURL());
         $log->logLine("getCurrentPageURL..: " . $book->getCurrentPageURL());
-        
+
         $book->setTitle(_('wallabag\'s articles'));
         $book->setIdentifier("http://$_SERVER[HTTP_HOST]", EPub::IDENTIFIER_URI); // Could also be the ISBN number, prefered for published books, or a UUID.
         //$book->setLanguage("en"); // Not needed, but included for the example, Language is mandatory, but EPub defaults to "en". Use RFC3066 Language codes, such as "en", "da", "fr" etc.
@@ -1226,39 +1225,39 @@ class Poche
         $book->setDate(time()); // Strictly not needed as the book date defaults to time().
         //$book->setRights("Copyright and licence information specific for the book."); // As this is generated, this _could_ contain the name or licence information of the user who purchased the book, if needed. If this is used that way, the identifier must also be made unique for the book.
         $book->setSourceURL("http://$_SERVER[HTTP_HOST]");
-        
+
         $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
         $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag");
-        
+
         $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n";
-        
+
         $log->logLine("Add Cover");
-        
+
         $fullTitle = "<h1> " . $bookTitle . "</h1>\n";
-        
+
         $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $fullTitle);
-        
+
         $cover = $content_start . '<div style="text-align:center;"><p>' . _('Produced by wallabag with PHPePub') . '</p><p>'. _('Please open <a href="https://github.com/wallabag/wallabag/issues" >an issue</a> if you have trouble with the display of this E-Book on your device.') . '</p></div>' . $bookEnd;
-        
+
         //$book->addChapter("Table of Contents", "TOC.xhtml", NULL, false, EPub::EXTERNAL_REF_IGNORE);
         $book->addChapter("Notices", "Cover2.html", $cover);
-        
+
         $book->buildTOC();
-        
+
         foreach ($entries as $entry) { //set tags as subjects
             $tags = $this->store->retrieveTagsByEntry($entry['id']);
             foreach ($tags as $tag) {
                 $book->setSubject($tag['value']);
             }
-            
+
             $log->logLine("Set up parameters");
-            
+
             $chapter = $content_start . $entry['content'] . $bookEnd;
             $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD);
             $log->logLine("Added chapter " . $entry['title']);
         }
 
-        if (DEBUG_POCHE) { 
+        if (DEBUG_POCHE) {
             $epuplog = $book->getLog();
             $book->addChapter("Log", "Log.html", $content_start . $log->getLog() . "\n</pre>" . $bookEnd); // log generation
         }
index 8073a3fe88d77c28ead1fa6e7242933322d687fe..cc01f4030498ef8127574bad949408f6a24065c2 100755 (executable)
@@ -18,8 +18,6 @@ class Tools
             die(_('Oops, it seems you don\'t have PHP 5.'));
         }
 
-        error_reporting(E_ALL);
-
         function stripslashesDeep($value) {
             return is_array($value)
                 ? array_map('stripslashesDeep', $value)
@@ -64,7 +62,7 @@ class Tools
         if (strpos($host, ':') !== false) {
             $serverport = '';
         }
-        
+
         return 'http' . ($https ? 's' : '') . '://'
             . $host . $serverport . $scriptname;
     }
@@ -218,7 +216,7 @@ class Tools
 
     public static function getDomain($url)
     {
-      return parse_url($url, PHP_URL_HOST);
+        return parse_url($url, PHP_URL_HOST);
     }
 
     public static function getReadingTime($text) {
index ffcd205d859d3b2cd4db64a68de5df140cd6abc4..95f727c6889f760661b63573d27ef6767d752595 100755 (executable)
 
 @define ('MODE_DEMO', FALSE);
 @define ('DEBUG_POCHE', FALSE);
+
+//default level of error reporting in application. Developers should override it in their config.inc.php: set to E_ALL.
+@define ('ERROR_REPORTING', E_ALL & ~E_NOTICE);
+
 @define ('DOWNLOAD_PICTURES', FALSE); # This can slow down the process of adding articles
 @define ('REGENERATE_PICTURES_QUALITY', 75);
 @define ('CONVERT_LINKS_FOOTNOTES', FALSE);
index 472e0fabc20e3d34885367999e7258fd7a187567..481841ece69067d1e971caff7f52cd2dff5c5fc2 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -8,10 +8,15 @@
  * @license    http://www.wtfpl.net/ see COPYING file
  */
 
-define ('POCHE', '1.7.0');
+define ('POCHE', '1.7.1');
 require 'check_setup.php';
 require_once 'inc/poche/global.inc.php';
 
+# Set error reporting level
+if (defined('ERROR_REPORTING')) {
+       error_reporting(ERROR_REPORTING);
+}
+
 # Start session
 Session::$sessionName = 'poche';
 Session::init();
@@ -93,7 +98,7 @@ if (isset($_GET['login'])) {
     }
     else {
         $tag_id = (isset($_GET['tag_id']) ? intval($_GET['tag_id']) : 0);
-        $poche->generateFeeds($_GET['token'], $_GET['user_id'], $tag_id, $_GET['type']);
+        $poche->generateFeeds($_GET['token'], filter_var($_GET['user_id'],FILTER_SANITIZE_NUMBER_INT), $tag_id, $_GET['type']);
     }
 }
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index fd0e23f..b625e34
Binary files a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo and b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo differ
old mode 100755 (executable)
new mode 100644 (file)
index 0b2a87d..0343bfe
@@ -1,10 +1,10 @@
 msgid ""
 msgstr ""
-"Project-Id-Version: wallabag 1.6.1\n"
+"Project-Id-Version: wallabag 1.7\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2014-05-10 20:09+0100\n"
 "PO-Revision-Date: \n"
-"Last-Translator: Mickaël RAYBAUD-ROIG <raybaudroigm@gmail.com>\n"
+"Last-Translator: Gilles Wittezaële <gilles.wittezaele@laposte.net>\n"
 "Language-Team: \n"
 "Language: fr_FR\n"
 "MIME-Version: 1.0\n"
@@ -131,7 +131,7 @@ msgid "via F-Droid"
 msgstr "via F-Droid"
 
 msgid " or "
-msgstr "ou"
+msgstr " ou "
 
 msgid "via Google Play"
 msgstr "via Google PlayStore"
@@ -240,7 +240,7 @@ msgid ""
 "You can import your Pocket, Readability, Instapaper, Wallabag or any data in "
 "appropriate json or html format."
 msgstr ""
-"Vous pouvez importer depuis Pocket, Readability, Instapaper, Wallabag, ou "
+"Vous pouvez importer depuis Pocket, Readability, Instapaper, wallabag, ou "
 "n'importe quel fichier au format JSON ou HTML approprié."
 
 msgid ""
@@ -251,7 +251,7 @@ msgid ""
 "IMPORT_DELAY (delay between fetch of next batch of articles)."
 msgstr ""
 "Sélectionner le fichier à importer sur votre disque dur, et pressez la "
-"bouton « Importer » ci-dessous.<br />Wallabag analysera votre fichier, "
+"bouton « Importer » ci-dessous.<br />wallabag analysera votre fichier, "
 "ajoutera toutes les URL trouvées et commencera à télécharger les contenus si "
 "nécessaire.<br />Le processus de téléchargement est contrôlé par deux "
 "constantes dans votre fichier de configuration:<wbr /><code>IMPORT_LIMIT</"
@@ -259,7 +259,7 @@ msgstr ""
 "(le délai d'attente entre deux séquences de téléchargement)."
 
 msgid "File:"
-msgstr "Fichier: "
+msgstr "Fichier : "
 
 msgid "You can click here to fetch content for articles with no content."
 msgstr ""
@@ -287,7 +287,7 @@ msgid "Add user"
 msgstr "Ajouter un utilisateur"
 
 msgid "Add a new user :"
-msgstr "Ajouter un nouvel utilisateur: "
+msgstr "Ajouter un nouvel utilisateur : "
 
 msgid "Login for new user"
 msgstr "Identifiant du nouvel utilisateur"
@@ -296,10 +296,10 @@ msgid "Login"
 msgstr "Nom d'utilisateur"
 
 msgid "Password for new user"
-msgstr "Mot de passe du nouvel utilisateur"
+msgstr "Mot de passe du nouvel utilisateur"
 
 msgid "Send"
-msgstr "Imvoyer"
+msgstr "Envoyer"
 
 msgid "Delete account"
 msgstr "Supprimer le compte"
@@ -322,7 +322,7 @@ msgstr ""
 msgid ""
 "To completely remove wallabag, delete the wallabag folder on your web server."
 msgstr ""
-"Pour déinstaller complètement Wallabag, supprimez le répertoire "
+"Pour désinstaller complètement wallabag, supprimez le répertoire "
 "<code>wallabag</code> de votre serveur Web."
 
 msgid "Save a link"
@@ -418,17 +418,17 @@ msgid "More infos in the official doc:"
 msgstr "Plus d'infos dans la documentation officielle :"
 
 msgid "import from Pocket"
-msgstr "importation depuis Pocket"
+msgstr "importer depuis Pocket"
 
 #, php-format
 msgid "(you must have a %s file on your server)"
 msgstr "(le fichier %s doit être présent sur le serveur)"
 
 msgid "import from Readability"
-msgstr "importation depuis Readability"
+msgstr "importer depuis Readability"
 
 msgid "import from Instapaper"
-msgstr "importation depuis Instapaper"
+msgstr "importer depuis Instapaper"
 
 msgid "Start typing for auto complete."
 msgstr "Commencez à taper pour activer l'auto-complétion."
@@ -525,13 +525,13 @@ msgid "Download required for "
 msgstr "Téléchargement requis pour "
 
 msgid "records"
-msgstr " éléments."
+msgstr " articles"
 
 msgid "Downloading next "
 msgstr "Téléchargement des "
 
 msgid "articles, please wait"
-msgstr " prochains éléments, veuillez patienter"
+msgstr " articles suivants, veuillez patienter..."
 
 msgid "Enter your search here"
 msgstr "Entrez votre recherche ici"
@@ -546,18 +546,18 @@ msgstr ""
 
 #, php-format
 msgid "Error : An user with the name %s already exists !"
-msgstr "Erreur: Un utilisateur avec le nom « %s » existe déjà."
+msgstr "Erreur : Un utilisateur avec le nom « %s » existe déjà !"
 
 #, php-format
 msgid "User %s has been successfully deleted !"
-msgstr "L'utilisateur « %s » a bien été supprimé !"
+msgstr "L'utilisateur « %s » a été supprimé avec succès !"
 
 msgid "Error : The password is wrong !"
-msgstr "Erreur: Le mot de passe est incorrect !"
+msgstr "Erreur : le mot de passe est incorrect !"
 
 msgid "Error : You are the only user, you cannot delete your account !"
 msgstr ""
-"Erreur: Vous êtes l'unique utilisateur, vous ne pouvez pas supprimer votre "
+"Erreur : Vous êtes l'unique utilisateur, vous ne pouvez pas supprimer votre "
 "compte !"
 
 msgid "Untitled"
@@ -585,7 +585,7 @@ msgid "next"
 msgstr "suivant"
 
 msgid "in demo mode, you can't update your password"
-msgstr "en mode démo, vous ne pouvez pas mettre à jour le mot de passe"
+msgstr "en mode démo, vous ne pouvez pas mettre à jour votre mot de passe"
 
 msgid "your password has been updated"
 msgstr "votre mot de passe a été mis à jour"
@@ -598,7 +598,7 @@ msgstr ""
 "dans les deux"
 
 msgid "still using the \""
-msgstr "Vous utilisez toujours \""
+msgstr "vous utilisez toujours \""
 
 msgid "that theme does not seem to be installed"
 msgstr "ce thème ne semble pas installé"
@@ -628,16 +628,16 @@ msgid "click to finish import"
 msgstr "cliquez pour terminer l'importation"
 
 msgid "Articles inserted: "
-msgstr "Articles ajoutés: "
+msgstr "Articles ajoutés : "
 
 msgid ". Please note, that some may be marked as \"read\"."
-msgstr ". Notez que certains pourraient être marqués comme lus."
+msgstr ". Notez que certains pourraient être marqués comme \"lus\"."
 
 msgid "Import finished."
 msgstr "Importation terminée."
 
 msgid "Undefined"
-msgstr "Non définit"
+msgstr "Non défini"
 
 msgid "User with this id ("
 msgstr "Utilisateur avec cet identifiant ("
@@ -650,71 +650,3 @@ msgstr "Cache effacé."
 
 msgid "Oops, it seems you don't have PHP 5."
 msgstr "Oups, vous ne semblez pas avoir PHP 5."
-
-#~ msgid ""
-#~ "Please execute the import script locally as it can take a very long time."
-#~ msgstr ""
-#~ "Merci d'exécuter le script d'importation en local car cela peut prendre "
-#~ "du temps."
-
-#~ msgid "More info in the official documentation:"
-#~ msgstr "Plus d'infos dans la documentation officielle :"
-
-#~ msgid "Import from Pocket"
-#~ msgstr "Import depuis Pocket"
-
-#~ msgid "Import from Readability"
-#~ msgstr "Importer depuis Readability"
-
-#~ msgid "Import from Instapaper"
-#~ msgstr "Importer depuis Instapaper"
-
-#~ msgid "Import from wallabag"
-#~ msgstr "Importer depuis wallabag"
-
-#~ msgid "import from instapaper completed"
-#~ msgstr "Importation depuis Instapaper achevée"
-
-#~ msgid "import from pocket completed"
-#~ msgstr "Importation depuis Pocket achevée"
-
-#~ msgid "import from Readability completed. "
-#~ msgstr "Importation depuis Readability achevée"
-
-#~ msgid "import from Poche completed. "
-#~ msgstr "Importation depuis Pocket achevée"
-
-#~ msgid "Unknown import provider."
-#~ msgstr "Format d'importation inconnu."
-
-#~ msgid "Incomplete inc/poche/define.inc.php file, please define \""
-#~ msgstr "Fichier inc/poche/define.inc.php incomplet, merci de définir \""
-
-#~ msgid "Could not find required \""
-#~ msgstr "Impossible de trouver \""
-
-#~ msgid "poche it!"
-#~ msgstr "pochez-le !"
-
-#~ msgid "Updating poche"
-#~ msgstr "Mettre à jour poche"
-
-#, fuzzy
-#~ msgid "Export your poche datas"
-#~ msgstr "Exporter vos données de poche"
-
-#, fuzzy
-#~ msgid "to export your poche datas."
-#~ msgstr "pour exporter vos données de poche."
-
-#~ msgid "create an issue"
-#~ msgstr "créez un ticket"
-
-#~ msgid "or"
-#~ msgstr "ou"
-
-#~ msgid "contact us by mail"
-#~ msgstr "contactez-nous par email"
-
-#~ msgid "your poche version:"
-#~ msgstr "votre version de poche :"