aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2024-08-01 20:31:40 +0200
committerGravatar GitHub <noreply@github.com> 2024-08-01 20:31:40 +0200
commitd2247221bbf23a8fe19f66ea4ad7d0a59ffaa5b4 (patch)
treef5174c1b1d174cd41dca20f350e1297894e1c6fa /app/Models
parentb2c8cb74562b2f7cb290abd61ff1b6f35475f23a (diff)
Minor update whitespace PHPCS rules (#6666)
* Minor update whitespace PHPCS rules To simplify our configuration, apply more rules, and be clearer about what is added or removed compared with PSR12. Does not change our current conventions, but just a bit more consistent. * Forgotten *.phtml * Sort exclusion patterns + add a few for Extensions repo * Relaxed some rules
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/Auth.php130
-rw-r--r--app/Models/CategoryDAOSQLite.php1
-rw-r--r--app/Models/Context.php260
-rw-r--r--app/Models/Entry.php24
-rw-r--r--app/Models/EntryDAO.php82
-rw-r--r--app/Models/EntryDAOSQLite.php10
-rw-r--r--app/Models/Factory.php1
-rw-r--r--app/Models/FeedDAO.php2
-rw-r--r--app/Models/FilterActionsTrait.php4
-rw-r--r--app/Models/Share.php2
-rw-r--r--app/Models/StatsDAO.php1
-rw-r--r--app/Models/StatsDAOPGSQL.php3
-rw-r--r--app/Models/StatsDAOSQLite.php3
-rw-r--r--app/Models/TagDAO.php2
-rw-r--r--app/Models/TagDAOPGSQL.php1
-rw-r--r--app/Models/TagDAOSQLite.php1
-rw-r--r--app/Models/Themes.php2
-rw-r--r--app/Models/View.php1
-rw-r--r--app/Models/ViewStats.php1
19 files changed, 261 insertions, 270 deletions
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 416f3061d..f65a59e03 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -54,48 +54,48 @@ class FreshRSS_Auth {
private static function accessControl(): bool {
$auth_type = FreshRSS_Context::systemConf()->auth_type;
switch ($auth_type) {
- case 'form':
- $credentials = FreshRSS_FormAuth::getCredentialsFromCookie();
- $current_user = '';
- if (isset($credentials[1])) {
- $current_user = trim($credentials[0]);
- Minz_Session::_params([
+ case 'form':
+ $credentials = FreshRSS_FormAuth::getCredentialsFromCookie();
+ $current_user = '';
+ if (isset($credentials[1])) {
+ $current_user = trim($credentials[0]);
+ Minz_Session::_params([
Minz_User::CURRENT_USER => $current_user,
'passwordHash' => trim($credentials[1]),
'csrf' => false,
- ]);
- }
- return $current_user != '';
- case 'http_auth':
- $current_user = httpAuthUser();
- if ($current_user == '') {
- return false;
- }
- $login_ok = FreshRSS_UserDAO::exists($current_user);
- if (!$login_ok && FreshRSS_Context::systemConf()->http_auth_auto_register) {
- $email = null;
- if (FreshRSS_Context::systemConf()->http_auth_auto_register_email_field !== '' &&
- isset($_SERVER[FreshRSS_Context::systemConf()->http_auth_auto_register_email_field])) {
- $email = (string)$_SERVER[FreshRSS_Context::systemConf()->http_auth_auto_register_email_field];
+ ]);
}
- $language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::systemConf()->language);
- Minz_Translate::init($language);
- $login_ok = FreshRSS_user_Controller::createUser($current_user, $email, '', [
+ return $current_user != '';
+ case 'http_auth':
+ $current_user = httpAuthUser();
+ if ($current_user == '') {
+ return false;
+ }
+ $login_ok = FreshRSS_UserDAO::exists($current_user);
+ if (!$login_ok && FreshRSS_Context::systemConf()->http_auth_auto_register) {
+ $email = null;
+ if (FreshRSS_Context::systemConf()->http_auth_auto_register_email_field !== '' &&
+ isset($_SERVER[FreshRSS_Context::systemConf()->http_auth_auto_register_email_field])) {
+ $email = (string)$_SERVER[FreshRSS_Context::systemConf()->http_auth_auto_register_email_field];
+ }
+ $language = Minz_Translate::getLanguage(null, Minz_Request::getPreferredLanguages(), FreshRSS_Context::systemConf()->language);
+ Minz_Translate::init($language);
+ $login_ok = FreshRSS_user_Controller::createUser($current_user, $email, '', [
'language' => $language,
- ]);
- }
- if ($login_ok) {
- Minz_Session::_params([
+ ]);
+ }
+ if ($login_ok) {
+ Minz_Session::_params([
Minz_User::CURRENT_USER => $current_user,
'csrf' => false,
- ]);
- }
- return $login_ok;
- case 'none':
- return true;
- default:
- // TODO load extension
- return false;
+ ]);
+ }
+ return $login_ok;
+ case 'none':
+ return true;
+ default:
+ // TODO load extension
+ return false;
}
}
@@ -110,19 +110,19 @@ class FreshRSS_Auth {
}
switch (FreshRSS_Context::systemConf()->auth_type) {
- case 'form':
- self::$login_ok = Minz_Session::paramString('passwordHash') === FreshRSS_Context::userConf()->passwordHash;
- break;
- case 'http_auth':
- $current_user = Minz_User::name() ?? '';
- self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0;
- break;
- case 'none':
- self::$login_ok = true;
- break;
- default:
- // TODO: extensions
- self::$login_ok = false;
+ case 'form':
+ self::$login_ok = Minz_Session::paramString('passwordHash') === FreshRSS_Context::userConf()->passwordHash;
+ break;
+ case 'http_auth':
+ $current_user = Minz_User::name() ?? '';
+ self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0;
+ break;
+ case 'none':
+ self::$login_ok = true;
+ break;
+ default:
+ // TODO: extensions
+ self::$login_ok = false;
}
Minz_Session::_params([
@@ -147,13 +147,13 @@ class FreshRSS_Auth {
$default_user = FreshRSS_Context::systemConf()->default_user;
$ok = self::$login_ok;
switch ($scope) {
- case 'general':
- break;
- case 'admin':
- $ok &= $default_user === $currentUser || $isAdmin;
- break;
- default:
- $ok = false;
+ case 'general':
+ break;
+ case 'admin':
+ $ok &= $default_user === $currentUser || $isAdmin;
+ break;
+ default:
+ $ok = false;
}
return (bool)$ok;
}
@@ -186,16 +186,16 @@ class FreshRSS_Auth {
Minz_User::change($username);
switch (FreshRSS_Context::systemConf()->auth_type) {
- case 'form':
- Minz_Session::_param('passwordHash');
- FreshRSS_FormAuth::deleteCookie();
- break;
- case 'http_auth':
- case 'none':
- // Nothing to do…
- break;
- default:
- // TODO: extensions
+ case 'form':
+ Minz_Session::_param('passwordHash');
+ FreshRSS_FormAuth::deleteCookie();
+ break;
+ case 'http_auth':
+ case 'none':
+ // Nothing to do…
+ break;
+ default:
+ // TODO: extensions
}
}
diff --git a/app/Models/CategoryDAOSQLite.php b/app/Models/CategoryDAOSQLite.php
index 5fb0da31d..4aaac07a8 100644
--- a/app/Models/CategoryDAOSQLite.php
+++ b/app/Models/CategoryDAOSQLite.php
@@ -16,5 +16,4 @@ class FreshRSS_CategoryDAOSQLite extends FreshRSS_CategoryDAO {
}
return false;
}
-
}
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 7efb24ab1..988eedc71 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -347,23 +347,23 @@ final class FreshRSS_Context {
$type = substr($get, 0, 1);
$id = substr($get, 2);
- switch($type) {
- case 'a':
- return self::$current_get['all'];
- case 'i':
- return self::$current_get['important'];
- case 's':
- return self::$current_get['starred'];
- case 'f':
- return self::$current_get['feed'] == $id;
- case 'c':
- return self::$current_get['category'] == $id;
- case 't':
- return self::$current_get['tag'] == $id;
- case 'T':
- return self::$current_get['tags'] || self::$current_get['tag'];
- default:
- return false;
+ switch ($type) {
+ case 'a':
+ return self::$current_get['all'];
+ case 'i':
+ return self::$current_get['important'];
+ case 's':
+ return self::$current_get['starred'];
+ case 'f':
+ return self::$current_get['feed'] == $id;
+ case 'c':
+ return self::$current_get['category'] == $id;
+ case 't':
+ return self::$current_get['tag'] == $id;
+ case 'T':
+ return self::$current_get['tags'] || self::$current_get['tag'];
+ default:
+ return false;
}
}
@@ -393,84 +393,84 @@ final class FreshRSS_Context {
self::$categories = $catDAO->listCategories(true, $details);
}
- switch($type) {
- case 'a':
- self::$current_get['all'] = true;
- self::$name = _t('index.feed.title');
- self::$description = FreshRSS_Context::systemConf()->meta_description;
- self::$get_unread = self::$total_unread;
- break;
- case 'i':
- self::$current_get['important'] = true;
- self::$name = _t('index.menu.important');
- self::$description = FreshRSS_Context::systemConf()->meta_description;
- self::$get_unread = self::$total_unread;
- break;
- case 's':
- self::$current_get['starred'] = true;
- self::$name = _t('index.feed.title_fav');
- self::$description = FreshRSS_Context::systemConf()->meta_description;
- self::$get_unread = self::$total_starred['unread'];
-
- // Update state if favorite is not yet enabled.
- self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE;
- break;
- case 'f':
- // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description
- $feed = FreshRSS_Context::systemConf()->allow_robots ? null : FreshRSS_Category::findFeed(self::$categories, $id);
- if ($feed === null) {
- $feedDAO = FreshRSS_Factory::createFeedDao();
- $feed = $feedDAO->searchById($id);
+ switch ($type) {
+ case 'a':
+ self::$current_get['all'] = true;
+ self::$name = _t('index.feed.title');
+ self::$description = FreshRSS_Context::systemConf()->meta_description;
+ self::$get_unread = self::$total_unread;
+ break;
+ case 'i':
+ self::$current_get['important'] = true;
+ self::$name = _t('index.menu.important');
+ self::$description = FreshRSS_Context::systemConf()->meta_description;
+ self::$get_unread = self::$total_unread;
+ break;
+ case 's':
+ self::$current_get['starred'] = true;
+ self::$name = _t('index.feed.title_fav');
+ self::$description = FreshRSS_Context::systemConf()->meta_description;
+ self::$get_unread = self::$total_starred['unread'];
+
+ // Update state if favorite is not yet enabled.
+ self::$state = self::$state | FreshRSS_Entry::STATE_FAVORITE;
+ break;
+ case 'f':
+ // We try to find the corresponding feed. When allowing robots, always retrieve the full feed including description
+ $feed = FreshRSS_Context::systemConf()->allow_robots ? null : FreshRSS_Category::findFeed(self::$categories, $id);
if ($feed === null) {
- throw new FreshRSS_Context_Exception('Invalid feed: ' . $id);
+ $feedDAO = FreshRSS_Factory::createFeedDao();
+ $feed = $feedDAO->searchById($id);
+ if ($feed === null) {
+ throw new FreshRSS_Context_Exception('Invalid feed: ' . $id);
+ }
}
- }
- self::$current_get['feed'] = $id;
- self::$current_get['category'] = $feed->categoryId();
- self::$name = $feed->name();
- self::$description = $feed->description();
- self::$get_unread = $feed->nbNotRead();
- break;
- case 'c':
- // We try to find the corresponding category.
- self::$current_get['category'] = $id;
- if (!isset(self::$categories[$id])) {
- $catDAO = FreshRSS_Factory::createCategoryDao();
- $cat = $catDAO->searchById($id);
- if ($cat === null) {
- throw new FreshRSS_Context_Exception('Invalid category: ' . $id);
+ self::$current_get['feed'] = $id;
+ self::$current_get['category'] = $feed->categoryId();
+ self::$name = $feed->name();
+ self::$description = $feed->description();
+ self::$get_unread = $feed->nbNotRead();
+ break;
+ case 'c':
+ // We try to find the corresponding category.
+ self::$current_get['category'] = $id;
+ if (!isset(self::$categories[$id])) {
+ $catDAO = FreshRSS_Factory::createCategoryDao();
+ $cat = $catDAO->searchById($id);
+ if ($cat === null) {
+ throw new FreshRSS_Context_Exception('Invalid category: ' . $id);
+ }
+ self::$categories[$id] = $cat;
+ } else {
+ $cat = self::$categories[$id];
}
- self::$categories[$id] = $cat;
- } else {
- $cat = self::$categories[$id];
- }
- self::$name = $cat->name();
- self::$get_unread = $cat->nbNotRead();
- break;
- case 't':
- // We try to find the corresponding tag.
- self::$current_get['tag'] = $id;
- if (!isset(self::$tags[$id])) {
- $tagDAO = FreshRSS_Factory::createTagDao();
- $tag = $tagDAO->searchById($id);
- if ($tag === null) {
- throw new FreshRSS_Context_Exception('Invalid tag: ' . $id);
+ self::$name = $cat->name();
+ self::$get_unread = $cat->nbNotRead();
+ break;
+ case 't':
+ // We try to find the corresponding tag.
+ self::$current_get['tag'] = $id;
+ if (!isset(self::$tags[$id])) {
+ $tagDAO = FreshRSS_Factory::createTagDao();
+ $tag = $tagDAO->searchById($id);
+ if ($tag === null) {
+ throw new FreshRSS_Context_Exception('Invalid tag: ' . $id);
+ }
+ self::$tags[$id] = $tag;
+ } else {
+ $tag = self::$tags[$id];
}
- self::$tags[$id] = $tag;
- } else {
- $tag = self::$tags[$id];
- }
- self::$name = $tag->name();
- self::$get_unread = $tag->nbUnread();
- break;
- case 'T':
- $tagDAO = FreshRSS_Factory::createTagDao();
- self::$current_get['tags'] = true;
- self::$name = _t('index.menu.tags');
- self::$get_unread = $tagDAO->countNotRead();
- break;
- default:
- throw new FreshRSS_Context_Exception('Invalid getter: ' . $get);
+ self::$name = $tag->name();
+ self::$get_unread = $tag->nbUnread();
+ break;
+ case 'T':
+ $tagDAO = FreshRSS_Factory::createTagDao();
+ self::$current_get['tags'] = true;
+ self::$name = _t('index.menu.tags');
+ self::$get_unread = $tagDAO->countNotRead();
+ break;
+ default:
+ throw new FreshRSS_Context_Exception('Invalid getter: ' . $get);
}
self::_nextGet();
@@ -493,54 +493,54 @@ final class FreshRSS_Context {
$another_unread_id = '';
$found_current_get = false;
switch ($get[0]) {
- case 'f':
- // We search the next unread feed with the following priorities: next in same category, or previous in same category, or next, or previous.
- foreach (self::$categories as $cat) {
- $sameCat = false;
- foreach ($cat->feeds() as $feed) {
- if ($found_current_get) {
- if ($feed->nbNotRead() > 0) {
+ case 'f':
+ // We search the next unread feed with the following priorities: next in same category, or previous in same category, or next, or previous.
+ foreach (self::$categories as $cat) {
+ $sameCat = false;
+ foreach ($cat->feeds() as $feed) {
+ if ($found_current_get) {
+ if ($feed->nbNotRead() > 0) {
+ $another_unread_id = $feed->id();
+ break 2;
+ }
+ } elseif ($feed->id() == self::$current_get['feed']) {
+ $found_current_get = true;
+ } elseif ($feed->nbNotRead() > 0) {
$another_unread_id = $feed->id();
- break 2;
+ $sameCat = true;
}
- } elseif ($feed->id() == self::$current_get['feed']) {
- $found_current_get = true;
- } elseif ($feed->nbNotRead() > 0) {
- $another_unread_id = $feed->id();
- $sameCat = true;
+ }
+ if ($found_current_get && $sameCat) {
+ break;
}
}
- if ($found_current_get && $sameCat) {
- break;
- }
- }
- // If there is no more unread feed, show main stream
- self::$next_get = $another_unread_id == '' ? 'a' : 'f_' . $another_unread_id;
- break;
- case 'c':
- // We search the next category with at least one unread article.
- foreach (self::$categories as $cat) {
- if ($cat->id() == self::$current_get['category']) {
- // Here is our current category! Next one could be our
- // champion if it has unread articles.
- $found_current_get = true;
- continue;
- }
+ // If there is no more unread feed, show main stream
+ self::$next_get = $another_unread_id == '' ? 'a' : 'f_' . $another_unread_id;
+ break;
+ case 'c':
+ // We search the next category with at least one unread article.
+ foreach (self::$categories as $cat) {
+ if ($cat->id() == self::$current_get['category']) {
+ // Here is our current category! Next one could be our
+ // champion if it has unread articles.
+ $found_current_get = true;
+ continue;
+ }
- if ($cat->nbNotRead() > 0) {
- $another_unread_id = $cat->id();
- if ($found_current_get) {
- // Unread articles and the current category has
- // already been found? Leave the loop!
- break;
+ if ($cat->nbNotRead() > 0) {
+ $another_unread_id = $cat->id();
+ if ($found_current_get) {
+ // Unread articles and the current category has
+ // already been found? Leave the loop!
+ break;
+ }
}
}
- }
- // If there is no more unread category, show main stream
- self::$next_get = $another_unread_id == '' ? 'a' : 'c_' . $another_unread_id;
- break;
+ // If there is no more unread category, show main stream
+ self::$next_get = $another_unread_id == '' ? 'a' : 'c_' . $another_unread_id;
+ break;
}
}
}
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index ada6e9944..cd7b27291 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -393,7 +393,7 @@ HTML;
return timestamptodate($this->date);
}
public function machineReadableDate(): string {
- return @date (DATE_ATOM, $this->date);
+ return @date(DATE_ATOM, $this->date);
}
public function lastSeen(): int {
@@ -728,17 +728,17 @@ HTML;
public function isDay(int $day, int $today): bool {
$date = $this->dateAdded(true);
switch ($day) {
- case FreshRSS_Days::TODAY:
- $tomorrow = $today + 86400;
- return $date >= $today && $date < $tomorrow;
- case FreshRSS_Days::YESTERDAY:
- $yesterday = $today - 86400;
- return $date >= $yesterday && $date < $today;
- case FreshRSS_Days::BEFORE_YESTERDAY:
- $yesterday = $today - 86400;
- return $date < $yesterday;
- default:
- return false;
+ case FreshRSS_Days::TODAY:
+ $tomorrow = $today + 86400;
+ return $date >= $today && $date < $tomorrow;
+ case FreshRSS_Days::YESTERDAY:
+ $yesterday = $today - 86400;
+ return $date >= $yesterday && $date < $today;
+ case FreshRSS_Days::BEFORE_YESTERDAY:
+ $yesterday = $today - 86400;
+ return $date < $yesterday;
+ default:
+ return false;
}
}
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index ba0cf1970..cd8373766 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -312,7 +312,7 @@ SQL;
}
$sql = 'UPDATE `_entry` '
. 'SET is_favorite=? '
- . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
+ . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1) . '?)';
$values = [$is_favorite ? 1 : 0];
$values = array_merge($values, $ids);
$stm = $this->pdo->prepare($sql);
@@ -393,7 +393,7 @@ SQL;
$sql = 'UPDATE `_entry` '
. 'SET is_read=? '
- . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)';
+ . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1) . '?)';
$values = [$is_read ? 1 : 0];
$values = array_merge($values, $ids);
$stm = $this->pdo->prepare($sql);
@@ -1062,43 +1062,43 @@ SQL;
$where = '';
$values = [];
switch ($type) {
- case 'a': //All PRIORITY_MAIN_STREAM
- $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_MAIN_STREAM . ' ';
- break;
- case 'A': //All except PRIORITY_ARCHIVED
- $where .= 'f.priority > ' . FreshRSS_Feed::PRIORITY_ARCHIVED . ' ';
- break;
- case 'i': //Priority important feeds
- $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_IMPORTANT . ' ';
- break;
- case 's': //Starred. Deprecated: use $state instead
- $where .= 'f.priority > ' . FreshRSS_Feed::PRIORITY_ARCHIVED . ' ';
- $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_CATEGORY . ' ';
- $where .= 'AND f.category=? ';
- $values[] = $id;
- break;
- case 'f': //Feed
- $where .= 'e.id_feed=? ';
- $values[] = $id;
- break;
- case 't': //Tag (label)
- $where .= 'et.id_tag=? ';
- $values[] = $id;
- break;
- case 'T': //Any tag (label)
- $where .= '1=1 ';
- break;
- case 'ST': //Starred or tagged (label)
- $where .= 'e.is_favorite=1 OR EXISTS (SELECT et2.id_tag FROM `_entrytag` et2 WHERE et2.id_entry = e.id) ';
- break;
- default:
- throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
+ case 'a': //All PRIORITY_MAIN_STREAM
+ $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_MAIN_STREAM . ' ';
+ break;
+ case 'A': //All except PRIORITY_ARCHIVED
+ $where .= 'f.priority > ' . FreshRSS_Feed::PRIORITY_ARCHIVED . ' ';
+ break;
+ case 'i': //Priority important feeds
+ $where .= 'f.priority >= ' . FreshRSS_Feed::PRIORITY_IMPORTANT . ' ';
+ break;
+ case 's': //Starred. Deprecated: use $state instead
+ $where .= 'f.priority > ' . FreshRSS_Feed::PRIORITY_ARCHIVED . ' ';
+ $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_CATEGORY . ' ';
+ $where .= 'AND f.category=? ';
+ $values[] = $id;
+ break;
+ case 'f': //Feed
+ $where .= 'e.id_feed=? ';
+ $values[] = $id;
+ break;
+ case 't': //Tag (label)
+ $where .= 'et.id_tag=? ';
+ $values[] = $id;
+ break;
+ case 'T': //Any tag (label)
+ $where .= '1=1 ';
+ break;
+ case 'ST': //Starred or tagged (label)
+ $where .= 'e.is_favorite=1 OR EXISTS (SELECT et2.id_tag FROM `_entrytag` et2 WHERE et2.id_entry = e.id) ';
+ break;
+ default:
+ throw new FreshRSS_EntriesGetter_Exception('Bad type in Entry->listByType: [' . $type . ']!');
}
[$searchValues, $search] = $this->sqlListEntriesWhere('e.', $filters, $state, $order, $firstId, $date_min);
@@ -1257,7 +1257,7 @@ SQL;
}
$guids = array_unique($guids);
$sql = 'SELECT guid, ' . static::sqlHexEncode('hash') .
- ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)';
+ ' AS hex_hash FROM `_entry` WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1) . '?)';
$stm = $this->pdo->prepare($sql);
$values = [$id_feed];
$values = array_merge($values, $guids);
@@ -1294,7 +1294,7 @@ SQL;
}
return $affected;
}
- $sql = 'UPDATE `_entry` SET `lastSeen`=? WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1). '?)';
+ $sql = 'UPDATE `_entry` SET `lastSeen`=? WHERE id_feed=? AND guid IN (' . str_repeat('?,', count($guids) - 1) . '?)';
$stm = $this->pdo->prepare($sql);
if ($mtime <= 0) {
$mtime = time();
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index 44c248e82..364d0c153 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -86,11 +86,11 @@ SQL;
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)
- $affected = 0;
- foreach ($ids as $id) {
- $affected += ($this->markRead($id, $is_read) ?: 0);
- }
- return $affected;
+ $affected = 0;
+ foreach ($ids as $id) {
+ $affected += ($this->markRead($id, $is_read) ?: 0);
+ }
+ return $affected;
//}
} else {
$this->pdo->beginTransaction();
diff --git a/app/Models/Factory.php b/app/Models/Factory.php
index f69c7f6aa..be96c0e58 100644
--- a/app/Models/Factory.php
+++ b/app/Models/Factory.php
@@ -89,5 +89,4 @@ class FreshRSS_Factory {
return new FreshRSS_DatabaseDAO($username);
}
}
-
}
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index 204f95939..11eef4e90 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -464,7 +464,7 @@ SET `cache_nbEntries`=(SELECT COUNT(e1.id) FROM `_entry` e1 WHERE e1.id_feed=`_f
`cache_nbUnreads`=(SELECT COUNT(e2.id) FROM `_entry` e2 WHERE e2.id_feed=`_feed`.id AND e2.is_read=0)
SQL;
if (count($feedIds) > 0) {
- $sql .= ' WHERE id IN (' . str_repeat('?,', count($feedIds) - 1). '?)';
+ $sql .= ' WHERE id IN (' . str_repeat('?,', count($feedIds) - 1) . '?)';
}
$stm = $this->pdo->prepare($sql);
if ($stm !== false && $stm->execute($feedIds)) {
diff --git a/app/Models/FilterActionsTrait.php b/app/Models/FilterActionsTrait.php
index 495dc3eee..9b7ee66d4 100644
--- a/app/Models/FilterActionsTrait.php
+++ b/app/Models/FilterActionsTrait.php
@@ -84,7 +84,7 @@ trait FreshRSS_FilterActionsTrait {
}
}
//Update existing filter with new action
- for ($k = count($filters) - 1; $k >= 0; $k --) {
+ for ($k = count($filters) - 1; $k >= 0; $k--) {
$filter = $filters[$k];
if ($filter === $filterAction->booleanSearch()->getRawInput()) {
$actions[] = $action;
@@ -100,7 +100,7 @@ trait FreshRSS_FilterActionsTrait {
}
//Add new filters
- for ($k = count($filters) - 1; $k >= 0; $k --) {
+ for ($k = count($filters) - 1; $k >= 0; $k--) {
$filter = $filters[$k];
if ($filter != '') {
$filterAction = FreshRSS_FilterAction::fromJSON([
diff --git a/app/Models/Share.php b/app/Models/Share.php
index 8d2d70a6a..9c8f2084e 100644
--- a/app/Models/Share.php
+++ b/app/Models/Share.php
@@ -157,7 +157,7 @@ class FreshRSS_Share {
case 'method':
$this->method = strcasecmp($value, 'POST') === 0 ? 'POST' : 'GET';
break;
- case 'field';
+ case 'field':
$this->field = $value;
break;
}
diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php
index 3ee481776..6331e24f2 100644
--- a/app/Models/StatsDAO.php
+++ b/app/Models/StatsDAO.php
@@ -371,5 +371,4 @@ SQL;
return $translated;
}
-
}
diff --git a/app/Models/StatsDAOPGSQL.php b/app/Models/StatsDAOPGSQL.php
index 4fd00c29d..ba5cbfca1 100644
--- a/app/Models/StatsDAOPGSQL.php
+++ b/app/Models/StatsDAOPGSQL.php
@@ -68,7 +68,7 @@ SQL;
$periodMax = 12;
break;
default:
- $periodMax = 30;
+ $periodMax = 30;
}
$repartition = array_fill(0, $periodMax, 0);
@@ -78,5 +78,4 @@ SQL;
return $repartition;
}
-
}
diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php
index 8997f3abe..c45951069 100644
--- a/app/Models/StatsDAOSQLite.php
+++ b/app/Models/StatsDAOSQLite.php
@@ -43,7 +43,7 @@ SQL;
$periodMax = 12;
break;
default:
- $periodMax = 30;
+ $periodMax = 30;
}
$repartition = array_fill(0, $periodMax, 0);
@@ -53,5 +53,4 @@ SQL;
return $repartition;
}
-
}
diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.php
index 7e3f54457..1feba263e 100644
--- a/app/Models/TagDAO.php
+++ b/app/Models/TagDAO.php
@@ -381,7 +381,7 @@ SQL;
}
return $values;
}
- $sql .= ' AND et.id_entry IN (' . str_repeat('?,', count($entries) - 1). '?)';
+ $sql .= ' AND et.id_entry IN (' . str_repeat('?,', count($entries) - 1) . '?)';
if (is_array($entries[0])) {
/** @var array<array<string,string>> $entries */
foreach ($entries as $entry) {
diff --git a/app/Models/TagDAOPGSQL.php b/app/Models/TagDAOPGSQL.php
index 107ab6d08..35688c2d0 100644
--- a/app/Models/TagDAOPGSQL.php
+++ b/app/Models/TagDAOPGSQL.php
@@ -7,5 +7,4 @@ class FreshRSS_TagDAOPGSQL extends FreshRSS_TagDAO {
public function sqlIgnore(): string {
return ''; //TODO
}
-
}
diff --git a/app/Models/TagDAOSQLite.php b/app/Models/TagDAOSQLite.php
index 2ecda7735..69584edf0 100644
--- a/app/Models/TagDAOSQLite.php
+++ b/app/Models/TagDAOSQLite.php
@@ -7,5 +7,4 @@ class FreshRSS_TagDAOSQLite extends FreshRSS_TagDAO {
public function sqlIgnore(): string {
return 'OR IGNORE';
}
-
}
diff --git a/app/Models/Themes.php b/app/Models/Themes.php
index fab29e986..04ce0a36d 100644
--- a/app/Models/Themes.php
+++ b/app/Models/Themes.php
@@ -158,7 +158,7 @@ class FreshRSS_Themes extends Minz_Model {
if ($type == self::ICON_DEFAULT) {
if ((FreshRSS_Context::hasUserConf() && FreshRSS_Context::userConf()->icons_as_emojis)
// default to emoji alternate for some icons
- ) {
+ ) {
$type = self::ICON_EMOJI;
} else {
$type = self::ICON_IMG;
diff --git a/app/Models/View.php b/app/Models/View.php
index 293bc71ac..c586d8632 100644
--- a/app/Models/View.php
+++ b/app/Models/View.php
@@ -129,5 +129,4 @@ class FreshRSS_View extends Minz_View {
public string $errorMessage;
/** @var array<string,string> */
public array $message;
-
}
diff --git a/app/Models/ViewStats.php b/app/Models/ViewStats.php
index ca98c554a..608633f6b 100644
--- a/app/Models/ViewStats.php
+++ b/app/Models/ViewStats.php
@@ -44,5 +44,4 @@ final class FreshRSS_ViewStats extends FreshRSS_View {
public array $repartitionMonth;
/** @var array<array{'id':int,'name':string,'category':string,'count':int}> */
public array $topFeed;
-
}