From 945cf832ad2c20c10704282d03326d8495d0ca4b Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 2 Jan 2019 21:43:05 +0100 Subject: HTTP authenfication fixes (#2204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Security fixes when HTTP user does not exist in FreshRSS * Accept HTTP header X-WebAuth-User for delegated HTTP Authentication (e.g. Træfik) * Document delegated HTTP authentication from https://github.com/FreshRSS/FreshRSS/pull/2202 --- app/Models/Auth.php | 9 +++++---- app/Models/UserDAO.php | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'app/Models') diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 9c3e31952..513a9cb2f 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -28,13 +28,13 @@ class FreshRSS_Auth { if (self::$login_ok) { self::giveAccess(); - } elseif (self::accessControl()) { - self::giveAccess(); + } elseif (self::accessControl() && self::giveAccess()) { FreshRSS_UserDAO::touch(); } else { // Be sure all accesses are removed! self::removeAccess(); } + return self::$login_ok; } /** @@ -60,7 +60,7 @@ class FreshRSS_Auth { return $current_user != ''; case 'http_auth': $current_user = httpAuthUser(); - $login_ok = $current_user != ''; + $login_ok = $current_user != '' && FreshRSS_UserDAO::exists($current_user); if ($login_ok) { Minz_Session::_param('currentUser', $current_user); } @@ -81,7 +81,7 @@ class FreshRSS_Auth { $user_conf = get_user_configuration($current_user); if ($user_conf == null) { self::$login_ok = false; - return; + return false; } $system_conf = Minz_Configuration::get('system'); @@ -102,6 +102,7 @@ class FreshRSS_Auth { Minz_Session::_param('loginOk', self::$login_ok); Minz_Session::_param('REMOTE_USER', httpAuthUser()); + return self::$login_ok; } /** diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 5fb46c947..e9d3a7329 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -65,7 +65,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); if ($db['type'] === 'sqlite') { - return unlink(join_path(DATA_PATH, 'users', $username, 'db.sqlite')); + return unlink(USERS_PATH . '/' . $username . '/db.sqlite'); } else { $userPDO = new Minz_ModelPdo($username); @@ -81,18 +81,18 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } - public static function exist($username) { - return is_dir(join_path(DATA_PATH, 'users', $username)); + public static function exists($username) { + return is_dir(USERS_PATH . '/' . $username); } public static function touch($username = '') { if (!FreshRSS_user_Controller::checkUsername($username)) { $username = Minz_Session::param('currentUser', '_'); } - return touch(join_path(DATA_PATH, 'users', $username, 'config.php')); + return touch(USERS_PATH . '/' . $username . '/config.php'); } public static function mtime($username) { - return @filemtime(join_path(DATA_PATH, 'users', $username, 'config.php')); + return @filemtime(USERS_PATH . '/' . $username . '/config.php'); } } -- cgit v1.2.3 From 802c264574902ea44c2c76ae098a6f58911fe114 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Jan 2019 00:46:48 +0100 Subject: Copy syslog to STDERR (#2208) * Use openlog before syslog In order to have a copy on stderr when syslog is not available. * Take advantage of syslog for actualization Pipe cron job STDERR and syslog to Docker log Cf. https://github.com/FreshRSS/FreshRSS/pull/2202/commits/00bd467655b7c060cdae388519b2413d12d8cb0f --- Docker/Dockerfile | 11 +++++------ app/Models/Entry.php | 1 + app/actualize_script.php | 8 ++++++-- cli/_cli.php | 2 +- lib/favicons.php | 1 + lib/lib_install.php | 1 + lib/lib_rss.php | 7 +++++++ p/i/index.php | 2 ++ 8 files changed, 24 insertions(+), 9 deletions(-) (limited to 'app/Models') diff --git a/Docker/Dockerfile b/Docker/Dockerfile index 2a25e567d..db034ff61 100644 --- a/Docker/Dockerfile +++ b/Docker/Dockerfile @@ -6,11 +6,10 @@ RUN apk add --no-cache \ php7-ctype php7-dom php7-fileinfo php7-iconv php7-json php7-session php7-simplexml php7-xmlreader php7-zlib \ php7-pdo_sqlite php7-pdo_mysql php7-pdo_pgsql -ENV FRESHRSS_ROOT /var/www/FreshRSS -RUN mkdir -p ${FRESHRSS_ROOT} /run/apache2/ -WORKDIR ${FRESHRSS_ROOT} +RUN mkdir -p /var/www/FreshRSS /run/apache2/ +WORKDIR /var/www/FreshRSS -COPY . ${FRESHRSS_ROOT} +COPY . /var/www/FreshRSS COPY ./Docker/*.Apache.conf /etc/apache2/conf.d/ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ @@ -21,8 +20,8 @@ RUN rm -f /etc/apache2/conf.d/languages.conf /etc/apache2/conf.d/info.conf \ /etc/apache2/httpd.conf && \ sed -r -i "/^\s*(CustomLog|ErrorLog|Listen) /s/^/#/" \ /etc/apache2/httpd.conf && \ - echo "17,37 * * * * php ${FRESHRSS_ROOT}/app/actualize_script.php 2>&1 | tee /tmp/FreshRSS.log" >> \ - /var/spool/cron/crontabs/www-data + echo "17,37 * * * * su apache -s /bin/sh -c 'php /var/www/FreshRSS/app/actualize_script.php' 2>> /proc/1/fd/2 > /tmp/FreshRSS.log" >> \ + /var/spool/cron/crontabs/root ENV CRON_MIN '' ENTRYPOINT ["./Docker/entrypoint.sh"] diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 985276734..f2f3d08fe 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -209,6 +209,7 @@ class FreshRSS_Entry extends Minz_Model { $feed_timeout = empty($attributes['timeout']) ? 0 : intval($attributes['timeout']); if ($system_conf->simplepie_syslog_enabled) { + prepareSyslog(); syslog(LOG_INFO, 'FreshRSS GET ' . SimplePie_Misc::url_remove_credentials($url)); } diff --git a/app/actualize_script.php b/app/actualize_script.php index ba9660a14..f1dec5640 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -12,6 +12,9 @@ if (defined('STDOUT')) { fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered } +prepareSyslog(); +syslog(LOG_INFO, 'FreshRSS Start feeds actualization...'); + // Set the header params ($_GET) to call the FRSS application. $_GET['c'] = 'feed'; $_GET['a'] = 'actualize'; @@ -64,7 +67,7 @@ foreach ($users as $user) { if (!invalidateHttpCache()) { Minz_Log::warning('FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt'), ADMIN_LOG); if (defined('STDERR')) { - fwrite(STDERR, 'Write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); + fwrite(STDERR, 'FreshRSS write access problem in ' . join_path(USERS_PATH, $user, 'log.txt') . "\n"); } } } @@ -75,7 +78,8 @@ if (defined('STDOUT')) { $end_date = date_create('now'); $duration = date_diff($end_date, $begin_date); fwrite(STDOUT, 'Ending feed actualization at ' . $end_date->format('c') . "\n"); //Unbuffered - fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%a day(s), %h hour(s), %i minute(s) and %s seconds') . ' for ' . count($users) . " users\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%a day(s), %h hour(s), %i minute(s) and %s seconds') . ' for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); +syslog(LOG_INFO, 'FreshRSS feeds actualization done.'); diff --git a/cli/_cli.php b/cli/_cli.php index 72629171c..e8fb6ae42 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -4,7 +4,7 @@ if (php_sapi_name() !== 'cli') { } require(__DIR__ . '/../constants.php'); -require(LIB_PATH . '/lib_rss.php'); +require(LIB_PATH . '/lib_rss.php'); //Includes class autoloader require(LIB_PATH . '/lib_install.php'); Minz_Configuration::register('system', diff --git a/lib/favicons.php b/lib/favicons.php index fe2e65f1f..7a2d1187e 100644 --- a/lib/favicons.php +++ b/lib/favicons.php @@ -22,6 +22,7 @@ function isImgMime($content) { } function downloadHttp(&$url, $curlOptions = array()) { + prepareSyslog(); syslog(LOG_INFO, 'FreshRSS Favicon GET ' . $url); if (substr($url, 0, 2) === '//') { $url = 'https:' . $url; diff --git a/lib/lib_install.php b/lib/lib_install.php index d51a37e58..6e4df4e9c 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -81,6 +81,7 @@ function generateSalt() { function checkDb(&$dbOptions) { $dsn = ''; $driver_options = null; + prepareSyslog(); try { switch ($dbOptions['type']) { case 'mysql': diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 168309563..738ccf641 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -202,12 +202,19 @@ function html_only_entity_decode($text) { return strtr($text, $htmlEntitiesOnly); } +function prepareSyslog() { + return openlog("FreshRSS", LOG_PERROR | LOG_PID, LOG_USER); +} + function customSimplePie($attributes = array()) { $system_conf = Minz_Configuration::get('system'); $limits = $system_conf->limits; $simplePie = new SimplePie(); $simplePie->set_useragent(FRESHRSS_USERAGENT); $simplePie->set_syslog($system_conf->simplepie_syslog_enabled); + if ($system_conf->simplepie_syslog_enabled) { + prepareSyslog(); + } $simplePie->set_cache_location(CACHE_PATH); $simplePie->set_cache_duration($limits['cache_duration']); diff --git a/p/i/index.php b/p/i/index.php index 5bc9c0d76..8a4f529d4 100755 --- a/p/i/index.php +++ b/p/i/index.php @@ -50,5 +50,7 @@ if (file_exists(DATA_PATH . '/do-install.txt')) { echo '### Fatal error! ###
', "\n"; Minz_Log::error($e->getMessage()); echo 'See logs files.'; + prepareSyslog(); + syslog(LOG_INFO, 'FreshRSS Fatal error! ' . $e->getMessage()); } } -- cgit v1.2.3 From 743c1b740bd8ec0b70f7058d4b52101b346a5e9c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 16 Jan 2019 22:26:43 +0100 Subject: Export labels (#2217) * Export labels https://github.com/FreshRSS/FreshRSS/issues/2196 * Small fixes * Backport code from 1.14.0 https://github.com/FreshRSS/FreshRSS/pull/2199/commits/4888f919f104b2d170302565e481a0b731eb4145 * More fixes --- app/Controllers/importExportController.php | 36 +++++++++++++++++------------- app/Models/EntryDAO.php | 6 +++++ app/Models/TagDAO.php | 14 ++++++++++-- app/i18n/cz/sub.php | 1 + app/i18n/de/sub.php | 1 + app/i18n/en/sub.php | 1 + app/i18n/es/sub.php | 1 + app/i18n/fr/sub.php | 1 + app/i18n/he/sub.php | 1 + app/i18n/it/sub.php | 1 + app/i18n/kr/sub.php | 1 + app/i18n/nl/sub.php | 1 + app/i18n/oc/sub.php | 1 + app/i18n/pt-br/sub.php | 1 + app/i18n/ru/sub.php | 1 + app/i18n/tr/sub.php | 1 + app/i18n/zh-cn/sub.php | 1 + app/views/helpers/export/articles.phtml | 10 ++++----- app/views/importExport/index.phtml | 5 +++++ cli/export-opml-for-user.php | 2 +- cli/export-zip-for-user.php | 2 +- 21 files changed, 64 insertions(+), 25 deletions(-) (limited to 'app/Models') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 2d8d4e01d..3f2947c7a 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -650,7 +650,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { return $return; } - public function exportFile($export_opml = true, $export_starred = false, $export_feeds = array(), $maxFeedEntries = 50, $username = null) { + public function exportFile($export_opml = true, $export_starred = false, $export_labelled = false, $export_feeds = array(), $maxFeedEntries = 50, $username = null) { require_once(LIB_PATH . '/lib_opml.php'); $this->catDAO = new FreshRSS_CategoryDAO($username); @@ -674,8 +674,11 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $export_files["feeds_${day}.opml.xml"] = $this->generateOpml(); } - if ($export_starred) { - $export_files["starred_${day}.json"] = $this->generateEntries('starred'); + if ($export_starred || $export_labelled) { + $export_files["starred_${day}.json"] = $this->generateEntries( + ($export_starred ? 'S' : '') . + ($export_labelled ? 'T' : '') + ); } foreach ($export_feeds as $feed_id) { @@ -683,7 +686,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { if ($feed) { $filename = "feed_${day}_" . $feed->category() . '_' . $feed->id() . '.json'; - $export_files[$filename] = $this->generateEntries('feed', $feed, $maxFeedEntries); + $export_files[$filename] = $this->generateEntries('f', $feed, $maxFeedEntries); } } @@ -725,6 +728,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $nb_files = $this->exportFile( Minz_Request::param('export_opml', false), Minz_Request::param('export_starred', false), + Minz_Request::param('export_labelled', false), Minz_Request::param('export_feeds', array()) ); } catch (FreshRSS_ZipMissing_Exception $zme) { @@ -758,27 +762,29 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { /** * This method returns a JSON file content. * - * @param string $type must be "starred" or "feed" + * @param string $type must be one of: + * 'S' (starred/favourite), 'f' (feed), 'T' (taggued/labelled), 'ST' (starred or labelled) * @param FreshRSS_Feed $feed feed of which we want to get entries. * @return string the JSON file content. */ private function generateEntries($type, $feed = null, $maxFeedEntries = 50) { $this->view->categories = $this->catDAO->listCategories(); + $tagDAO = FreshRSS_Factory::createTagDao(); - if ($type == 'starred') { + if ($type === 's' || $type === 'S' || $type === 'T' || $type === 'ST') { $this->view->list_title = _t('sub.import_export.starred_list'); $this->view->type = 'starred'; - $unread_fav = $this->entryDAO->countUnreadReadFavorites(); - $this->view->entriesRaw = $this->entryDAO->listWhereRaw( - 's', '', FreshRSS_Entry::STATE_ALL, 'ASC', $unread_fav['all'] - ); - } elseif ($type === 'feed' && $feed != null) { + $this->view->entriesId = $this->entryDAO->listIdsWhere($type, '', FreshRSS_Entry::STATE_ALL, 'ASC', -1); + $this->view->entryIdsTagNames = $tagDAO->getEntryIdsTagNames($this->view->entriesId); + //The following is a streamable query, i.e. must be last + $this->view->entriesRaw = $this->entryDAO->listWhereRaw($type, '', FreshRSS_Entry::STATE_ALL, 'ASC', -1); + } elseif ($type === 'f' && $feed != null) { $this->view->list_title = _t('sub.import_export.feed_list', $feed->name()); $this->view->type = 'feed/' . $feed->id(); - $this->view->entriesRaw = $this->entryDAO->listWhereRaw( - 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', - $maxFeedEntries - ); + $this->view->entriesId = $this->entryDAO->listIdsWhere($type, $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', $maxFeedEntries); + $this->view->entryIdsTagNames = $tagDAO->getEntryIdsTagNames($this->view->entriesId); + //The following is a streamable query, i.e. must be last + $this->view->entriesRaw = $this->entryDAO->listWhereRaw($type, $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', $maxFeedEntries); $this->view->feed = $feed; } diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 6d77a33cd..08927196e 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -839,6 +839,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_NORMAL . ' '; $where .= 'AND e.is_favorite=1 '; break; + case 'S': //Starred + $where .= 'e.is_favorite=1 '; + break; case 'c': //Category $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_NORMAL . ' '; $where .= 'AND f.category=? '; @@ -855,6 +858,9 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { case 'T': //Any tag $where .= '1=1 '; break; + case 'ST': //Starred or tagged + $where .= 'e.is_favorite=1 OR EXISTS (SELECT et2.id_tag FROM `' . $this->prefix . 'entrytag` et2 WHERE et2.id_entry = e.id) '; + break; default: throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!'); } diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index b55d2b35d..dba854aa4 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -265,8 +265,18 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $values = array(); if (is_array($entries) && count($entries) > 0) { $sql .= ' AND et.id_entry IN (' . str_repeat('?,', count($entries) - 1). '?)'; - foreach ($entries as $entry) { - $values[] = is_array($entry) ? $entry['id'] : $entry->id(); + if (is_array($entries[0])) { + foreach ($entries as $entry) { + $values[] = $entry['id']; + } + } elseif (is_object($entries[0])) { + foreach ($entries as $entry) { + $values[] = $entry->id(); + } + } else { + foreach ($entries as $entry) { + $values[] = $entry; + } } } $stm = $this->bd->prepare($sql); diff --git a/app/i18n/cz/sub.php b/app/i18n/cz/sub.php index ad02f6f49..5b5634fed 100644 --- a/app/i18n/cz/sub.php +++ b/app/i18n/cz/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Export', 'export_opml' => 'Exportovat seznam kanálů (OPML)', 'export_starred' => 'Exportovat oblíbené', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Seznam %s článků', 'file_to_import' => 'Soubor k importu
(OPML, JSON nebo ZIP)', 'file_to_import_no_zip' => 'Soubor k importu
(OPML nebo JSON)', diff --git a/app/i18n/de/sub.php b/app/i18n/de/sub.php index aa408e8c7..27e893177 100644 --- a/app/i18n/de/sub.php +++ b/app/i18n/de/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Exportieren', 'export_opml' => 'Liste der Feeds exportieren (OPML)', 'export_starred' => 'Ihre Favoriten exportieren', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Liste von %s Artikeln', 'file_to_import' => 'Zu importierende Datei
(OPML, JSON oder ZIP)', 'file_to_import_no_zip' => 'Zu importierende Datei
(OPML oder JSON)', diff --git a/app/i18n/en/sub.php b/app/i18n/en/sub.php index 9acbcbf33..4efd81ba4 100644 --- a/app/i18n/en/sub.php +++ b/app/i18n/en/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Export', 'export_opml' => 'Export list of feeds (OPML)', 'export_starred' => 'Export your favourites', + 'export_labelled' => 'Export your labelled articles', 'feed_list' => 'List of %s articles', 'file_to_import' => 'File to import
(OPML, JSON or ZIP)', 'file_to_import_no_zip' => 'File to import
(OPML or JSON)', diff --git a/app/i18n/es/sub.php b/app/i18n/es/sub.php index 64e420dc1..854984891 100755 --- a/app/i18n/es/sub.php +++ b/app/i18n/es/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Exportar', 'export_opml' => 'Exportar la lista de fuentes (OPML)', 'export_starred' => 'Exportar tus favoritos', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Lista de %s artículos', 'file_to_import' => 'Archivo a importar
(OPML, JSON o ZIP)', 'file_to_import_no_zip' => 'Archivo a importar
(OPML o JSON)', diff --git a/app/i18n/fr/sub.php b/app/i18n/fr/sub.php index 6cb31414d..d9964ac6e 100644 --- a/app/i18n/fr/sub.php +++ b/app/i18n/fr/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Exporter', 'export_opml' => 'Exporter la liste des flux (OPML)', 'export_starred' => 'Exporter les favoris', + 'export_labelled' => 'Exporter les articles étiquetés', 'feed_list' => 'Liste des articles de %s', 'file_to_import' => 'Fichier à importer
(OPML, JSON ou ZIP)', 'file_to_import_no_zip' => 'Fichier à importer
(OPML ou JSON)', diff --git a/app/i18n/he/sub.php b/app/i18n/he/sub.php index e4c487b84..6d824e349 100644 --- a/app/i18n/he/sub.php +++ b/app/i18n/he/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'ייצוא', 'export_opml' => 'ייצוא רשימת הזנות (OPML)', 'export_starred' => 'ייצוא מועדפים', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'רשימה של %s מאמרים', 'file_to_import' => 'קובץ לייבוא
(OPML, Json or Zip)', 'file_to_import_no_zip' => 'קובץ לייבוא
(OPML or Json)', diff --git a/app/i18n/it/sub.php b/app/i18n/it/sub.php index 6faa48d63..ff7fa6f1d 100644 --- a/app/i18n/it/sub.php +++ b/app/i18n/it/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Esporta', 'export_opml' => 'Esporta tutta la lista dei feed (OPML)', 'export_starred' => 'Esporta i tuoi preferiti', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Elenco di %s articoli', 'file_to_import' => 'File da importare
(OPML, JSON o ZIP)', 'file_to_import_no_zip' => 'File da importare
(OPML o JSON)', diff --git a/app/i18n/kr/sub.php b/app/i18n/kr/sub.php index 463496c57..9f8967053 100644 --- a/app/i18n/kr/sub.php +++ b/app/i18n/kr/sub.php @@ -72,6 +72,7 @@ return array( 'export' => '내보내기', 'export_opml' => '피드 목록 내보내기 (OPML)', 'export_starred' => '즐겨찾기 내보내기', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => '%s 개의 글 목록', 'file_to_import' => '불러올 파일
(OPML, JSON 또는 ZIP)', 'file_to_import_no_zip' => '불러올 파일
(OPML 또는 JSON)', diff --git a/app/i18n/nl/sub.php b/app/i18n/nl/sub.php index 36c96b53f..0ab7ac44f 100644 --- a/app/i18n/nl/sub.php +++ b/app/i18n/nl/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Exporteer', 'export_opml' => 'Exporteer lijst van feeds (OPML)', 'export_starred' => 'Exporteer je favorieten', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Lijst van %s artikelen', 'file_to_import' => 'Bestand om te importeren
(OPML, JSON of ZIP)', 'file_to_import_no_zip' => 'Bestand om te importeren
(OPML of JSON)', diff --git a/app/i18n/oc/sub.php b/app/i18n/oc/sub.php index f9ddf339a..3ca98d75e 100644 --- a/app/i18n/oc/sub.php +++ b/app/i18n/oc/sub.php @@ -71,6 +71,7 @@ return array( 'export' => 'Exportar', 'export_opml' => 'Exportar la lista de fluxes (OPML)', 'export_starred' => 'Exportar los favorits', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Lista dels %s articles', 'file_to_import' => 'Fichièr d’importar
(OPML, JSON o ZIP)', 'file_to_import_no_zip' => 'Fichièr d’importar
(OPML o JSON)', diff --git a/app/i18n/pt-br/sub.php b/app/i18n/pt-br/sub.php index 78684c14c..58b2fc1f9 100644 --- a/app/i18n/pt-br/sub.php +++ b/app/i18n/pt-br/sub.php @@ -68,6 +68,7 @@ return array( 'export' => 'Exportar', 'export_opml' => 'Exporta a lista dos feeds (OPML)', 'export_starred' => 'Exportar seus favoritos', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'Lista dos %s artigos', 'file_to_import' => 'Arquivo para importar
(OPML, JSON or ZIP)', 'file_to_import_no_zip' => 'Arquivo para importar
(OPML or JSON)', diff --git a/app/i18n/ru/sub.php b/app/i18n/ru/sub.php index 7de80586b..62f8a8e3a 100644 --- a/app/i18n/ru/sub.php +++ b/app/i18n/ru/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Export', //TODO - Translation 'export_opml' => 'Export list of feeds (OPML)', //TODO - Translation 'export_starred' => 'Export your favourites', //TODO - Translation + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => 'List of %s articles', //TODO - Translation 'file_to_import' => 'File to import
(OPML, JSON or ZIP)', //TODO - Translation 'file_to_import_no_zip' => 'File to import
(OPML or JSON)', //TODO - Translation diff --git a/app/i18n/tr/sub.php b/app/i18n/tr/sub.php index b5b56f4b8..7f29633be 100644 --- a/app/i18n/tr/sub.php +++ b/app/i18n/tr/sub.php @@ -72,6 +72,7 @@ return array( 'export' => 'Dışa aktar', 'export_opml' => 'Akış listesini dışarı aktar (OPML)', 'export_starred' => 'Favorileri dışarı aktar', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => '%s makalenin listesi', 'file_to_import' => 'Dosyadan içe aktar
(OPML, JSON or ZIP)', 'file_to_import_no_zip' => 'Dosyadan içe aktar
(OPML or JSON)', diff --git a/app/i18n/zh-cn/sub.php b/app/i18n/zh-cn/sub.php index e1c176bc6..3a9623468 100644 --- a/app/i18n/zh-cn/sub.php +++ b/app/i18n/zh-cn/sub.php @@ -72,6 +72,7 @@ return array( 'export' => '导出', 'export_opml' => '导出 RSS 源列表 (OPML)', 'export_starred' => '导出你的收藏', + 'export_labelled' => 'Export your labelled articles', //TODO 'feed_list' => '%s 文章列表', 'file_to_import' => '需要导入的文件
(OPML, JSON 或 ZIP)', 'file_to_import_no_zip' => '需要导入的文件
(OPML 或 JSON)', diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index 59a2c7ad7..eb2cb0924 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -16,14 +16,12 @@ $articles = array( echo rtrim(json_encode($articles, $options), " ]}\n\r\t"), "\n"; $first = true; -$tagDAO = FreshRSS_Factory::createTagDao(); -$entryIdsTagNames = $tagDAO->getEntryIdsTagNames($this->entriesRaw); -if ($entryIdsTagNames == false) { - $entryIdsTagNames = array(); +if (empty($this->entryIdsTagNames)) { + $this->entryIdsTagNames = array(); } foreach ($this->entriesRaw as $entryRaw) { - if (empty($entryRaw)) { + if ($entryRaw == null) { continue; } $entry = FreshRSS_EntryDAO::daoToEntry($entryRaw); @@ -61,7 +59,7 @@ foreach ($this->entriesRaw as $entryRaw) { if ($entry->isFavorite()) { $article['categories'][] = 'user/-/state/com.google/starred'; } - $tagNames = isset($entryIdsTagNames['e_' . $entry->id()]) ? $entryIdsTagNames['e_' . $entry->id()] : array(); + $tagNames = isset($this->entryIdsTagNames['e_' . $entry->id()]) ? $this->entryIdsTagNames['e_' . $entry->id()] : array(); foreach ($tagNames as $tagName) { $article['categories'][] = 'user/-/label/' . $tagName; } diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml index c5049e3ea..139e715c5 100644 --- a/app/views/importExport/index.phtml +++ b/app/views/importExport/index.phtml @@ -33,6 +33,11 @@ + +