private $bookVersion = EPub::BOOK_VERSION_EPUB2;
+ private $debugInside = FALSE;
+
public $maxImageWidth = 768;
public $maxImageHeight = 1024;
*
* @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;
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
} else {
$topCandidate->innerHTML = $page->documentElement->innerHTML;
$page->documentElement->innerHTML = '';
+ $this->reinitBody();
$page->documentElement->appendChild($topCandidate);
}
} else {
{
// 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);
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
// 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
$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
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
+}
* @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
{\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
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
$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
foreach ($head as $k=>$v)\r
{\r
if (!isset($found_keys[$k]))\r
+ {\r
$found_keys[$k] = 1;\r
+ }\r
}\r
}\r
\r
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
// 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
} 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
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
\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
// $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
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
}\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
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
$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
\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
// 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
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
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
// 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
// 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
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
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
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
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
--- /dev/null
+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
--- /dev/null
+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
# 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
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;
}
$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();
$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
$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);
break;
case 'default':
die(_('Uh, there is a problem while generating epub.'));
-
+
}
$content_start =
. "<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.
$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
}
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)
if (strpos($host, ':') !== false) {
$serverport = '';
}
-
+
return 'http' . ($https ? 's' : '') . '://'
. $host . $serverport . $scriptname;
}
public static function getDomain($url)
{
- return parse_url($url, PHP_URL_HOST);
+ return parse_url($url, PHP_URL_HOST);
}
public static function getReadingTime($text) {
@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);
* @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();
}
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']);
}
}
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"
msgstr "via F-Droid"
msgid " or "
-msgstr "ou"
+msgstr " ou "
msgid "via Google Play"
msgstr "via Google PlayStore"
"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 ""
"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</"
"(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 ""
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"
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"
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"
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."
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"
#, 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"
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"
"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é"
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 ("
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 :"