From 25947336340ac5bb7f1f9fc762d6e449320069da Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 18 Dec 2015 02:26:00 -0500 Subject: + Added function "isGUID" to object class for checking whether GUIDs exist --- app/class/object.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app') 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; + } } ?> -- cgit v1.2.3