]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
remove unused code: vars, foreach keys, etc
authorSteve Clay <steve@mrclay.org>
Tue, 5 Feb 2013 01:59:06 +0000 (20:59 -0500)
committerCash Costello <cash.costello@gmail.com>
Sat, 9 Feb 2013 13:14:23 +0000 (08:14 -0500)
22 files changed:
engine/classes/ElggEntity.php
engine/classes/ElggFile.php
engine/classes/ElggMenuBuilder.php
engine/lib/annotations.php
engine/lib/cron.php
engine/lib/database.php
engine/lib/elgglib.php
engine/lib/export.php
engine/lib/filestore.php
engine/lib/input.php
engine/lib/languages.php
engine/lib/metastrings.php
engine/lib/navigation.php
engine/lib/notification.php
engine/lib/output.php
engine/lib/plugins.php
engine/lib/relationships.php
engine/lib/river.php
engine/lib/sessions.php
engine/lib/sites.php
engine/lib/upgrade.php
engine/lib/users.php

index 0cb8e5f7c7988a91f6d17542efe838fb19ab22cf..f44e730237c40a39a48c3b5170e32608274cd58e 100644 (file)
@@ -1735,8 +1735,6 @@ abstract class ElggEntity extends ElggData implements
         * @return array
         */
        public function getTags($tag_names = NULL) {
-               global $CONFIG;
-
                if ($tag_names && !is_array($tag_names)) {
                        $tag_names = array($tag_names);
                }
index 3f652ff19b10e1ca0c483a6f4e95daa50ec080f9..532db36179595a4540f78575a6207358e1608919 100644 (file)
@@ -365,7 +365,6 @@ class ElggFile extends ElggObject {
                // need to get all filestore::* metadata because the rest are "parameters" that
                // get passed to filestore::setParameters()
                if ($this->guid) {
-                       $db_prefix = elgg_get_config('dbprefix');
                        $options = array(
                                'guid' => $this->guid,
                                'where' => array("n.string LIKE 'filestore::%'"),
index 028eef15f583d063278c11100be40f238875b192..6da95159764c0f9dcae6e560993e2c9f334159e6 100644 (file)
@@ -227,7 +227,6 @@ class ElggMenuBuilder {
                                        if ($children) {
                                                $stack = array_merge($stack, $children);
                                        }
-                                       $p = count($stack);
                                }
                        }
                }
index a95aba8f87a68eb38b0d645b38b3ed09e6fb6279..e5566a00ab84be00a1ab7d819a1dfad1ac5b5de4 100644 (file)
@@ -465,7 +465,6 @@ function export_annotation_plugin_hook($hook, $entity_type, $returnvalue, $param
        }
 
        $guid = (int)$params['guid'];
-       $name = $params['name'];
 
        $result = elgg_get_annotations(array(
                'guid' => $guid,
index dd83a98498cec3c532cd3629211e32087abcf81d..4f3d05b93b91fb8745f2afe3a364dc11e48f8448 100644 (file)
@@ -30,8 +30,6 @@ function cron_init() {
  * @access private
  */
 function cron_page_handler($page) {
-       global $CONFIG;
-
        if (!isset($page[0])) {
                forward();
        }
index 18c30cb8ef40c3191777f5d4ab8c51ae3be82693..dcf50545d674ffc98cab4cad29a9036c8d2ff052 100644 (file)
@@ -79,7 +79,7 @@ $dbcalls = 0;
  */
 function establish_db_link($dblinkname = "readwrite") {
        // Get configuration, and globalise database link
-       global $CONFIG, $dblink, $DB_QUERY_CACHE, $dbcalls;
+       global $CONFIG, $dblink, $DB_QUERY_CACHE;
 
        if ($dblinkname != "readwrite" && isset($CONFIG->db[$dblinkname])) {
                if (is_array($CONFIG->db[$dblinkname])) {
@@ -137,7 +137,7 @@ function establish_db_link($dblinkname = "readwrite") {
  * @access private
  */
 function setup_db_connections() {
-       global $CONFIG, $dblink;
+       global $CONFIG;
 
        if (!empty($CONFIG->db->split)) {
                establish_db_link('read');
@@ -250,7 +250,7 @@ function explain_query($query, $link) {
  * @access private
  */
 function execute_query($query, $dblink) {
-       global $CONFIG, $dbcalls;
+       global $dbcalls;
 
        if ($query == NULL) {
                throw new DatabaseException(elgg_echo('DatabaseException:InvalidQuery'));
@@ -389,7 +389,7 @@ function get_data_row($query, $callback = "") {
  * @access private
  */
 function elgg_query_runner($query, $callback = null, $single = false) {
-       global $CONFIG, $DB_QUERY_CACHE;
+       global $DB_QUERY_CACHE;
 
        // Since we want to cache results of running the callback, we need to
        // need to namespace the query with the callback and single result request.
@@ -454,7 +454,7 @@ function elgg_query_runner($query, $callback = null, $single = false) {
  * @access private
  */
 function insert_data($query) {
-       global $CONFIG, $DB_QUERY_CACHE;
+       global $DB_QUERY_CACHE;
 
        elgg_log("DB query $query", 'NOTICE');
        
@@ -486,7 +486,7 @@ function insert_data($query) {
  * @access private
  */
 function update_data($query) {
-       global $CONFIG, $DB_QUERY_CACHE;
+       global $DB_QUERY_CACHE;
 
        elgg_log("DB query $query", 'NOTICE');
 
@@ -517,7 +517,7 @@ function update_data($query) {
  * @access private
  */
 function delete_data($query) {
-       global $CONFIG, $DB_QUERY_CACHE;
+       global $DB_QUERY_CACHE;
 
        elgg_log("DB query $query", 'NOTICE');
 
@@ -644,7 +644,7 @@ function run_sql_script($scriptlocation) {
                        $statement = str_replace("prefix_", $CONFIG->dbprefix, $statement);
                        if (!empty($statement)) {
                                try {
-                                       $result = update_data($statement);
+                                       update_data($statement);
                                } catch (DatabaseException $e) {
                                        $errors[] = $e->getMessage();
                                }
index 6a2ebf97bd5b2d44f66253e2e242d0840031a7de..4cac79a228f695ab87ba6c424fcf7592289f3a4c 100644 (file)
@@ -128,8 +128,6 @@ function elgg_load_library($name) {
  * @throws SecurityException
  */
 function forward($location = "", $reason = 'system') {
-       global $CONFIG;
-
        if (!headers_sent()) {
                if ($location === REFERER) {
                        $location = $_SERVER['HTTP_REFERER'];
@@ -385,7 +383,7 @@ function elgg_load_external_file($type, $name) {
                $item->url = '';
                $item->location = '';
 
-               $priority = $CONFIG->externals[$type]->add($item);
+               $CONFIG->externals[$type]->add($item);
                $CONFIG->externals_map[$type][$name] = $item;
        }
 }
@@ -563,7 +561,7 @@ function system_messages($message = null, $register = "success", $count = false)
                        return sizeof($_SESSION['msg'][$register]);
                } else {
                        $count = 0;
-                       foreach ($_SESSION['msg'] as $register => $submessages) {
+                       foreach ($_SESSION['msg'] as $submessages) {
                                $count += sizeof($submessages);
                        }
                        return $count;
@@ -1294,8 +1292,6 @@ function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
  * @return string The current page URL.
  */
 function current_page_url() {
-       global $CONFIG;
-
        $url = parse_url(elgg_get_site_url());
 
        $page = $url['scheme'] . "://";
@@ -1489,8 +1485,6 @@ function elgg_http_add_url_query_elements($url, array $elements) {
  * @since 1.8.0
  */
 function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset', 'limit')) {
-       global $CONFIG;
-
        // if the server portion is missing but it starts with / then add the url in.
        // @todo use elgg_normalize_url()
        if (elgg_substr($url1, 0, 1) == '/') {
@@ -1629,7 +1623,7 @@ $sort_type = SORT_LOCALE_STRING) {
 
        $sort = array();
 
-       foreach ($array as $k => $v) {
+       foreach ($array as $v) {
                if (isset($v[$element])) {
                        $sort[] = strtolower($v[$element]);
                } else {
index 1996bc88533ec15315638a01a7a8c124792e0c90..ecc894e639a84d010784db44c96a48e0926f47e6 100644 (file)
@@ -40,8 +40,6 @@ function get_uuid_from_object($object) {
  * @return string
  */
 function guid_to_uuid($guid) {
-       global $CONFIG;
-
        return elgg_get_site_url()  . "export/opendd/$guid/";
 }
 
@@ -53,8 +51,6 @@ function guid_to_uuid($guid) {
  * @return bool
  */
 function is_uuid_this_domain($uuid) {
-       global $CONFIG;
-
        if (strpos($uuid, elgg_get_site_url()) === 0) {
                return true;
        }
index 677fac931e40caebf1fe06db430fd513cdf72ab4..a3c7ba439ca14304bc87a9ff3375d68ad2961429 100644 (file)
@@ -308,8 +308,6 @@ function get_image_resize_parameters($width, $height, $options) {
 function file_delete($guid) {
        if ($file = get_entity($guid)) {
                if ($file->canEdit()) {
-                       $container = get_entity($file->container_guid);
-
                        $thumbnail = $file->thumbnail;
                        $smallthumb = $file->smallthumb;
                        $largethumb = $file->largethumb;
index 2d71fb77edaef7419aefaa8166d66534676d4c4d..bbb9ff94d7eca3e66a8e49cf9f7d8db162d54854 100644 (file)
@@ -266,10 +266,8 @@ function input_livesearch_page_handler($page) {
        }
 
        if (get_input('match_owner', false)) {
-               $owner_guid = $user->getGUID();
                $owner_where = 'AND e.owner_guid = ' . $user->getGUID();
        } else {
-               $owner_guid = null;
                $owner_where = '';
        }
 
index 11722f744d811903e121d6cac7e069356b3df303..3c231d9645283ad26d8f38fd42cb16970cff5ae6 100644 (file)
@@ -104,8 +104,6 @@ function add_translation($country_code, $language_array) {
  * @return string The language code for the site/user or "en" if not set
  */
 function get_current_language() {
-       global $CONFIG;
-
        $language = get_language();
 
        if (!$language) {
index 264d2ba2ce399e592a68ec198b34d27c1ee91830..698c8c1a95880a4f80938b3685ac52b41bff9f6e 100644 (file)
@@ -520,9 +520,6 @@ function elgg_get_metastring_sql($table, $names = null, $values = null,
 
        $db_prefix = elgg_get_config('dbprefix');
 
-       // join counter for incremental joins.
-       $i = 1;
-
        // binary forces byte-to-byte comparision of strings, making
        // it case- and diacritical-mark- sensitive.
        // only supported on values.
index 0e8914bbb726c8e2073ac4e73ad23c0abdb47c98..118a7214c8f0c87417544403877aed8e4b451aa6 100644 (file)
@@ -152,7 +152,7 @@ function elgg_is_menu_item_registered($menu_name, $item_name) {
                return false;
        }
 
-       foreach ($CONFIG->menus[$menu_name] as $index => $menu_object) {
+       foreach ($CONFIG->menus[$menu_name] as $menu_object) {
                /* @var ElggMenuItem $menu_object */
                if ($menu_object->getName() == $item_name) {
                        return true;
@@ -313,8 +313,8 @@ function elgg_site_menu_setup($hook, $type, $return, $params) {
        
        // check if we have anything selected
        $selected = false;
-       foreach ($return as $section_name => $section) {
-               foreach ($section as $key => $item) {
+       foreach ($return as $section) {
+               foreach ($section as $item) {
                        if ($item->getSelected()) {
                                $selected = true;
                                break 2;
index d72b1352a4551b1779deeef6234cdc08f2723705..f0aff84e6ab732b06e6a82379e1b5eedf92bc0e5 100644 (file)
@@ -86,7 +86,7 @@ function unregister_notification_handler($method) {
  * @throws NotificationException
  */
 function notify_user($to, $from, $subject, $message, array $params = NULL, $methods_override = "") {
-       global $NOTIFICATION_HANDLERS, $CONFIG;
+       global $NOTIFICATION_HANDLERS;
 
        // Sanitise
        if (!is_array($to)) {
index fefb94b3e8bc3b69896e6ff19672f1c64531837c..da8e1ab862c7e17f23135530bdd3cb6137655575 100644 (file)
@@ -224,7 +224,6 @@ function elgg_normalize_url($url) {
        $php_5_3_0_to_5_3_2 = version_compare(PHP_VERSION, '5.3.0', '>=') &&
                        version_compare(PHP_VERSION, '5.3.3', '<');
 
-       $validated = false;
        if ($php_5_2_13_and_below || $php_5_3_0_to_5_3_2) {
                $tmp_address = str_replace("-", "", $url);
                $validated = filter_var($tmp_address, FILTER_VALIDATE_URL);
index d6f03c7958b24424e15ea75c3970e70835d0af4f..0ea4404f37cd910a60ec3e83ed731f0c88de2566 100644 (file)
@@ -309,8 +309,6 @@ function elgg_is_active_plugin($plugin_id, $site_guid = null) {
  * @access private
  */
 function elgg_load_plugins() {
-       global $CONFIG;
-
        $plugins_path = elgg_get_plugins_path();
        $start_flags =  ELGG_PLUGIN_INCLUDE_START
                                        | ELGG_PLUGIN_REGISTER_VIEWS
index 6f18bda9346cfc0d0ffb2538be916fe7d76cf171..c1a7cc080974eb91fa4b9ec6c7112a286fdfb09b 100644 (file)
@@ -589,8 +589,6 @@ function import_relationship_plugin_hook($hook, $entity_type, $returnvalue, $par
  * @access private
  */
 function export_relationship_plugin_hook($hook, $entity_type, $returnvalue, $params) {
-       global $CONFIG;
-
        // Sanity check values
        if ((!is_array($params)) && (!isset($params['guid']))) {
                throw new InvalidParameterException(elgg_echo('InvalidParameterException:GUIDNotForExport'));
@@ -626,7 +624,6 @@ function export_relationship_plugin_hook($hook, $entity_type, $returnvalue, $par
 function relationship_notification_hook($event, $type, $object) {
        /* @var ElggRelationship $object */
        $user_one = get_entity($object->guid_one);
-       $user_two = get_entity($object->guid_two);
        /* @var ElggUser $user_one */
 
        return notify_user($object->guid_two,
index 6274887b5eaa662f9cd971a6f70c0fd1f1075e45..f2ec1e101ae954999386ca28cee353cde6c2113d 100644 (file)
@@ -664,10 +664,6 @@ function elgg_river_page_handler($page) {
        }
        set_input('page_type', $page_type);
 
-       // content filter code here
-       $entity_type = '';
-       $entity_subtype = '';
-
        require_once("{$CONFIG->path}pages/river.php");
        return true;
 }
index 3dd95aa2fef9abe22e5279237157a565db222bca..a34c2045b163f8765cee7bb582564090a3af8a3d 100644 (file)
@@ -286,8 +286,6 @@ function check_rate_limit_exceeded($user_guid) {
  * @throws LoginException
  */
 function login(ElggUser $user, $persistent = false) {
-       global $CONFIG;
-
        // User is banned, return false.
        if ($user->isBanned()) {
                throw new LoginException(elgg_echo('LoginException:BannedUser'));
@@ -334,8 +332,6 @@ function login(ElggUser $user, $persistent = false) {
  * @return bool
  */
 function logout() {
-       global $CONFIG;
-
        if (isset($_SESSION['user'])) {
                if (!elgg_trigger_event('logout', 'user', $_SESSION['user'])) {
                        return false;
@@ -618,8 +614,6 @@ function _elgg_session_destroy($id) {
                $sess_file = "$sess_save_path/sess_$id";
                return @unlink($sess_file);
        }
-
-       return false;
 }
 
 /**
index 8ee3213d312cbf784c33cd6f139fed4122555413..3de0eccc24f6632d83f130804583bd370739747b 100644 (file)
@@ -118,8 +118,6 @@ function create_site_entity($guid, $name, $description, $url) {
  * @return bool
  */
 function add_site_user($site_guid, $user_guid) {
-       global $CONFIG;
-
        $site_guid = (int)$site_guid;
        $user_guid = (int)$user_guid;
 
@@ -150,8 +148,6 @@ function remove_site_user($site_guid, $user_guid) {
  * @return mixed
  */
 function add_site_object($site_guid, $object_guid) {
-       global $CONFIG;
-
        $site_guid = (int)$site_guid;
        $object_guid = (int)$object_guid;
 
index ae4591b0bc6036155566360d171288f92d4a04c7..2883dc5094dd23f0b6526004e7e690dbac552698 100644 (file)
@@ -17,8 +17,6 @@
  * @access private
  */
 function upgrade_code($version, $quiet = FALSE) {
-       global $CONFIG;
-
        $version = (int) $version;
        $upgrade_path = elgg_get_config('path') . 'engine/lib/upgrades/';
        $processed_upgrades = elgg_get_processed_upgrades();
@@ -291,7 +289,6 @@ function elgg_upgrade_bootstrap_17_to_18() {
                '2011010101.php',
        );
 
-       $upgrades_17 = array();
        $upgrade_files = elgg_get_upgrade_files();
        $processed_upgrades = array();
 
index c4e06895dc35f439de6c1bd1a462d640362dc695..8e9086f57e91c544283e91aa8301a02304784880 100644 (file)
@@ -343,8 +343,6 @@ function user_add_friend($user_guid, $friend_guid) {
  * @return bool Depending on success
  */
 function user_remove_friend($user_guid, $friend_guid) {
-       global $CONFIG;
-
        $user_guid = (int) $user_guid;
        $friend_guid = (int) $friend_guid;
 
@@ -675,8 +673,6 @@ function find_active_users($seconds = 600, $limit = 10, $offset = 0, $count = fa
  * @return bool
  */
 function send_new_password_request($user_guid) {
-       global $CONFIG;
-
        $user_guid = (int)$user_guid;
 
        $user = get_entity($user_guid);
@@ -916,9 +912,6 @@ function validate_email_address($address) {
 function register_user($username, $password, $name, $email,
 $allow_multiple_emails = false, $friend_guid = 0, $invitecode = '') {
 
-       // Load the configuration
-       global $CONFIG;
-
        // no need to trim password.
        $username = trim($username);
        $name = trim(strip_tags($name));
@@ -1205,8 +1198,6 @@ function set_last_login($user_guid) {
  * @access private
  */
 function user_create_hook_add_site_relationship($event, $object_type, $object) {
-       global $CONFIG;
-
        add_entity_relationship($object->getGUID(), 'member_of_site', elgg_get_site_entity()->guid);
 }