From 4766f36a4d74924f21ff329c4318ce4e069ffa04 Mon Sep 17 00:00:00 2001 From: brettp Date: Wed, 3 Mar 2010 17:53:05 +0000 Subject: Pulled in the interface changes. git-svn-id: http://code.elgg.org/elgg/trunk@5257 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/reportedcontent/actions/add.php | 49 +++++++++++++++++++++++++++++++++ mod/reportedcontent/actions/archive.php | 38 +++++++++++++++++++++++++ mod/reportedcontent/actions/delete.php | 41 +++++++++++++++++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 mod/reportedcontent/actions/add.php create mode 100644 mod/reportedcontent/actions/archive.php create mode 100644 mod/reportedcontent/actions/delete.php (limited to 'mod/reportedcontent/actions') diff --git a/mod/reportedcontent/actions/add.php b/mod/reportedcontent/actions/add.php new file mode 100644 index 000000000..76cefa4c8 --- /dev/null +++ b/mod/reportedcontent/actions/add.php @@ -0,0 +1,49 @@ + + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + $title = get_input('title'); + $description = get_input('description'); + $address = get_input('address'); + $access = ACCESS_PRIVATE; //this is private and only admins can see it + + if ($title && $address) { + + $entity = new ElggObject; + $entity->subtype = "reported_content"; + $entity->owner_guid = $_SESSION['user']->getGUID(); + $entity->title = $title; + $entity->address = $address; + $entity->description = $description; + $entity->access_id = $access; + + if ($entity->save()) { + if (!trigger_plugin_hook('reportedcontent:add', $reported->type, array('entity'=>$reported), true)) { + $entity->delete(); + register_error(elgg_echo('reportedcontent:failed')); + } else { + system_message(elgg_echo('reportedcontent:success')); + $entity->state = "active"; + } + forward($address); + } else { + register_error(elgg_echo('reportedcontent:failed')); + forward($address); + } + + } else { + + register_error(elgg_echo('reportedcontent:failed')); + forward($address); + + } + +?> \ No newline at end of file diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php new file mode 100644 index 000000000..a550abc2a --- /dev/null +++ b/mod/reportedcontent/actions/archive.php @@ -0,0 +1,38 @@ + + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + // Make sure we're logged in and are admin + admin_gatekeeper(); + + // Get input data + $guid = (int) get_input('item'); + + // Make sure we actually have permission to edit + $reported = get_entity($guid); + if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) { + + // change the state + if (!trigger_plugin_hook('reportedcontent:archive', $reported->type, array('entity'=>$reported), true)) { + system_message(elgg_echo("reportedcontent:notarchived")); + forward("pg/reportedcontent/"); + } + $reported->state = "archived"; + + // Success message + system_message(elgg_echo("reportedcontent:archived")); + + // Forward back to the reported content page + forward("pg/reportedcontent/"); + + } + +?> \ No newline at end of file diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php new file mode 100644 index 000000000..cff42b025 --- /dev/null +++ b/mod/reportedcontent/actions/delete.php @@ -0,0 +1,41 @@ + + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + + // Make sure we're logged in and are admin + admin_gatekeeper(); + + // Get input data + $guid = (int) get_input('item'); + + // Make sure we actually have permission to edit + $reported = get_entity($guid); + if ($reported->getSubtype() == "reported_content" && $reported->canEdit()) { + + // Delete it! + if (!trigger_plugin_hook('reportedcontent:delete', $reported->type, array('entity'=>$reported), true)) { + register_error(elgg_echo("reportedcontent:notdeleted")); + forward("pg/reportedcontent/"); + } + $rowsaffected = $reported->delete(); + if ($rowsaffected > 0) { + // Success message + system_message(elgg_echo("reportedcontent:deleted")); + } else { + register_error(elgg_echo("reportedcontent:notdeleted")); + } + + // Forward back to the reported content page + forward("pg/reportedcontent/"); + + } + +?> \ No newline at end of file -- cgit v1.2.3