Skip to content

Commit

Permalink
Merge branch 'FreshRSS/dev' into FreshRSS/dev-1.14.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkarex committed Jan 17, 2019
2 parents 6bc49e1 + 48c901b commit 34fe41a
Show file tree
Hide file tree
Showing 25 changed files with 65 additions and 25 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Expand Up @@ -2,10 +2,13 @@

## 2019-01-XX FreshRSS 1.13.1-dev

* Features
* Include articles with custom labels during export [#2196](https://github.com/FreshRSS/FreshRSS/issues/2196)
* Bug fixing
* Fix missing HTTP `X-Forwarded-Prefix` in cookie path behind a reverse-proxy [#2201](https://github.com/FreshRSS/FreshRSS/pull/2201)
* Deployment
* Docker improvements [#2202](https://github.com/FreshRSS/FreshRSS/pull/2202)
* Add `TZ` timezone parameter [#2153](https://github.com/FreshRSS/FreshRSS/issues/2153)
* Performance: Hard-include Apache .htaccess to avoid having to scan for changes in those files
* Performance: Disable unused Apache security check of symlinks
* Performance: Disable unused Apache modules
Expand All @@ -16,9 +19,11 @@
* Accept HTTP header `X-WebAuth-User` for delegated HTTP Authentication [#2204](https://github.com/FreshRSS/FreshRSS/pull/2204)
* API
* Automatic test of API configuration [#2207](https://github.com/FreshRSS/FreshRSS/pull/2207)
* Use Apache SetEnvIf module if available and fall-back to RewriteRule [#2202](https://github.com/FreshRSS/FreshRSS/pull/2202)
* Performance + compatibility: Use Apache `SetEnvIf` module if available and fall-back to `RewriteRule` [#2202](https://github.com/FreshRSS/FreshRSS/pull/2202)
* Security
* Fixes when HTTP user does not exist in FreshRSS [#2204](https://github.com/FreshRSS/FreshRSS/pull/2204)
* Accessibility
* Remove alt in logo [#2209](https://github.com/FreshRSS/FreshRSS/pull/2209)


## 2018-12-22 FreshRSS 1.13.0
Expand Down
2 changes: 2 additions & 0 deletions Docker/Dockerfile
@@ -1,5 +1,7 @@
FROM alpine:3.8

ENV TZ UTC

RUN apk add --no-cache \
apache2 php7-apache2 \
php7 php7-curl php7-gmp php7-intl php7-mbstring php7-xml php7-zip \
Expand Down
2 changes: 2 additions & 0 deletions Docker/README.md
Expand Up @@ -66,6 +66,7 @@ sudo docker volume create freshrss-data
sudo docker run -d --restart unless-stopped --log-opt max-size=10m \
-v freshrss-data:/var/www/FreshRSS/data \
-e 'CRON_MIN=4,34' \
-e TZ=Europe/Paris \
--net freshrss-network \
--label traefik.port=80 \
--label traefik.frontend.rule='Host:freshrss.example.net' \
Expand All @@ -74,6 +75,7 @@ sudo docker run -d --restart unless-stopped --log-opt max-size=10m \
--name freshrss freshrss/freshrss
```

* Replace `TZ=Europe/Paris` by your [server timezone](http://php.net/timezones), or remove the line to use `UTC`.
* If you cannot have FreshRSS at the root of a dedicated domain, update the command above according to the following model:
`--label traefik.frontend.rule='Host:freshrss.example.net;PathPrefixStrip:/FreshRSS/' \`
* You may remove the `--label traefik.*` lines if you do not use Træfik.
Expand Down
2 changes: 2 additions & 0 deletions Docker/entrypoint.sh
Expand Up @@ -5,6 +5,8 @@ php -f ./cli/prepare.php > /dev/null
chown -R :www-data .
chmod -R g+r . && chmod -R g+w ./data/

find /etc/php*/ -name php.ini -exec sed -r -i "\#^;?date.timezone#s#^.*#date.timezone = $TZ#" {} \;

if [ -n "$CRON_MIN" ]; then
sed -r -i "\#FreshRSS#s#^[^ ]+ #$CRON_MIN #" /var/spool/cron/crontabs/root
fi
Expand Down
36 changes: 21 additions & 15 deletions app/Controllers/importExportController.php
Expand Up @@ -650,7 +650,7 @@ private function addFeedJson($origin) {
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);
Expand All @@ -674,16 +674,19 @@ public function exportFile($export_opml = true, $export_starred = false, $export
$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) {
$feed = $this->feedDAO->searchById($feed_id);
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);
}
}

Expand Down Expand Up @@ -725,6 +728,7 @@ public function exportAction() {
$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) {
Expand Down Expand Up @@ -758,27 +762,29 @@ private function generateOpml() {
/**
* 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;
}

Expand Down
6 changes: 6 additions & 0 deletions app/Models/EntryDAO.php
Expand Up @@ -839,6 +839,9 @@ private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::ST
$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=? ';
Expand All @@ -855,6 +858,9 @@ private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::ST
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 . ']!');
}
Expand Down
1 change: 1 addition & 0 deletions app/i18n/cz/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON nebo ZIP)',
'file_to_import_no_zip' => 'Soubor k importu<br />(OPML nebo JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/de/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON oder ZIP)',
'file_to_import_no_zip' => 'Zu importierende Datei<br />(OPML oder JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/en/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON or ZIP)',
'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/es/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON o ZIP)',
'file_to_import_no_zip' => 'Archivo a importar<br />(OPML o JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/fr/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON ou ZIP)',
'file_to_import_no_zip' => 'Fichier à importer<br />(OPML ou JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/he/sub.php
Expand Up @@ -72,6 +72,7 @@
'export' => 'ייצוא',
'export_opml' => 'ייצוא רשימת הזנות (OPML)',
'export_starred' => 'ייצוא מועדפים',
'export_labelled' => 'Export your labelled articles', //TODO
'feed_list' => 'רשימה של %s מאמרים',
'file_to_import' => 'קובץ לייבוא<br />(OPML, Json or Zip)',
'file_to_import_no_zip' => 'קובץ לייבוא<br />(OPML or Json)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/it/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON o ZIP)',
'file_to_import_no_zip' => 'File da importare<br />(OPML o JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/kr/sub.php
Expand Up @@ -72,6 +72,7 @@
'export' => '내보내기',
'export_opml' => '피드 목록 내보내기 (OPML)',
'export_starred' => '즐겨찾기 내보내기',
'export_labelled' => 'Export your labelled articles', //TODO
'feed_list' => '%s 개의 글 목록',
'file_to_import' => '불러올 파일<br />(OPML, JSON 또는 ZIP)',
'file_to_import_no_zip' => '불러올 파일<br />(OPML 또는 JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/nl/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON of ZIP)',
'file_to_import_no_zip' => 'Bestand om te importeren<br />(OPML of JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/oc/sub.php
Expand Up @@ -71,6 +71,7 @@
'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<br />(OPML, JSON o ZIP)',
'file_to_import_no_zip' => 'Fichièr d’importar<br />(OPML o JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/pt-br/sub.php
Expand Up @@ -68,6 +68,7 @@
'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<br />(OPML, JSON or ZIP)',
'file_to_import_no_zip' => 'Arquivo para importar<br />(OPML or JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/ru/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON or ZIP)', //TODO - Translation
'file_to_import_no_zip' => 'File to import<br />(OPML or JSON)', //TODO - Translation
Expand Down
1 change: 1 addition & 0 deletions app/i18n/tr/sub.php
Expand Up @@ -72,6 +72,7 @@
'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<br />(OPML, JSON or ZIP)',
'file_to_import_no_zip' => 'Dosyadan içe aktar<br />(OPML or JSON)',
Expand Down
1 change: 1 addition & 0 deletions app/i18n/zh-cn/sub.php
Expand Up @@ -72,6 +72,7 @@
'export' => '导出',
'export_opml' => '导出 RSS 源列表 (OPML)',
'export_starred' => '导出你的收藏',
'export_labelled' => 'Export your labelled articles', //TODO
'feed_list' => '%s 文章列表',
'file_to_import' => '需要导入的文件<br />(OPML, JSON 或 ZIP)',
'file_to_import_no_zip' => '需要导入的文件<br />(OPML 或 JSON)',
Expand Down
2 changes: 1 addition & 1 deletion app/layout/header.phtml
Expand Up @@ -16,7 +16,7 @@ if (FreshRSS_Auth::accessNeedsAction()) {
<div class="item title">
<h1>
<a href="<?php echo _url('index', 'index'); ?>">
<img class="logo" src="<?php echo _i('icon', true); ?>" alt="" />
<img class="logo" src="<?php echo _i('icon', true); ?>" alt="" />
<?php echo FreshRSS_Context::$system_conf->title; ?>
</a>
</h1>
Expand Down
10 changes: 4 additions & 6 deletions app/views/helpers/export/articles.phtml
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
5 changes: 5 additions & 0 deletions app/views/importExport/index.phtml
Expand Up @@ -33,6 +33,11 @@
<?php echo _t('sub.import_export.export_opml'); ?>
</label>

<label class="checkbox" for="export_labelled">
<input type="checkbox" name="export_labelled" id="export_labelled" value="1" <?php echo extension_loaded('zip') ? 'checked="checked"' : ''; ?> />
<?php echo _t('sub.import_export.export_labelled'); ?>
</label>

<label class="checkbox" for="export_starred">
<input type="checkbox" name="export_starred" id="export_starred" value="1" <?php echo extension_loaded('zip') ? 'checked="checked"' : ''; ?> />
<?php echo _t('sub.import_export.export_starred'); ?>
Expand Down
2 changes: 1 addition & 1 deletion cli/export-opml-for-user.php
Expand Up @@ -17,7 +17,7 @@
$importController = new FreshRSS_importExport_Controller();

$ok = false;
$ok = $importController->exportFile(true, false, array(), 0, $username);
$ok = $importController->exportFile(true, false, false, array(), 0, $username);

invalidateHttpCache($username);

Expand Down
2 changes: 1 addition & 1 deletion cli/export-zip-for-user.php
Expand Up @@ -19,7 +19,7 @@

$ok = false;
try {
$ok = $importController->exportFile(true, true, true,
$ok = $importController->exportFile(true, true, true, true,
empty($options['max-feed-entries']) ? 100 : intval($options['max-feed-entries']),
$username);
} catch (FreshRSS_ZipMissing_Exception $zme) {
Expand Down

0 comments on commit 34fe41a

Please sign in to comment.