From 4b77a62f2af5e3804b13159f44641e584825cdb1 Mon Sep 17 00:00:00 2001 From: Thomas Date: Fri, 7 Aug 2015 11:16:48 +0200 Subject: [PATCH 01/32] remove a console.log() call --- themes/baggy/_head.twig | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/baggy/_head.twig b/themes/baggy/_head.twig index 9ca51cd2d..e959ec3e1 100755 --- a/themes/baggy/_head.twig +++ b/themes/baggy/_head.twig @@ -45,7 +45,6 @@ {% endblock %} diff --git a/themes/default/view.twig b/themes/default/view.twig index 0010d18fb..d1b6496e9 100755 --- a/themes/default/view.twig +++ b/themes/default/view.twig @@ -129,13 +129,5 @@ // Use left and right arrow to navigate on with keyboard navigateKeyboard('?view=view&id={{ navigate.nextid|e }}','?view=view&id={{ navigate.previousid|e }}'); - // swipe to right or left on mobile to navigate - $('article').on("swiperight", function(){ - goLeft('?view=view&id={{ navigate.nextid|e }}'); - }); - $('article').on("swipeleft", function(){ - goRight('?view=view&id={{ navigate.previousid|e }}'); - }); - {% endblock %} From 206c2a734e2a0d100af6d772d90b01c5cb8fe870 Mon Sep 17 00:00:00 2001 From: Eric Fredj Date: Tue, 5 Apr 2016 16:30:08 +0200 Subject: [PATCH 29/32] Fix UTF-8 encoding before JSON export --- inc/poche/Poche.class.php | 2 +- inc/poche/Tools.class.php | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 400857b49..1476d158a 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -908,7 +908,7 @@ class Poche $entries = $this->store->retrieveAllWithTags($this->user->getId()); if ($entries) { echo $this->tpl->render('export.twig', array( - 'export' => Tools::renderJson($entries), + 'export' => Tools::renderJson(Tools::utf8ize($entries)), )); Tools::logm('export view'); } else { diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index e5e150cdb..d84850cf7 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -232,6 +232,27 @@ final class Tools exit(); } + /** + * UTF-8 encode array of string + * + * @param $data + */ + public static function utf8ize($data) + { + if (is_array($data)) + { + foreach ($data as $k => $v) + { + $data[$k] = self::utf8ize($v); + } + } + else if (is_string ($data)) + { + return utf8_encode($data); + } + return $data; + } + /** * Create new line in log file * From ccf59ac4fff1f66b312828cffbbb7090ef72d528 Mon Sep 17 00:00:00 2001 From: Eric Fredj Date: Tue, 5 Apr 2016 20:07:55 +0200 Subject: [PATCH 30/32] Fix indentation --- inc/poche/Tools.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index d84850cf7..3f68cff5e 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -239,7 +239,7 @@ final class Tools */ public static function utf8ize($data) { - if (is_array($data)) + if (is_array($data)) { foreach ($data as $k => $v) { From 7672a10776136842906e4f34e3ced0d7286f1c4a Mon Sep 17 00:00:00 2001 From: Ymage Date: Thu, 7 Apr 2016 22:35:37 +0200 Subject: [PATCH 31/32] Apply utf8_encode only on unrecognized encoded string --- inc/poche/Tools.class.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 3f68cff5e..2ee86c74e 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -237,18 +237,25 @@ final class Tools * * @param $data */ - public static function utf8ize($data) + public static function utf8ize($data) { - if (is_array($data)) + if (is_array($data)) { - foreach ($data as $k => $v) + foreach ($data as $k => $v) { $data[$k] = self::utf8ize($v); } } - else if (is_string ($data)) + else if (is_string ($data)) { - return utf8_encode($data); + if ('' == mb_detect_encoding($data)) + { + return utf8_encode($data); + } + else + { + return $data; + } } return $data; } From af8b3b649e9956fe15c98298faf6755c29edcf77 Mon Sep 17 00:00:00 2001 From: Ymage Date: Thu, 7 Apr 2016 22:49:15 +0200 Subject: [PATCH 32/32] Factorize --- inc/poche/Tools.class.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/inc/poche/Tools.class.php b/inc/poche/Tools.class.php index 2ee86c74e..263034f07 100755 --- a/inc/poche/Tools.class.php +++ b/inc/poche/Tools.class.php @@ -239,23 +239,16 @@ final class Tools */ public static function utf8ize($data) { - if (is_array($data)) + if (is_array($data)) { foreach ($data as $k => $v) { $data[$k] = self::utf8ize($v); } } - else if (is_string ($data)) + else if (is_string ($data) && '' == mb_detect_encoding($data)) { - if ('' == mb_detect_encoding($data)) - { - return utf8_encode($data); - } - else - { - return $data; - } + return utf8_encode($data); } return $data; }