diff options
author | Malf Furious <m@lfurio.us> | 2016-10-22 00:13:12 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-10-22 00:13:12 -0400 |
commit | 9d0ff6546fb03489bbd127aeec6ee161e204a139 (patch) | |
tree | 3e4624c95293c3000e0dbac095af4a461ae35176 /app/class/user.class.php | |
parent | 827a8025ab48dea386b77717f1d1bc30d10ba232 (diff) | |
parent | 35da301d31045b0974100307a7f0f4128b482170 (diff) | |
download | scrott-9d0ff6546fb03489bbd127aeec6ee161e204a139.tar.gz scrott-9d0ff6546fb03489bbd127aeec6ee161e204a139.zip |
Merge branch 'feature/core/groups' into dev
Diffstat (limited to 'app/class/user.class.php')
-rw-r--r-- | app/class/user.class.php | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/app/class/user.class.php b/app/class/user.class.php index 1185f45..b8143a9 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -15,6 +15,7 @@ */ require_once "class/object.class.php"; +require_once "class/group.class.php"; /* * Application users @@ -213,22 +214,27 @@ class User extends Object } /* - * Get this user's head image + * Get all groups this user owns or is a member of */ - function getHeadImage() + function getGroups() { - return $this->ar() . "/file.php?d=img/heads&f=" . $this->guid; - } + /* owner */ + $query = "SELECT guid FROM object WHERE type = 'group' AND owner = '" . $this->db->esc($this->guid) . "'"; + $result = $this->db->query($query); - /* - * Remove this user's head image - */ - function rmHeadImage() - { - if (!is_file("assets/img/heads/" . $this->guid)) - return true; + $groups = array(); + + foreach ($result as $g) + $groups[] = new Group($g['guid']); + + /* member */ + $query = "SELECT o.guid FROM object o JOIN obj_member om ON o.guid = om.guid WHERE o.type = 'group' AND member = '" . $this->db->esc($this->guid) . "'"; + $result = $this->db->query($query); + + foreach ($result as $g) + $groups[] = new Group($g['guid']); - return unlink("assets/img/heads/" . $this->guid); + return $groups; } } |