From 4a16f33dcc99139f3621ca3f25dec32b1ce36c27 Mon Sep 17 00:00:00 2001 From: tcitworld Date: Fri, 4 Apr 2014 22:13:06 +0200 Subject: Changed copyright to 2014 Happy new year ! --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fe6a06b6..0b54dff4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ wallabag is a self hostable application allowing you to not miss any content any More informations on our website: [wallabag.org](http://wallabag.org) ## License -Copyright © 2010-2013 Nicolas Lœuillet +Copyright © 2010-2014 Nicolas Lœuillet This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See the COPYING file for more details. -- cgit v1.2.3 From db117db3c5b61f2ec10162f1b123024ded6949c2 Mon Sep 17 00:00:00 2001 From: tcitworld Date: Fri, 4 Apr 2014 22:36:33 +0200 Subject: Fix to #600 --- themes/courgette/config.twig | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/courgette/config.twig b/themes/courgette/config.twig index 5c0aa4b1..6e1a9043 100755 --- a/themes/courgette/config.twig +++ b/themes/courgette/config.twig @@ -9,9 +9,11 @@

{% trans "Poching a link" %}

{% trans "There are several ways to save an article:" %} (?)

    -
  • firefox: {% trans "download the extension" %}
  • -
  • chrome: {% trans "download the extension" %}
  • -
  • android: {% trans "download the application" %}
  • +
  • Firefox: {% trans "download the extension" %}
  • +
  • Chrome: {% trans "download the extension" %}
  • +
  • Android: {% trans "via F-Droid" %} {% trans " or " %} {% trans "via Google Play" %}
  • +
  • iOS: {% trans "download the application" %}
  • +
  • Windows Phone: {% trans "download the application" %}
  • @@ -79,4 +81,4 @@

    {% trans "Export your wallabag data" %}

    {% trans "Click here" %} {% trans "to export your wallabag data." %}

    -{% endblock %} \ No newline at end of file +{% endblock %} -- cgit v1.2.3 From 1bcbe8bebf4f469420fc36759e6f5ae5ea551535 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Sat, 5 Apr 2014 11:22:33 +0300 Subject: postgres sequence error fix, issue #602 --- inc/poche/Database.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 6244df88..a80eea97 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -374,7 +374,7 @@ class Database { $id = null; } else { - $id = intval($this->getLastId( (STORAGE == 'postgres') ? 'users_id_seq' : '' )); + $id = intval($this->getLastId( (STORAGE == 'postgres') ? 'entries_id_seq' : '') ); } return $id; } -- cgit v1.2.3 From 29d9c0ffe1819f0cdf8d8201727777cfd1b1d0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 6 Apr 2014 16:21:48 +0200 Subject: [fix] Use of undefined constant ATOM #604 --- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index 5d16e765..3f95372d 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -193,7 +193,7 @@ define('JSONP', 3, true); */ public function setDescription($desciption) { - $tag = ($this->version == ATOM)? 'subtitle' : 'description'; + $tag = 'description'; $this->setChannelElement($tag, $desciption); } -- cgit v1.2.3 From f86784c22d63ebd8315d0f86befa626779e36ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 6 Apr 2014 16:39:11 +0200 Subject: in RSS feed, add link to wallabag URL #556 --- inc/3rdparty/libraries/feedwriter/FeedItem.php | 354 +++++++++++++------------ inc/poche/Poche.class.php | 65 ++--- 2 files changed, 216 insertions(+), 203 deletions(-) diff --git a/inc/3rdparty/libraries/feedwriter/FeedItem.php b/inc/3rdparty/libraries/feedwriter/FeedItem.php index 0eae5e08..7e467ce8 100644 --- a/inc/3rdparty/libraries/feedwriter/FeedItem.php +++ b/inc/3rdparty/libraries/feedwriter/FeedItem.php @@ -10,177 +10,189 @@ */ class FeedItem { - private $elements = array(); //Collection of feed elements - private $version; - - /** - * Constructor - * - * @param contant (RSS1/RSS2/ATOM) RSS2 is default. - */ - function __construct($version = RSS2) - { - $this->version = $version; - } + private $elements = array(); //Collection of feed elements + private $version; + + /** + * Constructor + * + * @param contant (RSS1/RSS2/ATOM) RSS2 is default. + */ + function __construct($version = RSS2) + { + $this->version = $version; + } - /** - * Set element (overwrites existing elements with $elementName) - * - * @access public - * @param srting The tag name of an element - * @param srting The content of tag - * @param array Attributes(if any) in 'attrName' => 'attrValue' format - * @return void - */ - public function setElement($elementName, $content, $attributes = null) - { - if (isset($this->elements[$elementName])) { - unset($this->elements[$elementName]); - } - $this->addElement($elementName, $content, $attributes); - } - - /** - * Add an element to elements array - * - * @access public - * @param srting The tag name of an element - * @param srting The content of tag - * @param array Attributes(if any) in 'attrName' => 'attrValue' format - * @return void - */ - public function addElement($elementName, $content, $attributes = null) - { - $i = 0; - if (isset($this->elements[$elementName])) { - $i = count($this->elements[$elementName]); - } else { - $this->elements[$elementName] = array(); - } - $this->elements[$elementName][$i]['name'] = $elementName; - $this->elements[$elementName][$i]['content'] = $content; - $this->elements[$elementName][$i]['attributes'] = $attributes; - } - - /** - * Set multiple feed elements from an array. - * Elements which have attributes cannot be added by this method - * - * @access public - * @param array array of elements in 'tagName' => 'tagContent' format. - * @return void - */ - public function addElementArray($elementArray) - { - if(! is_array($elementArray)) return; - foreach ($elementArray as $elementName => $content) - { - $this->addElement($elementName, $content); - } - } - - /** - * Return the collection of elements in this feed item - * - * @access public - * @return array - */ - public function getElements() - { - return $this->elements; - } - - // Wrapper functions ------------------------------------------------------ - - /** - * Set the 'dscription' element of feed item - * - * @access public - * @param string The content of 'description' element - * @return void - */ - public function setDescription($description) - { - $tag = 'description'; - $this->setElement($tag, $description); - } - - /** - * @desc Set the 'title' element of feed item - * @access public - * @param string The content of 'title' element - * @return void - */ - public function setTitle($title) - { - $this->setElement('title', $title); - } - - /** - * Set the 'date' element of feed item - * - * @access public - * @param string The content of 'date' element - * @return void - */ - public function setDate($date) - { - if(! is_numeric($date)) - { - $date = strtotime($date); - } + /** + * Set element (overwrites existing elements with $elementName) + * + * @access public + * @param srting The tag name of an element + * @param srting The content of tag + * @param array Attributes(if any) in 'attrName' => 'attrValue' format + * @return void + */ + public function setElement($elementName, $content, $attributes = null) + { + if (isset($this->elements[$elementName])) { + unset($this->elements[$elementName]); + } + $this->addElement($elementName, $content, $attributes); + } + + /** + * Add an element to elements array + * + * @access public + * @param srting The tag name of an element + * @param srting The content of tag + * @param array Attributes(if any) in 'attrName' => 'attrValue' format + * @return void + */ + public function addElement($elementName, $content, $attributes = null) + { + $i = 0; + if (isset($this->elements[$elementName])) { + $i = count($this->elements[$elementName]); + } else { + $this->elements[$elementName] = array(); + } + $this->elements[$elementName][$i]['name'] = $elementName; + $this->elements[$elementName][$i]['content'] = $content; + $this->elements[$elementName][$i]['attributes'] = $attributes; + } + + /** + * Set multiple feed elements from an array. + * Elements which have attributes cannot be added by this method + * + * @access public + * @param array array of elements in 'tagName' => 'tagContent' format. + * @return void + */ + public function addElementArray($elementArray) + { + if(! is_array($elementArray)) return; + foreach ($elementArray as $elementName => $content) + { + $this->addElement($elementName, $content); + } + } + + /** + * Return the collection of elements in this feed item + * + * @access public + * @return array + */ + public function getElements() + { + return $this->elements; + } + + // Wrapper functions ------------------------------------------------------ + + /** + * Set the 'dscription' element of feed item + * + * @access public + * @param string The content of 'description' element + * @return void + */ + public function setDescription($description) + { + $tag = 'description'; + $this->setElement($tag, $description); + } + + /** + * @desc Set the 'title' element of feed item + * @access public + * @param string The content of 'title' element + * @return void + */ + public function setTitle($title) + { + $this->setElement('title', $title); + } + + /** + * Set the 'date' element of feed item + * + * @access public + * @param string The content of 'date' element + * @return void + */ + public function setDate($date) + { + if(! is_numeric($date)) + { + $date = strtotime($date); + } - if($this->version == RSS2) - { - $tag = 'pubDate'; - $value = date(DATE_RSS, $date); - } - else - { - $tag = 'dc:date'; - $value = date("Y-m-d", $date); - } - - $this->setElement($tag, $value); - } - - /** - * Set the 'link' element of feed item - * - * @access public - * @param string The content of 'link' element - * @return void - */ - public function setLink($link) - { - if($this->version == RSS2 || $this->version == RSS1) - { - $this->setElement('link', $link); - $this->setElement('guid', $link); - } - else - { - $this->setElement('link','',array('href'=>$link)); - $this->setElement('id', FeedWriter::uuid($link,'urn:uuid:')); - } - - } - - /** - * Set the 'encloser' element of feed item - * For RSS 2.0 only - * - * @access public - * @param string The url attribute of encloser tag - * @param string The length attribute of encloser tag - * @param string The type attribute of encloser tag - * @return void - */ - public function setEncloser($url, $length, $type) - { - $attributes = array('url'=>$url, 'length'=>$length, 'type'=>$type); - $this->setElement('enclosure','',$attributes); - } - + if($this->version == RSS2) + { + $tag = 'pubDate'; + $value = date(DATE_RSS, $date); + } + else + { + $tag = 'dc:date'; + $value = date("Y-m-d", $date); + } + + $this->setElement($tag, $value); + } + + /** + * Set the 'link' element of feed item + * + * @access public + * @param string The content of 'link' element + * @return void + */ + public function setLink($link) + { + if($this->version == RSS2 || $this->version == RSS1) + { + $this->setElement('link', $link); + $this->setElement('guid', $link); + } + else + { + $this->setElement('link','',array('href'=>$link)); + $this->setElement('id', FeedWriter::uuid($link,'urn:uuid:')); + } + + } + + /** + * Set the 'source' element of feed item + * + * @access public + * @param string The content of 'source' element + * @return void + */ + public function setSource($link) + { + $this->setElement('source', $link); + } + + /** + * Set the 'encloser' element of feed item + * For RSS 2.0 only + * + * @access public + * @param string The url attribute of encloser tag + * @param string The length attribute of encloser tag + * @param string The type attribute of encloser tag + * @return void + */ + public function setEncloser($url, $length, $type) + { + $attributes = array('url'=>$url, 'length'=>$length, 'type'=>$type); + $this->setElement('enclosure','',$attributes); + } + } // end of class FeedItem -?> +?> \ No newline at end of file diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a662f695..a7bee65d 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -828,7 +828,7 @@ class Poche define('IMPORT_LIMIT', 5); } if (!defined('IMPORT_DELAY')) { - define('IMPORT_DELAY', 5); + define('IMPORT_DELAY', 5); } if ( isset($_FILES['file']) ) { @@ -844,18 +844,18 @@ class Poche $read = 0; foreach (array('ol','ul') as $list) { foreach ($html->find($list) as $ul) { - foreach ($ul->find('li') as $li) { - $tmpEntry = array(); - $a = $li->find('a'); - $tmpEntry['url'] = $a[0]->href; - $tmpEntry['tags'] = $a[0]->tags; - $tmpEntry['is_read'] = $read; - if ($tmpEntry['url']) { - $data[] = $tmpEntry; - } - } - # the second
      is for read links - $read = ((sizeof($data) && $read)?0:1); + foreach ($ul->find('li') as $li) { + $tmpEntry = array(); + $a = $li->find('a'); + $tmpEntry['url'] = $a[0]->href; + $tmpEntry['tags'] = $a[0]->tags; + $tmpEntry['is_read'] = $read; + if ($tmpEntry['url']) { + $data[] = $tmpEntry; + } + } + # the second
        is for read links + $read = ((sizeof($data) && $read)?0:1); } } } @@ -866,7 +866,7 @@ class Poche $data[] = $record; foreach ($record as $record2) { if (is_array($record2)) { - $data[] = $record2; + $data[] = $record2; } } } @@ -886,7 +886,7 @@ class Poche //increment no of records inserted $i++; if ( isset($record['tags']) && trim($record['tags']) ) { - //@TODO: set tags + //@TODO: set tags } } @@ -919,17 +919,17 @@ class Poche $purifier = new HTMLPurifier($config); foreach ($items as $item) { - $url = new Url(base64_encode($item['url'])); - $content = Tools::getPageContent($url); + $url = new Url(base64_encode($item['url'])); + $content = Tools::getPageContent($url); - $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); - $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); + $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); + $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); - //clean content to prevent xss attack - $title = $purifier->purify($title); - $body = $purifier->purify($body); + //clean content to prevent xss attack + $title = $purifier->purify($title); + $body = $purifier->purify($body); - $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); + $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); } } @@ -944,8 +944,8 @@ class Poche */ public function export() { - $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; - header('Content-Disposition: attachment; filename='.$filename); + $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; + header('Content-Disposition: attachment; filename='.$filename); $entries = $this->store->retrieveAll($this->user->getId()); echo $this->tpl->render('export.twig', array( @@ -978,13 +978,13 @@ class Poche public function generateToken() { if (ini_get('open_basedir') === '') { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - echo 'This is a server using Windows!'; - // alternative to /dev/urandom for Windows - $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); - } else { - $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15); - } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + echo 'This is a server using Windows!'; + // alternative to /dev/urandom for Windows + $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); + } else { + $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15); + } } else { $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); @@ -1031,6 +1031,7 @@ class Poche foreach ($entries as $entry) { $newItem = $feed->createNewItem(); $newItem->setTitle($entry['title']); + $newItem->setSource(Tools::getPocheUrl() . '?view=view&id=' . $entry['id']); $newItem->setLink($entry['url']); $newItem->setDate(time()); $newItem->setDescription($entry['content']); -- cgit v1.2.3 From 7a873ef1d76a26975185afcfd1669b5b024d85ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 6 Apr 2014 20:53:31 +0200 Subject: remove unnecessary variable declaration --- inc/3rdparty/libraries/feedwriter/FeedItem.php | 3 +- inc/3rdparty/libraries/feedwriter/FeedWriter.php | 839 +++++++++++------------ 2 files changed, 420 insertions(+), 422 deletions(-) diff --git a/inc/3rdparty/libraries/feedwriter/FeedItem.php b/inc/3rdparty/libraries/feedwriter/FeedItem.php index 7e467ce8..3487423f 100644 --- a/inc/3rdparty/libraries/feedwriter/FeedItem.php +++ b/inc/3rdparty/libraries/feedwriter/FeedItem.php @@ -101,8 +101,7 @@ */ public function setDescription($description) { - $tag = 'description'; - $this->setElement($tag, $description); + $this->setElement('description', $description); } /** diff --git a/inc/3rdparty/libraries/feedwriter/FeedWriter.php b/inc/3rdparty/libraries/feedwriter/FeedWriter.php index 3f95372d..df4c8b4b 100755 --- a/inc/3rdparty/libraries/feedwriter/FeedWriter.php +++ b/inc/3rdparty/libraries/feedwriter/FeedWriter.php @@ -18,424 +18,423 @@ define('JSONP', 3, true); */ class FeedWriter { - private $self = null; // self URL - http://feed2.w3.org/docs/warning/MissingAtomSelfLink.html - private $hubs = array(); // PubSubHubbub hubs - private $channels = array(); // Collection of channel elements - private $items = array(); // Collection of items as object of FeedItem class. - private $data = array(); // Store some other version wise data - private $CDATAEncoding = array(); // The tag names which have to encoded as CDATA - private $xsl = null; // stylesheet to render RSS (used by Chrome) - private $json = null; // JSON object - - private $version = null; - - /** - * Constructor - * - * @param constant the version constant (RSS2 or JSON). - */ - function __construct($version = RSS2) - { - $this->version = $version; - - // Setting default value for assential channel elements - $this->channels['title'] = $version . ' Feed'; - $this->channels['link'] = 'http://www.ajaxray.com/blog'; - - //Tag names to encode in CDATA - $this->CDATAEncoding = array('description', 'content:encoded', 'content', 'subtitle', 'summary'); - } - - public function setFormat($format) { - $this->version = $format; - } - - // Start # public functions --------------------------------------------- - - /** - * Set a channel element - * @access public - * @param srting name of the channel tag - * @param string content of the channel tag - * @return void - */ - public function setChannelElement($elementName, $content) - { - $this->channels[$elementName] = $content ; - } - - /** - * Set multiple channel elements from an array. Array elements - * should be 'channelName' => 'channelContent' format. - * - * @access public - * @param array array of channels - * @return void - */ - public function setChannelElementsFromArray($elementArray) - { - if(! is_array($elementArray)) return; - foreach ($elementArray as $elementName => $content) - { - $this->setChannelElement($elementName, $content); - } - } - - /** - * Genarate the actual RSS/JSON file - * - * @access public - * @return void - */ - public function genarateFeed() - { - if ($this->version == RSS2) { -// header('Content-type: text/xml; charset=UTF-8'); - // this line prevents Chrome 20 from prompting download - // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss -// header('X-content-type-options: nosniff'); - } elseif ($this->version == JSON) { -// header('Content-type: application/json; charset=UTF-8'); - $this->json = new stdClass(); - } elseif ($this->version == JSONP) { -// header('Content-type: application/javascript; charset=UTF-8'); - $this->json = new stdClass(); - } - $this->printHead(); - $this->printChannels(); - $this->printItems(); - $this->printTale(); - if ($this->version == JSON || $this->version == JSONP) { - echo json_encode($this->json); - } - } - - /** - * Create a new FeedItem. - * - * @access public - * @return object instance of FeedItem class - */ - public function createNewItem() - { - $Item = new FeedItem($this->version); - return $Item; - } - - /** - * Add a FeedItem to the main class - * - * @access public - * @param object instance of FeedItem class - * @return void - */ - public function addItem($feedItem) - { - $this->items[] = $feedItem; - } - - // Wrapper functions ------------------------------------------------------------------- - - /** - * Set the 'title' channel element - * - * @access public - * @param srting value of 'title' channel tag - * @return void - */ - public function setTitle($title) - { - $this->setChannelElement('title', $title); - } - - /** - * Add a hub to the channel element - * - * @access public - * @param string URL - * @return void - */ - public function addHub($hub) - { - $this->hubs[] = $hub; - } - - /** - * Set XSL URL - * - * @access public - * @param string URL - * @return void - */ - public function setXsl($xsl) - { - $this->xsl = $xsl; - } - - /** - * Set self URL - * - * @access public - * @param string URL - * @return void - */ - public function setSelf($self) - { - $this->self = $self; - } - - /** - * Set the 'description' channel element - * - * @access public - * @param srting value of 'description' channel tag - * @return void - */ - public function setDescription($desciption) - { - $tag = 'description'; - $this->setChannelElement($tag, $desciption); - } - - /** - * Set the 'link' channel element - * - * @access public - * @param srting value of 'link' channel tag - * @return void - */ - public function setLink($link) - { - $this->setChannelElement('link', $link); - } - - /** - * Set the 'image' channel element - * - * @access public - * @param srting title of image - * @param srting link url of the imahe - * @param srting path url of the image - * @return void - */ - public function setImage($title, $link, $url) - { - $this->setChannelElement('image', array('title'=>$title, 'link'=>$link, 'url'=>$url)); - } - - // End # public functions ---------------------------------------------- - - // Start # private functions ---------------------------------------------- - - /** - * Prints the xml and rss namespace - * - * @access private - * @return void - */ - private function printHead() - { - if ($this->version == RSS2) - { - $out = ''."\n"; - if ($this->xsl) $out .= 'xsl).'"?>' . PHP_EOL; - $out .= '' . PHP_EOL; - echo $out; - } - elseif ($this->version == JSON || $this->version == JSONP) - { - $this->json->rss = array('@attributes' => array('version' => '2.0')); - } - } - - /** - * Closes the open tags at the end of file - * - * @access private - * @return void - */ - private function printTale() - { - if ($this->version == RSS2) - { - echo '',PHP_EOL,''; - } - // do nothing for JSON - } - - /** - * Creates a single node as xml format - * - * @access private - * @param string name of the tag - * @param mixed tag value as string or array of nested tags in 'tagName' => 'tagValue' format - * @param array Attributes(if any) in 'attrName' => 'attrValue' format - * @return string formatted xml tag - */ - private function makeNode($tagName, $tagContent, $attributes = null) - { - if ($this->version == RSS2) - { - $nodeText = ''; - $attrText = ''; - if (is_array($attributes)) - { - foreach ($attributes as $key => $value) - { - $attrText .= " $key=\"$value\" "; - } - } - $nodeText .= "<{$tagName}{$attrText}>"; - if (is_array($tagContent)) - { - foreach ($tagContent as $key => $value) - { - $nodeText .= $this->makeNode($key, $value); - } - } - else - { - //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? $tagContent : htmlentities($tagContent); - $nodeText .= htmlspecialchars($tagContent); - } - //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]>" : ""; - $nodeText .= ""; - return $nodeText . PHP_EOL; - } - elseif ($this->version == JSON || $this->version == JSONP) - { - $tagName = (string)$tagName; - $tagName = strtr($tagName, ':', '_'); - $node = null; - if (!$tagContent && is_array($attributes) && count($attributes)) - { - $node = array('@attributes' => $this->json_keys($attributes)); - } else { - if (is_array($tagContent)) { - $node = $this->json_keys($tagContent); - } else { - $node = $tagContent; - } - } - return $node; - } - return ''; // should not get here - } - - private function json_keys(array $array) { - $new = array(); - foreach ($array as $key => $val) { - if (is_string($key)) $key = strtr($key, ':', '_'); - if (is_array($val)) { - $new[$key] = $this->json_keys($val); - } else { - $new[$key] = $val; - } - } - return $new; - } - - /** - * @desc Print channels - * @access private - * @return void - */ - private function printChannels() - { - //Start channel tag - if ($this->version == RSS2) { - echo '' . PHP_EOL; - // add hubs - foreach ($this->hubs as $hub) { - //echo $this->makeNode('link', '', array('rel'=>'hub', 'href'=>$hub, 'xmlns'=>'http://www.w3.org/2005/Atom')); - echo '' . PHP_EOL; - } - // add self - if (isset($this->self)) { - //echo $this->makeNode('link', '', array('rel'=>'self', 'href'=>$this->self, 'xmlns'=>'http://www.w3.org/2005/Atom')); - echo '' . PHP_EOL; - } - //Print Items of channel - foreach ($this->channels as $key => $value) - { - echo $this->makeNode($key, $value); - } - } elseif ($this->version == JSON || $this->version == JSONP) { - $this->json->rss['channel'] = (object)$this->json_keys($this->channels); - } - } - - /** - * Prints formatted feed items - * - * @access private - * @return void - */ - private function printItems() - { - foreach ($this->items as $item) { - $itemElements = $item->getElements(); - - echo $this->startItem(); - - if ($this->version == JSON || $this->version == JSONP) { - $json_item = array(); - } - - foreach ($itemElements as $thisElement) { - foreach ($thisElement as $instance) { - if ($this->version == RSS2) { - echo $this->makeNode($instance['name'], $instance['content'], $instance['attributes']); - } elseif ($this->version == JSON || $this->version == JSONP) { - $_json_node = $this->makeNode($instance['name'], $instance['content'], $instance['attributes']); - if (count($thisElement) > 1) { - $json_item[strtr($instance['name'], ':', '_')][] = $_json_node; - } else { - $json_item[strtr($instance['name'], ':', '_')] = $_json_node; - } - } - } - } - echo $this->endItem(); - if ($this->version == JSON || $this->version == JSONP) { - if (count($this->items) > 1) { - $this->json->rss['channel']->item[] = $json_item; - } else { - $this->json->rss['channel']->item = $json_item; - } - } - } - } - - /** - * Make the starting tag of channels - * - * @access private - * @return void - */ - private function startItem() - { - if ($this->version == RSS2) - { - echo '' . PHP_EOL; - } - // nothing for JSON - } - - /** - * Closes feed item tag - * - * @access private - * @return void - */ - private function endItem() - { - if ($this->version == RSS2) - { - echo '' . PHP_EOL; - } - // nothing for JSON - } - - // End # private functions ---------------------------------------------- + private $self = null; // self URL - http://feed2.w3.org/docs/warning/MissingAtomSelfLink.html + private $hubs = array(); // PubSubHubbub hubs + private $channels = array(); // Collection of channel elements + private $items = array(); // Collection of items as object of FeedItem class. + private $data = array(); // Store some other version wise data + private $CDATAEncoding = array(); // The tag names which have to encoded as CDATA + private $xsl = null; // stylesheet to render RSS (used by Chrome) + private $json = null; // JSON object + + private $version = null; + + /** + * Constructor + * + * @param constant the version constant (RSS2 or JSON). + */ + function __construct($version = RSS2) + { + $this->version = $version; + + // Setting default value for assential channel elements + $this->channels['title'] = $version . ' Feed'; + $this->channels['link'] = 'http://www.ajaxray.com/blog'; + + //Tag names to encode in CDATA + $this->CDATAEncoding = array('description', 'content:encoded', 'content', 'subtitle', 'summary'); + } + + public function setFormat($format) { + $this->version = $format; + } + + // Start # public functions --------------------------------------------- + + /** + * Set a channel element + * @access public + * @param srting name of the channel tag + * @param string content of the channel tag + * @return void + */ + public function setChannelElement($elementName, $content) + { + $this->channels[$elementName] = $content ; + } + + /** + * Set multiple channel elements from an array. Array elements + * should be 'channelName' => 'channelContent' format. + * + * @access public + * @param array array of channels + * @return void + */ + public function setChannelElementsFromArray($elementArray) + { + if(! is_array($elementArray)) return; + foreach ($elementArray as $elementName => $content) + { + $this->setChannelElement($elementName, $content); + } + } + + /** + * Genarate the actual RSS/JSON file + * + * @access public + * @return void + */ + public function genarateFeed() + { + if ($this->version == RSS2) { +// header('Content-type: text/xml; charset=UTF-8'); + // this line prevents Chrome 20 from prompting download + // used by Google: https://news.google.com/news/feeds?ned=us&topic=b&output=rss +// header('X-content-type-options: nosniff'); + } elseif ($this->version == JSON) { +// header('Content-type: application/json; charset=UTF-8'); + $this->json = new stdClass(); + } elseif ($this->version == JSONP) { +// header('Content-type: application/javascript; charset=UTF-8'); + $this->json = new stdClass(); + } + $this->printHead(); + $this->printChannels(); + $this->printItems(); + $this->printTale(); + if ($this->version == JSON || $this->version == JSONP) { + echo json_encode($this->json); + } + } + + /** + * Create a new FeedItem. + * + * @access public + * @return object instance of FeedItem class + */ + public function createNewItem() + { + $Item = new FeedItem($this->version); + return $Item; + } + + /** + * Add a FeedItem to the main class + * + * @access public + * @param object instance of FeedItem class + * @return void + */ + public function addItem($feedItem) + { + $this->items[] = $feedItem; + } + + // Wrapper functions ------------------------------------------------------------------- + + /** + * Set the 'title' channel element + * + * @access public + * @param srting value of 'title' channel tag + * @return void + */ + public function setTitle($title) + { + $this->setChannelElement('title', $title); + } + + /** + * Add a hub to the channel element + * + * @access public + * @param string URL + * @return void + */ + public function addHub($hub) + { + $this->hubs[] = $hub; + } + + /** + * Set XSL URL + * + * @access public + * @param string URL + * @return void + */ + public function setXsl($xsl) + { + $this->xsl = $xsl; + } + + /** + * Set self URL + * + * @access public + * @param string URL + * @return void + */ + public function setSelf($self) + { + $this->self = $self; + } + + /** + * Set the 'description' channel element + * + * @access public + * @param srting value of 'description' channel tag + * @return void + */ + public function setDescription($description) + { + $this->setChannelElement('description', $description); + } + + /** + * Set the 'link' channel element + * + * @access public + * @param srting value of 'link' channel tag + * @return void + */ + public function setLink($link) + { + $this->setChannelElement('link', $link); + } + + /** + * Set the 'image' channel element + * + * @access public + * @param srting title of image + * @param srting link url of the imahe + * @param srting path url of the image + * @return void + */ + public function setImage($title, $link, $url) + { + $this->setChannelElement('image', array('title'=>$title, 'link'=>$link, 'url'=>$url)); + } + + // End # public functions ---------------------------------------------- + + // Start # private functions ---------------------------------------------- + + /** + * Prints the xml and rss namespace + * + * @access private + * @return void + */ + private function printHead() + { + if ($this->version == RSS2) + { + $out = ''."\n"; + if ($this->xsl) $out .= 'xsl).'"?>' . PHP_EOL; + $out .= '' . PHP_EOL; + echo $out; + } + elseif ($this->version == JSON || $this->version == JSONP) + { + $this->json->rss = array('@attributes' => array('version' => '2.0')); + } + } + + /** + * Closes the open tags at the end of file + * + * @access private + * @return void + */ + private function printTale() + { + if ($this->version == RSS2) + { + echo '',PHP_EOL,''; + } + // do nothing for JSON + } + + /** + * Creates a single node as xml format + * + * @access private + * @param string name of the tag + * @param mixed tag value as string or array of nested tags in 'tagName' => 'tagValue' format + * @param array Attributes(if any) in 'attrName' => 'attrValue' format + * @return string formatted xml tag + */ + private function makeNode($tagName, $tagContent, $attributes = null) + { + if ($this->version == RSS2) + { + $nodeText = ''; + $attrText = ''; + if (is_array($attributes)) + { + foreach ($attributes as $key => $value) + { + $attrText .= " $key=\"$value\" "; + } + } + $nodeText .= "<{$tagName}{$attrText}>"; + if (is_array($tagContent)) + { + foreach ($tagContent as $key => $value) + { + $nodeText .= $this->makeNode($key, $value); + } + } + else + { + //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? $tagContent : htmlentities($tagContent); + $nodeText .= htmlspecialchars($tagContent); + } + //$nodeText .= (in_array($tagName, $this->CDATAEncoding))? "]]>" : ""; + $nodeText .= ""; + return $nodeText . PHP_EOL; + } + elseif ($this->version == JSON || $this->version == JSONP) + { + $tagName = (string)$tagName; + $tagName = strtr($tagName, ':', '_'); + $node = null; + if (!$tagContent && is_array($attributes) && count($attributes)) + { + $node = array('@attributes' => $this->json_keys($attributes)); + } else { + if (is_array($tagContent)) { + $node = $this->json_keys($tagContent); + } else { + $node = $tagContent; + } + } + return $node; + } + return ''; // should not get here + } + + private function json_keys(array $array) { + $new = array(); + foreach ($array as $key => $val) { + if (is_string($key)) $key = strtr($key, ':', '_'); + if (is_array($val)) { + $new[$key] = $this->json_keys($val); + } else { + $new[$key] = $val; + } + } + return $new; + } + + /** + * @desc Print channels + * @access private + * @return void + */ + private function printChannels() + { + //Start channel tag + if ($this->version == RSS2) { + echo '' . PHP_EOL; + // add hubs + foreach ($this->hubs as $hub) { + //echo $this->makeNode('link', '', array('rel'=>'hub', 'href'=>$hub, 'xmlns'=>'http://www.w3.org/2005/Atom')); + echo '' . PHP_EOL; + } + // add self + if (isset($this->self)) { + //echo $this->makeNode('link', '', array('rel'=>'self', 'href'=>$this->self, 'xmlns'=>'http://www.w3.org/2005/Atom')); + echo '' . PHP_EOL; + } + //Print Items of channel + foreach ($this->channels as $key => $value) + { + echo $this->makeNode($key, $value); + } + } elseif ($this->version == JSON || $this->version == JSONP) { + $this->json->rss['channel'] = (object)$this->json_keys($this->channels); + } + } + + /** + * Prints formatted feed items + * + * @access private + * @return void + */ + private function printItems() + { + foreach ($this->items as $item) { + $itemElements = $item->getElements(); + + echo $this->startItem(); + + if ($this->version == JSON || $this->version == JSONP) { + $json_item = array(); + } + + foreach ($itemElements as $thisElement) { + foreach ($thisElement as $instance) { + if ($this->version == RSS2) { + echo $this->makeNode($instance['name'], $instance['content'], $instance['attributes']); + } elseif ($this->version == JSON || $this->version == JSONP) { + $_json_node = $this->makeNode($instance['name'], $instance['content'], $instance['attributes']); + if (count($thisElement) > 1) { + $json_item[strtr($instance['name'], ':', '_')][] = $_json_node; + } else { + $json_item[strtr($instance['name'], ':', '_')] = $_json_node; + } + } + } + } + echo $this->endItem(); + if ($this->version == JSON || $this->version == JSONP) { + if (count($this->items) > 1) { + $this->json->rss['channel']->item[] = $json_item; + } else { + $this->json->rss['channel']->item = $json_item; + } + } + } + } + + /** + * Make the starting tag of channels + * + * @access private + * @return void + */ + private function startItem() + { + if ($this->version == RSS2) + { + echo '' . PHP_EOL; + } + // nothing for JSON + } + + /** + * Closes feed item tag + * + * @access private + * @return void + */ + private function endItem() + { + if ($this->version == RSS2) + { + echo '' . PHP_EOL; + } + // nothing for JSON + } + + // End # private functions ---------------------------------------------- } \ No newline at end of file -- cgit v1.2.3 From d9b51a21fac7815e4b79efc98d696154fb221917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Apr 2014 15:14:50 +0200 Subject: update french locale, thx to @goofy-bz and @Draky50110 #596 --- locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo | Bin 12738 -> 12818 bytes locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po | 116 +++++++++++++++++----------- 2 files changed, 72 insertions(+), 44 deletions(-) mode change 100644 => 100755 locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo mode change 100644 => 100755 locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.mo old mode 100644 new mode 100755 index 600b3281..7bcde861 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 diff --git a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po old mode 100644 new mode 100755 index 5053e9e3..bd8dd9b8 --- a/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po +++ b/locale/fr_FR.utf8/LC_MESSAGES/fr_FR.utf8.po @@ -1,26 +1,25 @@ msgid "" msgstr "" -"Project-Id-Version: \n" +"Project-Id-Version: wallabag 1.6.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2014-02-25 18:33+0300\n" "PO-Revision-Date: \n" -"Last-Translator: Maryana \n" +"Last-Translator: Gilles WITTEZAELE \n" "Language-Team: \n" -"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Poedit-KeywordsList: _;gettext;gettext_noop\n" -"X-Poedit-Basepath: .\n" -"X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.5.7\n" -"X-Poedit-SearchPath-0: /home/mariroz/_DEV/web/wallabag/wallabag-master-testing\n" +"X-Poedit-SourceCharset: UTF-8\n" +"X-Generator: Poedit 1.6.4\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Language: fr_FR\n" msgid "wallabag, a read it later open source system" msgstr "wallabag, un système open source de lecture différé" msgid "login failed: user doesn't exist" -msgstr "identification échouée : l'utilisateur n'existe pas" +msgstr "échec de l'identification : cet utilisateur n'existe pas" msgid "return home" msgstr "retour à l'accueil" @@ -32,13 +31,13 @@ msgid "Saving articles" msgstr "Sauvegarde des articles" msgid "There are several ways to save an article:" -msgstr "Il y a plusieurs façons de sauver un article :" +msgstr "Il y a plusieurs façons d'enregistrer un article :" msgid "read the documentation" msgstr "lisez la documentation" msgid "download the extension" -msgstr "télécharger l'extension" +msgstr "téléchargez l'extension" msgid "via F-Droid" msgstr "via F-Droid" @@ -50,7 +49,7 @@ msgid "via Google Play" msgstr "via Google PlayStore" msgid "download the application" -msgstr "télécharger l'application" +msgstr "téléchargez l'application" msgid "By filling this field" msgstr "En remplissant ce champ" @@ -85,8 +84,13 @@ msgstr "Une version de développement plus récente est disponible." msgid "Feeds" msgstr "Flux" -msgid "Your feed token is currently empty and must first be generated to enable feeds. Click here to generate it." -msgstr "Votre jeton de flux est actuellement vide doit d'abord être généré pour activer les flux. Cliquez ici pour le générer." +msgid "" +"Your feed token is currently empty and must first be generated to enable " +"feeds. Click here to generate it." +msgstr "" +"Votre jeton de flux est actuellement vide et doit d'abord être généré pour " +"activer les flux. Cliquez ici pour " +"le générer." msgid "Unread feed" msgstr "Flux des non lus" @@ -103,8 +107,12 @@ msgstr "Votre jeton :" msgid "Your user id:" msgstr "Votre ID utilisateur :" -msgid "You can regenerate your token: generate!." -msgstr "Vous pouvez regénérer votre jeton : génération !." +msgid "" +"You can regenerate your token: generate!" +"." +msgstr "" +"Vous pouvez regénérer votre jeton : génération !." msgid "Change your theme" msgstr "Changer votre thème" @@ -136,8 +144,11 @@ msgstr "Répétez votre nouveau mot de passe :" msgid "Import" msgstr "Importer" -msgid "Please execute the import script locally as it can take a very long time." -msgstr "Merci d'exécuter l'import en local car cela peut prendre du temps." +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 :" @@ -150,13 +161,13 @@ 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 "Import depuis Readability" +msgstr "Importer depuis Readability" msgid "Import from Instapaper" -msgstr "Import depuis Instapaper" +msgstr "Importer depuis Instapaper" msgid "Import from wallabag" -msgstr "Import depuis wallabag" +msgstr "Importer depuis wallabag" msgid "Export your wallabag data" msgstr "Exporter vos données de wallabag" @@ -185,8 +196,12 @@ msgstr "retourner à l'article" msgid "plop" msgstr "plop" -msgid "You can check your configuration here." -msgstr "Vous pouvez vérifier votre configuration ici." +msgid "" +"You can check your configuration " +"here." +msgstr "" +"Vous pouvez vérifier votre configuration ici." msgid "favoris" msgstr "favoris" @@ -248,8 +263,14 @@ msgstr "installation" msgid "install your wallabag" msgstr "installez votre wallabag" -msgid "wallabag is still not installed. Please fill the below form to install it. Don't hesitate to read the documentation on wallabag website." -msgstr "wallabag n'est pas encore installé. Merci de remplir le formulaire suivant pour l'installer. N'hésitez pas à lire la documentation sur le site de wallabag." +msgid "" +"wallabag is still not installed. Please fill the below form to install it. " +"Don't hesitate to read the documentation " +"on wallabag website." +msgstr "" +"wallabag n'est pas encore installé. Merci de remplir le formulaire suivant " +"pour l'installer. N'hésitez pas à lire la " +"documentation sur le site de wallabag." msgid "Login" msgstr "Nom d'utilisateur" @@ -267,7 +288,8 @@ msgid "Login to wallabag" msgstr "Se connecter à wallabag" msgid "you are in demo mode, some features may be disabled." -msgstr "vous êtes en mode démo, certaines fonctionnalités peuvent être désactivées." +msgstr "" +"vous êtes en mode démo, certaines fonctionnalités peuvent être désactivées." msgid "Username" msgstr "Nom d'utilisateur" @@ -318,10 +340,10 @@ msgid "tags:" msgstr "tags :" msgid "Edit tags" -msgstr "Editer les tags" +msgstr "Modifier les tags" msgid "save link!" -msgstr "sauver le lien !" +msgstr "enregistrer le lien !" msgid "powered by" msgstr "propulsé par" @@ -360,7 +382,7 @@ msgid "tweet" msgstr "tweet" msgid "email" -msgstr "ee-mail" +msgstr "e-mail" msgid "this article appears wrong?" msgstr "cet article s'affiche mal ?" @@ -369,7 +391,7 @@ msgid "No link available here!" msgstr "Aucun lien n'est disponible ici !" msgid "Poching a link" -msgstr "Sauver un lien" +msgstr "Enregistrer un lien" msgid "by filling this field" msgstr "en remplissant ce champ" @@ -396,19 +418,21 @@ msgid "a more recent development version is available." msgstr "une version de développement plus récente est disponible." msgid "Please execute the import script locally, it can take a very long time." -msgstr "Merci d'exécuter l'import en local car cela peut prendre du temps." +msgstr "" +"Merci d'exécuter le script d'importation en local car cela peut prendre du " +"temps." msgid "More infos in the official doc:" msgstr "Plus d'infos dans la documentation officielle :" msgid "import from Pocket" -msgstr "import depuis Pocket" +msgstr "importation depuis Pocket" msgid "import from Readability" -msgstr "import depuis Readability" +msgstr "importation depuis Readability" msgid "import from Instapaper" -msgstr "import depuis Instapaper" +msgstr "importation depuis Instapaper" msgid "estimated reading time :" msgstr "temps de lecture estimé :" @@ -449,8 +473,12 @@ msgstr "en mode démo, vous ne pouvez pas mettre à jour le mot de passe" msgid "your password has been updated" msgstr "votre mot de passe a été mis à jour" -msgid "the two fields have to be filled & the password must be the same in the two fields" -msgstr "les deux champs doivent être remplis & le mot de passe doit être le même dans les deux" +msgid "" +"the two fields have to be filled & the password must be the same in the two " +"fields" +msgstr "" +"les deux champs doivent être remplis & le mot de passe doit être le même " +"dans les deux" msgid "still using the \"" msgstr "utilise encore \"" @@ -459,7 +487,7 @@ msgid "that theme does not seem to be installed" msgstr "ce thème ne semble pas installé" msgid "you have changed your theme preferences" -msgstr "vous avez changez vos préférences de thème" +msgstr "vous avez changé vos préférences de thème" msgid "that language does not seem to be installed" msgstr "cette langue ne semble pas être installée" @@ -468,28 +496,28 @@ msgid "you have changed your language preferences" msgstr "vous avez changé vos préférences de langue" msgid "login failed: you have to fill all fields" -msgstr "identification échouée : vous devez remplir tous les champs" +msgstr "échec de l'identification : vous devez remplir tous les champs" msgid "welcome to your wallabag" msgstr "bienvenue dans votre wallabag" msgid "login failed: bad login or password" -msgstr "identification échouée : mauvais identifiant ou mot de passe" +msgstr "échec de l'identification : mauvais identifiant ou mot de passe" msgid "import from instapaper completed" -msgstr "Import depuis Instapaper complété" +msgstr "Importation depuis Instapaper complété" msgid "import from pocket completed" -msgstr "Import depuis Pocket complété" +msgstr "Importation depuis Pocket complété" msgid "import from Readability completed. " -msgstr "Import depuis Readability complété" +msgstr "Importation depuis Readability complété" msgid "import from Poche completed. " -msgstr "Import depuis Pocket complété" +msgstr "Importation depuis Pocket complété" msgid "Unknown import provider." -msgstr "Fournisseur d'import inconnu." +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 \"" @@ -498,7 +526,7 @@ msgid "Could not find required \"" msgstr "Ne peut pas trouver \"" msgid "Uh, there is a problem while generating feeds." -msgstr "Ih, il y a un problème lors de la génération des flux." +msgstr "Hum, il y a un problème lors de la génération des flux." msgid "Cache deleted." msgstr "Cache effacé." -- cgit v1.2.3 From 69c57493e758ec71380fb04accc223bd169be51c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 7 Apr 2014 15:44:05 +0200 Subject: [fix] with some config, http host is different --- inc/poche/Tools.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index a130e94b..7f064020 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -59,8 +59,10 @@ class Tools return $scriptname; } + $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'])); + return 'http' . ($https ? 's' : '') . '://' - . $_SERVER["HTTP_HOST"] . $serverport . $scriptname; + . $host . $serverport . $scriptname; } public static function redirect($url = '') -- cgit v1.2.3 From 86da39886d11e6058199fc7da5adc24d1f84cb76 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Tue, 8 Apr 2014 11:41:06 +0300 Subject: remove duplicates by import, code changes: tabs replaced with spaces --- inc/poche/Poche.class.php | 73 ++++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 36 deletions(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a662f695..90fbcb2d 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -828,7 +828,7 @@ class Poche define('IMPORT_LIMIT', 5); } if (!defined('IMPORT_DELAY')) { - define('IMPORT_DELAY', 5); + define('IMPORT_DELAY', 5); } if ( isset($_FILES['file']) ) { @@ -844,18 +844,18 @@ class Poche $read = 0; foreach (array('ol','ul') as $list) { foreach ($html->find($list) as $ul) { - foreach ($ul->find('li') as $li) { - $tmpEntry = array(); - $a = $li->find('a'); - $tmpEntry['url'] = $a[0]->href; - $tmpEntry['tags'] = $a[0]->tags; - $tmpEntry['is_read'] = $read; - if ($tmpEntry['url']) { - $data[] = $tmpEntry; - } - } - # the second
          is for read links - $read = ((sizeof($data) && $read)?0:1); + foreach ($ul->find('li') as $li) { + $tmpEntry = array(); + $a = $li->find('a'); + $tmpEntry['url'] = $a[0]->href; + $tmpEntry['tags'] = $a[0]->tags; + $tmpEntry['is_read'] = $read; + if ($tmpEntry['url']) { + $data[] = $tmpEntry; + } + } + # the second
            is for read links + $read = ((sizeof($data) && $read)?0:1); } } } @@ -866,16 +866,16 @@ class Poche $data[] = $record; foreach ($record as $record2) { if (is_array($record2)) { - $data[] = $record2; + $data[] = $record2; } } } } - $i = 0; //counter for articles inserted + $urlsInserted = array(); //urls of articles inserted foreach ($data as $record) { $url = trim( isset($record['article__url']) ? $record['article__url'] : (isset($record['url']) ? $record['url'] : '') ); - if ( $url ) { + if ( $url and !in_array($url, $urlsInserted) ) { $title = (isset($record['title']) ? $record['title'] : _('Untitled - Import - ').' '._('click to finish import').''); $body = (isset($record['content']) ? $record['content'] : ''); $isRead = (isset($record['is_read']) ? intval($record['is_read']) : (isset($record['archive'])?intval($record['archive']):0)); @@ -883,16 +883,17 @@ class Poche //insert new record $id = $this->store->add($url, $title, $body, $this->user->getId(), $isFavorite, $isRead); if ( $id ) { - //increment no of records inserted - $i++; + $urlsInserted[] = $url; //add + if ( isset($record['tags']) && trim($record['tags']) ) { - //@TODO: set tags + //@TODO: set tags } } } } + $i = sizeof($urlsInserted); if ( $i > 0 ) { $this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".')); } @@ -919,17 +920,17 @@ class Poche $purifier = new HTMLPurifier($config); foreach ($items as $item) { - $url = new Url(base64_encode($item['url'])); - $content = Tools::getPageContent($url); + $url = new Url(base64_encode($item['url'])); + $content = Tools::getPageContent($url); - $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); - $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); + $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); + $body = (($content['rss']['channel']['item']['description'] != '') ? $content['rss']['channel']['item']['description'] : _('Undefined')); - //clean content to prevent xss attack - $title = $purifier->purify($title); - $body = $purifier->purify($body); + //clean content to prevent xss attack + $title = $purifier->purify($title); + $body = $purifier->purify($body); - $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); + $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); } } @@ -944,8 +945,8 @@ class Poche */ public function export() { - $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; - header('Content-Disposition: attachment; filename='.$filename); + $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; + header('Content-Disposition: attachment; filename='.$filename); $entries = $this->store->retrieveAll($this->user->getId()); echo $this->tpl->render('export.twig', array( @@ -978,13 +979,13 @@ class Poche public function generateToken() { if (ini_get('open_basedir') === '') { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - echo 'This is a server using Windows!'; - // alternative to /dev/urandom for Windows - $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); - } else { - $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15); - } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + echo 'This is a server using Windows!'; + // alternative to /dev/urandom for Windows + $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); + } else { + $token = substr(base64_encode(file_get_contents('/dev/urandom', false, null, 0, 20)), 0, 15); + } } else { $token = substr(base64_encode(uniqid(mt_rand(), true)), 0, 20); -- cgit v1.2.3 From 3945335f3988c7eb9d5bbf9e9428b2cd6c173a2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Apr 2014 21:58:44 +0200 Subject: can't close search popup with the cross picture #613 --- themes/baggy/_head.twig | 1 + themes/baggy/_search-form.twig | 22 ++++------------------ themes/default/_head.twig | 1 + themes/default/js/popupForm.js | 20 ++++++++++++++++++++ 4 files changed, 26 insertions(+), 18 deletions(-) create mode 100644 themes/default/js/popupForm.js diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig index 04898d85..be11673f 100755 --- a/themes/baggy/_head.twig +++ b/themes/baggy/_head.twig @@ -12,4 +12,5 @@ + diff --git a/themes/baggy/_search-form.twig b/themes/baggy/_search-form.twig index 1fd4154e..b8ac3bfa 100644 --- a/themes/baggy/_search-form.twig +++ b/themes/baggy/_search-form.twig @@ -1,21 +1,7 @@ -
            +
            - + X{% trans "Search" %} : - + -
            - \ No newline at end of file +
            \ No newline at end of file diff --git a/themes/default/_head.twig b/themes/default/_head.twig index ffbfc22e..8c939e30 100755 --- a/themes/default/_head.twig +++ b/themes/default/_head.twig @@ -11,3 +11,4 @@ + \ No newline at end of file diff --git a/themes/default/js/popupForm.js b/themes/default/js/popupForm.js new file mode 100644 index 00000000..06be3f0c --- /dev/null +++ b/themes/default/js/popupForm.js @@ -0,0 +1,20 @@ +$(document).ready(function() { + + $("#search-form").hide(); + + function closeSearch() { + $("#search-form").toggle(); + $("#search").toggleClass("current"); + $("#search-arrow").toggleClass("arrow-down"); + } + + $("#search").click(function(){ + closeSearch(); + }); + + $("#search-form-close").click(function(){ + closeSearch(); + }); + + +}); \ No newline at end of file -- cgit v1.2.3 From f8e9d8bdbcd1514bef078456a6235288800f9950 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Apr 2014 22:10:40 +0200 Subject: [fix] Escap key displays save a link form #612 --- themes/default/js/saveLink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/default/js/saveLink.js b/themes/default/js/saveLink.js index ccc00d1e..bee453c0 100755 --- a/themes/default/js/saveLink.js +++ b/themes/default/js/saveLink.js @@ -75,7 +75,7 @@ $.fn.ready(function() { ========================================================================== */ $(window).keydown(function(e){ - if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || e.keyCode == 27 ) { + if ( ( e.target.tagName.toLowerCase() !== 'input' && e.keyCode == 83 ) || (e.keyCode == 27 && $bagitForm.is(':visible') ) ) { $bagit.removeClass("current"); $("#bagit-arrow").removeClass("arrow-down"); toggleSaveLinkForm(); -- cgit v1.2.3 From 6e8030a0db9b669fdd5be3d3a07d6a193e456cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Apr 2014 22:33:28 +0200 Subject: [fix] display problem with smartphone and Baggy #610 --- themes/baggy/css/main.css | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index 0dd552de..e4c62a10 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -352,10 +352,10 @@ footer a { letter-spacing:normal; box-shadow: 0 3px 7px rgba(0,0,0,0.3); display: inline-block; - width: 32%!important; + width: 32%; margin-bottom: 1.5em; vertical-align: top; - margin-left: 1.5%!important; + margin-left: 1.5%; position: relative; overflow: hidden; padding: 1.5em 1.5em 3em 1.5em; @@ -492,7 +492,7 @@ footer a { } .entrie:nth-child(3n+1) { - margin-left: 0!important; + margin-left: 0; } .results { -- cgit v1.2.3 From 08f539f738c0b30426392cd2ea74da96a92c625d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Tue, 8 Apr 2014 22:42:34 +0200 Subject: responsive for search form #610 --- themes/baggy/css/main.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/baggy/css/main.css b/themes/baggy/css/main.css index e4c62a10..0991dbed 100755 --- a/themes/baggy/css/main.css +++ b/themes/baggy/css/main.css @@ -540,7 +540,7 @@ footer a { 2.1 = "save a link" popup div related styles ========================================================================== */ -#bagit-form { +#bagit-form, #search-form { background: rgba(0,0,0,0.5); position: absolute; top: 0; @@ -555,7 +555,7 @@ footer a { border-left: 1px #EEE solid; } -#bagit-form form { +#bagit-form form, #search-form form { background: #FFF; position: absolute; top: 0; @@ -568,7 +568,7 @@ footer a { padding: 2em; } -a#bagit-form-close { +a#bagit-form-close, a#search-form-close { background: #000; color: #FFF; padding: 0.2em 0.5em; @@ -577,7 +577,7 @@ a#bagit-form-close { float: right; font-size: 0.6em; } -a#bagit-form-close:hover { +a#bagit-form-close:hover, a#search-form-close:hover { background: #999; color: #000; } @@ -1028,7 +1028,7 @@ blockquote { display: none; } - #bagit-form { + #bagit-form, #search-form { left: 0; } } -- cgit v1.2.3 From 5ce397847230c70c513ac4fbc3bfbb31498b443f Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Fri, 11 Apr 2014 14:43:17 +0300 Subject: logging by import added; error by creation table if exists in postgresql fixed. --- inc/poche/Database.class.php | 6 +++--- inc/poche/Poche.class.php | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index a80eea97..d1044a6e 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -77,7 +77,7 @@ class Database { } else { $sql = ' - CREATE TABLE tags ( + CREATE TABLE IF NOT EXISTS tags ( id bigserial primary key, value varchar(255) NOT NULL ); @@ -110,7 +110,7 @@ class Database { } else { $sql = ' - CREATE TABLE tags_entries ( + CREATE TABLE IF NOT EXISTS tags_entries ( id bigserial primary key, entry_id integer NOT NULL, tag_id integer NOT NULL @@ -407,7 +407,7 @@ class Database { public function getLastId($column = '') { return $this->getHandle()->lastInsertId($column); } - + public function search($term, $user_id, $limit = '') { $search = '%'.$term.'%'; $sql_action = "SELECT * FROM entries WHERE user_id=? AND (content LIKE ? OR title LIKE ? OR url LIKE ?) "; //searches in content, title and URL diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 613377c6..3a4e78d6 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -832,6 +832,8 @@ class Poche } if ( isset($_FILES['file']) ) { + Tools::logm('Import stated: parsing file'); + // assume, that file is in json format $str_data = file_get_contents($_FILES['file']['tmp_name']); $data = json_decode($str_data, true); @@ -897,6 +899,7 @@ class Poche if ( $i > 0 ) { $this->messages->add('s', _('Articles inserted: ').$i._('. Please note, that some may be marked as "read".')); } + Tools::logm('Import of articles finished: '.$i.' articles added (w/o content if not provided).'); } //file parsing finished here @@ -907,12 +910,14 @@ class Poche if ( $recordsDownloadRequired == 0 ) { //nothing to download $this->messages->add('s', _('Import finished.')); + Tools::logm('Import finished completely'); Tools::redirect(); } else { //if just inserted - don't download anything, download will start in next reload if ( !isset($_FILES['file']) ) { //download next batch + Tools::logm('Fetching next batch of articles...'); $items = $this->store->retrieveUnfetchedEntries($this->user->getId(), IMPORT_LIMIT); $config = HTMLPurifier_Config::createDefault(); @@ -921,6 +926,7 @@ class Poche foreach ($items as $item) { $url = new Url(base64_encode($item['url'])); + Tools::logm('Fetching article '.$item['id']); $content = Tools::getPageContent($url); $title = (($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled')); @@ -931,6 +937,7 @@ class Poche $body = $purifier->purify($body); $this->store->updateContentAndTitle($item['id'], $title, $body, $this->user->getId()); + Tools::logm('Article '.$item['id'].' updated.'); } } -- cgit v1.2.3 From 0f859c6f321af6dfaea66e04cde705ba97e6b5be Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Fri, 11 Apr 2014 17:21:54 +0300 Subject: error with empty content by import fixed. Also youtube and vimeo videos are allowd in content now. --- inc/poche/Database.class.php | 4 ++-- inc/poche/Poche.class.php | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index d1044a6e..036c9d1b 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -245,7 +245,7 @@ class Database { $sql_limit = "LIMIT ".$limit." OFFSET 0"; } - $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND user_id=? ORDER BY id " . $sql_limit; + $sql = "SELECT * FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=? ORDER BY id " . $sql_limit; $query = $this->executeQuery($sql, array($user_id)); $entries = $query->fetchAll(); @@ -253,7 +253,7 @@ class Database { } public function retrieveUnfetchedEntriesCount($user_id) { - $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND user_id=?"; + $sql = "SELECT count(*) FROM entries WHERE (content = '' OR content IS NULL) AND title LIKE 'Untitled - Import%' AND user_id=?"; $query = $this->executeQuery($sql, array($user_id)); list($count) = $query->fetch(); diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 3a4e78d6..811895dc 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -373,9 +373,7 @@ class Poche $body = $content['rss']['channel']['item']['description']; // clean content from prevent xss attack - $config = HTMLPurifier_Config::createDefault(); - $config->set('Cache.SerializerPath', CACHE); - $purifier = new HTMLPurifier($config); + $purifier = $this->getPurifier(); $title = $purifier->purify($title); $body = $purifier->purify($body); @@ -920,9 +918,7 @@ class Poche Tools::logm('Fetching next batch of articles...'); $items = $this->store->retrieveUnfetchedEntries($this->user->getId(), IMPORT_LIMIT); - $config = HTMLPurifier_Config::createDefault(); - $config->set('Cache.SerializerPath', CACHE); - $purifier = new HTMLPurifier($config); + $purifier = $this->getPurifier(); foreach ($items as $item) { $url = new Url(base64_encode($item['url'])); @@ -1064,4 +1060,16 @@ class Poche $this->messages->add('s', _('Cache deleted.')); Tools::redirect(); } + + /** + * return new purifier object with actual config + */ + protected function getPurifier() { + $config = HTMLPurifier_Config::createDefault(); + $config->set('Cache.SerializerPath', CACHE); + $config->set('HTML.SafeIframe', true); + $config->set('URI.SafeIframeRegexp', '%^(https?:)?//(www\.youtube(?:-nocookie)?\.com/embed/|player\.vimeo\.com/video/)%'); //allow YouTube and Vimeo$purifier = new HTMLPurifier($config); + + return new HTMLPurifier($config); + } } -- cgit v1.2.3 From 7256e9e139eb07cdae1fbe3009454e6c7d9a8677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 11 Apr 2014 17:08:11 +0200 Subject: 1.6.1 version --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 7f72b146..deb13d7a 100755 --- a/index.php +++ b/index.php @@ -8,7 +8,7 @@ * @license http://www.wtfpl.net/ see COPYING file */ -define ('POCHE', '1.6.0'); +define ('POCHE', '1.6.1'); require 'check_setup.php'; require_once 'inc/poche/global.inc.php'; -- cgit v1.2.3