diff options
author | Malf Furious <m@lfurio.us> | 2016-06-08 23:23:04 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2016-06-08 23:23:04 -0400 |
commit | d70f5ac0ddc976fff9a526996dca8ea6e69d9a16 (patch) | |
tree | a2758c69f048c139e9140e7e50e05e4a9a7f0b1f /app/class/object.class.php | |
parent | d8f7264898d59a261c0e65e525502143259415ad (diff) | |
download | scrott-d70f5ac0ddc976fff9a526996dca8ea6e69d9a16.tar.gz scrott-d70f5ac0ddc976fff9a526996dca8ea6e69d9a16.zip |
Add function Object::getMembers()
Added object function to get an array of all its members. These will
always be user objects, so this is always a safe function to call.
Diffstat (limited to 'app/class/object.class.php')
-rw-r--r-- | app/class/object.class.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/class/object.class.php b/app/class/object.class.php index 42c9355..a64bdfb 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -252,6 +252,22 @@ abstract class Object extends Framework { return hash("sha256", openssl_random_pseudo_bytes(64)); } + + /* + * Get an array of all members of this object + */ + function getMembers() + { + $query = "SELECT member FROM obj_member WHERE guid = '" . $this->db->esc($this->guid) . "'"; + $result = $this->db->query($query); + + $members = array(); + + foreach ($result as $m) + $members[] = new User($m['member']); + + return $members; + } } /* |