From 947e918f05d70d5dce4efa4ef403e593581c3fa9 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 28 Feb 2021 12:26:24 +0100 Subject: Travis: Enforce phpcs line length + whitespace (#3488) * Update Travis line length * Also check whitespace in CSS files * Fix line length ext.php * More syntax, string templates * Fix exclude-pattern * Test JS files as well --- .travis.yml | 4 +- Makefile | 4 +- app/Controllers/authController.php | 20 +- app/Controllers/categoryController.php | 3 +- app/Controllers/configureController.php | 24 +- app/Controllers/extensionController.php | 39 +- app/Controllers/feedController.php | 9 +- app/Controllers/importExportController.php | 3 +- app/Controllers/javascriptController.php | 3 +- app/Controllers/tagController.php | 12 +- app/Controllers/updateController.php | 6 +- app/Controllers/userController.php | 6 +- app/FreshRSS.php | 6 +- app/Models/CategoryDAO.php | 29 +- app/Models/DatabaseDAOPGSQL.php | 16 +- app/Models/Entry.php | 2 +- app/Models/EntryDAO.php | 34 +- app/Models/EntryDAOSQLite.php | 4 +- app/Models/FeedDAO.php | 36 +- app/Models/FormAuth.php | 5 +- app/Models/Share.php | 3 +- app/Models/StatsDAO.php | 4 +- app/Models/TagDAO.php | 24 +- app/Models/UserQuery.php | 12 +- app/install.php | 51 +- app/layout/aside_configure.phtml | 12 +- app/layout/aside_feed.phtml | 28 +- app/layout/nav_menu.phtml | 45 +- app/views/auth/formLogin.phtml | 3 +- app/views/auth/index.phtml | 26 +- app/views/auth/register.phtml | 3 +- app/views/configure/archiving.phtml | 38 +- app/views/configure/display.phtml | 63 +- app/views/configure/integration.phtml | 18 +- app/views/configure/reading.phtml | 76 +- app/views/configure/shortcut.phtml | 63 +- app/views/configure/system.phtml | 18 +- app/views/extension/index.phtml | 2 +- app/views/helpers/category/update.phtml | 27 +- app/views/helpers/configure/query.phtml | 12 +- app/views/helpers/extension/configure.phtml | 3 +- app/views/helpers/feed/update.phtml | 75 +- app/views/helpers/index/normal/entry_header.phtml | 3 +- app/views/helpers/pagination.phtml | 8 +- app/views/index/global.phtml | 6 +- app/views/index/logs.phtml | 6 +- app/views/index/normal.phtml | 16 +- app/views/index/reader.phtml | 8 +- app/views/stats/idle.phtml | 6 +- app/views/stats/repartition.phtml | 6 +- app/views/subscription/bookmarklet.phtml | 4 +- app/views/subscription/index.phtml | 8 +- app/views/user/details.phtml | 139 +- app/views/user/manage.phtml | 8 +- app/views/user/profile.phtml | 9 +- lib/Minz/Configuration.php | 9 +- .../ControllerNotActionControllerException.php | 3 +- lib/Minz/ExtensionException.php | 6 +- lib/Minz/ExtensionManager.php | 42 +- lib/Minz/Log.php | 8 +- lib/Minz/Paginator.php | 2 +- lib/lib_install.php | 2 +- lib/lib_rss.php | 9 +- p/api/fever.php | 4 +- p/api/greader.php | 14 +- p/ext.php | 3 +- p/scripts/install.js | 4 +- p/scripts/integration.js | 62 +- p/scripts/main.js | 11 +- p/scripts/stats.js | 12 +- p/themes/Alternative-Dark/adark.rtl.css | 2 +- p/themes/Ansum/ansum.css | 1794 +++++++++---------- p/themes/Ansum/ansum.rtl.css | 1796 +++++++++---------- p/themes/BlueLagoon/BlueLagoon.rtl.css | 2 +- p/themes/Mapco/mapco.css | 1812 +++++++++---------- p/themes/Mapco/mapco.rtl.css | 1814 ++++++++++---------- p/themes/Origine-compact/origine-compact.rtl.css | 2 +- p/themes/Origine/origine.rtl.css | 2 +- p/themes/Pafat/pafat.rtl.css | 2 +- p/themes/Screwdriver/screwdriver.rtl.css | 2 +- p/themes/Swage/swage.css | 1274 +++++++------- p/themes/Swage/swage.rtl.css | 1274 +++++++------- phpcs.xml | 37 +- tests/app/Models/CategoryTest.php | 3 +- tests/app/Models/SearchTest.php | 3 +- 85 files changed, 5654 insertions(+), 5454 deletions(-) diff --git a/.travis.yml b/.travis.yml index 83cff8be9..ae99fc85e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ jobs: - if [ -s php-l-results ]; then cat php-l-results; exit 1; fi - COMPOSER_BIN=$(composer global config --absolute bin-dir) - $COMPOSER_BIN/phpunit --bootstrap ./tests/bootstrap.php --verbose ./tests - - $COMPOSER_BIN/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p + - $COMPOSER_BIN/phpcs . -p -s - name: "PHP 7.4 Syntax, linter and tests" php: "7.4" install: @@ -29,7 +29,7 @@ jobs: - if [ -s php-l-results ]; then cat php-l-results; exit 1; fi - COMPOSER_BIN=$(composer global config --absolute bin-dir) - $COMPOSER_BIN/phpunit --bootstrap ./tests/bootstrap.php --verbose ./tests - - $COMPOSER_BIN/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p + - $COMPOSER_BIN/phpcs . -p -s - name: "PHP 5.6 Syntax" php: "5.6" script: diff --git a/Makefile b/Makefile index b843cb81e..72352ff42 100644 --- a/Makefile +++ b/Makefile @@ -61,11 +61,11 @@ test: bin/phpunit ## Run the test suite .PHONY: lint lint: bin/phpcs ## Run the linter on the PHP files - $(PHP) ./bin/phpcs . --standard=phpcs.xml --warning-severity=0 --extensions=php -p + $(PHP) ./bin/phpcs . -p -s .PHONY: lint-fix lint-fix: bin/phpcbf ## Fix the errors detected by the linter - $(PHP) ./bin/phpcbf . --standard=phpcs.xml --warning-severity=0 --extensions=php -p + $(PHP) ./bin/phpcbf . -p -s bin/phpunit: mkdir -p bin/ diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index ca8a9758a..3202b59f2 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -53,11 +53,9 @@ class FreshRSS_auth_Controller extends Minz_ActionController { invalidateHttpCache(); if ($ok) { - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'auth', 'a' => 'index')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'auth', 'a' => 'index' ]); } else { - Minz_Request::bad(_t('feedback.conf.error'), - array('c' => 'auth', 'a' => 'index')); + Minz_Request::bad(_t('feedback.conf.error'), [ 'c' => 'auth', 'a' => 'index' ]); } } } @@ -160,13 +158,9 @@ class FreshRSS_auth_Controller extends Minz_ActionController { Minz_Translate::init(FreshRSS_Context::$user_conf->language); // All is good, go back to the index. - Minz_Request::good(_t('feedback.auth.login.success'), - array('c' => 'index', 'a' => 'index')); + Minz_Request::good(_t('feedback.auth.login.success'), [ 'c' => 'index', 'a' => 'index' ]); } else { - Minz_Log::warning('Password mismatch for' . - ' user=' . $username . - ', nonce=' . $nonce . - ', c=' . $challenge); + Minz_Log::warning("Password mismatch for user={$username}, nonce={$nonce}, c={$challenge}"); header('HTTP/1.1 403 Forbidden'); Minz_Session::_param('POST_to_GET', true); //Prevent infinite internal redirect @@ -203,8 +197,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { Minz_Translate::init(FreshRSS_Context::$user_conf->language); - Minz_Request::good(_t('feedback.auth.login.success'), - array('c' => 'index', 'a' => 'index')); + Minz_Request::good(_t('feedback.auth.login.success'), [ 'c' => 'index', 'a' => 'index' ]); } else { Minz_Log::warning('Unsafe password mismatch for user ' . $username); Minz_Request::bad( @@ -221,8 +214,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { public function logoutAction() { invalidateHttpCache(); FreshRSS_Auth::removeAccess(); - Minz_Request::good(_t('feedback.auth.logout.success'), - array('c' => 'index', 'a' => 'index')); + Minz_Request::good(_t('feedback.auth.logout.success'), [ 'c' => 'index', 'a' => 'index' ]); } /** diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 1d0359a39..3ec88460a 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -34,8 +34,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { $this->view->categories = $catDAO->listCategories(false); if (count($this->view->categories) >= $limits['max_categories']) { - Minz_Request::bad(_t('feedback.sub.category.over_max', $limits['max_categories']), - $url_redirect); + Minz_Request::bad(_t('feedback.sub.category.over_max', $limits['max_categories']), $url_redirect); } if (Minz_Request::isPost()) { diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index f658d1c44..b2c1b5109 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -63,8 +63,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Translate::reset(FreshRSS_Context::$user_conf->language); invalidateHttpCache(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'display')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'display' ]); } $this->view->themes = FreshRSS_Themes::get(); @@ -127,8 +126,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'reading')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'reading' ]); } Minz_View::prependTitle(_t('conf.reading.title') . ' · '); @@ -154,8 +152,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'integration')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'integration' ]); } Minz_View::prependTitle(_t('conf.sharing.title') . ' · '); @@ -236,8 +233,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->save(); invalidateHttpCache(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'archiving')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'archiving' ]); } $volatile = [ @@ -300,8 +296,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'queries')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'queries' ]); } else { $this->view->queries = array(); foreach (FreshRSS_Context::$user_conf->queries as $key => $query) { @@ -369,8 +364,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'queries', 'params' => ['id' => $id])); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'queries', 'params' => ['id' => $id] ]); } Minz_View::prependTitle(_t('conf.query.title') . ' · ' . $query->getName() . ' · '); @@ -391,8 +385,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); - Minz_Request::good(_t('feedback.conf.updated'), - array('c' => 'configure', 'a' => 'queries')); + Minz_Request::good(_t('feedback.conf.updated'), [ 'c' => 'configure', 'a' => 'queries' ]); } /** @@ -419,8 +412,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { FreshRSS_Context::$user_conf->queries = $queries; FreshRSS_Context::$user_conf->save(); - Minz_Request::good(_t('feedback.conf.query_created', $params['name']), - array('c' => 'configure', 'a' => 'queries')); + Minz_Request::good(_t('feedback.conf.query_created', $params['name']), [ 'c' => 'configure', 'a' => 'queries' ]); } /** diff --git a/app/Controllers/extensionController.php b/app/Controllers/extensionController.php index 8ac45acc7..a932954a9 100644 --- a/app/Controllers/extensionController.php +++ b/app/Controllers/extensionController.php @@ -117,13 +117,11 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $ext = Minz_ExtensionManager::findExtension($ext_name); if (is_null($ext)) { - Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), $url_redirect); } if ($ext->isEnabled()) { - Minz_Request::bad(_t('feedback.extensions.already_enabled', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.already_enabled', $ext_name), $url_redirect); } $conf = null; @@ -132,8 +130,7 @@ class FreshRSS_extension_Controller extends Minz_ActionController { } elseif ($ext->getType() === 'user') { $conf = FreshRSS_Context::$user_conf; } else { - Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), $url_redirect); } $res = $ext->install(); @@ -144,12 +141,10 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $conf->extensions_enabled = $ext_list; $conf->save(); - Minz_Request::good(_t('feedback.extensions.enable.ok', $ext_name), - $url_redirect); + Minz_Request::good(_t('feedback.extensions.enable.ok', $ext_name), $url_redirect); } else { Minz_Log::warning('Can not enable extension ' . $ext_name . ': ' . $res); - Minz_Request::bad(_t('feedback.extensions.enable.ko', $ext_name, _url('index', 'logs')), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.enable.ko', $ext_name, _url('index', 'logs')), $url_redirect); } } @@ -173,13 +168,11 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $ext = Minz_ExtensionManager::findExtension($ext_name); if (is_null($ext)) { - Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), $url_redirect); } if (!$ext->isEnabled()) { - Minz_Request::bad(_t('feedback.extensions.not_enabled', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.not_enabled', $ext_name), $url_redirect); } $conf = null; @@ -188,8 +181,7 @@ class FreshRSS_extension_Controller extends Minz_ActionController { } elseif ($ext->getType() === 'user') { $conf = FreshRSS_Context::$user_conf; } else { - Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.no_access', $ext_name), $url_redirect); } $res = $ext->uninstall(); @@ -204,12 +196,10 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $conf->extensions_enabled = $ext_list; $conf->save(); - Minz_Request::good(_t('feedback.extensions.disable.ok', $ext_name), - $url_redirect); + Minz_Request::good(_t('feedback.extensions.disable.ok', $ext_name), $url_redirect); } else { Minz_Log::warning('Can not unable extension ' . $ext_name . ': ' . $res); - Minz_Request::bad(_t('feedback.extensions.disable.ko', $ext_name, _url('index', 'logs')), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.disable.ko', $ext_name, _url('index', 'logs')), $url_redirect); } } @@ -237,17 +227,14 @@ class FreshRSS_extension_Controller extends Minz_ActionController { $ext = Minz_ExtensionManager::findExtension($ext_name); if (is_null($ext)) { - Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.not_found', $ext_name), $url_redirect); } $res = recursive_unlink($ext->getPath()); if ($res) { - Minz_Request::good(_t('feedback.extensions.removed', $ext_name), - $url_redirect); + Minz_Request::good(_t('feedback.extensions.removed', $ext_name), $url_redirect); } else { - Minz_Request::bad(_t('feedback.extensions.cannot_remove', $ext_name), - $url_redirect); + Minz_Request::bad(_t('feedback.extensions.cannot_remove', $ext_name), $url_redirect); } } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 5737a8535..158015d2b 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -150,8 +150,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $limits = FreshRSS_Context::$system_conf->limits; $this->view->feeds = $feedDAO->listFeeds(); if (count($this->view->feeds) >= $limits['max_feeds']) { - Minz_Request::bad(_t('feedback.sub.feed.over_max', $limits['max_feeds']), - $url_redirect); + Minz_Request::bad(_t('feedback.sub.feed.over_max', $limits['max_feeds']), $url_redirect); } if (Minz_Request::isPost()) { @@ -366,9 +365,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } else { //This entry already exists but has been updated //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) . //', old hash ' . $existingHash . ', new hash ' . $entry->hash()); - $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? ( - $feed->attributes('mark_updated_article_unread') - ) : FreshRSS_Context::$user_conf->mark_updated_article_unread; + $mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? + $feed->attributes('mark_updated_article_unread') : + FreshRSS_Context::$user_conf->mark_updated_article_unread; $needFeedCacheRefresh = $mark_updated_article_unread; $entry->_isRead($mark_updated_article_unread ? false : null); //Change is_read according to policy. diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index d23bb3689..3550ba0dd 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -157,8 +157,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { if ($status_file !== 0) { Minz_Log::warning('File cannot be uploaded. Error code: ' . $status_file); - Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), - array('c' => 'importExport', 'a' => 'index')); + Minz_Request::bad(_t('feedback.import_export.file_cannot_be_uploaded'), [ 'c' => 'importExport', 'a' => 'index' ]); } @set_time_limit(300); diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 40f0fc19a..4a79da27a 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -34,7 +34,8 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { $salt = FreshRSS_Context::$system_conf->salt; $s = FreshRSS_Context::$user_conf->passwordHash; if (strlen($s) >= 60) { - $this->view->salt1 = substr($s, 0, 29); //CRYPT_BLOWFISH Salt: "$2a$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z". + //CRYPT_BLOWFISH Salt: "$2a$", a two digit cost parameter, "$", and 22 characters from the alphabet "./0-9A-Za-z". + $this->view->salt1 = substr($s, 0, 29); $this->view->nonce = sha1($salt . uniqid(mt_rand(), true)); Minz_Session::_param('nonce', $this->view->nonce); return; //Success diff --git a/app/Controllers/tagController.php b/app/Controllers/tagController.php index 217d95db1..4f3fe9bf9 100644 --- a/app/Controllers/tagController.php +++ b/app/Controllers/tagController.php @@ -34,12 +34,12 @@ class FreshRSS_tag_Controller extends Minz_ActionController { $tagDAO = FreshRSS_Factory::createTagDao(); if ($id_tag == 0 && $name_tag != '' && $checked) { if ($existing_tag = $tagDAO->searchByName($name_tag)) { - // Use existing tag - $tagDAO->tagEntry($existing_tag->id(), $id_entry, $checked); - } else { - //Create new tag - $id_tag = $tagDAO->addTag(array('name' => $name_tag)); - } + // Use existing tag + $tagDAO->tagEntry($existing_tag->id(), $id_entry, $checked); + } else { + //Create new tag + $id_tag = $tagDAO->addTag(array('name' => $name_tag)); + } } if ($id_tag != 0) { $tagDAO->tagEntry($id_tag, $id_entry, $checked); diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index c0c1ef1c8..45bf70f62 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -193,8 +193,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { @file_put_contents(join_path(DATA_PATH, 'last_update.txt'), ''); Minz_Request::good(_t('feedback.update.finished')); } else { - Minz_Request::bad(_t('feedback.update.error', $res), - array('c' => 'update', 'a' => 'index')); + Minz_Request::bad(_t('feedback.update.error', $res), [ 'c' => 'update', 'a' => 'index' ]); } } else { $res = false; @@ -220,8 +219,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { 'params' => array('post_conf' => true) ), true); } else { - Minz_Request::bad(_t('feedback.update.error', $res), - array('c' => 'update', 'a' => 'index')); + Minz_Request::bad(_t('feedback.update.error', $res), [ 'c' => 'update', 'a' => 'index' ]); } } } diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 06c9ebc04..ec5e348c2 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -71,8 +71,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index')); } } else { - Minz_Request::bad(_t('feedback.user.updated.error', $username), - array('c' => 'user', 'a' => 'manage')); + Minz_Request::bad(_t('feedback.user.updated.error', $username), [ 'c' => 'user', 'a' => 'manage' ]); } } } @@ -140,8 +139,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_Request::good(_t('feedback.profile.updated'), array('c' => 'index', 'a' => 'index')); } } else { - Minz_Request::bad(_t('feedback.profile.error'), - array('c' => 'user', 'a' => 'profile')); + Minz_Request::bad(_t('feedback.profile.error'), [ 'c' => 'user', 'a' => 'profile' ]); } } } diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 8a9a85213..17ff9ab21 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -68,8 +68,10 @@ class FreshRSS extends Minz_FrontController { if (!(FreshRSS_Auth::isCsrfOk() || (Minz_Request::controllerName() === 'auth' && Minz_Request::actionName() === 'login') || (Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'create' && !FreshRSS_Auth::hasAccess('admin')) || - (Minz_Request::controllerName() === 'feed' && Minz_Request::actionName() === 'actualize' && FreshRSS_Context::$system_conf->allow_anonymous_refresh) || - (Minz_Request::controllerName() === 'javascript' && Minz_Request::actionName() === 'actualize' && FreshRSS_Context::$system_conf->allow_anonymous) + (Minz_Request::controllerName() === 'feed' && Minz_Request::actionName() === 'actualize' + && FreshRSS_Context::$system_conf->allow_anonymous_refresh) || + (Minz_Request::controllerName() === 'javascript' && Minz_Request::actionName() === 'actualize' + && FreshRSS_Context::$system_conf->allow_anonymous) )) { // Token-based protection against XSRF attacks, except for the login or self-create user forms self::initI18n(); diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index 519c7a29b..0a9bd68db 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -80,9 +80,13 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } public function addCategory($valuesTmp) { - $sql = 'INSERT INTO `_category`(name, attributes) ' - . 'SELECT * FROM (SELECT TRIM(?) AS name, TRIM(?) AS attributes) c2 ' //TRIM() to provide a type hint as text - . 'WHERE NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = TRIM(?))'; //No tag of the same name + // TRIM() to provide a type hint as text + // No tag of the same name + $sql = <<<'SQL' +INSERT INTO `_category`(name, attributes) +SELECT * FROM (SELECT TRIM(?) AS name, TRIM(?) AS attributes) c2 +WHERE NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = TRIM(?)) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8'); @@ -121,8 +125,11 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable } public function updateCategory($id, $valuesTmp) { - $sql = 'UPDATE `_category` SET name=?, attributes=? WHERE id=? ' - . 'AND NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = ?)'; //No tag of the same name + // No tag of the same name + $sql = <<<'SQL' +UPDATE `_category` SET name=?, attributes=? WHERE id=? +AND NOT EXISTS (SELECT 1 FROM `_tag` WHERE name = ?) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, FreshRSS_DatabaseDAO::LENGTH_INDEX_UNICODE, 'UTF-8'); @@ -240,12 +247,12 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo implements FreshRSS_Searchable public function listCategories($prePopulateFeeds = true, $details = false) { if ($prePopulateFeeds) { $sql = 'SELECT c.id AS c_id, c.name AS c_name, c.attributes AS c_attributes, ' - . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.`cache_nbEntries`, f.`cache_nbUnreads`, f.ttl ') - . 'FROM `_category` c ' - . 'LEFT OUTER JOIN `_feed` f ON f.category=c.id ' - . 'WHERE f.priority >= :priority_normal ' - . 'GROUP BY f.id, c_id ' - . 'ORDER BY c.name, f.name'; + . ($details ? 'f.* ' : 'f.id, f.name, f.url, f.website, f.priority, f.error, f.`cache_nbEntries`, f.`cache_nbUnreads`, f.ttl ') + . 'FROM `_category` c ' + . 'LEFT OUTER JOIN `_feed` f ON f.category=c.id ' + . 'WHERE f.priority >= :priority_normal ' + . 'GROUP BY f.id, c_id ' + . 'ORDER BY c.name, f.name'; $stm = $this->pdo->prepare($sql); $values = [ ':priority_normal' => FreshRSS_Feed::PRIORITY_NORMAL ]; if ($stm && $stm->execute($values)) { diff --git a/app/Models/DatabaseDAOPGSQL.php b/app/Models/DatabaseDAOPGSQL.php index 75ff8be7b..75b01c90b 100644 --- a/app/Models/DatabaseDAOPGSQL.php +++ b/app/Models/DatabaseDAOPGSQL.php @@ -57,13 +57,15 @@ class FreshRSS_DatabaseDAOPGSQL extends FreshRSS_DatabaseDAOSQLite { $stm->bindParam(':base', $db['base']); $stm->execute(); } else { - $sql = "SELECT " - . "pg_total_relation_size('`{$this->pdo->prefix()}category`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}feed`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entry`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}tag`') + " - . "pg_total_relation_size('`{$this->pdo->prefix()}entrytag`')"; + $sql = <<pdo->prefix()}category`') +pg_total_relation_size('`{$this->pdo->prefix()}feed`') +pg_total_relation_size('`{$this->pdo->prefix()}entry`') +pg_total_relation_size('`{$this->pdo->prefix()}entrytmp`') +pg_total_relation_size('`{$this->pdo->prefix()}tag`') +pg_total_relation_size('`{$this->pdo->prefix()}entrytag`') +SQL; $stm = $this->pdo->query($sql); } if ($stm == false) { diff --git a/app/Models/Entry.php b/app/Models/Entry.php index b5b28c97a..6e14d43b7 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -23,7 +23,7 @@ class FreshRSS_Entry extends Minz_Model { private $tags; public function __construct($feedId = '', $guid = '', $title = '', $authors = '', $content = '', - $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { + $link = '', $pubdate = 0, $is_read = false, $is_favorite = false, $tags = '') { $this->_title($title); $this->_authors($authors); $this->_content($content); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 6f7a4b48f..a9bf5a49b 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -578,14 +578,14 @@ SQL; if (!empty($options['keep_min']) && $options['keep_min'] > 0) { //Double SELECT for MySQL workaround ERROR 1093 (HY000) $sql .= ' AND `lastSeen` < (SELECT `lastSeen`' - . ' FROM (SELECT e2.`lastSeen` FROM `_entry` e2 WHERE e2.id_feed = :id_feed2' - . ' ORDER BY e2.`lastSeen` DESC LIMIT 1 OFFSET :keep_min) last_seen2)'; + . ' FROM (SELECT e2.`lastSeen` FROM `_entry` e2 WHERE e2.id_feed = :id_feed2' + . ' ORDER BY e2.`lastSeen` DESC LIMIT 1 OFFSET :keep_min) last_seen2)'; $params[':id_feed2'] = $id_feed; $params[':keep_min'] = (int)$options['keep_min']; } //Keep at least the articles seen at the last refresh $sql .= ' AND `lastSeen` < (SELECT maxlastseen' - . ' FROM (SELECT MAX(e3.`lastSeen`) AS maxlastseen FROM `_entry` e3 WHERE e3.id_feed = :id_feed3) last_seen3)'; + . ' FROM (SELECT MAX(e3.`lastSeen`) AS maxlastseen FROM `_entry` e3 WHERE e3.id_feed = :id_feed3) last_seen3)'; $params[':id_feed3'] = $id_feed; //==Inclusions== @@ -598,8 +598,8 @@ SQL; } if (!empty($options['keep_max']) && $options['keep_max'] > 0) { $sql .= ' OR `lastSeen` <= (SELECT `lastSeen`' - . ' FROM (SELECT e4.`lastSeen` FROM `_entry` e4 WHERE e4.id_feed = :id_feed4' - . ' ORDER BY e4.`lastSeen` DESC LIMIT 1 OFFSET :keep_max) last_seen4)'; + . ' FROM (SELECT e4.`lastSeen` FROM `_entry` e4 WHERE e4.id_feed = :id_feed4' + . ' ORDER BY e4.`lastSeen` DESC LIMIT 1 OFFSET :keep_max) last_seen4)'; $params[':id_feed4'] = $id_feed; $params[':keep_max'] = (int)$options['keep_max']; } @@ -670,7 +670,8 @@ SQL; return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL } - protected function sqlListEntriesWhere($alias = '', $filters = null, $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $firstId = '', $date_min = 0) { + protected function sqlListEntriesWhere($alias = '', $filters = null, $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $firstId = '', $date_min = 0) { $search = ' '; $values = array(); if ($state & FreshRSS_Entry::STATE_NOT_READ) { @@ -831,13 +832,15 @@ SQL; if ($filter->getSearch()) { foreach ($filter->getSearch() as $search_value) { - $sub_search .= 'AND ' . $this->sqlConcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; + $sub_search .= 'AND ' . $this->sqlConcat($alias . 'title', + $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ? '; $values[] = "%{$search_value}%"; } } if ($filter->getNotSearch()) { foreach ($filter->getNotSearch() as $search_value) { - $sub_search .= 'AND (NOT ' . $this->sqlConcat($alias . 'title', $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ?) '; + $sub_search .= 'AND (NOT ' . $this->sqlConcat($alias . 'title', + $this->isCompressed() ? 'UNCOMPRESS(' . $alias . 'content_bin)' : '' . $alias . 'content') . ' LIKE ?) '; $values[] = "%{$search_value}%"; } } @@ -859,7 +862,8 @@ SQL; return array($values, $search); } - private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { if (!$state) { $state = FreshRSS_Entry::STATE_ALL; } @@ -917,7 +921,8 @@ SQL; . ($limit > 0 ? ' LIMIT ' . intval($limit) : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ } - public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + public function listWhereRaw($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filters, $date_min); $sql = 'SELECT e0.id, e0.guid, e0.title, e0.author, ' @@ -939,7 +944,8 @@ SQL; } } - public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null, $date_min = 0) { $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filters, $date_min); if ($stm) { while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { @@ -969,7 +975,8 @@ SQL; } } - public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filters = null) { //For API + public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, + $order = 'DESC', $limit = 1, $firstId = '', $filters = null) { //For API list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filters); $stm = $this->pdo->prepare($sql); @@ -983,7 +990,8 @@ SQL; return array(); } $guids = array_unique($guids); - $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; + $sql = 'SELECT guid, ' . $this->sqlHexEncode('hash') . + ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)'; $stm = $this->pdo->prepare($sql); $values = array($id_feed); $values = array_merge($values, $guids); diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index e53583654..82d7c099c 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -114,13 +114,13 @@ DROP TABLE IF EXISTS `tmp`; public function markRead($ids, $is_read = true) { FreshRSS_UserDAO::touch(); if (is_array($ids)) { //Many IDs at once (used by API) - if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) + //if (true) { //Speed heuristics //TODO: Not implemented yet for SQLite (so always call IDs one by one) $affected = 0; foreach ($ids as $id) { $affected += $this->markRead($id, $is_read); } return $affected; - } + //} } else { $this->pdo->beginTransaction(); $sql = 'UPDATE `_entry` SET is_read=? WHERE id=? AND is_read=?'; diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 2b2b3c0ec..43485451c 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -175,9 +175,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateLastUpdate($id, $inError = false, $mtime = 0) { //See also updateCachedValue() - $sql = 'UPDATE `_feed` ' - . 'SET `lastUpdate`=?, error=? ' - . 'WHERE id=?'; + $sql = 'UPDATE `_feed` SET `lastUpdate`=?, error=? WHERE id=?'; $values = array( $mtime <= 0 ? time() : $mtime, $inError ? 1 : 0, @@ -248,9 +246,11 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function selectAll() { - $sql = 'SELECT id, url, category, name, website, description, `lastUpdate`, priority, ' - . '`pathEntries`, `httpAuth`, error, ttl, attributes ' - . 'FROM `_feed`'; + $sql = <<<'SQL' +SELECT id, url, category, name, website, description, `lastUpdate`, + priority, `pathEntries`, `httpAuth`, error, ttl, attributes +FROM `_feed` +SQL; $stm = $this->pdo->query($sql); while ($row = $stm->fetch(PDO::FETCH_ASSOC)) { yield $row; @@ -317,8 +317,10 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function arrayFeedCategoryNames() { //For API - $sql = 'SELECT f.id, f.name, c.name as c_name FROM `_feed` f ' - . 'INNER JOIN `_category` c ON c.id = f.category'; + $sql = <<<'SQL' +SELECT f.id, f.name, c.name as c_name FROM `_feed` f +INNER JOIN `_category` c ON c.id = f.category +SQL; $stm = $this->pdo->query($sql); $res = $stm->fetchAll(PDO::FETCH_ASSOC); $feedCategoryNames = array(); @@ -337,12 +339,12 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function listFeedsOrderUpdate($defaultCacheDuration = 3600, $limit = 0) { $this->updateTTL(); $sql = 'SELECT id, url, name, website, `lastUpdate`, `pathEntries`, `httpAuth`, ttl, attributes ' - . 'FROM `_feed` ' - . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl >= ' . FreshRSS_Feed::TTL_DEFAULT - . ' AND `lastUpdate` < (' . (time() + 60) - . '-(CASE WHEN ttl=' . FreshRSS_Feed::TTL_DEFAULT . ' THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') - . 'ORDER BY `lastUpdate` ' - . ($limit < 1 ? '' : 'LIMIT ' . intval($limit)); + . 'FROM `_feed` ' + . ($defaultCacheDuration < 0 ? '' : 'WHERE ttl >= ' . FreshRSS_Feed::TTL_DEFAULT + . ' AND `lastUpdate` < (' . (time() + 60) + . '-(CASE WHEN ttl=' . FreshRSS_Feed::TTL_DEFAULT . ' THEN ' . intval($defaultCacheDuration) . ' ELSE ttl END)) ') + . 'ORDER BY `lastUpdate` ' + . ($limit < 1 ? '' : 'LIMIT ' . intval($limit)); $stm = $this->pdo->query($sql); if ($stm !== false) { return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC)); @@ -394,9 +396,9 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable { public function updateCachedValues($id = null) { //2 sub-requests with FOREIGN KEY(e.id_feed), INDEX(e.is_read) faster than 1 request with GROUP BY or CASE $sql = 'UPDATE `_feed` ' - . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `_entry` e1 WHERE e1.id_feed=`_feed`.id),' - . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)' - . ($id != null ? ' WHERE id=:id' : ''); + . 'SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `_entry` e1 WHERE e1.id_feed=`_feed`.id),' + . '`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)' + . ($id != null ? ' WHERE id=:id' : ''); $stm = $this->pdo->prepare($sql); if ($id != null) { $stm->bindParam(':id', $id, PDO::PARAM_INT); diff --git a/app/Models/FormAuth.php b/app/Models/FormAuth.php index 1aca7c3d1..5211fd5d1 100644 --- a/app/Models/FormAuth.php +++ b/app/Models/FormAuth.php @@ -6,10 +6,7 @@ class FreshRSS_FormAuth { !ctype_graph($hash) || !ctype_graph($challenge) || !ctype_alnum($nonce)) { - Minz_Log::debug('Invalid credential parameters:' . - ' user=' . $username . - ' challenge=' . $challenge . - ' nonce=' . $nonce); + Minz_Log::debug("Invalid credential parameters: user={$username}, challenge={$challenge}, nonce={$nonce}"); return false; } diff --git a/app/Models/Share.php b/app/Models/Share.php index 218781dcc..7988a021f 100644 --- a/app/Models/Share.php +++ b/app/Models/Share.php @@ -97,8 +97,7 @@ class FreshRSS_Share { * @param $help_url is an optional url to give help on this option. * @param $method defines the sharing method (GET or POST) */ - private function __construct($type, $url_transform, $transform, - $form_type, $help_url, $method, $field) { + private function __construct($type, $url_transform, $transform, $form_type, $help_url, $method, $field) { $this->type = $type; $this->name = _t('gen.share.' . $type); $this->url_transform = $url_transform; diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index cbfa79c61..a73657e9a 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -15,8 +15,8 @@ class FreshRSS_StatsDAO extends Minz_ModelPdo { */ public function calculateEntryRepartition() { return array( - 'main_stream' => $this->calculateEntryRepartitionPerFeed(null, true), - 'all_feeds' => $this->calculateEntryRepartitionPerFeed(null, false), + 'main_stream' => $this->calculateEntryRepartitionPerFeed(null, true), + 'all_feeds' => $this->calculateEntryRepartitionPerFeed(null, false), ); } diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php index a9aad519d..7f95e2ac2 100644 --- a/app/Models/TagDAO.php +++ b/app/Models/TagDAO.php @@ -42,9 +42,13 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function addTag($valuesTmp) { - $sql = 'INSERT INTO `_tag`(name, attributes) ' - . 'SELECT * FROM (SELECT TRIM(?) as name, TRIM(?) as attributes) t2 ' //TRIM() gives a text type hint to PostgreSQL - . 'WHERE NOT EXISTS (SELECT 1 FROM `_category` WHERE name = TRIM(?))'; //No category of the same name + // TRIM() gives a text type hint to PostgreSQL + // No category of the same name + $sql = <<<'SQL' +INSERT INTO `_tag`(name, attributes) +SELECT * FROM (SELECT TRIM(?) as name, TRIM(?) as attributes) t2 +WHERE NOT EXISTS (SELECT 1 FROM `_category` WHERE name = TRIM(?)) +SQL; $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, 63, 'UTF-8'); @@ -79,8 +83,12 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateTag($id, $valuesTmp) { - $sql = 'UPDATE `_tag` SET name=?, attributes=? WHERE id=? ' - . 'AND NOT EXISTS (SELECT 1 FROM `_category` WHERE name = ?)'; //No category of the same name + // No category of the same name + $sql = <<<'SQL' +UPDATE `_tag` SET name=?, attributes=? WHERE id=? +AND NOT EXISTS (SELECT 1 FROM `_category` WHERE name = ?) +SQL; + $stm = $this->pdo->prepare($sql); $valuesTmp['name'] = mb_strcut(trim($valuesTmp['name']), 0, 63, 'UTF-8'); @@ -149,7 +157,11 @@ class FreshRSS_TagDAO extends Minz_ModelPdo implements FreshRSS_Searchable { } public function updateEntryTag($oldTagId, $newTagId) { - $sql = 'DELETE FROM `_entrytag` WHERE EXISTS (SELECT 1 FROM `_entrytag` AS e WHERE e.id_entry = `_entrytag`.id_entry AND e.id_tag = ? AND `_entrytag`.id_tag = ?)'; + $sql = <<<'SQL' +DELETE FROM `_entrytag` WHERE EXISTS ( + SELECT 1 FROM `_entrytag` AS e + WHERE e.id_entry = `_entrytag`.id_entry AND e.id_tag = ? AND `_entrytag`.id_tag = ?) +SQL; $stm = $this->pdo->prepare($sql); if (!($stm && $stm->execute([$newTagId, $oldTagId]))) { diff --git a/app/Models/UserQuery.php b/app/Models/UserQuery.php index a5a5a6ce2..88ddd3629 100644 --- a/app/Models/UserQuery.php +++ b/app/Models/UserQuery.php @@ -59,12 +59,12 @@ class FreshRSS_UserQuery { */ public function toArray() { return array_filter(array( - 'get' => $this->get, - 'name' => $this->name, - 'order' => $this->order, - 'search' => $this->search->__toString(), - 'state' => $this->state, - 'url' => $this->url, + 'get' => $this->get, + 'name' => $this->name, + 'order' => $this->order, + 'search' => $this->search->__toString(), + 'state' => $this->state, + 'url' => $this->url, )); } diff --git a/app/install.php b/app/install.php index a156027e4..b3e96a773 100644 --- a/app/install.php +++ b/app/install.php @@ -104,9 +104,9 @@ function saveStep2() { ]); } else { if (empty($_POST['type']) || - empty($_POST['host']) || - empty($_POST['user']) || - empty($_POST['base'])) { + empty($_POST['host']) || + empty($_POST['user']) || + empty($_POST['base'])) { Minz_Session::_param('bd_error', 'Missing parameters!'); } Minz_Session::_params([ @@ -336,7 +336,7 @@ function printStep0() { ?>

- +

@@ -426,7 +426,8 @@ function printStep1() {
- +
@@ -443,7 +444,8 @@ function printStep2() {

-

+

@@ -454,19 +456,19 @@ function printStep2() { +
- +
- +
- +
- +
@@ -539,7 +546,9 @@ function printStep3() {
- +
@@ -553,9 +562,12 @@ function printStep3() { } $auth_type = isset($_SESSION['auth_type']) ? $_SESSION['auth_type'] : ''; ?> - - - + + + @@ -564,7 +576,8 @@ function printStep3() {
- tabindex="5" /> + tabindex="5" />

diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index e74630b5a..5738cbb0f 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -18,8 +18,7 @@
  • -
  • +
  • @@ -32,20 +31,17 @@
  • -
  • +
  • -
  • +
  • disable_update) { ?> -
  • +
  • diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 98daf633c..c3f066601 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -27,7 +27,8 @@
    - name() ?> + name() ?> @@ -71,12 +73,15 @@ $position = $cat->attributes('position'); if (!empty($feeds)) { $c_active = FreshRSS_Context::isCurrentGet('c_' . $cat->id()); - $c_show = ($c_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ])) || FreshRSS_Context::$user_conf->display_categories === 'all'; + $c_show = ($c_active && in_array(FreshRSS_Context::$user_conf->display_categories, [ 'active', 'remember' ])) + || FreshRSS_Context::$user_conf->display_categories === 'all'; ?> -
  • data-unread="nbNotRead() ?>"> +
  • data-unread="nbNotRead() ?>">
      @@ -84,14 +89,17 @@ foreach ($feeds as $feed) { $f_active = FreshRSS_Context::isCurrentGet('f_' . $feed->id()); ?> -
    • +
    • show_favicons): ?>✇ - name() ?> + name() ?>
    @@ -134,9 +142,9 @@
  • reading_confirm ? 'confirm" disabled="disabled' : ''; ?> + form="mark-read-aside" + formaction="" + type="submit">
  • diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 5a385589f..0724abc16 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -3,7 +3,7 @@ ?>