]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Profile.php
Some more notices (#5526)
[friendica.git] / src / Model / Profile.php
index 11f44afe28a9fe7777f33bfc6a09b5b7e471d3ff..5180a3ea2e002fcc9f4b8daf5b5cdffcdfd73140 100644 (file)
@@ -16,6 +16,7 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\Model\Contact;
 use Friendica\Protocol\Diaspora;
 use Friendica\Util\DateTimeFormat;
 use Friendica\Util\Network;
@@ -90,7 +91,7 @@ class Profile
        {
                $user = DBA::selectFirst('user', ['uid'], ['nickname' => $nickname, 'account_removed' => false]);
 
-               if (!DBA::is_result($user) && empty($profiledata)) {
+               if (!DBA::isResult($user) && empty($profiledata)) {
                        logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
                        notice(L10n::t('Requested account is not available.') . EOL);
                        $a->error = 404;
@@ -101,7 +102,7 @@ class Profile
                        // Add profile data to sidebar
                        $a->page['aside'] .= self::sidebar($profiledata, true, $show_connect);
 
-                       if (!DBA::is_result($user)) {
+                       if (!DBA::isResult($user)) {
                                return;
                        }
                }
@@ -115,6 +116,10 @@ class Profile
                        return;
                }
 
+               if (empty($pdata)) {
+                       $pdata = ['uid' => 0, 'profile_uid' => 0, 'is-default' => false,'name' => $nickname];
+               }
+
                // fetch user tags if this isn't the default profile
 
                if (!$pdata['is-default']) {
@@ -198,7 +203,7 @@ class Profile
                        foreach ($_SESSION['remote'] as $visitor) {
                                if ($visitor['uid'] == $uid) {
                                        $contact = DBA::selectFirst('contact', ['profile-id'], ['id' => $visitor['cid']]);
-                                       if (DBA::is_result($contact)) {
+                                       if (DBA::isResult($contact)) {
                                                $profile_id = $contact['profile-id'];
                                        }
                                        break;
@@ -222,7 +227,7 @@ class Profile
                                intval($profile_id)
                        );
                }
-               if (!DBA::is_result($profile)) {
+               if (!DBA::isResult($profile)) {
                        $profile = DBA::fetchFirst(
                                "SELECT `contact`.`id` AS `contact_id`, `contact`.`photo` as `contact_photo`,
                                        `contact`.`thumb` AS `contact_thumb`, `contact`.`micro` AS `contact_micro`,
@@ -340,14 +345,14 @@ class Profile
                                        "SELECT `url` FROM `contact` WHERE `uid` = %d AND `id` = '%s' AND `rel` = %d",
                                        intval($profile['uid']),
                                        intval(remote_user()),
-                                       intval(CONTACT_IS_FRIEND)
+                                       intval(Contact::FRIEND)
                                );
                        } else {
                                $r = q(
                                        "SELECT `url` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND `rel` = %d",
                                        intval($profile['uid']),
-                                       dbesc(normalise_link(self::getMyURL())),
-                                       intval(CONTACT_IS_FRIEND)
+                                       DBA::escape(normalise_link(self::getMyURL())),
+                                       intval(Contact::FRIEND)
                                );
                        }
                        if ($r) {
@@ -374,7 +379,7 @@ class Profile
                                'entries' => [],
                        ];
 
-                       if (DBA::is_result($r)) {
+                       if (DBA::isResult($r)) {
                                foreach ($r as $rr) {
                                        $profile['menu']['entries'][] = [
                                                'photo' => $rr['thumb'],
@@ -452,7 +457,7 @@ class Profile
                                        "SELECT `gcontact`.`updated` FROM `contact` INNER JOIN `gcontact` WHERE `gcontact`.`nurl` = `contact`.`nurl` AND `self` AND `uid` = %d LIMIT 1",
                                        intval($a->profile['uid'])
                                );
-                               if (DBA::is_result($r)) {
+                               if (DBA::isResult($r)) {
                                        $updated = date('c', strtotime($r[0]['updated']));
                                }
 
@@ -463,11 +468,11 @@ class Profile
                                                AND NOT `hidden` AND NOT `archive`
                                                AND `network` IN ('%s', '%s', '%s', '')",
                                        intval($profile['uid']),
-                                       dbesc(NETWORK_DFRN),
-                                       dbesc(NETWORK_DIASPORA),
-                                       dbesc(NETWORK_OSTATUS)
+                                       DBA::escape(NETWORK_DFRN),
+                                       DBA::escape(NETWORK_DIASPORA),
+                                       DBA::escape(NETWORK_OSTATUS)
                                );
-                               if (DBA::is_result($r)) {
+                               if (DBA::isResult($r)) {
                                        $contacts = intval($r[0]['total']);
                                }
                        }
@@ -555,7 +560,7 @@ class Profile
                                DateTimeFormat::utc('now + 6 days'),
                                DateTimeFormat::utcNow()
                        );
-                       if (DBA::is_result($s)) {
+                       if (DBA::isResult($s)) {
                                $r = DBA::toArray($s);
                                Cache::set($cachekey, $r, CACHE_HOUR);
                        }
@@ -563,7 +568,7 @@ class Profile
 
                $total = 0;
                $classtoday = '';
-               if (DBA::is_result($r)) {
+               if (DBA::isResult($r)) {
                        $now = strtotime('now');
                        $cids = [];
 
@@ -657,7 +662,7 @@ class Profile
 
                $r = [];
 
-               if (DBA::is_result($s)) {
+               if (DBA::isResult($s)) {
                        $istoday = false;
 
                        while ($rr = DBA::fetch($s)) {
@@ -1026,7 +1031,7 @@ class Profile
 
                                $contact = DBA::selectFirst('contact',['id', 'url'], ['id' => $cid]);
 
-                               if (DBA::is_result($contact) && remote_user() && remote_user() == $contact['id']) {
+                               if (DBA::isResult($contact) && remote_user() && remote_user() == $contact['id']) {
                                        // The visitor is already authenticated.
                                        return;
                                }