From: Hypolite Petovan Date: Mon, 27 Nov 2017 13:17:56 +0000 (-0500) Subject: Improved dba calls X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ced1063a10909fd10c8dcfb0331e86fb0fa208d5;p=friendica.git Improved dba calls - Removed intval calls - Used boolean values for params when relevant --- diff --git a/include/auth.php b/include/auth.php index 5da71ef6e1..a02c18d1db 100644 --- a/include/auth.php +++ b/include/auth.php @@ -17,11 +17,11 @@ if (isset($_COOKIE["Friendica"])) { $user = dba::select('user', [], [ - 'uid' => intval($data->uid), - 'blocked' => 0, - 'account_expired' => 0, - 'account_removed' => 0, - 'verified' => 1, + 'uid' => $data->uid, + 'blocked' => false, + 'account_expired' => false, + 'account_removed' => false, + 'verified' => true, ], ['limit' => 1] ); @@ -86,11 +86,11 @@ if (isset($_SESSION) && x($_SESSION, 'authenticated') && (!x($_POST, 'auth-param $user = dba::select('user', [], [ - 'uid' => intval($_SESSION['uid']), - 'blocked' => 0, - 'account_expired' => 0, - 'account_removed' => 0, - 'verified' => 1, + 'uid' => $_SESSION['uid'], + 'blocked' => false, + 'account_expired' => false, + 'account_removed' => false, + 'verified' => true, ], ['limit' => 1] ); diff --git a/src/Model/User.php b/src/Model/User.php index 3fa3948621..b2beb8e19b 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -87,7 +87,7 @@ class User dba::insert('userd', ['username' => $user['nickname']]); // The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php) - dba::update('user', ['account_removed' => 1, 'account_expires_on' => datetime_convert()], ['uid' => intval($uid)]); + dba::update('user', ['account_removed' => true, 'account_expires_on' => datetime_convert()], ['uid' => $uid]); Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid); // Send an update to the directory diff --git a/src/Worker/Queue.php b/src/Worker/Queue.php index f2da800077..35642ae729 100644 --- a/src/Worker/Queue.php +++ b/src/Worker/Queue.php @@ -80,7 +80,7 @@ class Queue $q_item = $r[0]; - $contact = dba::select('contact', [], ['id' => intval($q_item['cid'])], ['limit' => 1]); + $contact = dba::select('contact', [], ['id' => $q_item['cid']], ['limit' => 1]); if (!DBM::is_result($contact)) { remove_queue_item($q_item['id']); return; @@ -113,7 +113,7 @@ class Queue } } - $user = dba::select('user', [], ['uid' => intval($contact['uid'])], ['limit' => 1]); + $user = dba::select('user', [], ['uid' => $contact['uid']], ['limit' => 1]); if (!DBM::is_result($user)) { remove_queue_item($q_item['id']); return;