aboutsummaryrefslogtreecommitdiffstats
path: root/include/group.php
diff options
context:
space:
mode:
authorThomas Willingham <founder@kakste.com>2012-12-07 22:27:35 +0000
committerThomas Willingham <founder@kakste.com>2012-12-07 22:27:35 +0000
commit44263d5ac3e5189df28c92f58c2875137052b6ea (patch)
tree70aa75426f2b3c984faecdb5f684157bccedda3a /include/group.php
parent555226ada4946b78be5fa2966f5c8532a997953f (diff)
parent2452b822f909a3cac432a76d8c928733a7683c6a (diff)
downloadvolse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.tar.gz
volse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.tar.bz2
volse-hubzilla-44263d5ac3e5189df28c92f58c2875137052b6ea.zip
Merge remote-tracking branch 'upstream/master'
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)
);