summaryrefslogtreecommitdiff
path: root/classes/handler
diff options
context:
space:
mode:
authorwn_ <[email protected]>2021-03-17 15:49:07 +0000
committerwn_ <[email protected]>2021-03-17 15:52:43 +0000
commitf057c124d1dd4f4bf55f5641731b264363ceb2b9 (patch)
tree3e5c5e35f6dc50e3aed8be1d6ba1852f683ddfa9 /classes/handler
parent7ea48f7a4bc83d3ff9e7c5557a2341aac52ff2f1 (diff)
Switch 'Handler_Public->login' to ORM, fix 'Handler_Public->getProfiles'
Diffstat (limited to 'classes/handler')
-rwxr-xr-xclasses/handler/public.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php
index c2c345219..6c3c91e78 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -268,6 +268,7 @@ class Handler_Public extends Handler {
if ($login) {
$profiles = ORM::for_table('ttrss_settings_profiles')
->table_alias('p')
+ ->select_many('title' , ['profile_id' => 'p.id'])
->join('ttrss_users', ['p.owner_uid', '=', 'u.id'], 'u')
->where_raw('LOWER(u.login) = LOWER(?)', [$login])
->order_by_asc('title')
@@ -276,7 +277,7 @@ class Handler_Public extends Handler {
$rv = [ [ "value" => 0, "label" => __("Default profile") ] ];
foreach ($profiles as $profile) {
- array_push($rv, [ "label" => $profile->title, "value" => $profile->id ]);
+ array_push($rv, [ "label" => $profile->title, "value" => $profile->profile_id ]);
}
}
@@ -370,18 +371,13 @@ class Handler_Public extends Handler {
$_SESSION["safe_mode"] = $safe_mode;
if (!empty($_POST["profile"])) {
-
$profile = (int) clean($_POST["profile"]);
- $sth = $this->pdo->prepare("SELECT id FROM ttrss_settings_profiles
- WHERE id = ? AND owner_uid = ?");
- $sth->execute([$profile, $_SESSION['uid']]);
+ $profile_obj = ORM::for_table('ttrss_settings_profiles')
+ ->where(['id' => $profile, 'owner_uid' => $_SESSION['uid']])
+ ->find_one();
- if ($sth->fetch()) {
- $_SESSION["profile"] = $profile;
- } else {
- $_SESSION["profile"] = null;
- }
+ $_SESSION["profile"] = $profile_obj ? $profile : null;
}
} else {