From 9f449e496b33a21ef9163faf7d5f019ac62d6113 Mon Sep 17 00:00:00 2001 From: marcus Date: Fri, 11 Jul 2008 14:46:24 +0000 Subject: Better errors for attempt to access a GUID you can't git-svn-id: https://code.elgg.org/elgg/trunk@1403 36083f99-b078-4883-b0ff-0f9b5a30f544 --- services/export/handler.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'services/export/handler.php') diff --git a/services/export/handler.php b/services/export/handler.php index f37921bef..2318e4ea8 100644 --- a/services/export/handler.php +++ b/services/export/handler.php @@ -30,7 +30,12 @@ ($id_or_name=="") ) { - page_draw("GUID:$guid", elgg_view("export/entity", array("entity" => get_entity($guid), "uuid" => guid_to_uuid($guid)))); + $entity = get_entity($guid); + + if (!$entity) + throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:GUIDNotFound'), $guid)); + + page_draw("GUID:$guid", elgg_view("export/entity", array("entity" => $entity, "uuid" => guid_to_uuid($guid)))); } // Export an individual attribute @@ -42,6 +47,9 @@ { // Get a uuid $entity = get_entity($guid); + if (!$entity) + throw new InvalidParameterException(sprintf(elgg_echo('InvalidParameterException:GUIDNotFound'), $guid)); + $uuid = guid_to_uuid($entity->getGUID()) . "$type/$id_or_name/"; switch ($type) -- cgit v1.2.3