]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #2508 Sending user to referrer in reported content admin actions
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 29 Nov 2010 12:56:38 +0000 (12:56 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Mon, 29 Nov 2010 12:56:38 +0000 (12:56 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7471 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/reportedcontent/actions/archive.php
mod/reportedcontent/actions/delete.php

index c41645ee2d9ee0778444d31dd3f4157bf3b33930..dd5c6aef1b063780c3b5f9480f069fcd3528886d 100644 (file)
@@ -5,22 +5,23 @@
  * @package ElggReportedContent
  */
 
-// Get input data
 $guid = (int) get_input('guid');
 
-// Make sure we actually have permission to edit
 $report = get_entity($guid);
+
+// Make sure we actually have permission to edit
 if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-       // change the state
-       if (!elgg_trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), TRUE)) {
+
+       // allow another plugin to override
+       if (!elgg_trigger_plugin_hook('reportedcontent:archive', 'system', array('report' => $report), TRUE)) {
                system_message(elgg_echo("reportedcontent:notarchived"));
-               forward('pg/admin/reportedcontent');
+               forward(REFERER);
        }
+
+       // change the state
        $report->state = "archived";
 
-       // Success message
        system_message(elgg_echo("reportedcontent:archived"));
 
-       // Forward back to the reported content page
-       forward('pg/admin/reportedcontent');
+       forward(REFERER);
 }
index faf169223daf9f53e42fd97cc9900a327babdff6..f7d4e210767371702b8a7df81d5ee1deae10c185 100644 (file)
@@ -2,29 +2,27 @@
 /**
  * Elgg reported content: delete action
  * 
- * @package ElggReportedCOntent
+ * @package ElggReportedContent
  */
 
-// Get input data
 $guid = (int) get_input('guid');
 
-// Make sure we actually have permission to edit
 $report = get_entity($guid);
+
+// Make sure we actually have permission to delete
 if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-       // Delete it!
-       if (!elgg_trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {
+
+       // give another plugin a chance to override
+       if (!elgg_trigger_plugin_hook('reportedcontent:delete', 'system', array('report' => $report), TRUE)) {
                register_error(elgg_echo("reportedcontent:notdeleted"));
-               forward('pg/admin/reportedcontent');
+               forward(REFERER);
        }
 
-       $rowsaffected = $report->delete();
-       if ($rowsaffected > 0) {
-               // Success message
+       if ($report->delete()) {
                system_message(elgg_echo("reportedcontent:deleted"));
        } else {
                register_error(elgg_echo("reportedcontent:notdeleted"));
        }
        
-       // Forward back to the reported content page
-       forward('pg/admin/reportedcontent');
+       forward(REFERER);
 }