$template = strtolower($template);
// Count the template load
- if (getConfig('num_templates') == null) {
- $_CONFIG['num_templates'] = 1;
- } else {
- $_CONFIG['num_templates']++;
- }
+ incrementConfigEntry('num_templates');
// Prepare IP number and User Agent
$REMOTE_ADDR = GET_REMOTE_ADDR();
//
// Generate a password in a specified length or use default password length
-function GEN_PASS($LEN = 0) {
- global $_CONFIG;
+function GEN_PASS ($LEN = 0) {
+ // Auto-fix invalid length of zero
if ($LEN == 0) $LEN = getConfig('pass_len');
// Initialize array with all allowed chars
}
//
function SET_LANGUAGE($lang) {
- global $_CONFIG;
-
// Accept only first 2 chars!
$lang = substr(SQL_ESCAPE(strip_tags($lang)), 0, 2);
}
//
function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
- global $DATA, $_CONFIG, $REPLACER;
+ global $DATA, $REPLACER;
// Make sure all template names are lowercase!
$template = strtolower($template);
}
//
function LOAD_URL($URL, $addUrlData=true) {
- global $CSS, $_CONFIG, $footer;
+ global $CSS, $footer;
// Compile out URI codes
$URL = COMPILE_CODE($URL);
if (((!defined('__COOKIES')) || (!__COOKIES)) && ($addUrlData)) $URL = ADD_URL_DATA($URL);
// Probe for bot from search engine
- if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT())) || (eregi("spider", GET_USER_AGENT()))) {
+ if ((eregi("spider", GET_USER_AGENT())) || (eregi("bot", GET_USER_AGENT()))) {
// Search engine bot detected so let's rewrite many chars for the link
$URL = htmlentities(strip_tags($URL), ENT_QUOTES);
}
//
function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
- global $MONTH_DESCR, $_CONFIG;
+ global $MONTH_DESCR;
$OUT = "";
if ($type == "yn") {
// Optional : $DATA
//
function GEN_RANDOM_CODE($length, $code, $uid, $DATA="") {
- global $_CONFIG;
-
// Fix missing _MAX constant
if (!defined('_MAX')) define('_MAX', 15235);
}
// Insert the code in $img_code into jpeg or PNG image
function GENERATE_IMAGE($img_code, $header=true) {
- global $_CONFIG;
-
if ((strlen($img_code) > 6) || (empty($img_code)) || (getConfig('code_length') == 0)) {
// Stop execution of function here because of over-sized code length
return;
}
// Create selection box or array of splitted timestamp
function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="center", $return_array=false) {
- global $_CONFIG;
-
// Calculate 2-seconds timestamp
$stamp = round($timestamp);
//* DEBUG: */ print("*".$stamp."/".$timestamp."*<br />");
return $OUT;
}
//
-function CREATE_TIMESTAMP_FROM_SELECTIONS($prefix, $POST) {
- global $_CONFIG;
+function CREATE_TIMESTAMP_FROM_SELECTIONS ($prefix, $POST) {
+ // Initial return value
$ret = 0;
// Do we have a leap year?
// Sends a raw request to another host
function SEND_RAW_REQUEST ($host, $request) {
- global $_CONFIG;
-
// Initialize array
$response = array("", "", "");
}
// Generate a hash for extra-security for all passwords
function generateHash ($plainText, $salt = "") {
- global $_CONFIG, $_SERVER;
+ global $_SERVER;
// Is the required extension "sql_patches" there and a salt is not given?
if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (!EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) {
}
//
function scrambleString($str) {
- global $_CONFIG;
-
// Init
$scrambled = "";
}
//
function descrambleString($str) {
- global $_CONFIG;
// Scramble only 40 chars long strings
if (strlen($str) != 40) return $str;
}
// Append data like session ID or referal ID to the given URL which would
// normally be stored in cookies
-function ADD_URL_DATA($URL) {
- global $_CONFIG;
+function ADD_URL_DATA ($URL) {
+ // Init add
$ADD = "";
// Determine URL binder
}
// Generate an PGP-like encrypted hash of given hash for e.g. cookies
function generatePassString($passHash) {
- global $_CONFIG;
-
// Return vanilla password hash
$ret = $passHash;
// Display parsing time and number of SQL queries in footer
function DISPLAY_PARSING_TIME_FOOTER() {
- global $_CONFIG;
-
// Is the timer started?
if (!isset($GLOBALS['startTime'])) {
// Abort here
}
// Load more reset scripts
function RESET_ADD_INCLUDES () {
- global $_CONFIG;
-
// Is the reset set or old sql_patches?
if ((!defined('__DAILY_RESET')) || (EXT_VERSION_IS_OLDER("sql_patches", "0.4.5"))) {
// Then abort here
}
// Rebuild cache
function REBUILD_CACHE ($cache, $inc="") {
- global $cacheInstance, $_CONFIG, $CSS;
+ global $cacheInstance, $CSS;
// Shall I remove the cache file?
if ((EXT_IS_ACTIVE("cache")) && (is_object($cacheInstance))) {
}
// Determines referal id and sets it
function DETERMINE_REFID () {
- global $_CONFIG, $CLICK, $_SERVER;
+ global $CLICK, $_SERVER;
// Check if refid is set
if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
// Get current theme name
function GET_CURR_THEME() {
- global $INC_POOL, $_CONFIG, $CSS, $cacheArray;
+ global $INC_POOL, $CSS, $cacheArray;
// The default theme is 'default'... ;-)
$ret = "default";
// Get id from theme
function THEME_GET_ID ($name) {
- global $cacheArray, $_CONFIG;
+ global $cacheArray;
// Is the extension "theme" installed?
if (!EXT_IS_ACTIVE("theme")) {
$id = $cacheArray['themes']['id'][$name];
// Count up
- if (getConfig('cache_hits') > 0) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; }
+ incrementConfigEntry('cache_hits');
} elseif (GET_EXT_VERSION("cache") != "0.1.8") {
// Check if current theme is already imported or not
$result = SQL_QUERY_ESC("SELECT id FROM `"._MYSQL_PREFIX."_themes` WHERE theme_path='%s' LIMIT 1",
return $id;
}
+// Increment or init with 1 the given config entry
+function incrementConfigEntry ($configEntry) {
+ global $_CONFIG;
+
+ // Increment it if set or init it with 1
+ if (getConfig($configEntry) > 0) { $_CONFIG[$configEntry]++; } else { $_CONFIG[$configEntry] = 1; }
+}
+
//////////////////////////////////////////////////
// //
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //