]> git.mxchange.org Git - friendica.git/commitdiff
Improved dba calls
authorHypolite Petovan <mrpetovan@gmail.com>
Mon, 27 Nov 2017 13:17:56 +0000 (08:17 -0500)
committerHypolite Petovan <mrpetovan@gmail.com>
Mon, 27 Nov 2017 13:17:56 +0000 (08:17 -0500)
- Removed intval calls
- Used boolean values for params when relevant

include/auth.php
src/Model/User.php
src/Worker/Queue.php

index 5da71ef6e1a10823a222bb51ded54e8a74794053..a02c18d1dbf0f64aa045e418e9155cd91af3773d 100644 (file)
@@ -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]
                );
index 3fa3948621ba10706a61dafbf91c139a414d4c63..b2beb8e19b7a6fe49efcf290ab1395fa121cbe43 100644 (file)
@@ -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
index f2da8000773f1237e8310cc2aca74c9079625646..35642ae729c7efabbbc6e9dce7d90d766cfbca0f 100644 (file)
@@ -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;