]> git.mxchange.org Git - friendica.git/blobdiff - include/group.php
Merge pull request #3879 from zeroadam/Remove-Includes-#3873
[friendica.git] / include / group.php
index fa0e8f59a69af6854e2d1822d08c6038a52bb458..ce8bc217cd7a9e9419544fe1fee40de08f112386 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use Friendica\Core\PConfig;
 
 function group_add($uid,$name) {
 
@@ -22,15 +23,11 @@ function group_add($uid,$name) {
                                        intval($uid),
                                        dbesc($name)
                                );
-                               notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL); 
+                               notice( t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
                        }
                        return true;
                }
-               $r = q("INSERT INTO `group` ( `uid`, `name` )
-                       VALUES( %d, '%s' ) ",
-                       intval($uid),
-                       dbesc($name)
-               );
+               $r = dba::insert('group', array('uid' => $uid, 'name' => $name));
                $ret = $r;
        }
        return $ret;
@@ -144,12 +141,7 @@ function group_add_member($uid,$name,$member,$gid = 0) {
                                // we indicate success because the group member was in fact created
                                // -- It was just created at another time
        if (! dbm::is_result($r)) {
-               $r = q("INSERT INTO `group_member` (`uid`, `gid`, `contact-id`)
-                       VALUES( %d, %d, %d ) ",
-                       intval($uid),
-                       intval($gid),
-                       intval($member)
-               );
+               $r = dba::insert('group_member', array('uid' => $uid, 'gid' => $gid, 'contact-id' => $member));
        }
        return $r;
 }
@@ -320,7 +312,7 @@ function expand_groups($a,$check_dead = false, $use_gcontact = false) {
        if (dbm::is_result($r))
                foreach ($r as $rr)
                        $ret[] = $rr['contact-id'];
-       if ($check_dead AND !$use_gcontact) {
+       if ($check_dead && !$use_gcontact) {
                require_once('include/acl_selectors.php');
                $ret = prune_deadguys($ret);
        }
@@ -394,7 +386,7 @@ function get_default_group($uid, $network = "") {
        $default_group = 0;
 
        if ($network == NETWORK_OSTATUS)
-               $default_group = get_pconfig($uid, "ostatus", "default_group");
+               $default_group = PConfig::get($uid, "ostatus", "default_group");
 
        if ($default_group != 0)
                return $default_group;