]> git.mxchange.org Git - friendica.git/blobdiff - mod/viewcontacts.php
Class file relocations
[friendica.git] / mod / viewcontacts.php
index c9f465676cfe6da34991f3290cae8a998b0a10be..8c35be77d89bdf85a6a802c0890ee116e159bcdb 100644 (file)
@@ -1,10 +1,15 @@
 <?php
+
+use Friendica\App;
+use Friendica\Core\Config;
+use Friendica\Database\DBM;
+
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 
-function viewcontacts_init(&$a) {
+function viewcontacts_init(App $a) {
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
        }
 
@@ -16,8 +21,9 @@ function viewcontacts_init(&$a) {
                        dbesc($nick)
                );
 
-               if(! dbm::is_result($r))
+               if (! DBM::is_result($r)) {
                        return;
+               }
 
                $a->data['user'] = $r[0];
                $a->profile_uid = $r[0]['uid'];
@@ -28,10 +34,10 @@ function viewcontacts_init(&$a) {
 }
 
 
-function viewcontacts_content(&$a) {
+function viewcontacts_content(App $a) {
        require_once("mod/proxy.php");
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+       if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
                return;
        }
@@ -47,18 +53,20 @@ function viewcontacts_content(&$a) {
        }
 
        $r = q("SELECT COUNT(*) AS `total` FROM `contact`
-               WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive`
+               WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
+                       AND NOT `hidden` AND NOT `archive`
                        AND `network` IN ('%s', '%s', '%s')",
                intval($a->profile['uid']),
                dbesc(NETWORK_DFRN),
                dbesc(NETWORK_DIASPORA),
                dbesc(NETWORK_OSTATUS)
        );
-       if (dbm::is_result($r))
+       if (DBM::is_result($r))
                $a->set_pager_total($r[0]['total']);
 
        $r = q("SELECT * FROM `contact`
-               WHERE `uid` = %d AND (NOT `blocked` OR `pending`) AND NOT `hidden` AND NOT `archive`
+               WHERE `uid` = %d AND NOT `blocked` AND NOT `pending`
+                       AND NOT `hidden` AND NOT `archive`
                        AND `network` IN ('%s', '%s', '%s')
                ORDER BY `name` ASC LIMIT %d, %d",
                intval($a->profile['uid']),
@@ -68,16 +76,18 @@ function viewcontacts_content(&$a) {
                intval($a->pager['start']),
                intval($a->pager['itemspage'])
        );
-       if (!dbm::is_result($r)) {
+       if (!DBM::is_result($r)) {
                info(t('No contacts.').EOL);
                return $o;
        }
 
        $contacts = array();
 
-       foreach($r as $rr) {
-               if($rr['self'])
+       foreach ($r as $rr) {
+               /// @TODO This triggers an E_NOTICE if 'self' is not there
+               if ($rr['self']) {
                        continue;
+               }
 
                $url = $rr['url'];