Merge pull request #761 from wallabag/dev

1.7.1
This commit is contained in:
Nicolas Lœuillet 2014-07-15 11:49:24 +02:00
commit 0f6273cdb8
17 changed files with 191 additions and 166 deletions

View 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;

View file

@ -2,6 +2,7 @@
define('RSS2', 1, true);
define('JSON', 2, true);
define('JSONP', 3, true);
define('ATOM', 4, true);
/**
* Univarsel Feed Writer class

17
inc/3rdparty/libraries/readability/Readability.php vendored Normal file → Executable file
View file

@ -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;
}
/**
* Will recreate previously deleted body property
*
* @return void
*/
protected function reinitBody() {
if (!isset($this->body->childNodes)) {
$this->body = $this->dom->createElement('body');
$this->body->innerHTML = $this->bodyCache;
}
}
}
?>

View file

@ -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
// For more request parameters, see http://help.fivefilters.org/customer/portal/articles/226660-usage
error_reporting(E_ALL ^ E_NOTICE);
//error_reporting(E_ALL ^ E_NOTICE);
ini_set("display_errors", 1);
@set_time_limit(120);
@ -671,7 +671,11 @@ foreach ($items as $key => $item) {
$html .= $item->get_description();
} else {
$readability->clean($content_block, 'select');
if ($options->rewrite_relative_urls) makeAbsolute($effective_url, $content_block);
// get base URL
$base_url = get_base_url($readability->dom);
if (!$base_url) $base_url = $effective_url;
// rewrite URLs
if ($options->rewrite_relative_urls) makeAbsolute($base_url, $content_block);
// footnotes
if (($links == 'footnotes') && (strpos($effective_url, 'wikipedia.org') === false)) {
$readability->addFootnotes($content_block);

View file

@ -377,3 +377,13 @@ function debug($msg) {
flush();
}
}
function get_base_url($dom) {
$xpath = new DOMXPath($dom);
$base_url = @$xpath->evaluate('string(//head/base/@href)', $dom);
if ($base_url !== '') {
return $base_url;
} else {
return false;
}
}

105
inc/3rdparty/simple_html_dom.php vendored Normal file → Executable file
View file

@ -34,7 +34,7 @@
* @author S.C. Chen <me578022@gmail.com>
* @author John Schlick
* @author Rus Carroll
* @version 1.5 ($Rev: 202 $)
* @version 1.5 ($Rev: 210 $)
* @package PlaceLocalInclude
* @subpackage simple_html_dom
*/
@ -269,7 +269,10 @@ class simple_html_dom_node
{
return $this->children;
}
if (isset($this->children[$idx])) return $this->children[$idx];
if (isset($this->children[$idx]))
{
return $this->children[$idx];
}
return null;
}
@ -330,14 +333,14 @@ class simple_html_dom_node
function find_ancestor_tag($tag)
{
global $debug_object;
if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
// Start by including ourselves in the comparison.
$returnDom = $this;
while (!is_null($returnDom))
{
if (is_object($debug_object)) { $debug_object->debugLog(2, "Current tag is: " . $returnDom->tag); }
if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); }
if ($returnDom->tag == $tag)
{
@ -374,7 +377,7 @@ class simple_html_dom_node
$text = " with text: " . $this->text;
}
}
$debug_object->debugLog(1, 'Innertext of tag: ' . $this->tag . $text);
$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
}
if ($this->tag==='root') return $this->innertext();
@ -532,7 +535,9 @@ class simple_html_dom_node
foreach ($head as $k=>$v)
{
if (!isset($found_keys[$k]))
{
$found_keys[$k] = 1;
}
}
}
@ -554,7 +559,7 @@ class simple_html_dom_node
protected function seek($selector, &$ret, $lowercase=false)
{
global $debug_object;
if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
list($tag, $key, $val, $exp, $no_key) = $selector;
@ -615,7 +620,7 @@ class simple_html_dom_node
// this is a normal search, we want the value of that attribute of the tag.
$nodeKeyValue = $node->attr[$key];
}
if (is_object($debug_object)) {$debug_object->debugLog(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);}
//PaperG - If lowercase is set, do a case insensitive test of the value of the selector.
if ($lowercase) {
@ -623,7 +628,7 @@ class simple_html_dom_node
} else {
$check = $this->match($exp, $val, $nodeKeyValue);
}
if (is_object($debug_object)) {$debug_object->debugLog(2, "after match: " . ($check ? "true" : "false"));}
if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));}
// handle multiple class
if (!$check && strcasecmp($key, 'class')===0) {
@ -645,12 +650,12 @@ class simple_html_dom_node
unset($node);
}
// It's passed by reference so this is actually what this function returns.
if (is_object($debug_object)) {$debug_object->debugLog(1, "EXIT - ret: ", $ret);}
if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);}
}
protected function match($exp, $pattern, $value) {
global $debug_object;
if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
switch ($exp) {
case '=':
@ -672,7 +677,7 @@ class simple_html_dom_node
protected function parse_selector($selector_string) {
global $debug_object;
if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
// pattern of CSS selectors, modified from mootools
// Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does.
@ -683,7 +688,7 @@ class simple_html_dom_node
// $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
$pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is";
preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER);
if (is_object($debug_object)) {$debug_object->debugLog(2, "Matches Array: ", $matches);}
if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);}
$selectors = array();
$result = array();
@ -718,12 +723,14 @@ class simple_html_dom_node
return $selectors;
}
function __get($name) {
function __get($name)
{
if (isset($this->attr[$name]))
{
return $this->convert_text($this->attr[$name]);
}
switch ($name) {
switch ($name)
{
case 'outertext': return $this->outertext();
case 'innertext': return $this->innertext();
case 'plaintext': return $this->text();
@ -732,22 +739,30 @@ class simple_html_dom_node
}
}
function __set($name, $value) {
switch ($name) {
function __set($name, $value)
{
global $debug_object;
if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
switch ($name)
{
case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
case 'innertext':
if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value;
return $this->_[HDOM_INFO_INNER] = $value;
}
if (!isset($this->attr[$name])) {
if (!isset($this->attr[$name]))
{
$this->_[HDOM_INFO_SPACE][] = array(' ', '', '');
$this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
}
$this->attr[$name] = $value;
}
function __isset($name) {
switch ($name) {
function __isset($name)
{
switch ($name)
{
case 'outertext': return true;
case 'innertext': return true;
case 'plaintext': return true;
@ -765,7 +780,7 @@ class simple_html_dom_node
function convert_text($text)
{
global $debug_object;
if (is_object($debug_object)) {$debug_object->debugLogEntry(1);}
if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
$converted_text = $text;
@ -777,7 +792,7 @@ class simple_html_dom_node
$sourceCharset = strtoupper($this->dom->_charset);
$targetCharset = strtoupper($this->dom->_target_charset);
}
if (is_object($debug_object)) {$debug_object->debugLog(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);}
if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0))
{
@ -1045,10 +1060,10 @@ class simple_html_dom
// prepare
$this->prepare($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText);
// strip out comments
$this->remove_noise("'<!--(.*?)-->'is");
// strip out cdata
$this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
// strip out comments
$this->remove_noise("'<!--(.*?)-->'is");
// Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037
// Script tags removal now preceeds style tag removal.
// strip out <script> tags
@ -1078,10 +1093,15 @@ class simple_html_dom
// load html from file
function load_file()
{
//external error: NOT related to dom loading
$extError=error_get_last();
$args = func_get_args();
$this->load(call_user_func_array('file_get_contents', $args), true);
// Throw an error if we can't properly load the dom.
if (($error=error_get_last())!==null) {
$error=error_get_last();
if ($error!==$extError) {
$this->clear();
return false;
}
@ -1198,22 +1218,22 @@ class simple_html_dom
if ($success)
{
$charset = $matches[1];
if (is_object($debug_object)) {$debug_object->debugLog(2, 'header content-type found charset of: ' . $charset);}
if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);}
}
}
if (empty($charset))
{
$el = $this->root->find('meta[http-equiv=Content-Type]',0);
$el = $this->root->find('meta[http-equiv=Content-Type]',0, true);
if (!empty($el))
{
$fullvalue = $el->content;
if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag found' . $fullvalue);}
if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);}
if (!empty($fullvalue))
{
$success = preg_match('/charset=(.+)/', $fullvalue, $matches);
$success = preg_match('/charset=(.+)/i', $fullvalue, $matches);
if ($success)
{
$charset = $matches[1];
@ -1221,7 +1241,7 @@ class simple_html_dom
else
{
// If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1
if (is_object($debug_object)) {$debug_object->debugLog(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');}
$charset = 'ISO-8859-1';
}
}
@ -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...
if (empty($charset))
{
// Have php try to detect the encoding from the text given to us.
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
if (is_object($debug_object)) {$debug_object->debugLog(2, 'mb_detect found: ' . $charset);}
// Use this in case mb_detect_charset isn't installed/loaded on this machine.
$charset = false;
if (function_exists('mb_detect_encoding'))
{
// Have php try to detect the encoding from the text given to us.
$charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) );
if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);}
}
// 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...
if ($charset === false)
{
if (is_object($debug_object)) {$debug_object->debugLog(2, 'since mb_detect failed - using default of utf-8');}
if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');}
$charset = 'UTF-8';
}
}
@ -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.
if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1')))
{
if (is_object($debug_object)) {$debug_object->debugLog(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');}
$charset = 'CP1252';
}
if (is_object($debug_object)) {$debug_object->debugLog(1, 'EXIT - ' . $charset);}
if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);}
return $this->_charset = $charset;
}
@ -1616,14 +1641,14 @@ class simple_html_dom
protected function remove_noise($pattern, $remove_tag=false)
{
global $debug_object;
if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
$count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
for ($i=$count-1; $i>-1; --$i)
{
$key = '___noise___'.sprintf('% 5d', count($this->noise)+1000);
if (is_object($debug_object)) { $debug_object->debugLog(2, 'key is: ' . $key); }
if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); }
$idx = ($remove_tag) ? 0 : 1;
$this->noise[$key] = $matches[$i][$idx][0];
$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
@ -1641,7 +1666,7 @@ class simple_html_dom
function restore_noise($text)
{
global $debug_object;
if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
while (($pos=strpos($text, '___noise___'))!==false)
{
@ -1649,7 +1674,7 @@ class simple_html_dom
if (strlen($text) > $pos+15)
{
$key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15];
if (is_object($debug_object)) { $debug_object->debugLog(2, 'located key of: ' . $key); }
if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); }
if (isset($this->noise[$key]))
{
@ -1674,7 +1699,7 @@ class simple_html_dom
function search_noise($text)
{
global $debug_object;
if (is_object($debug_object)) { $debug_object->debugLogEntry(1); }
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
foreach($this->noise as $noiseElement)
{

View file

@ -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

View file

@ -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

4
inc/3rdparty/site_config/standard/politico.com.txt vendored Normal file → Executable file
View file

@ -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"]
next_page_link://ul[contains(@class,"pagination")]/li[contains(@class, "current")]/following-sibling::node()/a
next_page_link://div[contains(@class,"pagination")]/ol/li[contains(@class, "current")]/following-sibling::node()/a
date://meta[@name="publish_date"]/@content
strip://div[contains(@class, "breadcrumbs")]
strip://a[contains(@class, "hidden")]
strip://div[contains(@class, "story-embed")]
strip://div[contains(@class, "story-text")]//p/a[contains(text(), "Also on POLITICO:")]/..
strip://div[contains(@class, "story-interrupt")]
strip://footer[contains(@class, "author-bio")]
test_url: http://www.politico.com/news/stories/0712/78105.html

View file

@ -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();

View file

@ -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
}

View file

@ -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) {

View file

@ -30,6 +30,10 @@
@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);

View file

@ -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']);
}
}

0
install/poche.sqlite Executable file → Normal file
View file

BIN
locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo Executable file → Normal file

Binary file not shown.

116
locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po Executable file → Normal file
View file

@ -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 :"