aboutsummaryrefslogtreecommitdiffstats
path: root/include/group.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-12-06 19:18:38 -0800
committerfriendica <info@friendica.com>2012-12-06 19:18:38 -0800
commit8f864ebd193076d88c48c94da61088de930ab1bd (patch)
treeda704991195694e659946436062916e06d43d95f /include/group.php
parent435836b224adac299d7c6868279b014010e70d29 (diff)
downloadvolse-hubzilla-8f864ebd193076d88c48c94da61088de930ab1bd.tar.gz
volse-hubzilla-8f864ebd193076d88c48c94da61088de930ab1bd.tar.bz2
volse-hubzilla-8f864ebd193076d88c48c94da61088de930ab1bd.zip
Fixing the acl widget is going to be hard. Here's a start.
Diffstat (limited to 'include/group.php')
-rw-r--r--include/group.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/group.php b/include/group.php
index 1019daa9c..35ec72167 100644
--- a/include/group.php
+++ b/include/group.php
@@ -26,8 +26,20 @@ function group_add($uid,$name) {
}
return true;
}
- $r = q("INSERT INTO `group` ( `uid`, `name` )
- VALUES( %d, '%s' ) ",
+
+ do {
+ $dups = false;
+ $hash = random_string() . $name;
+
+ $r = q("SELECT id FROM group WHERE hash = '%s' LIMIT 1", dbesc($hash));
+ if(count($r))
+ $dups = true;
+ } while($dups == true);
+
+
+ $r = q("INSERT INTO `group` ( hash, uid, name )
+ VALUES( '%s', %d, '%s' ) ",
+ dbesc($hash),
intval($uid),
dbesc($name)
);