aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/defaultwidgets/actions/update.php4
-rw-r--r--mod/defaultwidgets/dashboard.php31
-rw-r--r--mod/defaultwidgets/profile.php31
-rw-r--r--mod/defaultwidgets/start.php48
-rw-r--r--mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php21
-rw-r--r--mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php21
-rw-r--r--mod/logbrowser/index.php64
-rw-r--r--mod/logbrowser/start.php26
-rw-r--r--mod/logbrowser/views/default/admin/overview/logbrowser.php68
-rw-r--r--mod/logbrowser/views/default/logbrowser/form.php46
-rw-r--r--mod/profile/start.php25
-rw-r--r--mod/profile/views/default/admin/appearance/defaultprofile.php (renamed from mod/profile/defaultprofile.php)24
-rw-r--r--mod/reportedcontent/actions/archive.php63
-rw-r--r--mod/reportedcontent/actions/delete.php68
-rw-r--r--mod/reportedcontent/start.php29
-rw-r--r--mod/reportedcontent/views/default/admin/overview/reportedcontent.php (renamed from mod/reportedcontent/index.php)16
16 files changed, 224 insertions, 361 deletions
diff --git a/mod/defaultwidgets/actions/update.php b/mod/defaultwidgets/actions/update.php
index aaf03430d..056ee6cec 100644
--- a/mod/defaultwidgets/actions/update.php
+++ b/mod/defaultwidgets/actions/update.php
@@ -49,13 +49,13 @@ if ($context && isset ( $leftbar ) && isset ( $middlebar ) && isset ( $rightbar
forward ( 'pg/admin' );
} else {
register_error ( elgg_echo ( 'defaultwidgets:update:failed' ) );
- forward ( 'pg/defaultwidgets/' . $context );
+ forward("pg/admin/appearance/default_{$context}_widgets");
}
} else {
// report incorrect parameters error
register_error ( elgg_echo ( 'defaultwidgets:update:noparams' ) );
- forward ( 'pg/defaultwidgets/' . $context );
+ forward("pg/admin/appearance/default_{$context}_widgets");
}
diff --git a/mod/defaultwidgets/dashboard.php b/mod/defaultwidgets/dashboard.php
deleted file mode 100644
index 86f96cb67..000000000
--- a/mod/defaultwidgets/dashboard.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Elgg default_widgets plugin.
- *
- * @package DefaultWidgets
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
- * @author Milan Magudia & Curverider
- * @copyright HedgeHogs.net & Curverider Ltd
- *
- **/
-
-// load Elgg engine
-require_once (dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/engine/start.php");
-
-// make sure only admins can view this
-admin_gatekeeper ();
-set_context ( 'admin' );
-
-// Set admin user for user block
-set_page_owner ( $_SESSION ['guid'] );
-
-// vars required for action gatekeeper
-$ts = time ();
-$token = generate_action_token ( $ts );
-$context = 'dashboard';
-
-// create the view
-$content = elgg_view ( "defaultwidgets/editor", array ('token' => $token, 'ts' => $ts, 'context' => $context ) );
-
-// Display main admin menu
-page_draw('Default dashboard widgets for new users', elgg_view_layout('administration', $content));
diff --git a/mod/defaultwidgets/profile.php b/mod/defaultwidgets/profile.php
deleted file mode 100644
index 69640a845..000000000
--- a/mod/defaultwidgets/profile.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * Elgg default_widgets plugin.
- *
- * @package DefaultWidgets
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
- * @author Milan Magudia & Curverider
- * @copyright HedgeHogs.net & Curverider Ltd
- *
- **/
-
-// load Elgg engine
-require_once (dirname ( dirname ( dirname ( __FILE__ ) ) ) . "/engine/start.php");
-
-// make sure only admins can view this
-admin_gatekeeper ();
-set_context ( 'admin' );
-
-// set admin user for user block
-set_page_owner ( $_SESSION ['guid'] );
-
-// vars required for action gatekeeper
-$ts = time ();
-$token = generate_action_token ( $ts );
-$context = 'profile';
-
-// create the view
-$content = elgg_view ( "defaultwidgets/editor", array ('token' => $token, 'ts' => $ts, 'context' => $context ) );
-
-// Display main admin menu
-page_draw('Default profile widgets for new users', elgg_view_layout('administration', $content));
diff --git a/mod/defaultwidgets/start.php b/mod/defaultwidgets/start.php
index 1143cafa6..ceebbe285 100644
--- a/mod/defaultwidgets/start.php
+++ b/mod/defaultwidgets/start.php
@@ -30,11 +30,6 @@ global $CONFIG;
* @param unknown_type $object
*/
function defaultwidgets_init() {
- global $CONFIG;
-
- // Load system configuration
- register_page_handler ( 'defaultwidgets', 'defaultwidgets_page_handler' );
-
// register create user event hook
register_elgg_event_handler ( 'create', 'user', 'defaultwidgets_newusers' );
@@ -43,20 +38,9 @@ function defaultwidgets_init() {
register_elgg_event_handler('validate', 'user', 'defaultwidgets_reset_access');
}
- // Override metadata permissions
- //register_plugin_hook ( 'permissions_check:metadata', 'object', 'defaultwidgets_can_edit_metadata' );
-
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('defaultwidgets:menu:profile'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultwidgets/profile",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
-
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('defaultwidgets:menu:dashboard'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultwidgets/dashboard",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
+ // @todo These submenu pages should be DRYed up
+ elgg_add_admin_submenu_item('default_profile_widgets', elgg_echo('defaultwidgets:menu:profile'), 'appearance');
+ elgg_add_admin_submenu_item('default_dashboard_widgets', elgg_echo('defaultwidgets:menu:dashboard'), 'appearance');
}
/**
@@ -220,32 +204,6 @@ function defaultwidgets_reset_access($event, $object_type, $object) {
return true;
}
-/**
- * Default widgets page handler; allows the use of fancy URLs
- *
- * @param array $page From the page_handler function
- * @return true|false Depending on success
- */
-function defaultwidgets_page_handler($page) {
- global $CONFIG;
-
- if (isset ( $page [0] )) {
-
- switch ($page [0]) {
- case "profile" :
- include (dirname ( __FILE__ ) . "/profile.php");
- break;
- case "dashboard" :
- include (dirname ( __FILE__ ) . "/dashboard.php");
- break;
- }
- } else {
- register_error ( elgg_echo ( "defaultwidgets:admin:notfound" ) );
- forward ( $CONFIG->wwwroot );
- }
- return true;
-}
-
// Make sure the status initialisation function is called on initialisation
register_elgg_event_handler ( 'init', 'system', 'defaultwidgets_init' );
diff --git a/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php b/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php
new file mode 100644
index 000000000..e06f63f1d
--- /dev/null
+++ b/mod/defaultwidgets/views/default/admin/appearance/default_dashboard_widgets.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Elgg default_widgets plugin.
+ *
+ * @package DefaultWidgets
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
+ * @author Milan Magudia & Curverider
+ * @copyright HedgeHogs.net & Curverider Ltd
+ *
+ **/
+
+// Set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+// create the view
+$time = time();
+echo elgg_view('defaultwidgets/editor', array(
+ 'token' => generate_action_token($time),
+ 'ts' => $time,
+ 'context' => 'dashboard',
+));
diff --git a/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php b/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php
new file mode 100644
index 000000000..32350c6dd
--- /dev/null
+++ b/mod/defaultwidgets/views/default/admin/appearance/default_profile_widgets.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Elgg default_widgets plugin.
+ *
+ * @package DefaultWidgets
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU
+ * @author Milan Magudia & Curverider
+ * @copyright HedgeHogs.net & Curverider Ltd
+ *
+ **/
+
+// set admin user for user block
+set_page_owner($_SESSION['guid']);
+
+// create the view
+$time = time();
+echo elgg_view('defaultwidgets/editor', array (
+ 'token' => generate_action_token($time),
+ 'ts' => $time,
+ 'context' => 'profile',
+));
diff --git a/mod/logbrowser/index.php b/mod/logbrowser/index.php
deleted file mode 100644
index c72e9fc23..000000000
--- a/mod/logbrowser/index.php
+++ /dev/null
@@ -1,64 +0,0 @@
-<?php
- /**
- * Elgg log browser.
- *
- * @package ElggLogBrowser
-
- * @author Curverider Ltd
-
- * @link http://elgg.com/
- */
-
- require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
- admin_gatekeeper();
- set_context('admin');
-
- $limit = get_input('limit', 40);
- $offset = get_input('offset');
-
- $search_username = get_input('search_username');
- if ($search_username) {
- if ($user = get_user_by_username($search_username)) {
- $user = $user->guid;
- }
- } else {
- $user_guid = get_input('user_guid',0);
- if ($user_guid) {
- $user = (int) $user_guid;
- } else {
- $user = "";
- }
- }
-
- $timelower = get_input('timelower');
- if ($timelower) $timelower = strtotime($timelower);
- $timeupper = get_input('timeupper');
- if ($timeupper) $timeupper = strtotime($timeupper);
-
- $title = elgg_view_title(elgg_echo('logbrowser'));
-
- // Get log entries
- $log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
- $count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
- $log_entries = array();
-
- foreach ($log as $l)
- {
- $tmp = new ElggObject();
- $tmp->subtype = 'logwrapper';
- $tmp->entry = $l;
- $log_entries[] = $tmp;
- }
-
- $form = elgg_view('logbrowser/form',array('user_guid' => $user, 'timeupper' => $timeupper, 'timelower' => $timelower));
-
- set_context('search');
- $result = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
- $result = "<div class='admin_settings log_browser radius8 clearfloat'>".$result."</div>";
- set_context('admin');
-
-// Display main admin menu
- page_draw(elgg_echo('logbrowser'),elgg_view_layout('administration', $title . $form . $result));
-
-?>
diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php
index c8c830f00..378bab8f7 100644
--- a/mod/logbrowser/start.php
+++ b/mod/logbrowser/start.php
@@ -11,13 +11,9 @@
* Initialise the log browser and set up the menus.
*
*/
-function logbrowser_init()
-{
+function logbrowser_init() {
global $CONFIG;
- // Register a page handler, so we can have nice URLs
- register_page_handler('logbrowser','logbrowser_page_handler');
-
// Extend CSS
elgg_extend_view('css','logbrowser/css');
@@ -26,26 +22,8 @@ function logbrowser_init()
elgg_extend_view('profile/menu/adminlinks','logbrowser/adminlinks',10000);
}
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('logbrowser'),
- 'href' => "{$CONFIG->wwwroot}pg/logbrowser",
- 'parent_id' => 'overview',
- ), 'admin', 'default');
+ elgg_add_admin_submenu_item('logbrowser', elgg_echo('logbrowser'), 'overview');
}
-/**
- * Log browser page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function logbrowser_page_handler($page)
-{
- global $CONFIG;
-
- // only interested in one page for now
- include($CONFIG->pluginspath . "logbrowser/index.php");
-}
-
-
// Initialise log browser
register_elgg_event_handler('init','system','logbrowser_init');
diff --git a/mod/logbrowser/views/default/admin/overview/logbrowser.php b/mod/logbrowser/views/default/admin/overview/logbrowser.php
new file mode 100644
index 000000000..d82b1e00b
--- /dev/null
+++ b/mod/logbrowser/views/default/admin/overview/logbrowser.php
@@ -0,0 +1,68 @@
+<?php
+/**
+ * Elgg log browser.
+ *
+ * @package ElggLogBrowser
+ * @author Curverider Ltd
+ * @link http://elgg.com/
+ */
+
+$limit = get_input('limit', 40);
+$offset = get_input('offset');
+
+$search_username = get_input('search_username');
+if ($search_username) {
+ if ($user = get_user_by_username($search_username)) {
+ $user = $user->guid;
+ }
+} else {
+ $user_guid = get_input('user_guid',0);
+ if ($user_guid) {
+ $user = (int) $user_guid;
+ } else {
+ $user = "";
+ }
+}
+
+$timelower = get_input('timelower');
+if ($timelower) {
+ $timelower = strtotime($timelower);
+}
+
+$timeupper = get_input('timeupper');
+if ($timeupper) {
+ $timeupper = strtotime($timeupper);
+}
+
+$title = elgg_view_title(elgg_echo('logbrowser'));
+
+$form = elgg_view('logbrowser/form', array(
+ 'user_guid' => $user,
+ 'timeupper' => $timeupper,
+ 'timelower' => $timelower,
+));
+
+// Get log entries
+$log = get_system_log($user, "", "", "","", $limit, $offset, false, $timeupper, $timelower);
+$count = get_system_log($user, "", "", "","", $limit, $offset, true, $timeupper, $timelower);
+$log_entries = array();
+
+foreach ($log as $l) {
+ $tmp = new ElggObject();
+ $tmp->subtype = 'logwrapper';
+ $tmp->entry = $l;
+ $log_entries[] = $tmp;
+}
+
+$list = elgg_view_entity_list($log_entries, $count, $offset, $limit, false, false);
+
+// display admin body
+$body = <<<__HTML
+$title
+$form
+<div class="admin_settings log_browser radius8 clearfloat">
+ $list
+</div>
+__HTML;
+
+echo $body;
diff --git a/mod/logbrowser/views/default/logbrowser/form.php b/mod/logbrowser/views/default/logbrowser/form.php
index d79e71d86..7c993e6a2 100644
--- a/mod/logbrowser/views/default/logbrowser/form.php
+++ b/mod/logbrowser/views/default/logbrowser/form.php
@@ -22,34 +22,32 @@
}
- $form = "";
-
- $form .= "<p>" . elgg_echo('logbrowser:user');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'search_username',
- 'value' => $userval
- )) . "</p>";
+ $form = "<p>" . elgg_echo('logbrowser:user');
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'search_username',
+ 'value' => $userval,
+ )) . "</p>";
$form .= "<p>" . elgg_echo('logbrowser:starttime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timelower',
- 'value' => $lowerval
- )) . "</p>";
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'timelower',
+ 'value' => $lowerval,
+ )) . "</p>";
$form .= "<p>" . elgg_echo('logbrowser:endtime');
- $form .= elgg_view('input/text',array(
- 'internalname' => 'timeupper',
- 'value' => $upperval
- )) . "</p>";
- $form .= elgg_view('input/submit',array(
- 'value' => elgg_echo('search')
- ));
-
- $wrappedform = elgg_view('input/form',array(
- 'body' => $form,
- 'method' => 'get',
- 'action' => $vars['url'] . "mod/logbrowser/"
- ));
+ $form .= elgg_view('input/text', array(
+ 'internalname' => 'timeupper',
+ 'value' => $upperval,
+ )) . "</p>";
+ $form .= elgg_view('input/submit', array(
+ 'value' => elgg_echo('search'),
+ ));
+
+ $wrappedform = elgg_view('input/form', array(
+ 'body' => $form,
+ 'method' => 'get',
+ 'action' => "{$vars['url']}pg/admin/logbrowser",
+ ));
?>
<div id="log_browser_search_form" class="hidden radius8"><?php echo $wrappedform; ?></div>
diff --git a/mod/profile/start.php b/mod/profile/start.php
index 6263f4a54..90caa8f64 100644
--- a/mod/profile/start.php
+++ b/mod/profile/start.php
@@ -40,7 +40,6 @@ function profile_init() {
// Register a page handler, so we can have nice URLs
register_page_handler('profile', 'profile_page_handler');
- register_page_handler('defaultprofile', 'profileedit_page_handler');
register_page_handler('icon', 'profile_icon_handler');
register_page_handler('iconjs', 'profile_iconjs_handler');
@@ -52,11 +51,7 @@ function profile_init() {
// Now override icons
register_plugin_hook('entity:icon:url', 'user', 'profile_usericon_hook');
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('profile:edit:default'),
- 'href' => "{$CONFIG->wwwroot}pg/defaultprofile/edit",
- 'parent_id' => 'appearance',
- ), 'admin', 'default');
+ elgg_add_admin_submenu_item('defaultprofile', elgg_echo('profile:edit:default'), 'appearance');
}
/**
@@ -170,24 +165,6 @@ function profile_page_handler($page) {
}
/**
- * Profile edit page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function profileedit_page_handler($page) {
- global $CONFIG;
-
- // The username should be the file we're getting
- if (isset($page[0])) {
- switch ($page[0]) {
- default:
- include($CONFIG->pluginspath . "profile/defaultprofile.php");
- break;
- }
- }
-}
-
-/**
* Pagesetup function
*
*/
diff --git a/mod/profile/defaultprofile.php b/mod/profile/views/default/admin/appearance/defaultprofile.php
index 6d9a25832..7c498780b 100644
--- a/mod/profile/defaultprofile.php
+++ b/mod/profile/views/default/admin/appearance/defaultprofile.php
@@ -9,16 +9,9 @@
* @link http://elgg.com/
*/
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-admin_gatekeeper();
-set_context('admin');
-
$title = elgg_view_title(elgg_echo('profile:edit:default'));
$form = elgg_view('profile/editdefaultprofile');
-set_context('search');
-
// List form elements
$n = 0;
$loaded_defaults = array();
@@ -46,10 +39,13 @@ $resetlisting = elgg_view('input/form',
)
);
-$resetlisting = "<div class='default_profile_reset'>{$resetlisting}</div>";
-
-set_context('admin');
-
-$body = elgg_view_layout("administration", $title . $form . $listing . $resetlisting);
-
-page_draw(elgg_echo('profile:edit:default'), $body); \ No newline at end of file
+$body = <<<__HTML
+$title
+$form
+$listing
+<div class="default_profile_reset">
+ $resetlisting
+</div>
+__HTML;
+
+echo $body;
diff --git a/mod/reportedcontent/actions/archive.php b/mod/reportedcontent/actions/archive.php
index ca4ad2c41..c6cfe58bb 100644
--- a/mod/reportedcontent/actions/archive.php
+++ b/mod/reportedcontent/actions/archive.php
@@ -1,38 +1,33 @@
<?php
+/**
+ * Elgg reported content: archive action
+ *
+ * @package ElggReportedContent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
- /**
- * Elgg reported content: archive action
- *
- * @package ElggReportedContent
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
+// Make sure we're logged in and are admin
+admin_gatekeeper();
- // Make sure we're logged in and are admin
- admin_gatekeeper();
+// Get input data
+$guid = (int) get_input('item');
- // Get input data
- $guid = (int) get_input('item');
-
- // Make sure we actually have permission to edit
- $report = get_entity($guid);
- if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-
- // change the state
- if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), true)) {
- system_message(elgg_echo("reportedcontent:notarchived"));
- forward("pg/reportedcontent/");
- }
- $report->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
+// Make sure we actually have permission to edit
+$report = get_entity($guid);
+if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
+ // change the state
+ if (!trigger_plugin_hook('reportedcontent:archive', 'system', array('report'=>$report), TRUE)) {
+ system_message(elgg_echo("reportedcontent:notarchived"));
+ forward('pg/admin/reportedcontent');
+ }
+ $report->state = "archived";
+
+ // Success message
+ system_message(elgg_echo("reportedcontent:archived"));
+
+ // Forward back to the reported content page
+ forward('pg/admin/reportedcontent');
+}
diff --git a/mod/reportedcontent/actions/delete.php b/mod/reportedcontent/actions/delete.php
index b2e9c7acd..d24000476 100644
--- a/mod/reportedcontent/actions/delete.php
+++ b/mod/reportedcontent/actions/delete.php
@@ -1,41 +1,37 @@
<?php
+/**
+ * Elgg reported content: delete action
+ *
+ * @package ElggReportedCOntent
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ */
- /**
- * Elgg reported content: delete action
- *
- * @package ElggReportedCOntent
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider Ltd <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
- */
+// Make sure we're logged in and are admin
+admin_gatekeeper();
- // Make sure we're logged in and are admin
- admin_gatekeeper();
+// Get input data
+$guid = (int) get_input('item');
- // Get input data
- $guid = (int) get_input('item');
-
- // Make sure we actually have permission to edit
- $report = get_entity($guid);
- if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
-
- // Delete it!
- if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {
- register_error(elgg_echo("reportedcontent:notdeleted"));
- forward("pg/reportedcontent/");
- }
- $rowsaffected = $report->delete();
- if ($rowsaffected > 0) {
+// Make sure we actually have permission to edit
+$report = get_entity($guid);
+if ($report->getSubtype() == "reported_content" && $report->canEdit()) {
+ // Delete it!
+ if (!trigger_plugin_hook('reportedcontent:delete', '$system', array('report'=>$report), true)) {
+ register_error(elgg_echo("reportedcontent:notdeleted"));
+ forward('pg/admin/reportedcontent');
+ }
+
+ $rowsaffected = $report->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
+ system_message(elgg_echo("reportedcontent:deleted"));
+ } else {
+ register_error(elgg_echo("reportedcontent:notdeleted"));
+ }
+
+ // Forward back to the reported content page
+ forward('pg/admin/reportedcontent');
+}
diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php
index 22d93dbe1..b3266fcba 100644
--- a/mod/reportedcontent/start.php
+++ b/mod/reportedcontent/start.php
@@ -16,9 +16,6 @@
function reportedcontent_init() {
global $CONFIG;
- // Register a page handler, so we can have nice URLs
- register_page_handler('reportedcontent', 'reportedcontent_page_handler');
-
// Extend CSS
elgg_extend_view('css', 'reportedcontent/css');
@@ -28,29 +25,13 @@ function reportedcontent_init() {
elgg_extend_view('footer/links', 'reportedcontent/footer_link');
}
- elgg_add_submenu_item(array(
- 'text' => elgg_echo('reportedcontent'),
- 'href' => "{$CONFIG->wwwroot}pg/reportedcontent",
- 'parent_id' => 'overview',
- ), 'admin', 'default');
-}
-
-/**
- * Reported content page handler
- *
- * @param array $page Array of page elements, forwarded by the page handling mechanism
- */
-function reportedcontent_page_handler($page) {
- global $CONFIG;
+ elgg_add_admin_submenu_item('reportedcontent', elgg_echo('reportedcontent'), 'overview');
- // only interested in one page for now
- include($CONFIG->pluginspath . "reportedcontent/index.php");
+ //register action
+ register_action('reportedcontent/add', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/add.php");
+ register_action('reportedcontent/delete', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/delete.php");
+ register_action('reportedcontent/archive', FALSE, "{$CONFIG->pluginspath}reportedcontent/actions/archive.php");
}
// Initialise Reported Content
register_elgg_event_handler('init','system','reportedcontent_init');
-
-//register action
-register_action('reportedcontent/add',false,$CONFIG->pluginspath . "reportedcontent/actions/add.php");
-register_action('reportedcontent/delete',false,$CONFIG->pluginspath . "reportedcontent/actions/delete.php");
-register_action('reportedcontent/archive',false,$CONFIG->pluginspath . "reportedcontent/actions/archive.php"); \ No newline at end of file
diff --git a/mod/reportedcontent/index.php b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php
index bb969c343..4207aacd2 100644
--- a/mod/reportedcontent/index.php
+++ b/mod/reportedcontent/views/default/admin/overview/reportedcontent.php
@@ -9,19 +9,19 @@
* @link http://elgg.com/
*/
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
-
-admin_gatekeeper();
-set_context('admin');
// Set admin user for user block
set_page_owner($_SESSION['guid']);
-
$title = elgg_view_title(elgg_echo('reportedcontent'));
$reported = elgg_get_entities(array('types' => 'object', 'subtypes' => 'reported_content', 'limit' => 9999));
-
-$area2 = elgg_view("reportedcontent/listing", array('entity' => $reported));
+$list = elgg_view("reportedcontent/listing", array('entity' => $reported));
// Display main admin menu
-page_draw(elgg_echo('reportedcontent'),elgg_view_layout("administration", $title . $area2)); \ No newline at end of file
+$body = <<<__HTML
+$title
+$reported
+$list
+__HTML;
+
+echo $body; \ No newline at end of file