diff options
-rw-r--r-- | languages/en.php | 2 | ||||
-rw-r--r-- | services/export/handler.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/languages/en.php b/languages/en.php index 4c4075db3..20adc61d3 100644 --- a/languages/en.php +++ b/languages/en.php @@ -94,7 +94,7 @@ 'InvalidParameterException:NoEntityFound' => "No entity found, it either doesn't exist or you don't have access to it.",
-
+ 'InvalidParameterException:GUIDNotFound' => "GUID:%s could not be found, or you can not access it.",
'InvalidParameterException:IdNotExistForGUID' => "Sorry, '%s' does not exist for guid:%d",
'InvalidParameterException:CanNotExportType' => "Sorry, I don't know how to export '%s'",
'InvalidParameterException:NoDataFound' => "Could not find any data.",
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) |