aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-11 14:46:24 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-07-11 14:46:24 +0000
commit9f449e496b33a21ef9163faf7d5f019ac62d6113 (patch)
tree50ca3d6f955c67d25e4f6418d7cf83e18892cf3f
parentfc6fcf1a089c08af1b5c19658abdc5c954bc554d (diff)
downloadelgg-9f449e496b33a21ef9163faf7d5f019ac62d6113.tar.gz
elgg-9f449e496b33a21ef9163faf7d5f019ac62d6113.tar.bz2
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
-rw-r--r--languages/en.php2
-rw-r--r--services/export/handler.php10
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)