From f56a4eab1711206fd020e5a7a78b2fd1aeae5315 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 2 Mar 2021 08:08:48 +0300 Subject: use orm for app password stuff --- classes/pref/labels.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'classes/pref/labels.php') diff --git a/classes/pref/labels.php b/classes/pref/labels.php index 5bc094d55..2cdb919ce 100644 --- a/classes/pref/labels.php +++ b/classes/pref/labels.php @@ -8,14 +8,12 @@ class Pref_Labels extends Handler_Protected { } function edit() { - $label_id = clean($_REQUEST['id']); + $label = ORM::for_table('ttrss_labels2') + ->where('owner_uid', $_SESSION['uid']) + ->find_one($_REQUEST['id']); - $sth = $this->pdo->prepare("SELECT id, caption, fg_color, bg_color FROM ttrss_labels2 WHERE - id = ? AND owner_uid = ?"); - $sth->execute([$label_id, $_SESSION['uid']]); - - if ($line = $sth->fetch(PDO::FETCH_ASSOC)) { - print json_encode($line); + if ($label) { + print json_encode($label->as_array()); } } -- cgit v1.2.3-54-g00ecf