From c5cc2821311012a8a4385a304a043c4b41f2afbb Mon Sep 17 00:00:00 2001 From: brettp Date: Mon, 31 Aug 2009 19:05:21 +0000 Subject: All line endings are now Unix-style. git-svn-id: https://code.elgg.org/elgg/trunk@3451 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/admin.php | 348 +++++++++++++++++++++++++-------------------------- 1 file changed, 174 insertions(+), 174 deletions(-) (limited to 'engine/lib/admin.php') diff --git a/engine/lib/admin.php b/engine/lib/admin.php index a8272dc83..f09167bfa 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -1,177 +1,177 @@ -wwwroot . 'pg/admin/statistics/'); - add_submenu_item(elgg_echo('admin:site'), $CONFIG->wwwroot . 'pg/admin/site/'); - add_submenu_item(elgg_echo('admin:user'), $CONFIG->wwwroot . 'pg/admin/user/'); - add_submenu_item(elgg_echo('admin:plugins'), $CONFIG->wwwroot . 'pg/admin/plugins/'); - - } - - } - - function admin_settings_page_handler($page) - { - global $CONFIG; - - $path = $CONFIG->path . "admin/index.php"; - - if ($page[0]) - { - switch ($page[0]) - { - case 'user' : $path = $CONFIG->path . "admin/user.php"; break; - case 'statistics' : $path = $CONFIG->path . "admin/statistics.php"; break; - case 'plugins' : $path = $CONFIG->path . "admin/plugins.php"; break; - case 'site' : $path = $CONFIG->path . "admin/site.php"; break; - } - } - - if ($page[1]) - set_input('username', $page[1]); - - include($path); - } - - - /** - * Admin permissions system - * - * @return true|null True if the current user is an admin. - */ - function admin_permissions($hook, $type, $returnval, $params) { - - if (is_array($params) && !empty($params['user']) && $params['user'] instanceof ElggUser) { - $admin = $params['user']->admin; - if ($admin) { - return true; - } - } - - } - - /** - * 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'); - -?> + register_action('admin/user/removeadmin', false, "", true); + + // Register some actions + register_action('admin/site/update_basic', false, "", true); // Register basic site admin action + + // Page handler + register_page_handler('admin','admin_settings_page_handler'); + + if (isadminloggedin()) { + global $is_admin; + $is_admin = true; + } + + } + + function admin_pagesetup() { + + if (get_context() == 'admin') { + + global $CONFIG; + add_submenu_item(elgg_echo('admin:statistics'), $CONFIG->wwwroot . 'pg/admin/statistics/'); + add_submenu_item(elgg_echo('admin:site'), $CONFIG->wwwroot . 'pg/admin/site/'); + add_submenu_item(elgg_echo('admin:user'), $CONFIG->wwwroot . 'pg/admin/user/'); + add_submenu_item(elgg_echo('admin:plugins'), $CONFIG->wwwroot . 'pg/admin/plugins/'); + + } + + } + + function admin_settings_page_handler($page) + { + global $CONFIG; + + $path = $CONFIG->path . "admin/index.php"; + + if ($page[0]) + { + switch ($page[0]) + { + case 'user' : $path = $CONFIG->path . "admin/user.php"; break; + case 'statistics' : $path = $CONFIG->path . "admin/statistics.php"; break; + case 'plugins' : $path = $CONFIG->path . "admin/plugins.php"; break; + case 'site' : $path = $CONFIG->path . "admin/site.php"; break; + } + } + + if ($page[1]) + set_input('username', $page[1]); + + include($path); + } + + + /** + * Admin permissions system + * + * @return true|null True if the current user is an admin. + */ + function admin_permissions($hook, $type, $returnval, $params) { + + if (is_array($params) && !empty($params['user']) && $params['user'] instanceof ElggUser) { + $admin = $params['user']->admin; + if ($admin) { + return true; + } + } + + } + + /** + * 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'); + +?> -- cgit v1.2.3