diff options
Diffstat (limited to 'engine/lib/admin.php')
-rw-r--r-- | engine/lib/admin.php | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php index 9c54bc588..ad40926c0 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -1,64 +1,64 @@ -<?php - /** - * Elgg admin functions. - * Functions for adding and manipulating options on the admin panel. - * - * @package Elgg - * @subpackage Core - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd - * @copyright Curverider Ltd 2008-2009 - * @link http://elgg.org/ - */ - - - /** - * Register an admin page with the admin panel. - * This function extends the view "admin/main" with the provided view. This view should provide a description - * and either a control or a link to. - * - * Usage: - * - To add a control to the main admin panel then extend admin/main - * - To add a control to a new page create a page which renders a view admin/subpage (where subpage is your new page - - * nb. some pages already exist that you can extend), extend the main view to point to it, and add controls to your - * new view. - * - * At the moment this is essentially a wrapper around extend_view. - * - * @param string $new_admin_view The view associated with the control you're adding - * @param string $view The view to extend, by default this is 'admin/main'. - * @param int $priority Optional priority to govern the appearance in the list. - */ - function extend_elgg_admin_page( $new_admin_view, $view = 'admin/main', $priority = 500) - { - return extend_view($view, $new_admin_view, $priority); - } - - /** - * Initialise the admin page. - */ - function admin_init() - { - // Add plugin main menu option (last) - extend_elgg_admin_page('admin/main_opt/statistics', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/site', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/user', 'admin/main'); - extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999); // Always last - - register_action('admin/user/ban', false, "", true); - register_action('admin/user/unban', false, "", true); - register_action('admin/user/delete', false, "", true); +<?php
+ /**
+ * Elgg admin functions.
+ * Functions for adding and manipulating options on the admin panel.
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+
+ /**
+ * Register an admin page with the admin panel.
+ * This function extends the view "admin/main" with the provided view. This view should provide a description
+ * and either a control or a link to.
+ *
+ * Usage:
+ * - To add a control to the main admin panel then extend admin/main
+ * - To add a control to a new page create a page which renders a view admin/subpage (where subpage is your new page -
+ * nb. some pages already exist that you can extend), extend the main view to point to it, and add controls to your
+ * new view.
+ *
+ * At the moment this is essentially a wrapper around extend_view.
+ *
+ * @param string $new_admin_view The view associated with the control you're adding
+ * @param string $view The view to extend, by default this is 'admin/main'.
+ * @param int $priority Optional priority to govern the appearance in the list.
+ */
+ function extend_elgg_admin_page( $new_admin_view, $view = 'admin/main', $priority = 500)
+ {
+ return extend_view($view, $new_admin_view, $priority);
+ }
+
+ /**
+ * Initialise the admin page.
+ */
+ function admin_init()
+ {
+ // Add plugin main menu option (last)
+ extend_elgg_admin_page('admin/main_opt/statistics', 'admin/main');
+ extend_elgg_admin_page('admin/main_opt/site', 'admin/main');
+ extend_elgg_admin_page('admin/main_opt/user', 'admin/main');
+ extend_elgg_admin_page('admin/main_opt/plugins', 'admin/main', 999); // Always last
+
+ register_action('admin/user/ban', false, "", true);
+ register_action('admin/user/unban', false, "", true);
+ register_action('admin/user/delete', false, "", true);
register_action('admin/user/resetpassword', false, "", true);
- register_action('admin/user/makeadmin', false, "", true); - - // Register some actions + register_action('admin/user/makeadmin', false, "", true);
+
+ // Register some actions
register_action('admin/site/update_basic', false, "", true); // Register basic site admin action
if (isadminloggedin()) {
- global $is_admin; + global $is_admin;
$is_admin = true;
}
- +
}
function admin_pagesetup() {
@@ -73,7 +73,7 @@ }
- } + }
/**
* Admin permissions system
@@ -89,61 +89,61 @@ }
}
- } - - /** - * Write a persistent message to the administrator's notification window. - * - * Currently this writes a message to the admin store, we may want to come up with another way at some point. - * - * @param string $subject Subject of the message - * @param string $message Body of the message - */ - function send_admin_message($subject, $message) - { - $subject = sanitise_string($subject); - $message = sanitise_string($message); - - if (($subject) && ($message)) - { - $admin_message = new ElggObject(); - $admin_message->subtype = 'admin_message'; - $admin_message->access_id = 2; - $admin_message->title = $subject; - $admin_message->description = $message; - - return $admin_message->save(); - } - - return false; - } - - /** - * List all admin messages. - * - * @param int $limit Limit - */ - function list_admin_messages($limit = 10) - { - return list_entities('object','admin_message',0,$limit); - } - - /** - * Remove an admin message. - * - * @param int $guid The - */ - function clear_admin_message($guid) - { - return delete_entity($guid); }
- - /// Register init functions +
+ /**
+ * Write a persistent message to the administrator's notification window.
+ *
+ * Currently this writes a message to the admin store, we may want to come up with another way at some point.
+ *
+ * @param string $subject Subject of the message
+ * @param string $message Body of the message
+ */
+ function send_admin_message($subject, $message)
+ {
+ $subject = sanitise_string($subject);
+ $message = sanitise_string($message);
+
+ if (($subject) && ($message))
+ {
+ $admin_message = new ElggObject();
+ $admin_message->subtype = 'admin_message';
+ $admin_message->access_id = ACCESS_PUBLIC;
+ $admin_message->title = $subject;
+ $admin_message->description = $message;
+
+ return $admin_message->save();
+ }
+
+ return false;
+ }
+
+ /**
+ * List all admin messages.
+ *
+ * @param int $limit Limit
+ */
+ function list_admin_messages($limit = 10)
+ {
+ return list_entities('object','admin_message',0,$limit);
+ }
+
+ /**
+ * Remove an admin message.
+ *
+ * @param int $guid The
+ */
+ function clear_admin_message($guid)
+ {
+ return delete_entity($guid);
+ }
+
+ /// Register init functions
register_elgg_event_handler('init','system','admin_init');
register_elgg_event_handler('pagesetup','system','admin_pagesetup');
// Register a plugin hook for permissions
register_plugin_hook('permissions_check','all','admin_permissions');
register_plugin_hook('container_permissions_check','all','admin_permissions');
- -?> +
+?>
|