require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "agb"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "agb";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "beg";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "birthday_confirm"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "birthday_confirm";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "click"; $GLOBALS['output_mode'] = -1;
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module to confirm
-$GLOBALS['module'] = "confirm"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "confirm";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
// Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
require("inc/libs/security_functions.php");
-// Init "action" and "what"
-global $what, $action;
-
// Footer is disabled in CSS mode
$GLOBALS['footer_sent'] = "-1";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
// Set module and fake "CSS mode"
-$GLOBALS['module'] = "debug"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "debug";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "img"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "img";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
define('FULL_VERSION', "0.2.1-FINAL");
// Replacement strings
-$REPLACER = array(
+$GLOBALS['replacer'] = array(
'userid' => "%uid%", // User-ID
'surname' => "%vorname%", // Surname
'family' => "%nachname%", // Family name
// SQL queries
function SQL_QUERY ($sql_string, $F, $L) {
- global $OK;
-
// Link is up?
if (!SQL_IS_LINK_UP()) return false;
// Debugging stuff...
//
$fp = fopen(constant('PATH')."inc/cache/mysql.log", 'a') or mxchange_die("Cannot write mysql.log!");
- if (!isset($OK)) {
+ if (!isset($GLOBALS['sql_first_entry'])) {
// Write first entry
fwrite($fp, "Module=".$GLOBALS['module']."\n");
- $OK = true;
+ $GLOBALS['sql_first_entry'] = true;
} // END - if
fwrite($fp, $F."(LINE=".$L."|NUM=".SQL_NUMROWS($result)."|AFFECTED=".SQL_AFFECTEDROWS()."|QUERYTIME:".$queryTime."): ".str_replace('\r', "", str_replace('\n', " ", $sql_string))."\n");
fclose($fp);
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_doubler` SET completed='Y' WHERE id=%s LIMIT 1",
array(bigintval($id)), __FILE__, __LINE__);
- $OK = false;
+ $okay = false;
// Check for jackpot inclusion in doubling process
if (($jackpot > 0) && ($jackpot >= $points) && (getConfig('doubler_jackpot') == "Y")) {
// Subtract points from jackpot
$jackpot -= $points;
// Okay, done!
- $OK = true;
+ $okay = true;
} // END - if
// Exclude also webmaster's ID in taking points from webmaster's account
- if (($user > 0) && ($user >= $points) && (!$OK) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) {
+ if (($user > 0) && ($user >= $points) && (!$okay) && (getConfig('doubler_uid') > 0) && ($uid != getConfig('doubler_uid'))) {
// Add points to used points
SUB_POINTS("doubler_payout", getConfig('doubler_uid'), $points);
// Okay, done!
- $OK = true;
+ $okay = true;
} // END - if
// Update doubler's account only when others are not updated
- if (!$OK) {
+ if (!$okay) {
// Add points to used doubler points
UPDATE_CONFIG("doubler_used", $points, "+");
} // END - if
return $out;
}
+// Getter for CSS files array
+function EXT_GET_CSS_FILES () {
+ // By default no additional CSS files are found
+ $cssFiles = array();
+
+ // Is the array there?
+ if (isset($GLOBALS['css_files'])) {
+ // Then use it
+ $cssFiles = $GLOBALS['css_files'];
+ } // END - if
+
+ // Return array
+ return $cssFiles;
+}
+
+// Init CSS files array
+function EXT_INIT_CSS_FILES () {
+ // Simply init it
+ $GLOBALS['css_files'] = array();
+}
+
+// Add new entry
+function EXT_ADD_CSS_FILE ($file) {
+ // Is the array there?
+ if (!isset($GLOBALS['css_files'])) {
+ // Then auto-init them
+ EXT_INIT_CSS_FILES();
+ } // END - if
+
+ // Add the entry
+ $GLOBALS['css_files'][] = $file;
+}
+
//
?>
break;
default: // Do stuff when extension is loaded
- // Define all arrary variables as global!
- global $HTML_TAGS, $URL_ENDS, $VALID_EMAI_CHARS;
-
// Valid HTML tags (only simple and no attributes!)
- $HTML_TAGS = array(
+ $GLOBALS['html_tags'] = array(
"b",
"i",
"u",
// URL ends which are used to indentify the end of an URL or email link
// Don't use these chars in links... ;-)
//
- $URL_ENDS = array(
+ $GLOBALS['url_ends'] = array(
" ",
"\n",
"\r",
);
// Valid email chars (without @, or do you want to have another @ inside your email addy?)
- $VALID_EMAIL_CHARS = array(
+ $GLOBALS['valid_email_chars'] = array(
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1',
// URL ends which are used to indentify the end of an URL or email link
// Don't use these chars in links... ;-)
//
- global $URL_ENDS, $VALID_EMAIL_CHARS;
- $URL_ENDS = array(
+ $GLOBALS['url_ends'] = array(
" ",
"\n",
"\r",
);
// Valid email chars (without @, or do you want to have another @ inside your email addy?)
- $VALID_EMAIL_CHARS = array(
+ $GLOBALS['valid_email_chars'] = array(
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
't','u','v','w','x','y','z','a','B','C','D','E','F','G','H','I','J','K','L',
'M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','-','.','_','0','1',
break;
}
-// Init array
-global $primera;
-$primera = array();
-
//
?>
default: // Do stuff when extension is loaded
// Init array
- global $WERNIS;
- $WERNIS = array();
+ $GLOBALS['wernis_data'] = array();
break;
}
// Init "generic filter system"
function INIT_FILTER_SYSTEM () {
- global $filters, $loadedFilters, $counter;
-
// Is the filter already initialized?
- if ((isset($filters)) && (is_array($filters))) {
+ if ((isset($GLOBALS['filters']['chains'])) && (is_array($GLOBALS['filters']['chains']))) {
// Then abort here
addFatalMessage(getMessage('FILTER_FAILED_ALREADY_INIT'));
return false;
} // END - if
// Init the filter system (just some ideas)
- $filters = array(
+ $GLOBALS['filters']['chains'] = array(
// Filters for pre-init phase
'preinit' => array(),
// Filters for post-init phase
);
// Init loaded filters and counter
- $loadedFilters = array();
- $counter = array();
+ $GLOBALS['filters']['loaded'] = array();
+ $GLOBALS['filters']['counter'] = array();
// Load all saved filers if sql_patches is updated
if (GET_EXT_VERSION("sql_patches") >= "0.5.9") {
$filterFunction = $filterArray['filter_function'];
// Set counter to default
- $counter[$filterName][$filterFunction] = 0;
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0;
// Mark this filter as loaded (from database)
- $loadedFilters[$filterName][$filterFunction] = true;
+ $GLOBALS['filters']['loaded'][$filterName][$filterFunction] = true;
// Set this filter
- $filters[$filterName][$filterFunction] = $filterArray['filter_active'];
+ $GLOBALS['filters']['chains'][$filterName][$filterFunction] = $filterArray['filter_active'];
// Is the array element for counter there?
if (isset($filterArray['filter_counter'])) {
// Then use this value!
- $counter[$filterName][$filterFunction] = $filterArray['filter_counter'];
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction] = $filterArray['filter_counter'];
} // END - if
} // END - while
} // END - if
// "Registers" a new filter function
function REGISTER_FILTER ($filterName, $filterFunction, $silentAbort = true, $force = false, $dry_run = false) {
- global $filters, $counter;
-
// Extend the filter function name
$filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
// Is that filter already there?
- if ((isset($filters[$filterName][$filterFunction])) && (!$force)) {
+ if ((isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) {
// Then abort here
if (!$silentAbort) {
addFatalMessage(getMessage('FILTER_FAILED_ALREADY_ADDED'), array($filterFunction, $filterName));
// Shall we add it?
if (!$dry_run) {
// Simply add it to the array
- $filters[$filterName][$filterFunction] = "Y";
- $counter[$filterName][$filterFunction] = 0;
+ $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "Y";
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction] = 0;
} // END - if
}
// "Unregisters" a filter from the given chain
function UNREGISTER_FILTER ($filterName, $filterFunction, $force = false, $dry_run = false) {
- global $filters, $counter, $loadedFilters;
-
// Extend the filter function name only if not loaded from database
- if (!isset($loadedFilters[$filterName][$filterFunction])) {
+ if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) {
$filterFunction = sprintf("FILTER_%s", strtoupper($filterFunction));
} // END - if
// Is that filter there?
- if ((!isset($filters[$filterName][$filterFunction])) && (!$force)) {
+ if ((!isset($GLOBALS['filters']['chains'][$filterName][$filterFunction])) && (!$force)) {
// Not found, so abort here
addFatalMessage(getMessage('FILTER_FAILED_NOT_REMOVED'), array($filterFunction, $filterName));
return false;
// Shall we remove? (default, not while just showing an extension removal)
if (!$dry_run) {
// Mark for filter removal
- $filters[$filterName][$filterFunction] = "R";
- unset($counter[$filterName][$filterFunction]);
+ $GLOBALS['filters']['chains'][$filterName][$filterFunction] = "R";
+ unset($GLOBALS['filters']['counter'][$filterName][$filterFunction]);
} // END - if
}
// "Runs" the given filters, data is optional and can be any type of data
function RUN_FILTER ($filterName, $data = null, $silentAbort = true) {
- global $filters, $counter;
-
// Is that filter chain there?
- if (!isset($filters[$filterName])) {
+ if (!isset($GLOBALS['filters']['chains'][$filterName])) {
// Then abort here (quick'N'dirty hack)
if ((!$silentAbort) && (defined('FILTER_FAILED_NO_FILTER_FOUND'))) {
// Add fatal message
$returnValue = $data;
// Then run all filters
- foreach ($filters[$filterName] as $filterFunction=>$active) {
+ foreach ($GLOBALS['filters']['chains'][$filterName] as $filterFunction=>$active) {
// Debug message
//* DEBUG: */ echo __FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): name={$filterName},func={$filterFunction},active={$active}<br />\n";
$returnValue = call_user_func_array($filterFunction, array($returnValue));
// Update usage counter
- $counter[$filterName][$filterFunction]++;
+ $GLOBALS['filters']['counter'][$filterName][$filterFunction]++;
} // END - if
} // END - foreach
// Filter for flushing all new filters to the database
function FILTER_FLUSH_FILTERS () {
- global $filters, $counter, $loadedFilters, $SQLs;
+ global $SQLs;
// Clear all previous SQL queries
$SQLs = array();
$removeSQL = "DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_filters` WHERE";
// Write all filters to database
- foreach ($filters as $filterName => $filterArray) {
+ foreach ($GLOBALS['filters']['chains'] as $filterName => $filterArray) {
// Walk through all filters
foreach ($filterArray as $filterFunction => $active) {
// Is this filter loaded?
- if (!isset($loadedFilters[$filterName][$filterFunction])) {
+ if (!isset($GLOBALS['filters']['loaded'][$filterName][$filterFunction])) {
// Add this filter (all filters are active by default)
$insertSQL .= sprintf("('%s','%s','Y'),", $filterName, $filterFunction);
$inserted++;
// Shall we update usage counters (ONLY FOR DEBUGGING!)
if (getConfig('update_filter_usage') == "Y") {
// Update all counters
- foreach ($counter as $filterName => $filterArray) {
+ foreach ($GLOBALS['filters']['counter'] as $filterName => $filterArray) {
// Walk through all filters
foreach ($filterArray as $filterFunction => $cnt) {
// Construct and add the query
// Filter for auto-activation of a extension
function FILTER_AUTO_ACTIVATE_EXTENSION ($data) {
+ // @TODO Try to rewrite this
global $EXT_ALWAYS_ACTIVE;
// Is this extension always activated?
// Filter for updating/validating login data
function FILTER_UPDATE_LOGIN_DATA () {
- global $LAST;
- if (!is_array($LAST)) $LAST = array();
+ if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
// Recheck if logged in
if (!IS_MEMBER()) return false;
if (empty($mod)) $mod = "login";
// This will be displayed on welcome page! :-)
- if (empty($LAST['module'])) {
- $LAST['module'] = $mod; $LAST['online'] = $onl;
+ if (empty($GLOBALS['last']['module'])) {
+ $GLOBALS['last']['module'] = $mod; $GLOBALS['last']['online'] = $onl;
} // END - if
// "what" not set?
************************************************************************/
// Global variable stuff
-global $frame;
-
// Some security stuff...
if (!defined('__SECURITY')) {
$INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
} // END - if
// Shall we display the copyright notice?
- if ((empty($frame)) && (empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) {
+ if ((empty($_GET['frame'])) && (basename($_SERVER['PHP_SELF']) != "mailid_top.php") && (isBooleanConstantAndTrue('WRITE_FOOTER')) && ($GLOBALS['header_sent'] == "2")) {
// Backlink enabled?
if (isBooleanConstantAndTrue('ENABLE_BACKLINK')) {
// Copyright with backlink, thanks! :-)
} // END - if
}
+// Init fatal message array
+function initFatalMessages () {
+ $GLOBALS['fatal_messages'] = array();
+}
+
// Add a fatal error message to the queue array
function addFatalMessage ($message, $extra="") {
- global $FATAL;
-
if (is_array($extra)) {
// Multiple extras for a message with masks
$message = call_user_func_array('sprintf', $extra);
$message = sprintf($message, $extra);
}
- // Add message to $FATAL
- $FATAL[] = $message;
+ // Add message to $GLOBALS['fatal_messages']
+ $GLOBALS['fatal_messages'][] = $message;
// Log fatal messages away
DEBUG_LOG(__FUNCTION__, __LINE__, " message={$message}");
// Getter for total fatal message count
function getTotalFatalErrors () {
- global $FATAL;
-
// Init coun
$count = 0;
// Do we have at least the first entry?
- if (!empty($FATAL[0])) {
+ if (!empty($GLOBALS['fatal_messages'][0])) {
// Get total count
- $count = count($FATAL);
+ $count = count($GLOBALS['fatal_messages']);
} // END - if
// Return value
}
//
function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
- global $DATA, $REPLACER, $_CONFIG;
+ global $DATA, $_CONFIG;
// Make sure all template names are lowercase!
$template = strtolower($template);
//
function COMPILE_CODE($code, $simple = false, $constants = true, $full = true) {
- global $SEC_CHARS, $URL_CHARS;
// Is the code a string?
if (!is_string($code)) {
// Silently return it
return $code;
} // END - if
- $ARRAY = $SEC_CHARS;
+ $ARRAY = $GLOBALS['security_chars'];
// Select smaller set of chars to replace when we e.g. want to compile URLs
- if (!$full) $ARRAY = $URL_CHARS;
+ if (!$full) $ARRAY = $GLOBALS['url_chars'];
// Compile constants
if ($constants) {
}
function AUTOPURGE_ADD_POINTS($uid, $points) {
- global $jackpot;
-
// Check if he has locked points or not
$result = SQL_QUERY_ESC("SELECT ref_payout FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
array(bigintval($uid)), __FILE__, __LINE__);
}
//
-function HTML_ADD_VALID_TAGS()
-{
- global $HTML_TAGS; $OUT = "";
- if (!is_array($HTML_TAGS)) return "";
- foreach ($HTML_TAGS as $tag)
- {
+function HTML_ADD_VALID_TAGS() {
+ $OUT = "";
+ if (!is_array($GLOBALS['html_tags'])) return "";
+ foreach ($GLOBALS['html_tags'] as $tag) {
$OUT .= ", ".strtoupper($tag);
}
$OUT = substr($OUT, 2);
return $OUT;
}
//
-function HTML_CHECK_TAGS($html)
-{
- global $HTML_TAGS;
+function HTML_CHECK_TAGS($html {
$test = stripslashes($html);
- while (ereg("<", $test) && ereg(">", $test))
- {
+ while (ereg("<", $test) && ereg(">", $test)) {
$check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
$check = str_replace("/", "", $check);
- if (!in_array($check, $HTML_TAGS))
- {
+ if (!in_array($check, $GLOBALS['html_tags'])) {
// Invalid tag found!
return "";
}
return $html;
}
//
-function HTML_INSERT_URLS($text)
-{
- global $URL_ENDS, $VALID_EMAIL_CHARS;
+function HTML_INSERT_URLS ($text) {
$test = $text;
// First replace URLs...
$check = substr($test, strpos($test, "http://")); $check2 = $check;
// See ext-html.php if you want to add more URL ends...
- foreach ($URL_ENDS as $end)
+ foreach ($GLOBALS['url_ends'] as $end)
{
if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end));
}
while ($idx > 0)
{
$check = substr($test2, $idx, 1);
- if (!in_array($check, $VALID_EMAIL_CHARS))
+ if (!in_array($check, $GLOBALS['valid_email_chars']))
{
// Char found so we end here
break;
while ($idx < strlen($test))
{
$check = substr($test, $idx, 1);
- if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@"))
+ if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@"))
{
// Char found so end here again
break;
}
//
-function NL_ADD_VALID_TAGS()
-{
- global $HTML_TAGS; $OUT = "";
- if (!is_array($HTML_TAGS)) return "";
- foreach ($HTML_TAGS as $tag)
- {
+function NL_ADD_VALID_TAGS () {
+ $OUT = "";
+ if (!is_array($GLOBALS['html_tags'])) return "";
+ foreach ($GLOBALS['html_tags'] as $tag) {
$OUT .= ", ".strtoupper($tag);
}
$OUT = substr($OUT, 2);
return $OUT;
}
+
//
-function NL_CHECK_TAGS($html)
-{
- global $HTML_TAGS;
+function NL_CHECK_TAGS ($html) {
$test = stripslashes($html);
- while (ereg("<", $test) && ereg(">", $test))
- {
+ while (ereg("<", $test) && ereg(">", $test)) {
$check = strtolower(substr($test, strpos($test, "<") + 1, strpos($test, ">") - strpos($test, "<") - 1));
$check = str_replace("/", "", $check);
- if (!in_array($check, $HTML_TAGS))
- {
+ if (!in_array($check, $GLOBALS['html_tags'])) {
// Invalid tag found!
return "";
}
// Return tested code
return $html;
}
+
//
-function NL_INSERT_URLS($text)
-{
- global $URL_ENDS, $VALID_EMAIL_CHARS;
+function NL_INSERT_URLS ($text) {
$test = $text;
// First replace URLs...
- while (ereg("http://", $test))
- {
+ while (ereg("http://", $test)) {
$check = substr($test, strpos($test, "http://")); $check2 = $check;
// See ext-html.php if you want to add more URL ends...
- foreach ($URL_ENDS as $end)
- {
+ foreach ($GLOBALS['url_ends'] as $end) {
if (ereg($end, $check)) $check = substr($check, 0, strpos($check, $end));
}
// ... what will the email address be out the @... ;-)
$PARTS = array();
- while (ereg("@", $test))
- {
+ while (ereg("@", $test)) {
$pos = strpos($test, "@");
$test2 = substr($test, 0, $pos);
// First check backwards
$idx = $pos - 1;
- while ($idx > 0)
- {
+ while ($idx > 0) {
$check = substr($test2, $idx, 1);
- if (!in_array($check, $VALID_EMAIL_CHARS))
+ if (!in_array($check, $GLOBALS['valid_email_chars']))
{
// Char found so we end here
break;
}
$idx--;
}
- if ($idx > 0)
- {
+
+ if ($idx > 0) {
// Starting mark is found
$check2 = substr($test, 0, ($idx + 1));
$test = substr($test, ($idx + 1));
// And now go forward...
$idx = 0;
- while ($idx < strlen($test))
- {
+ while ($idx < strlen($test)) {
$check = substr($test, $idx, 1);
- if ((!in_array($check, $VALID_EMAIL_CHARS)) && ($check != "@"))
- {
+ if ((!in_array($check, $GLOBALS['valid_email_chars'])) && ($check != "@")) {
// Char found so end here again
break;
}
$idx++;
}
- if ($idx > 0)
- {
+
+ if ($idx > 0) {
// Maybe this is the email address?
$check = substr($test, 0, $idx);
}
// Remove email from testing string (see above why...)
$test = substr($test, strlen($check));
}
+
// Now put all parts together
$text = ""; $PARTS[] = $test;
- foreach ($PARTS as $part)
- {
+ foreach ($PARTS as $part) {
$text .= $part;
}
// Compile possible own HTML tags out...
return COMPILE_CODE($text);
}
+
//
-function SEND_NEWSLETTER($TO, $SUBJECT, $MSG, $MODE)
-{
- global $_POST;
+function SEND_NEWSLETTER ($TO, $SUBJECT, $MSG, $MODE) {
// Send mail away as HTML
if ($_POST['auto_urls'] == "Y") {
// Automatically insert URLs into newsletter
}
}
}
+
//
?>
if ($min_users == 0) {
// Rallye ends without user limitation
- $DATA['min_users'] = RALLYE_END_NO_USER_LIMITATION;
+ $DATA['min_users'] = getMessage('RALLYE_END_NO_USER_LIMITATION');
} else {
// Rallye ends when X members are totally in your exchange
$DATA['min_users'] = RALLYE_END_USERS_1." ".$min_users." ".RALLYE_END_USERS_2;
if ($min_prices == 0) {
// Rallye ends without user limitation
- $DATA['min_prices'] = RALLYE_END_NO_PRICE_LIMITATION;
+ $DATA['min_prices'] = getMessage('RALLYE_END_NO_PRICE_LIMITATION');
} else {
// Rallye ends when X members are totally in your exchange
$DATA['min_prices'] = RALLYE_END_PRICES_1." ".$min_prices." ".RALLYE_END_PRICES_2;
// Add task
SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_task_system` (status, task_type, subject, text, task_created)
-VALUES ('NEW','RALLYE_PURGED','".RALLYE_ADMIN_PURGED.": %s','".RALLYE_ADMIN_PURGED_TEXT."',UNIX_TIMESTAMP())",
+VALUES ('NEW','RALLYE_PURGED','{--RALLYE_ADMIN_PURGED--}: %s','{--RALLYE_ADMIN_PURGED_TEXT--}',UNIX_TIMESTAMP())",
array($title), __FILE__, __LINE__);
}
//require("/usr/share/php/ipfilter.php");
// Generate arrays which holds the relevante chars to replace
-global $SEC_CHARS, $URL_CHARS;
-$SEC_CHARS = array(
+$GLOBALS['security_chars'] = array(
// The chars we are looking for...
'from' => array("{", "}", "/", ".", "'", "$", "(", ")", '{--', '--}', "%", ";", "[", "]", ":", "--"),
// ... and we will replace to.
//
// Note: Do not replace 'to' with 'from' and vise-versa! When you do this all booked URLs will be
// rejected because of the {SLASH}, {DOT} and all below listed items inside the URL.
-$URL_CHARS = array(
+$GLOBALS['url_chars'] = array(
// Search for these secured characters
'to' => array("{SLASH}", "{DOT}", "{PER}", "{DBL_DOT}", "{COMMENT}"),
// Replace with these characters
unset($_GET[$seckey]);
} else {
// Only variables are allowed (non-array) but we secure them all!
- foreach ($SEC_CHARS['from'] as $key => $char) {
+ foreach ($GLOBALS['security_chars']['from'] as $key => $char) {
// Pass all through
- $_GET[$seckey] = str_replace($char , $SEC_CHARS['to'][$key], $_GET[$seckey]);
+ $_GET[$seckey] = str_replace($char , $GLOBALS['security_chars']['to'][$key], $_GET[$seckey]);
}
// Strip all other out
foreach ($_POST as $seckey => $secvalue) {
if (!is_array($secvalue)) {
// Only variables are allowed (non-array) to be secured...
- foreach ($SEC_CHARS['from'] as $key => $char) {
+ foreach ($GLOBALS['security_chars']['from'] as $key => $char) {
// Pass all through
- $_POST[$seckey] = str_replace($char , $SEC_CHARS['to'][$key], $_POST[$seckey]);
+ $_POST[$seckey] = str_replace($char , $GLOBALS['security_chars']['to'][$key], $_POST[$seckey]);
}
// Strip all other out
}
// Do the member form request
function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
- global $SURFBAR_CACHE;
-
// By default no action is performed
$performed = false;
// Is the function there?
if (function_exists($functionName)) {
// Add new status
- $URLs[$formData['id']]['new_status'] = $SURFBAR_CACHE['new_status'];
+ $URLs[$formData['id']]['new_status'] = $GLOBALS['cache_array']['surfbar']['new_status'];
// Extract URL data for call-back
$urlData = array(merge_array($URLs[$formData['id']], array($action => $formData)));
}
// Validate if the requested action can be performed on current URL status
function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
- global $SURFBAR_CACHE;
-
// Search for the requested action/status combination in database
$result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `action`='%s' AND `status`='%s' LIMIT 1",
array($action, $status), __FILE__, __LINE__);
// Fetch the new status if found
if ($isValid) {
// Load new status
- list($SURFBAR_CACHE['new_status']) = SQL_FETCHROW($result);
+ list($GLOBALS['cache_array']['surfbar']['new_status']) = SQL_FETCHROW($result);
} // END - if
// Free result
// Check if the "reload lock" of the current user is full, call this function
// before you call SURFBAR_CHECK_RELOAD_LOCK().
function SURFBAR_CHECK_RELOAD_FULL() {
- global $SURFBAR_CACHE;
-
// Default is full!
$isFull = true;
// Cache static reload lock
- $SURFBAR_CACHE['surf_lock'] = getConfig('surfbar_static_lock');
+ $GLOBALS['cache_array']['surfbar']['surf_lock'] = getConfig('surfbar_static_lock');
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false);
// Do we have dynamic model?
if (getConfig('surfbar_pay_model') == "DYNAMIC") {
// "Calculate" dynamic lock
- $SURFBAR_CACHE['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ $GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
} // END - if
// Ask the database
);
// Fetch row
- list($SURFBAR_CACHE['user_locks']) = SQL_FETCHROW($result);
+ list($GLOBALS['cache_array']['surfbar']['user_locks']) = SQL_FETCHROW($result);
// Is it null?
- if (is_null($SURFBAR_CACHE['user_locks'])) {
+ if (is_null($GLOBALS['cache_array']['surfbar']['user_locks'])) {
// Then fix it to zero!
- $SURFBAR_CACHE['user_locks'] = 0;
+ $GLOBALS['cache_array']['surfbar']['user_locks'] = 0;
} // END - if
// Free result
}
// Generate a validation code for the given id number
function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
- global $SURFBAR_CACHE;
-
// @TODO Invalid salt should be refused
- $SURFBAR_CACHE['salt'] = "INVALID";
+ $GLOBALS['cache_array']['surfbar']['salt'] = "INVALID";
// Get code length from config
$length = getConfig('code_length');
// Is the salt set?
if (empty($salt)) {
// Generate random hashed string
- $SURFBAR_CACHE['salt'] = sha1(GEN_PASS(255));
+ $GLOBALS['cache_array']['surfbar']['salt'] = sha1(GEN_PASS(255));
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false);
} else {
// Use this as salt!
- $SURFBAR_CACHE['salt'] = $salt;
+ $GLOBALS['cache_array']['surfbar']['salt'] = $salt;
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "oldSalt=".SURFBAR_GET_SALT()."", false);
}
}
// Check validation code
function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
- global $SURFBAR_CACHE;
-
// Secure id number
$urlId = bigintval($urlId);
// Determine next id for surfbar or get data for given id, always call this before you call other
// getters below this function!!!
function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) {
- global $SURFBAR_CACHE;
-
// Default is no id and no random number
$nextId = 0;
$randNum = 0;
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "lastQuery=".getConfig('db_last_query')."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."", false);
if (SQL_NUMROWS($result) == 1) {
// Load/cache data
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - BEFORE", false);
- $SURFBAR_CACHE = merge_array($SURFBAR_CACHE, SQL_FETCHARRAY($result));
- //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($SURFBAR_CACHE).") - AFTER", false);
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - BEFORE", false);
+ $GLOBALS['cache_array']['surfbar'] = merge_array($GLOBALS['cache_array']['surfbar'], SQL_FETCHARRAY($result));
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "count(".count($GLOBALS['cache_array']['surfbar']).") - AFTER", false);
// Determine waiting time
- $SURFBAR_CACHE['time'] = SURFBAR_DETERMINE_WAIT_TIME();
+ $GLOBALS['cache_array']['surfbar']['time'] = SURFBAR_DETERMINE_WAIT_TIME();
// Is the last salt there?
- if (is_null($SURFBAR_CACHE['last_salt'])) {
+ if (is_null($GLOBALS['cache_array']['surfbar']['last_salt'])) {
// Then repair it wit the static!
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_salt - FIXED!", false);
- $SURFBAR_CACHE['last_salt'] = "";
+ $GLOBALS['cache_array']['surfbar']['last_salt'] = "";
} // END - if
// Fix missing last_surfed
- if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) {
+ if ((!isset($GLOBALS['cache_array']['surfbar']['last_surfed'])) || (is_null($GLOBALS['cache_array']['surfbar']['last_surfed']))) {
// Fix it here
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "last_surfed - FIXED!", false);
- $SURFBAR_CACHE['last_surfed'] = 0;
+ $GLOBALS['cache_array']['surfbar']['last_surfed'] = 0;
} // END - if
// Get base/fixed reward and costs
- $SURFBAR_CACHE['reward'] = SURFBAR_DETERMINE_REWARD();
- $SURFBAR_CACHE['costs'] = SURFBAR_DETERMINE_COSTS();
+ $GLOBALS['cache_array']['surfbar']['reward'] = SURFBAR_DETERMINE_REWARD();
+ $GLOBALS['cache_array']['surfbar']['costs'] = SURFBAR_DETERMINE_COSTS();
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
// Only in dynamic model add the dynamic bonus!
if (getConfig('surfbar_pay_model') == "DYNAMIC") {
// Calculate dynamic reward/costs and add it
- $SURFBAR_CACHE['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
- $SURFBAR_CACHE['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ $GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
+ $GLOBALS['cache_array']['surfbar']['costs'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "DYNAMIC+ - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
} // END - if
}
// -----------------------------------------------------------------------------
// PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
-// $SURFBAR_CACHE ARRAY!
+// $GLOBALS['cache_array']['surfbar'] ARRAY!
// -----------------------------------------------------------------------------
// Private getter for data elements
function SURFBAR_GET_DATA ($element) {
- global $SURFBAR_CACHE;
//* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element={$element}", false);
// Default is null
$data = null;
// Is the entry there?
- if (isset($SURFBAR_CACHE[$element])) {
+ if (isset($GLOBALS['cache_array']['surfbar'][$element])) {
// Then take it
- $data = $SURFBAR_CACHE[$element];
+ $data = $GLOBALS['cache_array']['surfbar'][$element];
} else { // END - if
print("<pre>");
- print_r($SURFBAR_CACHE);
+ print_r($GLOBALS['cache_array']['surfbar']);
print("</pre>");
debug_report_bug();
}
}
// Autopurge installed?
- $LAST = "";
+ $lastOnline = "";
if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
// Use last online timestamp to keep inactive members away from here
- $LAST = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+ $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
}
$SQLs[] = "SELECT ".$USE." AS points
FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE.">0".$LAST."
+WHERE `status`='CONFIRMED' AND ".$USE.">0".$lastOnline."
ORDER BY points DESC, userid";
$WHATs[] = "list_bonus";
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BONUS');
// Begging rallye
// Autopurge installed?
- $LAST = "";
+ $lastOnline = "";
if ((EXT_IS_ACTIVE("autopurge")) && (getConfig('autopurge_inactive') == "Y") && (getConfig('ap_inactive_since') > 0)) {
// Use last online timestamp to keep inactive members away from here
- $LAST = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
+ $lastOnline = sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
}
$SQLs[] = "SELECT userid FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points>0".$LAST."
+WHERE `status`='CONFIRMED' AND beg_points>0".$lastOnline."
ORDER BY beg_points DESC, userid";
$WHATs[] = "list_beg";
$DESCRs[] = getMessage('ADMIN_TASK_LIST_BEG');
}
// Initialize variables
-$currTheme = GET_CURR_THEME();
+$GLOBALS['curr_theme'] = GET_CURR_THEME();
// Check if new theme is selcted
-if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $currTheme)) {
+if ((!empty($_POST['new_theme'])) && ($_POST['new_theme'] != $GLOBALS['curr_theme'])) {
// Set new theme for guests
$newTheme = $_POST['new_theme'];
set_session('mxchange_theme', $newTheme);
// Remove current from array and set new
- $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $currTheme);
+ $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), $GLOBALS['curr_theme']);
unset($INC_POOL[array_search($theme, $INC_POOL)]);
$INC_POOL[] = sprintf("%stheme/%s/theme.php", constant('PATH'), $newTheme);
} // END - if
// Do the user login
function USER_DO_LOGIN ($uid, $passwd) {
// Add last_login if available
- $LAST = "";
+ $lastOnline = "";
if (GET_EXT_VERSION("sql_patches") >= "0.2.8") {
- $LAST = ", last_login";
+ $lastOnline = ", last_login";
} // END - if
// Check login data
$password = ""; $uid2 = ""; $dmy = ""; $online = 0; $login = 0;
if ((EXT_IS_ACTIVE("nickname")) && (NICKNAME_PROBE_ON_USERID($uid))) {
// Nickname entered
- $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE nickname='%s' AND `status`='CONFIRMED' LIMIT 1",
array($uid), __FILE__, __LINE__);
list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
if (!empty($uid2)) $uid = bigintval($uid2);
} else {
// Direct userid entered
- $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$LAST." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT userid, password, last_online".$lastOnline." FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s AND `status`='CONFIRMED' LIMIT 1",
array($uid, $hash), __FILE__, __LINE__);
list($uid2, $password, $online, $login) = SQL_FETCHROW($result);
}
}
} else {
// Cannot update counter!
- $URL = "modules.php?module=index&what=login&login=".CODE_CNTR_FAILED;
+ $URL = "modules.php?module=index&what=login&login=".constant('CODE_CNTR_FAILED');
}
} else {
// Cookies not setable!
- $URL = "modules.php?module=index&what=login&login=".CODE_NO_COOKIES;
+ $URL = "modules.php?module=index&what=login&login=".constant('CODE_NO_COOKIES');
}
} elseif (GET_EXT_VERSION("sql_patches") >= "0.6.1") {
// Update failture counter
array($uid), __FILE__, __LINE__);
// Wrong password!
- $URL = "modules.php?module=index&what=login&login=".CODE_WRONG_PASS;
+ $URL = "modules.php?module=index&what=login&login=".constant('CODE_WRONG_PASS');
}
} elseif ((($probe_nickname) && (!empty($uid2))) || ($uid2 == $uid)) {
// Other account status?
// Sets a status message and code
function WERNIS_STATUS_MESSAGE ($msg, $status) {
- global $WERNIS;
- $WERNIS['message'] = $msg;
- $WERNIS['status'] = $status;
+ $GLOBALS['wernis_data']['message'] = $msg;
+ $GLOBALS['wernis_data']['status'] = $status;
}
// Get the status message
function GET_WERNIS_ERROR_MESSAGE () {
- global $WERNIS;
- if (isset($WERNIS['message'])) {
+ if (isset($GLOBALS['wernis_data']['message'])) {
// Use raw message
- return $WERNIS['message'];
- } elseif (isset($WERNIS['status'])) {
+ return $GLOBALS['wernis_data']['message'];
+ } elseif (isset($GLOBALS['wernis_data']['status'])) {
// Fall-back to status
- return sprintf(WERNIS_ERROR_STATUS, $WERNIS['status']);
+ return sprintf(WERNIS_ERROR_STATUS, $GLOBALS['wernis_data']['status']);
} else {
// Something bad happend
return WERNIS_UNKNOWN_ERROR;
// Get the status code
function GET_WERNIS_ERROR_CODE () {
- global $WERNIS;
- if (isset($WERNIS['status'])) {
+ if (isset($GLOBALS['wernis_data']['status'])) {
// Use raw message
- return $WERNIS['status'];
+ return $GLOBALS['wernis_data']['status'];
} else {
// Something bad happend
return WERNIS_UNKNOWN_ERROR;
}
// Init variables
-global $EXT_CSS_FILES;
-$EXT_CSS_FILES = array();
+EXT_INIT_CSS_FILES();
$ADD = "";
// Init cache instance and array
$EXT_NAMES = array();
foreach ($EXT_DUMMY['ext_name'] as $k => $name) {
// Load CSS file
- if ($EXT_DUMMY['ext_css'][$k] == "Y") $EXT_CSS_FILES[] = "".$name.".css";
+ if ($EXT_DUMMY['ext_css'][$k] == "Y") EXT_ADD_CSS_FILE("".$name.".css");
// Load extension file itself
if ((($EXT_DUMMY['ext_active'][$k] == "Y") || ($EXT_DUMMY['ext_keep'][$k] == "Y") || (IS_ADMIN())) && (!in_array($name, array("sql_patches", "cache")))) {
// Is the file there?
if (FILE_READABLE($GLOBALS['output_mode']_FILE)) {
// CSS file for extension was found (use only relative path for now!)
- $EXT_CSS_FILES[] = $content['ext_name'].".css";
+ EXT_ADD_CSS_FILE($content['ext_name'].".css");
$content['ext_css'] = "Y";
} else {
// Don't load CSS file
// Check for cache file
if (($GLOBALS['cache_instance']->loadCacheFile("admins_acls")) && ($GLOBALS['cache_instance']->extensionVersionMatches("admins"))) {
// Load referal system from cache
- global $GLOBALS['cache_array'];
$GLOBALS['cache_array']['admin_acls'] = $GLOBALS['cache_instance']->getArrayFromCache();
} elseif ((getConfig('cache_acls') == "Y") && ($GLOBALS['output_mode'] != "1") && ($GLOBALS['output_mode'] != "-1")) {
// Create cache file here
//
function ADMIN_DO_ACTION($wht) {
- global $menuDesription, $menuTitle, $DATA;
+ global $DATA;
//* DEBUG: */ echo __LINE__."*".$wht."/".$GLOBALS['module']."/".$GLOBALS['action']."/".$GLOBALS['what']."*<br />\n";
// Remove any spaces from variable
}
//
function ADD_ADMIN_MENU($act, $wht, $return=false) {
- global $menuDesription, $menuTitle;
-
// Init variables
$SUB = false;
$OUT = "";
// Menu descriptions
- $menuDesription = array();
- $menuTitle = array();
+ $GLOBALS['menu']['description'] = array();
+ $GLOBALS['menu']['title'] = array();
// Is there a cache instance?
if ((is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
// Extract all parts
$OUT = base64_decode($data['output'][0]);
- $menuTitle = unserialize(base64_decode($data['title'][0]));
- $menuDescription = unserialize(base64_decode($data['descr'][0]));
+ $GLOBALS['menu']['title'] = unserialize(base64_decode($data['title'][0]));
+ $GLOBALS['menu']['description'] = unserialize(base64_decode($data['descr'][0]));
// Return or output content?
if ($return) {
if ($ACL === true) {
if (!$SUB) {
// Insert compiled menu title and description
- $menuTitle[$menu] = $title;
- $menuDesription[$menu] = $descr;
+ $GLOBALS['menu']['title'][$menu] = $title;
+ $GLOBALS['menu']['description'][$menu] = $descr;
}
$OUT .= "<tr>
<td class=\"admin_menu\" colspan=\"2\">
array($menu), __FILE__, __LINE__);
if ((SQL_NUMROWS($result_what) > 0) && ($act == $menu))
{
- $menuDesription = array();
- $menuTitle = array(); $SUB = true;
+ $GLOBALS['menu']['description'] = array();
+ $GLOBALS['menu']['title'] = array(); $SUB = true;
$OUT .= "<tr>
<td width=\"10\" class=\"seperator\"> </td>
<td class=\"admin_menu\">
$readable = INCLUDE_READABLE($INC);
if ($ACL === true) {
// Insert compiled title and description
- $menuTitle[$wht_sub] = $title_what;
- $menuDesription[$wht_sub] = $desc_what;
+ $GLOBALS['menu']['title'][$wht_sub] = $title_what;
+ $GLOBALS['menu']['description'][$wht_sub] = $desc_what;
$OUT .= "<tr>
<td class=\"admin_menu\" colspan=\"2\">
<NOBR> <strong>--></strong> ";
// Prepare cache data
$data = array(
'output' => base64_encode($OUT),
- 'title' => $menuTitle,
- 'descr' => $menuDesription
+ 'title' => $GLOBALS['menu']['title'],
+ 'descr' => $GLOBALS['menu']['description']
);
// Write the data away
} // END - if
// Autopurge installed?
- $LAST = "%s"; $ONLINE = "";
+ $lastOnline = "%s"; $ONLINE = "";
if (EXT_IS_ACTIVE("autopurge")) {
// Use last online timestamp to keep inactive members away from here
- $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
} // END - if
// Check if at least one is in the active rallye
$result = SQL_QUERY_ESC("SELECT userid, email, gender, surname, family, beg_points, last_online
FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND beg_points > 0".$LAST."
+WHERE `status`='CONFIRMED' AND beg_points > 0".$lastOnline."
ORDER BY beg_points DESC, last_online DESC, userid",
array($ONLINE), __FILE__, __LINE__);
}
// Autopurge installed?
- $LAST = "%s"; $ONLINE = "";
+ $lastOnline = "%s"; $ONLINE = "";
if (EXT_IS_ACTIVE("autopurge")) {
// Use last online timestamp to keep inactive members away from here
- $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
// Check if at least one is in the active rallye
$result = SQL_QUERY_ESC("SELECT userid AS uid, email, gender, surname, family, ".$USE." AS points, last_online AS last
FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE `status`='CONFIRMED' AND ".$USE." > 0".$LAST."
+WHERE `status`='CONFIRMED' AND ".$USE." > 0".$lastOnline."
ORDER BY points DESC, last_online DESC, userid",
array($ONLINE), __FILE__, __LINE__);
// Are there jobs to be done?
if ($JOBS_DONE) {
// Generate overview of all main menus
- global $menuDesription;
- if ((is_array($menuDesription)) && (sizeof($menuDesription) > 0)) {
+ if ((is_array($GLOBALS['menu']['description'])) && (sizeof($GLOBALS['menu']['description']) > 0)) {
$OUT = "";
- foreach ($menuDesription as $key => $value)
+ foreach ($GLOBALS['menu']['description'] as $key => $value)
{
// Prepare content
$content = array(
- 'title' => $menuTitle[$key],
+ 'title' => $GLOBALS['menu']['title'][$key],
'text' => $value
);
set_session('mxchange_theme', $POST['default_theme']);
// Set it in config and current theme as well
- global $currTheme;
- $currTheme = $POST['default_theme'];
+ $GLOBALS['curr_theme'] = $POST['default_theme'];
setConfigEntry('default_theme', $POST['default_theme']);
// Save theme
ADD_DESCR("member", __FILE__);
// Autopurge installed?
-$LAST = "%s"; $ONLINE = "";
+$lastOnline = "%s"; $ONLINE = "";
if (EXT_IS_ACTIVE("autopurge")) {
// Use last online timestamp to keep inactive members away from here
- $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
// Let's check if there are some points left we can "pay"...
$result = SQL_QUERY_ESC("SELECT userid, beg_points AS beg, last_online FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE beg_points > 0 AND `status`='CONFIRMED'".$LAST."
+WHERE beg_points > 0 AND `status`='CONFIRMED'".$lastOnline."
ORDER BY beg_points DESC, last_online DESC, userid LIMIT %s",
array($ONLINE, getConfig('beg_ranks')), __FILE__, __LINE__);
}
// Autopurge installed?
-$LAST = "%s"; $ONLINE = "";
+$lastOnline = "%s"; $ONLINE = "";
if (EXT_IS_ACTIVE("autopurge")) {
// Use last online timestamp to keep inactive members away from here
- $LAST = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
+ $lastOnline = " AND last_online >= (UNIX_TIMESTAMP() - %s)";
$ONLINE = getConfig('ap_inactive_since');
}
// Let's check if there are some points left we can "pay"...
$result = SQL_QUERY_ESC("SELECT userid, ".$USE." AS points, last_online FROM `{!_MYSQL_PREFIX!}_user_data`
-WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$LAST."
+WHERE ".$USE." > 0 AND `status`='CONFIRMED'".$lastOnline."
ORDER BY points DESC, last_online DESC, userid
LIMIT %s",
array($ONLINE, getConfig('bonus_ranks')), __FILE__, __LINE__);
ADD_DESCR ("member", basename(__FILE__));
// Export data for template
-define('_LAST_ONLINE_VALUE', MAKE_DATETIME($LAST['online']));
-define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $LAST['module']));
+define('_LAST_ONLINE_VALUE', MAKE_DATETIME($GLOBALS['last']['online']));
+define('_LAST_MODULE_VALUE', GET_MOD_DESCR("member", $GLOBALS['last']['module']));
// Load header template
LOAD_TEMPLATE("member_welcome_header");
$GLOBALS['header_sent'] = 0;
// Init fatal messages
-global $FATAL;
-$FATAL = array();
+initFatalMessages();
// Check if this file is writeable or read-only and warn the user
if ((!isBooleanConstantAndTrue('mxchange_installing')) && (isBooleanConstantAndTrue('mxchange_installed'))) {
if (empty($GLOBALS['module'])) $GLOBALS['module'] = "index";
// CSS array
- $EXT_CSS_FILES = array();
+ EXT_INIT_CSS_FILES();
if ((!empty($MySQL['host'])) && (!empty($MySQL['login'])) && (!empty($MySQL['password'])) && (!empty($MySQL['dbase']))) {
// Connect to DB
// Add menu description pending on given file name (without path!)
function ADD_DESCR ($ACC_LVL, $FQFN, $return = false, $output = true) {
- global $NAV_DEPTH;
-
// Use only filename of the FQFN...
$file = basename($FQFN);
}
// Begin the navigation line
- if ((!isset($NAV_DEPTH)) && (!$return)) {
- $NAV_DEPTH = 0;
+ if ((!isset($GLOBALS['nav_depth'])) && (!$return)) {
+ $GLOBALS['nav_depth'] = 0;
$prefix = "<div class=\"you_are_here\">{--YOU_ARE_HERE--} <strong><a class=\"you_are_here\" href=\"{!URL!}/modules.php?module=".$GLOBALS['module'].$LINK_ADD."\">Home</a></strong>";
} else {
- if (!$return) $NAV_DEPTH++;
+ if (!$return) $GLOBALS['nav_depth']++;
$prefix = "";
}
//* DEBUG: */ echo __LINE__."+".$type."+<br />\n";
// Add closing div and br-tag
$OUT .= "</div><br />\n";
- $NAV_DEPTH = "0";
+ $GLOBALS['nav_depth'] = "0";
// Run the filter chain
$ret = RUN_FILTER('post_youhere_line', array('access_level' => $ACC_LVL, 'type' => $type, 'content' => ""));
// Generates a list of "max receiveable emails per day"
function ADD_MAX_RECEIVE_LIST ($MODE, $default = "", $return = false) {
- global $_POST;
$OUT = "";
switch ($MODE) {
case "guest":
// Checks wether the current user is a member
function IS_MEMBER () {
- global $status, $LAST;
- if (!is_array($LAST)) $LAST = array();
+ // @TODO Why is this global??? #100
+ global $status;
+ if (!is_array($GLOBALS['last'])) $GLOBALS['last'] = array();
$ret = false;
// is the cache entry there?
$valPass = generatePassString($password);
// Transfer last module and online time
- if ((!empty($mod)) && (empty($LAST['module']))) {
- $LAST['module'] = $mod;
- $LAST['online'] = $onl;
+ if ((!empty($mod)) && (empty($GLOBALS['last']['module']))) {
+ $GLOBALS['last']['module'] = $mod;
+ $GLOBALS['last']['online'] = $onl;
} // END - if
// So did we now have valid data and an unlocked user?
// Return result
return $ret;
}
+
//
-function GET_MOD_DESCR($MODE, $wht, $column="what")
-{
+function GET_MOD_DESCR($MODE, $wht, $column="what") {
// Fix empty "what"
if (empty($wht)) {
$wht = "welcome";
}
// Get action value from mode (admin/guest/member) and what-value
function GET_ACTION ($MODE, &$wht) {
- global $ret;
-
- // @DEPRECATED Init status
+ // Init status
$ret = "";
//* DEBUG: */ echo __LINE__."=".$MODE."/".$wht."/".$GLOBALS['action']."=<br />";
}
// Need this here
-global $REPLACER;
-
// Only send bonus mail when bonus extension is active and maximum send-mails is not reached
if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
// Do we need to send out bonus mails?
// Mark this user as "spammed" ;-) And place a line for him...
if (REMOVE_RECEIVER($dummy, $key, $uid, $DATA['id'], $DATA['id'], true) == "done") {
// Replace text variables
- foreach ($REPLACER as $key => $value) {
+ foreach ($GLOBALS['replacer'] as $key => $value) {
if (isset($DATA[$key])) $DATA['text'] = str_replace($value, $DATA[$key], $DATA['text']);
} // END - foreach
}
// Need this here
-global $REPLACER;
-
// Check for freed mail orders to send out
if (EXT_IS_ACTIVE("html_mail")) {
// 0 1 2 3 4 5 6 7 8 9 10
}
// Reset variables
-$cnt2 = 0; $LAST_SENT_ID = 0; $cnt_back = array("0"); $pointsBack = array("0");
+$cnt2 = 0; $lastSentId = 0; $cnt_back = array("0"); $pointsBack = array("0");
if (SQL_NUMROWS($result_main) > 0) {
// Parse all mails
while ($DATA = SQL_FETCHROW($result_main)) {
$DATA[14] = TRANSLATE_GENDER($gender);
// Replace text variables
- foreach ($REPLACER as $key => $value) {
+ foreach ($GLOBALS['replacer'] as $key => $value) {
if (isset($DATA[$key])) $DATA[3] = str_replace($value, $DATA[$key], $DATA[3]);
} // END - if
}
// Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
- //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$LAST_SENT_ID."!=".$DATA[0]."*<br />";
- if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($LAST_SENT_ID != $DATA[0])) {
+ //* DEBUG: */ echo "*L:".__LINE__."/".$GLOBALS['pool_cnt'].">=".$DATA[8]."/".getConfig('max_send').">=".$GLOBALS['pool_cnt']."/".$lastSentId."!=".$DATA[0]."*<br />";
+ if ((($GLOBALS['pool_cnt'] >= $DATA[8])) && ($lastSentId != $DATA[0])) {
// Prepare content
$content = array(
'sender_uid' => $DATA[1],
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_stats` SET timestamp_send=UNIX_TIMESTAMP() WHERE pool_id=%s LIMIT 1",
array(bigintval($DATA[0])), __FILE__, __LINE__);
- $LAST_SENT_ID = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
+ $lastSentId = $DATA[0]; $GLOBALS['pool_cnt'] = 0;
$cnt2 += $GLOBALS['pool_cnt'];
// Update mediadata if version is 0.0.4 or higher
// Output CSS files or content or link to css.php ?
if (($GLOBALS['output_mode'] == "1") || (getConfig('css_php') == "DIRECT")) {
// Load CSS files
- if (is_array($EXT_CSS_FILES)) {
- // Load extension's CSS files
- foreach ($EXT_CSS_FILES as $value) $STYLES[] = $value;
- } // END - if
+ $STYLES = merge_array($STYLES, EXT_GET_CSS_FILES());
// Output inclusion lines
foreach ($STYLES as $value) {
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
-
-// Set "CSS-Mode"
-$GLOBALS['output_mode'] = "0";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "index";
+// Set "CSS-Mode"
+$GLOBALS['output_mode'] = "0";
+
// Load config.php
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
// pattern is given...
//
// But mxchange 0.3.0 will show that in better way! :D :D :D
-$GLOBALS['output_mode'] = "1"; $GLOBALS['module'] = "js";
+$GLOBALS['output_mode'] = "1";
+$GLOBALS['module'] = "js";
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "lead-confirm";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "login";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "mailid";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Tell everyone we are in this module
-$GLOBALS['module'] = "mailid"; $GLOBALS['output_mode'] = 0;
+$GLOBALS['module'] = "mailid";
+$GLOBALS['output_mode'] = 0;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
$GLOBALS['output_mode'] = 0;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
$GLOBALS['userid'] = 0;
// Fix missing module to "index"
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "ref"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "ref";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime;
$GLOBALS['startTime'] = microtime(true);
$GLOBALS['what'] = "";
$GLOBALS['action'] = "";
// Set this because we have no module in URI
-$GLOBALS['module'] = "show_bonus"; $GLOBALS['output_mode'] = 0;
+$GLOBALS['module'] = "show_bonus";
+$GLOBALS['output_mode'] = 0;
// Load the required file(s)
require("inc/config.php");
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "sponsor_confirm";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
// Set module
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action, $startTime, $SURFBAR_CACHE;
-$SURFBAR_CACHE = array();
+$GLOBALS['cache_array']['surfbar'] = array();
$GLOBALS['startTime'] = microtime(true);
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
$GLOBALS['module'] = "surfbar";
require("inc/libs/security_functions.php");
// Init "action" and "what"
-global $what, $action;
-$GLOBALS['what'] = ""; $GLOBALS['action'] = "";
+$GLOBALS['what'] = "";
+$GLOBALS['action'] = "";
// Set module
-$GLOBALS['module'] = "view"; $GLOBALS['output_mode'] = -1;
+$GLOBALS['module'] = "view";
+$GLOBALS['output_mode'] = -1;
// Load the required file(s)
require("inc/config.php");