summaryrefslogtreecommitdiff
path: root/classes/handler
diff options
context:
space:
mode:
authorwn_ <[email protected]>2021-03-17 13:48:27 +0000
committerwn_ <[email protected]>2021-03-17 13:48:27 +0000
commitb6ae2804463d89385613b6d463cab024a3b11b08 (patch)
tree72ea02449ddecca4e0d2a0799dbc2e63401bd4c5 /classes/handler
parentdb0315e596576a3e516a4ae774263dedefd92f73 (diff)
Switch 'Handler_Public->getProfiles' to ORM
Diffstat (limited to 'classes/handler')
-rwxr-xr-xclasses/handler/public.php18
1 files changed, 9 insertions, 9 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 6a67827db..75b6d5f06 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -266,19 +266,19 @@ class Handler_Public extends Handler {
$rv = [];
if ($login) {
- $sth = $this->pdo->prepare("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users
- WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND LOWER(login) = LOWER(?) ORDER BY title");
- $sth->execute([$login]);
+ $profiles = ORM::for_table('ttrss_settings_profiles')
+ ->table_alias('p')
+ ->join('ttrss_users', ['p.owner_uid', '=', 'u.id'], 'u')
+ ->where_raw('LOWER(u.login) = LOWER(?)', [$login])
+ ->order_by_asc('title')
+ ->find_many();
$rv = [ [ "value" => 0, "label" => __("Default profile") ] ];
- while ($line = $sth->fetch()) {
- $id = $line["id"];
- $title = $line["title"];
-
- array_push($rv, [ "label" => $title, "value" => $id ]);
+ foreach ($profiles as $profile) {
+ array_push($rv, [ "label" => $profile->title, "value" => $profile->id ]);
}
- }
+ }
print json_encode($rv);
}