]> git.mxchange.org Git - friendica.git/blobdiff - mod/delegate.php
More usage of dbm::is_result($r) instead of count($r):
[friendica.git] / mod / delegate.php
index d421de37643791dcbf613850a5152560b415ee4e..69af8234806bf4a6522d9cfd4009cbd601b53be0 100644 (file)
@@ -1,13 +1,11 @@
 <?php
 require_once('mod/settings.php');
 
-if(! function_exists('delegate_init')) {
 function delegate_init(&$a) {
        return settings_init($a);
 }
-}
 
-if(! function_exists('delegate_content')) {
+
 function delegate_content(&$a) {
 
        if(! local_user()) {
@@ -28,12 +26,12 @@ function delegate_content(&$a) {
                $r = q("select `nickname` from user where uid = %d limit 1",
                        intval($id)
                );
-               if(count($r)) {
+               if(dbm::is_result($r)) {
                        $r = q("select id from contact where uid = %d and nurl = '%s' limit 1",
                                intval(local_user()),
                                dbesc(normalise_link($a->get_baseurl() . '/profile/' . $r[0]['nickname']))
                        );
-                       if(count($r)) {
+                       if(dbm::is_result($r)) {
                                q("insert into manage ( uid, mid ) values ( %d , %d ) ",
                                        intval($a->argv[2]),
                                        intval(local_user())
@@ -66,7 +64,7 @@ function delegate_content(&$a) {
                dbesc($a->user['email']),
                dbesc($a->user['password'])
        );
-       if(count($r))
+       if(dbm::is_result($r))
                $full_managers = $r;
 
        $delegates = array();
@@ -77,7 +75,7 @@ function delegate_content(&$a) {
                intval(local_user())
        );
 
-       if(count($r))
+       if(dbm::is_result($r))
                $delegates = $r;
 
        $uids = array();
@@ -92,21 +90,21 @@ function delegate_content(&$a) {
 
        // find every contact who might be a candidate for delegation
 
-       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
+       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s' 
                and contact.uid = %d and contact.self = 0 and network = '%s' ",
                dbesc(normalise_link($a->get_baseurl())),
                intval(local_user()),
                dbesc(NETWORK_DFRN)
-       );
+       ); 
 
-       if(! count($r)) {
+       if(! dbm::is_result($r)) {
                notice( t('No potential page delegates located.') . EOL);
                return;
        }
 
        $nicknames = array();
 
-       if(count($r)) {
+       if(dbm::is_result($r)) {
                foreach($r as $rr) {
                        $nicknames[] = "'" . dbesc(basename($rr['nurl'])) . "'";
                }
@@ -120,7 +118,7 @@ function delegate_content(&$a) {
 
        $r = q("select `uid`, `username`, `nickname` from user where nickname in ( $nicks )");
 
-       if(count($r))
+       if(dbm::is_result($r))
                foreach($r as $rr)
                        if(! in_array($rr['uid'],$uids))
                                $potentials[] = $rr;
@@ -146,5 +144,5 @@ function delegate_content(&$a) {
 
        return $o;
 
-}
+
 }