summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/class/object.class.php17
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;
+ }
}
?>