]> git.mxchange.org Git - friendica.git/blobdiff - mod/cal.php
Merge pull request #4208 from annando/thr-parent
[friendica.git] / mod / cal.php
index 4a6e2c992881155059272a09d9b9bd8eea2b29b1..51a66613ee107221552cfd0ebae6964f1ac386f7 100644 (file)
@@ -6,10 +6,10 @@
  *     This calendar is for profile visitors and contains only the events
  *     of the profile owner
  */
+
 use Friendica\App;
 use Friendica\Content\Feature;
 use Friendica\Core\Config;
-use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Database\DBM;
 use Friendica\Model\Contact;
@@ -32,16 +32,13 @@ function cal_init(App $a)
 
        if ($a->argc > 1) {
                $nick = $a->argv[1];
-               $user = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `blocked` = 0 LIMIT 1",
-                       dbesc($nick)
-               );
-
-               if (!count($user)) {
+               $user = dba::selectFirst('user', [], ['nickname' => $nick, 'blocked' => false]);
+               if (!DBM::is_result($user)) {
                        return;
                }
 
-               $a->data['user'] = $user[0];
-               $a->profile_uid = $user[0]['uid'];
+               $a->data['user'] = $user;
+               $a->profile_uid = $user['uid'];
 
                // if it's a json request abort here becaus we don't
                // need the widget data