aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-04-18 20:01:56 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2016-04-18 20:01:56 +0200
commit143f550ba6bee8c13ce80a753fe6f15a20a551f1 (patch)
tree26ff1bb46df5ad5c1dbf711fb323a7659a715345 /inc/poche
parent5d49f06220d3a8f1c731a6cea7f39fd71e8c774d (diff)
parent729c89aec41c7f53411deb43389e2b775a29d073 (diff)
downloadwallabag-143f550ba6bee8c13ce80a753fe6f15a20a551f1.tar.gz
wallabag-143f550ba6bee8c13ce80a753fe6f15a20a551f1.tar.zst
wallabag-143f550ba6bee8c13ce80a753fe6f15a20a551f1.zip
Merge pull request #1814 from wallabag/dev
Wallabag 1.9.2
Diffstat (limited to 'inc/poche')
-rwxr-xr-xinc/poche/Poche.class.php4
-rwxr-xr-xinc/poche/Tools.class.php23
2 files changed, 24 insertions, 3 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 9014f455..1476d158 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -190,7 +190,7 @@ class Poche
190 { 190 {
191 case 'add': 191 case 'add':
192 $content = Tools::getPageContent($url); 192 $content = Tools::getPageContent($url);
193 $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); 193 $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : parse_url($url, PHP_URL_HOST);
194 $body = $content['rss']['channel']['item']['description']; 194 $body = $content['rss']['channel']['item']['description'];
195 195
196 // clean content from prevent xss attack 196 // clean content from prevent xss attack
@@ -908,7 +908,7 @@ class Poche
908 $entries = $this->store->retrieveAllWithTags($this->user->getId()); 908 $entries = $this->store->retrieveAllWithTags($this->user->getId());
909 if ($entries) { 909 if ($entries) {
910 echo $this->tpl->render('export.twig', array( 910 echo $this->tpl->render('export.twig', array(
911 'export' => Tools::renderJson($entries), 911 'export' => Tools::renderJson(Tools::utf8ize($entries)),
912 )); 912 ));
913 Tools::logm('export view'); 913 Tools::logm('export view');
914 } else { 914 } else {
diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php
index 9c748391..263034f0 100755
--- a/inc/poche/Tools.class.php
+++ b/inc/poche/Tools.class.php
@@ -141,7 +141,7 @@ final class Tools
141 public static function getFile($url) 141 public static function getFile($url)
142 { 142 {
143 $timeout = 15; 143 $timeout = 15;
144 $useragent = "Mozilla/5.0 (Windows NT 5.1; rv:18.0) Gecko/20100101 Firefox/18.0"; 144 $useragent = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0";
145 145
146 if (in_array ('curl', get_loaded_extensions())) { 146 if (in_array ('curl', get_loaded_extensions())) {
147 # Fetch feed from URL 147 # Fetch feed from URL
@@ -233,6 +233,27 @@ final class Tools
233 } 233 }
234 234
235 /** 235 /**
236 * UTF-8 encode array of string
237 *
238 * @param $data
239 */
240 public static function utf8ize($data)
241 {
242 if (is_array($data))
243 {
244 foreach ($data as $k => $v)
245 {
246 $data[$k] = self::utf8ize($v);
247 }
248 }
249 else if (is_string ($data) && '' == mb_detect_encoding($data))
250 {
251 return utf8_encode($data);
252 }
253 return $data;
254 }
255
256 /**
236 * Create new line in log file 257 * Create new line in log file
237 * 258 *
238 * @param $message 259 * @param $message