aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAO.php
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/EntryDAO.php
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/EntryDAO.php')
-rw-r--r--app/Models/EntryDAO.php82
1 files changed, 41 insertions, 41 deletions
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();