Permalink
Browse files

$GLOBALS reduced back to normal variables (considered to be in the gl…

…obal scope)
  • Loading branch information...
trustmaster committed Nov 26, 2010
1 parent f7cb00c commit 84a3604cb23f0c22d30d309187cffe6b099ddc40
@@ -3,7 +3,7 @@
* Countries
* ISO 3166-1 publication 2009-05-08
*/
-$GLOBALS['cot_countries'] = array(
+$cot_countries = array(
'00' => '---',
'af' => 'Afghanistan',
'ax' => 'Åland Islands',
@@ -3,7 +3,7 @@
* Countries
* ISO 3166-1 publication 2009-05-08
*/
-$GLOBALS['cot_countries'] = array(
+$cot_countries = array(
'00' => '---',
'au' => 'Австралия',
'at' => 'Австрия',
@@ -16,9 +16,9 @@
require_once cot_incfile('forums', 'module', 'resources');
// Global variables
-$GLOBALS['db_forum_posts'] = (isset($GLOBALS['db_forum_posts'])) ? $GLOBALS['db_forum_posts'] : $GLOBALS['db_x'] . 'forum_posts';
-$GLOBALS['db_forum_topics'] = (isset($GLOBALS['db_forum_topics'])) ? $GLOBALS['db_forum_topics'] : $GLOBALS['db_x'] . 'forum_topics';
-$GLOBALS['db_forum_stats'] = (isset($GLOBALS['db_forum_stats'])) ? $GLOBALS['db_forum_stats'] : $GLOBALS['db_x'] . 'forum_stats';
+$db_forum_posts = (isset($db_forum_posts)) ? $db_forum_posts : $db_x . 'forum_posts';
+$db_forum_topics = (isset($db_forum_topics)) ? $db_forum_topics : $db_x . 'forum_topics';
+$db_forum_stats = (isset($db_forum_stats)) ? $db_forum_stats : $db_x . 'forum_stats';
/**
* Builds forum category path
@@ -18,10 +18,10 @@
require_once cot_incfile('extrafields');
// Global variables
-$GLOBALS['db_pages'] = (isset($GLOBALS['db_pages'])) ? $GLOBALS['db_pages'] : $GLOBALS['db_x'] . 'pages';
+$db_pages = (isset($db_pages)) ? $db_pages : $db_x . 'pages';
-$GLOBALS['cot_extrafields']['pages'] = (!empty($GLOBALS['cot_extrafields'][$GLOBALS['db_pages']]))
- ? $GLOBALS['cot_extrafields'][$GLOBALS['db_pages']] : array();
+$cot_extrafields['pages'] = (!empty($cot_extrafields[$db_pages]))
+ ? $cot_extrafields[$db_pages] : array();
/**
* Cuts the page after 'more' tag or after the first page (if multipage)
@@ -18,8 +18,8 @@
require_once cot_incfile('forms');
// Global variables
-$GLOBALS['db_pfs'] = (isset($GLOBALS['db_pfs'])) ? $GLOBALS['db_pfs'] : $GLOBALS['db_x'] . 'pfs';
-$GLOBALS['db_pfs_folders'] = (isset($GLOBALS['db_pfs_folders'])) ? $GLOBALS['db_pfs_folders'] : $GLOBALS['db_x'] . 'pfs_folders';
+$db_pfs = (isset($db_pfs)) ? $db_pfs : $db_x . 'pfs';
+$db_pfs_folders = (isset($db_pfs_folders)) ? $db_pfs_folders : $db_x . 'pfs_folders';
// TODO eliminate this function
function cot_build_pfs($id, $c1, $c2, $title)
@@ -16,7 +16,7 @@
require_once cot_incfile('pm', 'module', 'resources');
// Global variables
-$GLOBALS['db_pm'] = (isset($GLOBALS['db_pm'])) ? $GLOBALS['db_pm'] : $GLOBALS['db_x'] . 'pm';
+$db_pm = (isset($db_pm)) ? $db_pm : $db_x . 'pm';
/**
* Returns usertags
@@ -16,9 +16,9 @@
require_once cot_langfile('polls', 'module');
// Global variables
-$GLOBALS['db_polls'] = (isset($GLOBALS['db_polls'])) ? $GLOBALS['db_polls'] : $GLOBALS['db_x'] . 'polls';
-$GLOBALS['db_polls_options'] = (isset($GLOBALS['db_polls_options'])) ? $GLOBALS['db_polls_options'] : $GLOBALS['db_x'] . 'polls_options';
-$GLOBALS['db_polls_voters'] = (isset($GLOBALS['db_polls_voters'])) ? $GLOBALS['db_polls_voters'] : $GLOBALS['db_x'] . 'polls_voters';
+$db_polls = (isset($db_polls)) ? $db_polls : $db_x . 'polls';
+$db_polls_options = (isset($db_polls_options)) ? $db_polls_options : $db_x . 'polls_options';
+$db_polls_voters = (isset($db_polls_voters)) ? $db_polls_voters : $db_x . 'polls_voters';
/**
* Adds form for create/edit Poll
@@ -22,7 +22,7 @@
$tt = new XTemplate(cot_tplfile('banlist.admin', 'plug'));
require_once cot_langfile('banlist', 'plug');
-$GLOBALS['db_banlist'] = (isset($GLOBALS['db_banlist'])) ? $GLOBALS['db_banlist'] : $GLOBALS['db_x'] . 'banlist';
+$db_banlist = (isset($db_banlist)) ? $db_banlist : $db_x . 'banlist';
$adminhelp = $L['banlist_help'];
$d = cot_import('d', 'G', 'INT');
@@ -17,7 +17,7 @@
defined('COT_CODE') or die('Wrong URL');
-$GLOBALS['db_banlist'] = (isset($GLOBALS['db_banlist'])) ? $GLOBALS['db_banlist'] : $GLOBALS['db_x'] . 'banlist';
+$db_banlist = (isset($db_banlist)) ? $db_banlist : $db_x . 'banlist';
$userip = explode('.', $usr['ip']);
$ipmasks = "('".$userip[0].'.'.$userip[1].'.'.$userip[2].'.'.$userip[3]."','".$userip[0].'.'.$userip[1].'.'.$userip[2].".*','".$userip[0].'.'.$userip[1].".*.*','".$userip[0].".*.*.*')";
@@ -18,7 +18,7 @@
defined('COT_CODE') or die('Wrong URL');
require_once cot_langfile('banlist', 'plug');
-$GLOBALS['db_banlist'] = (isset($GLOBALS['db_banlist'])) ? $GLOBALS['db_banlist'] : $GLOBALS['db_x'] . 'banlist';
+$db_banlist = (isset($db_banlist)) ? $db_banlist : $db_x . 'banlist';
$ruser['user_email'] = cot_import('ruseremail','P','TXT',64, TRUE);
$ruser['user_email'] = mb_strtolower($ruser['user_email']);
@@ -10,7 +10,7 @@
defined('COT_CODE') or die('Wrong URL');
-$GLOBALS['db_bbcode'] = (isset($GLOBALS['db_bbcode'])) ? $GLOBALS['db_bbcode'] : $GLOBALS['db_x'] . 'bbcode';
+$db_bbcode = (isset($db_bbcode)) ? $db_bbcode : $db_x . 'bbcode';
/**
* Registers a new bbcode in database.
@@ -15,7 +15,7 @@
require_once cot_incfile('comments', 'plug', 'resources');
// Table name globals
-$GLOBALS['db_com'] = (isset($GLOBALS['db_com'])) ? $GLOBALS['db_com'] : $GLOBALS['db_x'] . 'com';
+$db_com = (isset($db_com)) ? $db_com : $db_x . 'com';
/**
* Returns number of comments for item
@@ -11,7 +11,7 @@
defined('COT_CODE') or die('Wrong URL');
-$GLOBALS['db_stats'] = (isset($GLOBALS['db_stats'])) ? $GLOBALS['db_stats'] : $GLOBALS['db_x'] . 'stats';
+$db_stats = (isset($db_stats)) ? $db_stats : $db_x . 'stats';
/*
* =============================== Statistics API =============================
@@ -14,9 +14,9 @@
require_once cot_langfile('i18n', 'plug');
require_once cot_incfile('i18n', 'plug', 'resources');
-$GLOBALS['db_i18n_locales'] = (isset($GLOBALS['db_i18n_locales'])) ? $GLOBALS['db_i18n_locales'] : $GLOBALS['db_x'] . 'i18n_locales';
-$GLOBALS['db_i18n_pages'] = (isset($GLOBALS['db_i18n_pages'])) ? $GLOBALS['db_i18n_pages'] : $GLOBALS['db_x'] . 'i18n_pages';
-$GLOBALS['db_i18n_structure'] = (isset($GLOBALS['db_i18n_structure'])) ? $GLOBALS['db_i18n_structure'] : $GLOBALS['db_x'] . 'i18n_structure';
+$db_i18n_locales = (isset($db_i18n_locales)) ? $db_i18n_locales : $db_x . 'i18n_locales';
+$db_i18n_pages = (isset($db_i18n_pages)) ? $db_i18n_pages : $db_x . 'i18n_pages';
+$db_i18n_structure = (isset($db_i18n_structure)) ? $db_i18n_structure : $db_x . 'i18n_structure';
/**
* Builds internationalized category path
@@ -21,7 +21,7 @@
$tt = new XTemplate(cot_tplfile('referers.admin', 'plug'));
-$GLOBALS['db_referers'] = (isset($GLOBALS['db_referers'])) ? $GLOBALS['db_referers'] : $GLOBALS['db_x'] . 'referers';
+$db_referers = (isset($db_referers)) ? $db_referers : $db_x . 'referers';
require_once cot_langfile('referers', 'plug');
$adminhelp = $L['adm_help_referers'];
@@ -17,7 +17,7 @@
defined('COT_CODE') or die('Wrong URL');
-$GLOBALS['db_referers'] = (isset($GLOBALS['db_referers'])) ? $GLOBALS['db_referers'] : $GLOBALS['db_x'] . 'referers';
+$db_referers = (isset($db_referers)) ? $db_referers : $db_x . 'referers';
$sys['referer'] = substr($_SERVER['HTTP_REFERER'], 0, 255);
@@ -10,15 +10,15 @@
* @license BSD
*/
-$GLOBALS['tc_styles'] = array(
+$tc_styles = array(
1 => 'xs',
5 => 's',
20 => 'm',
50 => 'l',
999999999 => 'xl'
);
-$GLOBALS['db_tags'] = (isset($GLOBALS['db_tags'])) ? $GLOBALS['db_tags'] : $GLOBALS['db_x'] . 'tags';
-$GLOBALS['db_tag_references'] = (isset($GLOBALS['db_tag_references'])) ? $GLOBALS['db_tag_references'] : $GLOBALS['db_x'] . 'tag_references';
+$db_tags = (isset($db_tags)) ? $db_tags : $db_x . 'tags';
+$db_tag_references = (isset($db_tag_references)) ? $db_tag_references : $db_x . 'tag_references';
?>
View
@@ -16,7 +16,7 @@
* Default allowed permissions map. If some value is missing in user-defined
* permission map, it will be taken from this one.
*/
-$GLOBALS['cot_auth_default_permit'] = array(
+$cot_auth_default_permit = array(
COT_GROUP_DEFAULT => 'RW',
COT_GROUP_GUESTS => 'R',
COT_GROUP_INACTIVE => 'R',
@@ -29,7 +29,7 @@
* Default disabled (locked) permissions map. If some value is missing
* in user-defined permission lock map, it will be taken from this one.
*/
-$GLOBALS['cot_auth_default_lock'] = array(
+$cot_auth_default_lock = array(
COT_GROUP_DEFAULT => '0',
COT_GROUP_GUESTS => 'W12345A',
COT_GROUP_INACTIVE => 'W12345A',
View
@@ -31,7 +31,7 @@
/**
* These parts ($name.$part.php) are reserved handlers with no hooks
*/
-$GLOBALS['cot_ext_ignore_parts'] = array('configure', 'install', 'setup', 'uninstall');
+$cot_ext_ignore_parts = array('configure', 'install', 'setup', 'uninstall');
/**
* Applies custom SQL and PHP patches in a directory. Error and success
View
@@ -477,6 +477,6 @@ function cot_load_extrafields()
/* ======== Extrafields Pre-load ======== */
cot_load_extrafields();
-$GLOBALS['cot_extrafields']['structure'] = (!empty($GLOBALS['cot_extrafields'][$GLOBALS['db_structure']])) ? $GLOBALS['cot_extrafields'][$GLOBALS['db_structure']] : array();
+$cot_extrafields['structure'] = (!empty($cot_extrafields[$db_structure])) ? $cot_extrafields[$db_structure] : array();
?>
View
@@ -15,7 +15,7 @@
/**
* Registers textarea instances to inform RichText editors that they need to be loaded
*/
-$GLOBALS['cot_textarea_count'] = 0;
+$cot_textarea_count = 0;
/**
* Generates a checkbox output
@@ -14,7 +14,7 @@
require_once cot_incfile('users', 'module', 'resources');
// Extafield globals
-$GLOBALS['cot_extrafields']['users'] = (!empty($GLOBALS['cot_extrafields'][$GLOBALS['db_users']])) ? $GLOBALS['cot_extrafields'][$GLOBALS['db_users']] : array();
+$cot_extrafields['users'] = (!empty($cot_extrafields[$db_users])) ? $cot_extrafields[$db_users] : array();
/**
* Returns group link (button)

0 comments on commit 84a3604

Please sign in to comment.