From 92fc97eeb3cbda0f7cee9b670c30bbf6b23b9e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 23 Feb 2014 09:56:21 +0100 Subject: [fix] redirect on config page after token generation #491 --- inc/poche/Poche.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 34f2ff5a..8a9de488 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -1124,6 +1124,7 @@ class Poche $currentConfig = $_SESSION['poche_user']->config; $currentConfig['token'] = $token; $_SESSION['poche_user']->setConfig($currentConfig); + Tools::redirect(); } public function generateFeeds($token, $user_id, $tag_id, $type = 'home') -- cgit v1.2.3 From cbcae4037c02cd6c1ce7c373c6dae390565b7c51 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Wed, 26 Feb 2014 15:43:49 +0200 Subject: translation related: how-to md file added, script to generate php from all twig templates, polish mo file compiled --- inc/poche/Poche.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 8a9de488..deec4226 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -34,7 +34,7 @@ class Poche 'pl_PL.utf8' => 'Polski', 'ru_RU.utf8' => 'Pусский', 'sl_SI.utf8' => 'Slovenščina', - 'uk_UA.utf8' => 'Український', + 'uk_UA.utf8' => 'Українська', ); public function __construct() { @@ -336,7 +336,7 @@ class Poche while (($language = readdir($handle)) !== false) { # Languages are stored in a directory, so all directory names are languages # @todo move language installation data to database - if (! is_dir(LOCALE . '/' . $language) || in_array($language, array('..', '.'))) { + if (! is_dir(LOCALE . '/' . $language) || in_array($language, array('..', '.', 'tools'))) { continue; } @@ -346,7 +346,7 @@ class Poche $current = true; } - $languages[] = array('name' => $this->language_names[$language], 'value' => $language, 'current' => $current); + $languages[] = array('name' => (isset($this->language_names[$language]) ? $this->language_names[$language] : $language), 'value' => $language, 'current' => $current); } return $languages; -- cgit v1.2.3 From 56532c4e7231bf7f26779754c18eb2bb5e1739bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 27 Feb 2014 13:24:29 +0100 Subject: [add] Empty cache after changing theme #503 --- inc/poche/Poche.class.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index deec4226..a9e226c4 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -750,6 +750,8 @@ class Poche $currentConfig['theme'] = $_POST['theme']; $_SESSION['poche_user']->setConfig($currentConfig); + + $this->emptyCache(); Tools::redirect('?view=config'); } -- cgit v1.2.3 From e145f767f38c3531196dad5453f298fbea243daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 27 Feb 2014 13:26:07 +0100 Subject: [add] empty cache after changing language #492 --- inc/poche/Poche.class.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index a9e226c4..87c00b78 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -790,6 +790,8 @@ class Poche $currentConfig['language'] = $_POST['language']; $_SESSION['poche_user']->setConfig($currentConfig); + + $this->emptyCache(); Tools::redirect('?view=config'); } -- cgit v1.2.3 From decb9a5814be82effde73f798fbdc0c76c3dd1de Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Thu, 27 Feb 2014 18:12:43 +0200 Subject: fix of #509, related to php 5.3 --- inc/poche/Poche.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index deec4226..e13e7e1b 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -366,7 +366,7 @@ class Poche // Saving and clearing context $REAL = array(); foreach( $GLOBALS as $key => $value ) { - if( $key != "GLOBALS" && $key != "_SESSION" ) { + if( $key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS' ) { $GLOBALS[$key] = array(); $REAL[$key] = $value; } -- cgit v1.2.3 From 346380e131ac41229fdcadb5bc5dcb99347552ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Thu, 27 Feb 2014 21:37:25 +0100 Subject: [add] label for brazilian language on config screen --- inc/poche/Poche.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4100f156..714fa9ee 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -35,6 +35,7 @@ class Poche 'ru_RU.utf8' => 'Pусский', 'sl_SI.utf8' => 'Slovenščina', 'uk_UA.utf8' => 'Українська', + 'pt_BR.utf8' => 'Brasileiro', ); public function __construct() { -- cgit v1.2.3 From 6065553c137ec63ec3ffddda0350f1d3d805b852 Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Fri, 28 Feb 2014 13:08:11 +0200 Subject: effect of block rebuilding on next page removed, issue #479 --- inc/poche/Poche.class.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 4100f156..d42da60d 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -660,6 +660,7 @@ class Poche 'entries' => '', 'page_links' => '', 'nb_results' => '', + 'listmode' => (isset($_COOKIE['listmode']) ? true : false), ); //if id is given - we retrive entries by tag: id is tag id -- cgit v1.2.3 From 31a10069a52c2fd2aca3a835a7bdc1accae197f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 28 Feb 2014 20:36:32 +0100 Subject: [add] upload form for import --- inc/poche/Poche.class.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 49651c52..026b0b4e 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -1068,13 +1068,7 @@ class Poche Tools::redirect(); } - $targetDefinition = 'IMPORT_' . strtoupper($from) . '_FILE'; - $targetFile = constant($targetDefinition); - - if (! defined($targetDefinition)) { - $this->messages->add('e', _('Incomplete inc/poche/define.inc.php file, please define "' . $targetDefinition . '".')); - Tools::redirect(); - } + $targetFile = CACHE . '/' . constant(strtoupper($from) . '_FILE'); if (! file_exists($targetFile)) { $this->messages->add('e', _('Could not find required "' . $targetFile . '" import file.')); @@ -1084,6 +1078,22 @@ class Poche $this->$providers[$from]($targetFile); } + public function uploadFile() { + if(isset($_FILES['file'])) + { + $dir = CACHE . '/'; + $file = basename($_FILES['file']['name']); + if(move_uploaded_file($_FILES['file']['tmp_name'], $dir . $file)) { + $this->messages->add('s', _('File uploaded. You can now execute import.')); + } + else { + $this->messages->add('e', _('Error while importing file. Do you have access to upload it?')); + } + } + + Tools::redirect('?view=config'); + } + /** * export poche entries in json * @return json all poche entries -- cgit v1.2.3 From 53e3158dfe697ea59da1fa0e401e8da75ae13030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 28 Feb 2014 21:49:38 +0100 Subject: [add] cron to fetch content on imported entries --- inc/poche/Poche.class.php | 86 +++++++++++------------------------------------ 1 file changed, 19 insertions(+), 67 deletions(-) (limited to 'inc/poche/Poche.class.php') diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index 026b0b4e..5a89a8d2 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php @@ -362,60 +362,6 @@ class Poche ); } - protected function getPageContent(Url $url) - { - // Saving and clearing context - $REAL = array(); - foreach( $GLOBALS as $key => $value ) { - if( $key != 'GLOBALS' && $key != '_SESSION' && $key != 'HTTP_SESSION_VARS' ) { - $GLOBALS[$key] = array(); - $REAL[$key] = $value; - } - } - // Saving and clearing session - $REAL_SESSION = array(); - foreach( $_SESSION as $key => $value ) { - $REAL_SESSION[$key] = $value; - unset($_SESSION[$key]); - } - - // Running code in different context - $scope = function() { - extract( func_get_arg(1) ); - $_GET = $_REQUEST = array( - "url" => $url->getUrl(), - "max" => 5, - "links" => "preserve", - "exc" => "", - "format" => "json", - "submit" => "Create Feed" - ); - ob_start(); - require func_get_arg(0); - $json = ob_get_flush(); - return $json; - }; - $json = $scope( "inc/3rdparty/makefulltextfeed.php", array("url" => $url) ); - - // Clearing and restoring context - foreach( $GLOBALS as $key => $value ) { - if( $key != "GLOBALS" && $key != "_SESSION" ) { - unset($GLOBALS[$key]); - } - } - foreach( $REAL as $key => $value ) { - $GLOBALS[$key] = $value; - } - // Clearing and restoring session - foreach( $_SESSION as $key => $value ) { - unset($_SESSION[$key]); - } - foreach( $REAL_SESSION as $key => $value ) { - $_SESSION[$key] = $value; - } - return json_decode($json, true); - } - /** * Call action (mark as fav, archive, delete, etc.) */ @@ -424,15 +370,21 @@ class Poche switch ($action) { case 'add': - $content = $this->getPageContent($url); - $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); - $body = $content['rss']['channel']['item']['description']; - - // clean content from prevent xss attack - $config = HTMLPurifier_Config::createDefault(); - $purifier = new HTMLPurifier($config); - $title = $purifier->purify($title); - $body = $purifier->purify($body); + if (!$import) { + $content = Tools::getPageContent($url); + $title = ($content['rss']['channel']['item']['title'] != '') ? $content['rss']['channel']['item']['title'] : _('Untitled'); + $body = $content['rss']['channel']['item']['description']; + + // clean content from prevent xss attack + $config = HTMLPurifier_Config::createDefault(); + $purifier = new HTMLPurifier($config); + $title = $purifier->purify($title); + $body = $purifier->purify($body); + } + else { + $title = ''; + $body = ''; + } //search for possible duplicate if not in import mode if (!$import) { @@ -897,7 +849,7 @@ class Poche # the second
    is for read links $read = 1; } - $this->messages->add('s', _('import from instapaper completed')); + $this->messages->add('s', _('import from instapaper completed. You have to execute the cron to fetch content.')); Tools::logm('import from instapaper completed'); Tools::redirect(); } @@ -941,7 +893,7 @@ class Poche # the second