From 6f59a0482ed182ed3f544ebde84bbcfdcd9b4680 Mon Sep 17 00:00:00 2001 From: cash Date: Tue, 30 Nov 2010 02:12:20 +0000 Subject: Refs #2428 removed some global CONFIG usage in plugins git-svn-id: http://code.elgg.org/elgg/trunk@7479 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/crontrigger/start.php | 1 - mod/garbagecollector/start.php | 1 - mod/invitefriends/start.php | 3 +-- mod/logbrowser/start.php | 1 - mod/members/start.php | 1 - mod/messageboard/start.php | 14 ++++++-------- mod/reportedcontent/start.php | 3 +-- mod/sitepages/start.php | 5 ++--- mod/thewire/start.php | 21 +++++++++------------ mod/uservalidationbyemail/lib/functions.php | 9 ++++++--- mod/uservalidationbyemail/start.php | 2 -- 11 files changed, 25 insertions(+), 36 deletions(-) (limited to 'mod') diff --git a/mod/crontrigger/start.php b/mod/crontrigger/start.php index 24f50f33b..2966d83f2 100644 --- a/mod/crontrigger/start.php +++ b/mod/crontrigger/start.php @@ -63,7 +63,6 @@ function crontrigger_yearly() { * not occur. */ function crontrigger_shutdownhook() { - global $CONFIG; $minute = 60; $fiveminute = $minute * 5; diff --git a/mod/garbagecollector/start.php b/mod/garbagecollector/start.php index 6267ab1ba..9579dc29e 100644 --- a/mod/garbagecollector/start.php +++ b/mod/garbagecollector/start.php @@ -26,7 +26,6 @@ function garbagecollector_init() { * Cron job */ function garbagecollector_cron($hook, $entity_type, $returnvalue, $params) { - global $CONFIG; echo elgg_echo('garbagecollector'); diff --git a/mod/invitefriends/start.php b/mod/invitefriends/start.php index aa08e0583..abba12f20 100644 --- a/mod/invitefriends/start.php +++ b/mod/invitefriends/start.php @@ -9,7 +9,6 @@ * Add menu item for invite friends */ function invitefriends_pagesetup() { - global $CONFIG; if (elgg_get_context() == "friends" || elgg_get_context() == "friendsof" || elgg_get_context() == "collections") { @@ -17,5 +16,5 @@ function invitefriends_pagesetup() { } } -elgg_register_action('invitefriends/invite', $CONFIG->pluginspath . 'invitefriends/actions/invite.php'); +elgg_register_action('invitefriends/invite', elgg_get_plugin_path() . 'invitefriends/actions/invite.php'); elgg_register_event_handler('pagesetup', 'system', 'invitefriends_pagesetup'); diff --git a/mod/logbrowser/start.php b/mod/logbrowser/start.php index 7a510b6e6..4236ce64e 100644 --- a/mod/logbrowser/start.php +++ b/mod/logbrowser/start.php @@ -11,7 +11,6 @@ elgg_register_event_handler('init', 'system', 'logbrowser_init'); * Initialize the log browser plugin. */ function logbrowser_init() { - global $CONFIG; // Extend CSS elgg_extend_view('css/admin', 'logbrowser/css'); diff --git a/mod/members/start.php b/mod/members/start.php index 53f4f3753..6c26efd75 100644 --- a/mod/members/start.php +++ b/mod/members/start.php @@ -6,7 +6,6 @@ */ function members_init() { - global $CONFIG; elgg_extend_view('css','members/css'); } diff --git a/mod/messageboard/start.php b/mod/messageboard/start.php index 56dfce1bd..d12086bf2 100644 --- a/mod/messageboard/start.php +++ b/mod/messageboard/start.php @@ -21,6 +21,11 @@ function messageboard_init() { // add a messageboard widget - only for profile add_widget_type('messageboard', elgg_echo("messageboard:board"), elgg_echo("messageboard:desc"), "profile"); + + // Register actions + $action_path = elgg_get_plugin_path() . 'messageboard/actions'; + elgg_register_action("messageboard/add", "$action_path/add.php"); + elgg_register_action("messageboard/delete", "$action_path/delete.php"); } /** @@ -30,15 +35,13 @@ function messageboard_init() { */ function messageboard_page_handler($page) { - global $CONFIG; - // The username should be the first array entry if (isset($page[0])) { set_input('username', $page[0]); } // Include the standard messageboard index - include($CONFIG->pluginspath . "messageboard/index.php"); + include(elgg_get_plugin_path() . "messageboard/index.php"); } /** @@ -51,7 +54,6 @@ function messageboard_page_handler($page) { * @return bool */ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC) { - global $CONFIG; $result = $owner->annotate('messageboard', $message, $access_id, $poster->guid); if (!$result) { @@ -86,7 +88,3 @@ function messageboard_add($poster, $owner, $message, $access_id = ACCESS_PUBLIC) // Register initialisation callback elgg_register_event_handler('init', 'system', 'messageboard_init'); - -// Register actions -elgg_register_action("messageboard/add", $CONFIG->pluginspath . "messageboard/actions/add.php"); -elgg_register_action("messageboard/delete", $CONFIG->pluginspath . "messageboard/actions/delete.php"); diff --git a/mod/reportedcontent/start.php b/mod/reportedcontent/start.php index 815c35fe5..37f98ad49 100644 --- a/mod/reportedcontent/start.php +++ b/mod/reportedcontent/start.php @@ -11,7 +11,6 @@ elgg_register_event_handler('init','system','reportedcontent_init'); * Initialize the plugin */ function reportedcontent_init() { - global $CONFIG; // Register a page handler, so we can have nice URLs register_page_handler('reportedcontent', 'reportedcontent_page_handler'); @@ -30,7 +29,7 @@ function reportedcontent_init() { elgg_add_admin_submenu_item('reportedcontent', elgg_echo('reportedcontent'), 'overview'); // Register actions - $action_path = "{$CONFIG->pluginspath}reportedcontent/actions"; + $action_path = elgg_get_plugin_path() . "reportedcontent/actions"; elgg_register_action('reportedcontent/add', "$action_path/add.php"); elgg_register_action('reportedcontent/delete', "$action_path/delete.php", 'admin'); elgg_register_action('reportedcontent/archive', "$action_path/archive.php", 'admin'); diff --git a/mod/sitepages/start.php b/mod/sitepages/start.php index 684bca62d..1f05f1287 100644 --- a/mod/sitepages/start.php +++ b/mod/sitepages/start.php @@ -20,7 +20,6 @@ */ function sitepages_init() { require_once(dirname(__FILE__) . '/sitepages_functions.php'); - global $CONFIG; // Extend CSS elgg_extend_view('css', 'sitepages/css'); @@ -49,7 +48,8 @@ function sitepages_init() { // hook into the walled garden pages elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'sitepages_public_pages'); - elgg_register_action('settings/sitepages/save', "{$CONFIG->pluginspath}sitepages/actions/edit_settings.php"); + $action_path = elgg_get_plugin_path() . 'sitepages/actions'; + elgg_register_action('settings/sitepages/save', "$action_path/edit_settings.php"); } @@ -108,7 +108,6 @@ function sitepages_url($expage) { * @return unknown_type */ function sitepages_page_handler($page) { - global $CONFIG; // for the owner block. if ($logged_in_guid = get_loggedin_userid()) { diff --git a/mod/thewire/start.php b/mod/thewire/start.php index d66f0ca14..f3d2f0e75 100644 --- a/mod/thewire/start.php +++ b/mod/thewire/start.php @@ -18,9 +18,6 @@ */ function thewire_init() { - - // Load system configuration - global $CONFIG; // Set up menu for logged in users add_menu(elgg_echo('thewire:title'), "pg/thewire"); @@ -52,18 +49,21 @@ // Listen to notification events and supply a more useful message for SMS' elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'thewire_notify_message'); + + $action_path = elgg_get_plugin_path() . 'thewire/actions'; + elgg_register_action("thewire/add", "$action_path/add.php"); + elgg_register_action("thewire/delete", "$action_path/delete.php"); } function thewire_pagesetup() { - - global $CONFIG; + + $base_url = elgg_get_site_url(); //add submenu options if (elgg_get_context() == "thewire") { if ((elgg_get_page_owner_guid() == get_loggedin_userid() || !elgg_get_page_owner_guid()) && isloggedin()) { - add_submenu_item(elgg_echo('thewire:read'),$CONFIG->wwwroot."pg/thewire/" . get_loggedin_user()->username); - add_submenu_item(elgg_echo('thewire:everyone'),$CONFIG->wwwroot."mod/thewire/everyone.php"); - //add_submenu_item(elgg_echo('thewire:add'),$CONFIG->wwwroot."mod/thewire/add.php"); + add_submenu_item(elgg_echo('thewire:read'),"{$base_url}pg/thewire/" . get_loggedin_user()->username); + add_submenu_item(elgg_echo('thewire:everyone'),"{$base_url}mod/thewire/everyone.php"); } } @@ -197,9 +197,6 @@ elgg_register_event_handler('init','system','thewire_init'); elgg_register_event_handler('pagesetup','system','thewire_pagesetup'); - // Register actions - global $CONFIG; - elgg_register_action("thewire/add", $CONFIG->pluginspath . "thewire/actions/add.php"); - elgg_register_action("thewire/delete", $CONFIG->pluginspath . "thewire/actions/delete.php"); + ?> diff --git a/mod/uservalidationbyemail/lib/functions.php b/mod/uservalidationbyemail/lib/functions.php index aadabc927..ab382c059 100644 --- a/mod/uservalidationbyemail/lib/functions.php +++ b/mod/uservalidationbyemail/lib/functions.php @@ -14,10 +14,11 @@ * @return string */ function uservalidationbyemail_generate_code($user_guid, $email_address) { - global $CONFIG; + + $site_url = elgg_get_site_url(); // Note I bind to site URL, this is important on multisite! - return md5($user_guid . $email_address . $CONFIG->site->url . get_site_secret()); + return md5($user_guid . $email_address . $site_url . get_site_secret()); } /** @@ -30,13 +31,15 @@ function uservalidationbyemail_generate_code($user_guid, $email_address) { function uservalidationbyemail_request_validation($user_guid) { global $CONFIG; + $site_url = elgg_get_site_url(); + $user_guid = (int)$user_guid; $user = get_entity($user_guid); if (($user) && ($user instanceof ElggUser)) { // Work out validate link $code = uservalidationbyemail_generate_code($user_guid, $user->email); - $link = "{$CONFIG->site->url}pg/uservalidationbyemail/confirm?u=$user_guid&c=$code"; + $link = "{$site_url}pg/uservalidationbyemail/confirm?u=$user_guid&c=$code"; $site = $CONFIG->site; // Send validation email diff --git a/mod/uservalidationbyemail/start.php b/mod/uservalidationbyemail/start.php index 0f8dd2091..1214df11b 100644 --- a/mod/uservalidationbyemail/start.php +++ b/mod/uservalidationbyemail/start.php @@ -10,7 +10,6 @@ elgg_register_event_handler('init', 'system', 'uservalidationbyemail_init'); function uservalidationbyemail_init() { - global $CONFIG; require_once dirname(__FILE__) . '/lib/functions.php'; @@ -147,7 +146,6 @@ function uservalidationbyemail_check_auth_attempt($credentials) { * @param array $page */ function uservalidationbyemail_page_handler($page) { - global $CONFIG; if (isset($page[0]) && $page[0] == 'confirm') { $code = sanitise_string(get_input('c', FALSE)); -- cgit v1.2.3