diff --git a/assets/css/app.css b/assets/css/app.css index b3fef5f..380b5cd 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -263,6 +263,9 @@ textarea.form-error { border-color: #ddd; } +.alert-error a { + color: #b94a48; +} /* buttons */ .btn { diff --git a/controllers/feed.php b/controllers/feed.php index 164fb43..d907f39 100644 --- a/controllers/feed.php +++ b/controllers/feed.php @@ -53,78 +53,6 @@ Router\post_action('edit-feed', function() { ))); }); -// Disable content grabber for a feed -Router\get_action('disable-grabber-feed', function() { - - $id = Request\int_param('feed_id'); - - if ($id && Model\Feed\disable_grabber($id)) { - Session\flash(t('The content grabber is disabled successfully.')); - } - else { - Session\flash_error(t('Unable to disable the content grabber for this subscription.')); - } - - Response\redirect('?action=feeds'); -}); - -// Enable content grabber for a feed -Router\get_action('enable-grabber-feed', function() { - - $id = Request\int_param('feed_id'); - - if ($id && Model\Feed\enable_grabber($id)) { - Session\flash(t('The content grabber is enabled successfully.')); - } - else { - Session\flash_error(t('Unable to activate the content grabber for this subscription.')); - } - - Response\redirect('?action=feeds'); -}); - -// Confirmation box to disable a feed -Router\get_action('confirm-disable-feed', function() { - - $id = Request\int_param('feed_id'); - - Response\html(Template\layout('confirm_disable_feed', array( - 'feed' => Model\Feed\get($id), - 'menu' => 'feeds', - 'title' => t('Confirmation') - ))); -}); - -// Disable a feed -Router\get_action('disable-feed', function() { - - $id = Request\int_param('feed_id'); - - if ($id && Model\Feed\disable($id)) { - Session\flash(t('This subscription has been disabled successfully.')); - } - else { - Session\flash_error(t('Unable to disable this subscription.')); - } - - Response\redirect('?action=feeds'); -}); - -// Enable a feed -Router\get_action('enable-feed', function() { - - $id = Request\int_param('feed_id'); - - if ($id && Model\Feed\enable($id)) { - Session\flash(t('This subscription has been enabled successfully.')); - } - else { - Session\flash_error(t('Unable to enable this subscription.')); - } - - Response\redirect('?action=feeds'); -}); - // Confirmation box to remove a feed Router\get_action('confirm-remove-feed', function() { @@ -232,9 +160,9 @@ Router\action('subscribe', function() { } } - $values += array('download_content' => 0); + $values += array('download_content' => 0, 'rtl' => 0); $url = trim($url); - $feed_id = Model\Feed\create($url, $values['download_content']); + $feed_id = Model\Feed\create($url, $values['download_content'], $values['rtl']); if ($feed_id) { Session\flash(t('Subscription added successfully.')); diff --git a/lib/helpers.php b/lib/helpers.php index a0c7b57..838b412 100644 --- a/lib/helpers.php +++ b/lib/helpers.php @@ -2,9 +2,9 @@ namespace Helper; -function isRTL($language) +function isRTL(array $item) { - return \PicoFeed\Parser::isLanguageRTL($language); + return ! empty($item['rtl']) || \PicoFeed\Parser::isLanguageRTL($item['language']); } function css() diff --git a/locales/cs_CZ/translations.php b/locales/cs_CZ/translations.php index c6a0b9b..c0f0410 100644 --- a/locales/cs_CZ/translations.php +++ b/locales/cs_CZ/translations.php @@ -225,4 +225,7 @@ return array( // 'Display items on lists' => '', // 'Summaries' => '', // 'Full contents' => '', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/locales/de_DE/translations.php b/locales/de_DE/translations.php index 432e138..a64b21a 100644 --- a/locales/de_DE/translations.php +++ b/locales/de_DE/translations.php @@ -225,4 +225,7 @@ return array( 'Display items on lists' => 'Einträge in Listen anzeigen', 'Summaries' => 'Zusammenfassungen', 'Full contents' => 'Komplette Inhalte', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/locales/es_ES/translations.php b/locales/es_ES/translations.php index bbe912e..63511ec 100644 --- a/locales/es_ES/translations.php +++ b/locales/es_ES/translations.php @@ -225,4 +225,7 @@ return array( // 'Display items on lists' => '', // 'Summaries' => '', // 'Full contents' => '', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/locales/fr_FR/translations.php b/locales/fr_FR/translations.php index 1de659e..caec067 100644 --- a/locales/fr_FR/translations.php +++ b/locales/fr_FR/translations.php @@ -225,4 +225,7 @@ return array( 'Display items on lists' => 'Mode d\'affichage en listes', 'Summaries' => 'Résumés', 'Full contents' => 'Contenus complets', + 'Force RTL mode (Right-to-left language)' => 'Forcer le mode RTL (Lecture de droite à gauche)', + 'Activated' => 'Activé', + 'Remove this feed' => 'Supprimer cet abonnement', ); diff --git a/locales/it_IT/translations.php b/locales/it_IT/translations.php index 6db152f..297a963 100644 --- a/locales/it_IT/translations.php +++ b/locales/it_IT/translations.php @@ -225,4 +225,7 @@ return array( // 'Display items on lists' => '', // 'Summaries' => '', // 'Full contents' => '', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/locales/pt_BR/translations.php b/locales/pt_BR/translations.php index a55cc61..1e89535 100644 --- a/locales/pt_BR/translations.php +++ b/locales/pt_BR/translations.php @@ -225,4 +225,7 @@ return array( // 'Display items on lists' => '', // 'Summaries' => '', // 'Full contents' => '', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/locales/zh_CN/translations.php b/locales/zh_CN/translations.php index c956047..d0a07dd 100644 --- a/locales/zh_CN/translations.php +++ b/locales/zh_CN/translations.php @@ -225,4 +225,7 @@ return array( // 'Display items on lists' => '', // 'Summaries' => '', // 'Full contents' => '', + // 'Force RTL mode (Right-to-left language)' => '', + // 'Activated' => '', + // 'Remove this feed' => '', ); diff --git a/models/config.php b/models/config.php index b679704..bf22278 100644 --- a/models/config.php +++ b/models/config.php @@ -8,7 +8,7 @@ use PicoDb\Database; use PicoFeed\Config as ReaderConfig; use PicoFeed\Logging; -const DB_VERSION = 27; +const DB_VERSION = 28; const HTTP_USER_AGENT = 'Miniflux (http://miniflux.net)'; // Get PicoFeed config diff --git a/models/feed.php b/models/feed.php index 324aeb4..14148a1 100644 --- a/models/feed.php +++ b/models/feed.php @@ -23,7 +23,10 @@ function update(array $values) ->save(array( 'title' => $values['title'], 'site_url' => $values['site_url'], - 'feed_url' => $values['feed_url'] + 'feed_url' => $values['feed_url'], + 'enabled' => empty($values['enabled']) ? 0 : $values['enabled'], + 'rtl' => empty($values['rtl']) ? 0 : $values['rtl'], + 'download_content' => empty($values['download_content']) ? 0 : $values['download_content'], )); } @@ -71,7 +74,7 @@ function import_opml($content) } // Add a new feed from an URL -function create($url, $enable_grabber = false) +function create($url, $enable_grabber = false, $force_rtl = false) { $reader = new Reader(Config\get_reader_config()); $resource = $reader->download($url); @@ -110,7 +113,8 @@ function create($url, $enable_grabber = false) 'title' => $feed->getTitle(), 'site_url' => $feed->getUrl(), 'feed_url' => $reader->getUrl(), - 'download_content' => $enable_grabber ? 1 : 0 + 'download_content' => $enable_grabber ? 1 : 0, + 'rtl' => $force_rtl ? 1 : 0, )); if ($rs) { @@ -385,18 +389,6 @@ function disable($feed_id) return Database::get('db')->table('feeds')->eq('id', $feed_id)->save((array('enabled' => 0))); } -// Enable content download -function enable_grabber($feed_id) -{ - return Database::get('db')->table('feeds')->eq('id', $feed_id)->save((array('download_content' => 1))); -} - -// Disable content download -function disable_grabber($feed_id) -{ - return Database::get('db')->table('feeds')->eq('id', $feed_id)->save((array('download_content' => 0))); -} - // Validation for edit function validate_modification(array $values) { diff --git a/models/item.php b/models/item.php index 8e1b57c..a1fd93b 100644 --- a/models/item.php +++ b/models/item.php @@ -27,7 +27,8 @@ function get_everything() 'items.content', 'items.language', 'feeds.site_url', - 'feeds.title AS feed_title' + 'feeds.title AS feed_title', + 'feeds.rtl' ) ->join('feeds', 'id', 'feed_id') ->in('status', array('read', 'unread')) @@ -53,7 +54,8 @@ function get_everything_since($timestamp) 'items.content', 'items.language', 'feeds.site_url', - 'feeds.title AS feed_title' + 'feeds.title AS feed_title', + 'feeds.rtl' ) ->join('feeds', 'id', 'feed_id') ->in('status', array('read', 'unread')) @@ -90,7 +92,8 @@ function get_all($status, $offset = null, $limit = null, $order_column = 'update 'items.content', 'items.language', 'feeds.site_url', - 'feeds.title AS feed_title' + 'feeds.title AS feed_title', + 'feeds.rtl' ) ->join('feeds', 'id', 'feed_id') ->eq('status', $status) @@ -137,7 +140,8 @@ function get_bookmarks($offset = null, $limit = null) 'items.feed_id', 'items.language', 'feeds.site_url', - 'feeds.title AS feed_title' + 'feeds.title AS feed_title', + 'feeds.rtl' ) ->join('feeds', 'id', 'feed_id') ->in('status', array('read', 'unread')) @@ -175,7 +179,8 @@ function get_all_by_feed($feed_id, $offset = null, $limit = null, $order_column 'items.content', 'items.bookmark', 'items.language', - 'feeds.site_url' + 'feeds.site_url', + 'feeds.rtl' ) ->join('feeds', 'id', 'feed_id') ->in('status', array('unread', 'read')) diff --git a/models/schema.php b/models/schema.php index b394b8a..d4a492d 100644 --- a/models/schema.php +++ b/models/schema.php @@ -2,18 +2,21 @@ namespace Schema; +function version_28($pdo) +{ + $pdo->exec('ALTER TABLE feeds ADD COLUMN rtl INTEGER DEFAULT 0'); +} + function version_27($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN items_display_mode TEXT DEFAULT "summaries"'); } - function version_26($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN bookmarklet_token TEXT DEFAULT "'.\Model\Config\generate_token().'"'); } - function version_25($pdo) { $pdo->exec( @@ -30,38 +33,32 @@ function version_25($pdo) ); } - function version_24($pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN auto_update_url TEXT DEFAULT 'https://github.com/fguillot/miniflux/archive/master.zip'"); } - function version_23($pdo) { $pdo->exec('ALTER TABLE items ADD COLUMN language TEXT'); } - function version_22($pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN timezone TEXT DEFAULT 'UTC'"); } - function version_21($pdo) { $pdo->exec('ALTER TABLE items ADD COLUMN enclosure TEXT'); $pdo->exec('ALTER TABLE items ADD COLUMN enclosure_type TEXT'); } - function version_20($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN redirect_nothing_to_read TEXT DEFAULT "feeds"'); } - function version_19($pdo) { $rq = $pdo->prepare('SELECT autoflush FROM config'); @@ -75,50 +72,42 @@ function version_19($pdo) } } - function version_18($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN parsing_error INTEGER DEFAULT 0'); } - function version_17($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN items_sorting_direction TEXT DEFAULT "desc"'); } - function version_16($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN auth_google_token TEXT DEFAULT ""'); $pdo->exec('ALTER TABLE config ADD COLUMN auth_mozilla_token TEXT DEFAULT ""'); } - function version_15($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN download_content INTEGER DEFAULT 0'); } - function version_14($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN feed_token TEXT DEFAULT "'.\Model\Config\generate_token().'"'); } - function version_13($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN enabled INTEGER DEFAULT 1'); } - function version_12($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN api_token TEXT DEFAULT "'.\Model\Config\generate_token().'"'); } - function version_11($pdo) { $rq = $pdo->prepare(' @@ -148,62 +137,52 @@ function version_11($pdo) } } - function version_10($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN theme TEXT DEFAULT "original"'); } - function version_9($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN items_per_page INTEGER DEFAULT 100'); } - function version_8($pdo) { $pdo->exec('ALTER TABLE items ADD COLUMN bookmark INTEGER DEFAULT 0'); } - function version_7($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER DEFAULT 0'); } - function version_6($pdo) { $pdo->exec('ALTER TABLE config ADD COLUMN autoflush INTEGER DEFAULT 0'); } - function version_5($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN last_checked INTEGER'); } - function version_4($pdo) { $pdo->exec('CREATE INDEX idx_status ON items(status)'); } - function version_3($pdo) { $pdo->exec("ALTER TABLE config ADD COLUMN language TEXT DEFAULT 'en_US'"); } - function version_2($pdo) { $pdo->exec('ALTER TABLE feeds ADD COLUMN last_modified TEXT'); $pdo->exec('ALTER TABLE feeds ADD COLUMN etag TEXT'); } - function version_1($pdo) { $pdo->exec(" diff --git a/scripts/sync-locales.php b/scripts/sync-locales.php index 159ce73..2ed2df3 100755 --- a/scripts/sync-locales.php +++ b/scripts/sync-locales.php @@ -1,27 +1,41 @@ #!/usr/bin/env php $value) { +function update_missing_locales(array $reference, $outdated_file) +{ + $outdated = include $outdated_file; - if (isset($outdated[$key])) { - //$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $value)."',\n"; - $output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n"; - } - else { - //$output .= " // '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $value)."',\n"; - $output .= " // '".str_replace("'", "\'", $key)."' => '',\n"; + $output = ' $value) { + + if (isset($outdated[$key])) { + $output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n"; + } + else { + $output .= " // '".str_replace("'", "\'", $key)."' => '',\n"; + } } + + $output .= ");\n"; + return $output; } -$output .= ');'.PHP_EOL; -echo $output; \ No newline at end of file +foreach (new DirectoryIterator('locales') as $fileInfo) { + + if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== $reference_lang) { + + $filename = 'locales/'.$fileInfo->getFilename().'/translations.php'; + + echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL; + + file_put_contents($filename, update_missing_locales($reference, $filename)); + } +} diff --git a/templates/add.php b/templates/add.php index 10f9a17..ff62df5 100644 --- a/templates/add.php +++ b/templates/add.php @@ -9,8 +9,11 @@
- +

+ +

+

diff --git a/templates/edit_feed.php b/templates/edit_feed.php index 789ff18..75fc39a 100644 --- a/templates/edit_feed.php +++ b/templates/edit_feed.php @@ -21,8 +21,20 @@ +
+ +
+ + +
- \ No newline at end of file + +
+
+
    +
  • +
+
diff --git a/templates/feed_items.php b/templates/feed_items.php index c313dae..4834958 100644 --- a/templates/feed_items.php +++ b/templates/feed_items.php @@ -18,7 +18,14 @@
- $item, 'menu' => $menu, 'offset' => $offset, 'hide' => false, 'display_mode' => $display_mode)) ?> + $feed, + 'item' => $item, + 'menu' => $menu, + 'offset' => $offset, + 'hide' => false, + 'display_mode' => $display_mode, + )) ?>
diff --git a/templates/feeds.php b/templates/feeds.php index e25dc01..2a57a11 100644 --- a/templates/feeds.php +++ b/templates/feeds.php @@ -56,33 +56,14 @@
  • -
  • - -
  • -
  • - - - - - -
  • -
  • - -
  • -
  • - -
  • -
  • - +
  • -
  • - -
  • +
  • diff --git a/templates/item.php b/templates/item.php index 0f287ea..6674dba 100644 --- a/templates/item.php +++ b/templates/item.php @@ -7,7 +7,7 @@ data-item-page="" > -

    > +

    > ★ ' : '' ?> ✔ ' : '' ?>

    -
    > +
    >
    -

    > +

    >

    diff --git a/templates/show_item.php b/templates/show_item.php index 0b0ba20..16ec28b 100644 --- a/templates/show_item.php +++ b/templates/show_item.php @@ -30,7 +30,7 @@ -

    > +

    $feed['rtl'])) ? 'dir="rtl"' : '' ?>> @@ -89,7 +89,7 @@ -
    > +
    $feed['rtl'])) ? 'dir="rtl"' : '' ?>>
    diff --git a/templates/unread_items.php b/templates/unread_items.php index 3f55757..816d3f0 100644 --- a/templates/unread_items.php +++ b/templates/unread_items.php @@ -16,7 +16,13 @@
    - $item, 'menu' => $menu, 'offset' => $offset, 'hide' => true, 'display_mode' => $display_mode)) ?> + $item, + 'menu' => $menu, + 'offset' => $offset, + 'hide' => true, + 'display_mode' => $display_mode, + )) ?>