From 855b008013aad0426ab0332b040bddb033bb6af9 Mon Sep 17 00:00:00 2001 From: cash Date: Mon, 29 Nov 2010 00:56:55 +0000 Subject: cleaned up the reported content plugin git-svn-id: http://code.elgg.org/elgg/trunk@7466 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/actions/add.php | 74 +++++++++++++++------------------ mod/reportedcontent/actions/archive.php | 2 +- mod/reportedcontent/actions/delete.php | 2 +- 3 files changed, 36 insertions(+), 42 deletions(-) (limited to 'mod/reportedcontent/actions') diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php index 138e66cb9..7c60cdf22 100644 --- a/mod/reportedcontent/actions/add.php +++ b/mod/reportedcontent/actions/add.php @@ -1,45 +1,39 @@ subtype = "reported_content"; - $report->owner_guid = get_loggedin_userid(); - $report->title = $title; - $report->address = $address; - $report->description = $description; - $report->access_id = $access; - - if ($report->save()) { - if (!elgg_trigger_plugin_hook('reportedcontent:add', 'system', array('report'=>$report), true)) { - $report->delete(); - register_error(elgg_echo('reportedcontent:failed')); - } else { - system_message(elgg_echo('reportedcontent:success')); - $report->state = "active"; - } - forward($address); - } else { - register_error(elgg_echo('reportedcontent:failed')); - forward($address); - } - + $report = new ElggObject; + $report->subtype = "reported_content"; + $report->owner_guid = get_loggedin_userid(); + $report->title = $title; + $report->address = $address; + $report->description = $description; + $report->access_id = $access; + + if ($report->save()) { + if (!elgg_trigger_plugin_hook('reportedcontent:add', 'system', array('report' => $report), true)) { + $report->delete(); + register_error(elgg_echo('reportedcontent:failed')); } else { - - register_error(elgg_echo('reportedcontent:failed')); - forward($address); - - } + system_message(elgg_echo('reportedcontent:success')); + $report->state = "active"; + } + forward($address); + } else { + register_error(elgg_echo('reportedcontent:failed')); + forward($address); + } +} else { -?> \ No newline at end of file + register_error(elgg_echo('reportedcontent:failed')); + forward($address); +} diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php index c0169fa28..c41645ee2 100644 --- a/mod/reportedcontent/actions/archive.php +++ b/mod/reportedcontent/actions/archive.php @@ -6,7 +6,7 @@ */ // Get input data -$guid = (int) get_input('item'); +$guid = (int) get_input('guid'); // Make sure we actually have permission to edit $report = get_entity($guid); diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php index b7d6fdaa5..faf169223 100644 --- a/mod/reportedcontent/actions/delete.php +++ b/mod/reportedcontent/actions/delete.php @@ -6,7 +6,7 @@ */ // Get input data -$guid = (int) get_input('item'); +$guid = (int) get_input('guid'); // Make sure we actually have permission to edit $report = get_entity($guid); -- cgit v1.2.3