diff options
author | Malf Furious <m@lfurio.us> | 2015-12-18 02:26:00 -0500 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2015-12-18 02:26:00 -0500 |
commit | 25947336340ac5bb7f1f9fc762d6e449320069da (patch) | |
tree | 77e36be067545988f58cca1d19647ca571837ac8 | |
parent | 30c2345e1567832cbaeefcf4db1e559a8a198046 (diff) | |
download | scrott-25947336340ac5bb7f1f9fc762d6e449320069da.tar.gz scrott-25947336340ac5bb7f1f9fc762d6e449320069da.zip |
+ Added function "isGUID" to object class for checking whether GUIDs exist
-rw-r--r-- | app/class/object.class.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/class/object.class.php b/app/class/object.class.php index 3622d6a..fe487bc 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -44,6 +44,9 @@ abstract class Object extends Framework if (is_null($guid)) return; + if (!$this->isGUID($guid)) + return; + $escdGuid = $this->db->esc($guid); /* Base fields */ @@ -175,6 +178,20 @@ abstract class Object extends Framework $query = "DELETE FROM `" . $this->childTable . "` WHERE `guid` = '" . $this->db->esc($this->guid) . "'"; $this->db->query($query); } + + /* + * Check whether given GUID exists + */ + function isGUID($guid) + { + $query = "SELECT `guid` FROM `object` WHERE `guid` = '" . $this->db->esc($guid) . "'"; + $result = $this->db->query($query); + + if (count($result) > 0) + return true; + + return false; + } } ?> |