Fixes/rewrites for 'dublicate entry' bug
authorRoland Häder <roland@mxchange.org>
Wed, 4 Mar 2009 18:15:58 +0000 (18:15 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 4 Mar 2009 18:15:58 +0000 (18:15 +0000)
36 files changed:
inc/autopurge.php
inc/autopurge/purge-inact.php
inc/autopurge/purge-mails.php
inc/autopurge/purge-tsks.php
inc/autopurge/purge-unconfirmed.php
inc/databases.php
inc/db/lib-mysql3.php
inc/doubler_send.php
inc/extensions.php
inc/extensions/ext-cache.php
inc/extensions/ext-sql_patches.php
inc/functions.php
inc/libs/cache_functions.php
inc/libs/surfbar_functions.php
inc/libs/wernis_functions.php
inc/libs/yoomedia_functions.php
inc/load_cache.php
inc/load_extensions.php
inc/loader/load_cache-admin.php
inc/loader/load_cache-config.php
inc/loader/load_cache-modreg.php
inc/loader/load_cache-refdepths.php
inc/loader/load_cache-refsystem.php
inc/loader/load_cache-them.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_primera.php
inc/modules/admin/what-config_refback.php
inc/modules/admin/what-config_transfer.php
inc/modules/admin/what-config_wernis.php
inc/modules/admin/what-config_yoomedia.php
inc/modules/admin/what-updates.php
inc/modules/member/what-primera.php
inc/modules/member/what-wernis.php
inc/monthly/monthly_beg.php
inc/monthly/monthly_bonus.php
inc/pool-update.php

index 72b242a..aec79e6 100644 (file)
@@ -37,11 +37,8 @@ if (!defined('__SECURITY')) {
        require($INC);
 } // END - if
 
-// Load all includes
-$INC_POOL = GET_DIR_AS_ARRAY("inc/autopurge/", "purge-");
-
 // Run the filter
-runFilterChain('load_includes', $INC_POOL);
+runFilterChain('load_includes', GET_DIR_AS_ARRAY("inc/autopurge/", "purge-"));
 
 // Run filters for extra autopurge
 runFilterChain('extra_autopurge');
index c015fc5..adb04be 100644 (file)
@@ -46,7 +46,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 // Shall I look for inactive accounts and autopurge inactive accounts?
 if (getConfig('autopurge_inactive') == "Y") {
        // Ok, let's have a look...
-       $since = bigintval(getConfig('ap_inactive_since'));
+       $since = getConfig(('ap_inactive_since'));
 
        // Init exclusion list
        $EXCLUDE_LIST = "";
@@ -107,7 +107,7 @@ ORDER BY d.userid", array($since, $since, $since), __FILE__, __LINE__);
 
        // Now let's have a look for inactive accounts we want to delete we newly use the same exclude list
        // here for e.g. excluding holiday users
-       $time = bigintval(getConfig('ap_in_time'));
+       $time = getConfig(('ap_in_time'));
        $result_inactive = SQL_QUERY_ESC("SELECT d.userid, d.email, d.last_online
 FROM `{!_MYSQL_PREFIX!}_user_data` AS d
 WHERE `status`='CONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s) AND last_online < (UNIX_TIMESTAMP() - %s) AND ap_notified < (UNIX_TIMESTAMP() - %s)
index 7d5de27..3970e29 100644 (file)
@@ -46,7 +46,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 // Search for mails from deleted members?
 if (getConfig('ap_del_mails') == "Y") {
        // Okay, let's check for them...
-       $since = bigintval(getConfig('ap_dm_timeout'));
+       $since = getConfig(('ap_dm_timeout'));
        $result_mails = SQL_QUERY_ESC("SELECT sender\
 FROM `{!_MYSQL_PREFIX!}_pool`
 WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
@@ -70,7 +70,7 @@ ORDER BY sender ASC",
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
-                               $since = bigintval(getConfig('ap_dm_timeout'));
+                               $since = getConfig(('ap_dm_timeout'));
                                $result_mails = SQL_QUERY_ESC("SELECT sender
 FROM `{!_MYSQL_PREFIX!}_pool`
 WHERE data_type='DELETED' AND timestamp <= (UNIX_TIMESTAMP() - %s)
@@ -84,7 +84,7 @@ ORDER BY sender ASC",
        SQL_FREERESULT($result_mails);
 
        // Now let's check for stats entries as well
-       $since = bigintval(getConfig('ap_dm_timeout'));
+       $since = getConfig(('ap_dm_timeout'));
        $result_mails = SQL_QUERY_ESC("SELECT sender
 FROM `{!_MYSQL_PREFIX!}_user_stats`
 WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
@@ -103,7 +103,7 @@ ORDER BY sender ASC",
                                $DELETED += SQL_AFFECTEDROWS();
 
                                // Reset query (to prevent possible errors) ...
-                               $since = bigintval(getConfig('ap_dm_timeout'));
+                               $since = getConfig(('ap_dm_timeout'));
                                $result_mails = SQL_QUERY_ESC("SELECT sender
 FROM `{!_MYSQL_PREFIX!}_user_stats`
 WHERE data_type='DELETED' AND timestamp_send <= (UNIX_TIMESTAMP() - %s)
index dde1e7c..5cdc442 100644 (file)
@@ -46,7 +46,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 // Check version (must be > 0.0)
 if ((GET_EXT_VERSION("task") > "0.0") && (getConfig('ap_tasks') == "Y")) {
        // Since when shall we purge?
-       $since = bigintval(getConfig('ap_tasks_time'));
+       $since = getConfig(('ap_tasks_time'));
 
        // Purge deleted tasks (no notification to admin)
        SQL_QUERY_ESC("DELETE LOW_PRIORITY
index baa56db..8871ffd 100644 (file)
@@ -46,7 +46,7 @@ if ((!EXT_IS_ACTIVE("autopurge")) || (getConfig('auto_purge_active') != "Y")) {
 // Shall I auto-purge unconfirmed accounts?
 if (getConfig('autopurge_unconfirmed') == "Y") {
        // Init variables and find unconfirmed accounts which I shall auto-purge
-       $time = bigintval(getConfig('ap_un_time'));
+       $time = getConfig(('ap_un_time'));
        $result_uncon = SQL_QUERY_ESC("SELECT userid, email, joined
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE `status`='UNCONFIRMED' AND joined < (UNIX_TIMESTAMP() - %s)
index 5306254..de16a5b 100644 (file)
@@ -98,7 +98,7 @@ define('SERVER_URL', "http://www.mxchange.org");
 
 // Current SVN revision
 //define('CURR_SVN_REVISION', getActualVersion(0));
-define('CURR_SVN_REVISION', "817");
+define('CURR_SVN_REVISION', "818");
 define('CURR_SVN_DATE'    , getActualVersion(1));
 define('CURR_SVN_VERSION' , getActualVersion(2));
 
index 88a1357..b325078 100644 (file)
@@ -203,12 +203,12 @@ function SQL_CLOSE ($F, $L) {
 
        // Do we need to update cache/db counter?
        //* DEBUG: */ echo "DB=".getConfig('db_hits').",CACHE=".getConfig('cache_hits')."<br />\n";
-       if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (is_object($GLOBALS['cache_instance']))) {
+       if ((GET_EXT_VERSION("cache") >= "0.0.7") && (getConfig('db_hits') > 0) && (getConfig('cache_hits') > 0) && (isCacheInstanceValid())) {
                // Add new hits
                incrementConfigEntry('db_hits', getConfig('db_hits_run'));
 
                // Update counter for db/cache
-               UPDATE_CONFIG(array("db_hits", "cache_hits"), array(bigintval(getConfig('db_hits')), bigintval(getConfig('cache_hits'))));
+               UPDATE_CONFIG(array("db_hits", "cache_hits"), array(getConfig(('db_hits')), getConfig(('cache_hits'))));
        } // END - if
 
        // Close database link and forget the link
index fe1f026..d71492d 100644 (file)
@@ -54,7 +54,7 @@ set_session('DOUBLER_UID', "");
 if (empty($DOUBLER_UID)) $DOUBLER_UID = 0;
 
 // Check for doubles which we can pay out
-$min = bigintval(getConfig('doubler_min') * 2);
+$min = getConfig(('doubler_min') * 2);
 $result_total = SQL_QUERY_ESC("SELECT DISTINCT d.id, d.userid, d.points, d.remote_ip, d.timemark
 FROM `{!_MYSQL_PREFIX!}_doubler` AS d
 LEFT JOIN `{!_MYSQL_PREFIX!}_user_data` AS u
index 9a17fa1..ab96062 100644 (file)
@@ -383,7 +383,7 @@ function GET_EXT_VERSION ($ext_name) {
 
                // Count cache hits
                incrementConfigEntry('cache_hits');
-       } elseif ((!isset($GLOBALS['cache_instance'])) || (!is_object($GLOBALS['cache_instance']))) {
+       } elseif (!isCacheInstanceValid()) {
                // Load from database
                $result = SQL_QUERY_ESC("SELECT ext_version FROM `{!_MYSQL_PREFIX!}_extensions` WHERE ext_name='%s' LIMIT 1",
                        array($ext_name), __FILE__, __LINE__);
index 1ce2684..a1ecd0f 100644 (file)
@@ -242,10 +242,10 @@ default: // Do stuff when extension is loaded
        // Create instance on class
        if ($GLOBALS['cacheMode'] != "init") {
                // Initialize cache system only when it's needed
-               $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), constant('PATH')."inc/".getConfig('cache_path'), getConfig('cache_tested'));
+               $GLOBALS['cache_instance'] = new CacheSystem(getConfig('cache_update'), "inc/".getConfig('cache_path'), getConfig('cache_tested'));
                if ($GLOBALS['cache_instance']->getStatus() != "done") {
                        // Failed to initialize cache sustem
-                       addFatalMessage(__FILE__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_INITIALIZE);
+                       addFatalMessage(__FILE__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_CANNOT_INITIALIZE'));
                } // END - if
        } // END - if
        break;
index b6e9fb8..c7aef22 100644 (file)
@@ -741,7 +741,7 @@ default: // Do stuff when extension is loaded
                        LOAD_INC_ONCE("inc/gen_sql_patches.php");
 
                        // @TODO Rewrite this to a filter!
-                       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance']))) {
+                       if ((GET_EXT_VERSION("cache") >= "0.1.2") && (isCacheInstanceValid())) {
                                // Remove extensions and mod_reg cache file
                                LOAD_INC_ONCE("inc/libs/cache_functions.php");
                                require(sprintf("%sinc/extensions/ext-cache.php", constant('PATH')));
index bfead5a..da1848b 100644 (file)
@@ -1254,7 +1254,7 @@ function generateRandomCodde ($length, $code, $uid, $DATA="") {
        $keys   = constant('SITE_KEY').":".constant('DATE_KEY');
        if (isConfigEntrySet('secret_key'))  $keys .= ":".getConfig('secret_key');
        if (isConfigEntrySet('file_hash'))   $keys .= ":".getConfig('file_hash');
-       $keys .= ":".date("d-m-Y (l-F-T)", bigintval(getConfig('patch_ctime')));
+       $keys .= ":".date("d-m-Y (l-F-T)", getConfig(('patch_ctime')));
        if (isConfigEntrySet('master_salt')) $keys .= ":".getConfig('master_salt');
 
        // Build string from misc data
@@ -2063,7 +2063,7 @@ function generateHash ($plainText, $salt = "") {
                $server = $_SERVER['PHP_SELF'].":".GET_USER_AGENT().":".getenv('SERVER_SOFTWARE').":".GET_REMOTE_ADDR().":".":".filemtime(constant('PATH')."inc/databases.php");
 
                // Build key string
-               $keys   = constant('SITE_KEY').":".constant('DATE_KEY').":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", bigintval(getConfig('patch_ctime'))).":".getConfig('master_salt');
+               $keys   = constant('SITE_KEY').":".constant('DATE_KEY').":".getConfig('secret_key').":".getConfig('file_hash').":".date("d-m-Y (l-F-T)", getConfig(('patch_ctime'))).":".getConfig('master_salt');
 
                // Additional data
                $data = $plainText.":".uniqid(mt_rand(), true).":".time();
@@ -2580,7 +2580,7 @@ function LOAD_INC ($INC) {
        // Is the include file there?
        if (!FILE_READABLE($FQFN)) {
                // Not there so log it
-               DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Include file %s not found.", basename($INC)));
+               debug_report_bug(sprintf("Include file %s not found.", $INC));
                return false;
        } // END - if
 
@@ -3182,7 +3182,7 @@ function HANDLE_LOGIN_FAILTURES ($accessLevel) {
 // Rebuild cache
 function rebuildCacheFiles ($cache, $inc="") {
        // Shall I remove the cache file?
-       if ((EXT_IS_ACTIVE("cache")) && (is_object($GLOBALS['cache_instance']))) {
+       if ((EXT_IS_ACTIVE("cache")) && (isCacheInstanceValid())) {
                // Rebuild cache
                if ($GLOBALS['cache_instance']->loadCacheFile($cache)) {
                        // Destroy it
@@ -3213,7 +3213,7 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
        if (!EXT_IS_ACTIVE("cache")) {
                // Cache extension not active
                return false;
-       } elseif (!is_object($GLOBALS['cache_instance'])) {
+       } elseif (!isCacheInstanceValid()) {
                // No cache instance!
                DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
                return false;
@@ -3361,7 +3361,7 @@ function DETERMINE_REFID () {
                $GLOBALS['refid'] = bigintval(get_session('refid'));
        } elseif ((GET_EXT_VERSION("sql_patches") != "") && (getConfig('def_refid') > 0)) {
                // Set default refid as refid in URL
-               $GLOBALS['refid'] = bigintval(getConfig('def_refid'));
+               $GLOBALS['refid'] = getConfig(('def_refid'));
        } elseif ((GET_EXT_VERSION("user") >= "0.3.4") && (getConfig('select_user_zero_refid')) == "Y") {
                // Select a random user which has confirmed enougth mails
                $GLOBALS['refid'] = SELECT_RANDOM_REFID();
@@ -3417,6 +3417,11 @@ function isDebugModeEnabled () {
        return isBooleanConstantAndTrue('DEBUG_MODE');
 }
 
+// Checks wether the cache instance is valid
+function isCacheInstanceValid () {
+       return ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])));
+}
+
 //////////////////////////////////////////////////
 // AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
 //////////////////////////////////////////////////
index 81a695e..bc24b68 100644 (file)
@@ -43,6 +43,7 @@ class CacheSystem {
        var $ret = "init";
        var $path = "";
        var $inc = "";
+       var $fqfn = "";
        var $pointer = false;
        var $data = array();
        var $version = array();
@@ -88,22 +89,26 @@ class CacheSystem {
                // Remember cache file
                $this->name = $cacheName;
 
-               // Construct FQFN (full qualified file name)
+               // COnstruct include filename for LOAD_INC_ONCE() call
                $this->inc = $this->path . $cacheName . ".cache";
 
+               // Construct FQFN (full qualified file name)
+               $this->fqfn = constant('PATH') . $this->inc;
+
                // Check if file exists and if version matches
-               $status = (FILE_READABLE($this->inc) && (is_writeable($this->inc)) && ($this->extensionVersionMatches("cache")));
+               $status = ($this->isCacheReadable() && (is_writeable($this->fqfn)) && ($this->extensionVersionMatches("cache")));
 
                // Return status
                return $status;
        }
 
+       // Initializes the cache file
        function init () {
                // This will destory an existing cache file!
                if ($this->ret == "done") {
                        // Create file
-                       if (FILE_READABLE($this->inc)) chmod($this->inc, 0666);
-                       $this->pointer = fopen($this->inc, 'w') or mxchange_die("Cannot write to cache ".$this->inc." !");
+                       if ($this->isCacheReadable()) chmod($this->fqfn, 0666);
+                       $this->pointer = fopen($this->fqfn, 'w') or mxchange_die("Cannot write to cache ".$this->fqfn." !");
 
                        // Add open PHP tag
                        fwrite($this->pointer, "<?php\n");
@@ -112,7 +117,7 @@ class CacheSystem {
                        $this->storeExtensionVersion("cache");
                } else {
                        // Cannot create file
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
@@ -141,7 +146,7 @@ class CacheSystem {
                        }
                } else {
                        // Cannot create file
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
@@ -155,7 +160,7 @@ class CacheSystem {
                        fclose($this->pointer);
 
                        // Set rights
-                       if (FILE_READABLE($this->inc)) chmod($this->inc, 0666);
+                       if ($this->isCacheReadable()) chmod($this->fqfn, 0666);
 
                        // Remove pointer
                        $this->pointer = false;
@@ -171,13 +176,13 @@ class CacheSystem {
                } // END - if
 
                // Is the cache file there?
-               if (FILE_READABLE($this->inc)) {
+               if ($this->isCacheReadable()) {
                        // Prepare temporary array
                        $data = array();
                        $cache_version = null;
 
                        // Load cache file
-                       LOAD_INC_ONCE($this->inc);
+                       require($this->inc);
 
                        // Is there an array?
                        if (is_array($data)) {
@@ -204,37 +209,37 @@ class CacheSystem {
                        }
                } else {
                        // Cache file not found or not readable
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_LOAD_1.$this->inc.CACHE_CANNOT_LOAD_2);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_LOAD_1.$this->fqfn.CACHE_CANNOT_LOAD_2);
                }
        }
 
        // Destroy an existing cache file
        function destroyCacheFile () {
                // Is the cache file there?
-               if ((!isset($this->rebuilt[$this->name])) && (FILE_READABLE($this->inc))) {
+               if ((!isset($this->rebuilt[$this->name])) && ($this->isCacheReadable())) {
                        // Close cache
                        $this->finalize();
 
                        // Remove cache file from system
                        //* DEBUG: */ print __METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): {$this->name} - DESTROYED!<br />\n";
-                       unlink($this->inc);
+                       unlink($this->fqfn);
 
                        // Is the file there?
-                       if (!FILE_READABLE($this->inc)) {
+                       if (!$this->isCacheReadable()) {
                                // The cache does no longer exist so kill the content
                                unset($this->data[$this->name]);
                                unset($this->version[$this->name]);
                                $this->rebuilt[$this->name] = true;
                        } else {
                                // Not removed!
-                               addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->inc.CACHE_CANNOT_UNLINK_2);
+                               addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_CANNOT_UNLINK_1.$this->fqfn.CACHE_CANNOT_UNLINK_2);
                        }
                } // END - if
        }
 
        // Unused method:
        function removeEntry ($search, $data, $array) {
-               if ((FILE_READABLE($this->inc)) && (is_writeable($this->inc))) {
+               if (($this->isCacheReadable()) && (is_writeable($this->fqfn))) {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
 
@@ -258,7 +263,7 @@ class CacheSystem {
                        }
                } else {
                        // Cannot write to cache!
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
@@ -282,13 +287,13 @@ class CacheSystem {
                        } // END - foreach
                } else {
                        // Cannot write array!
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
        // Unused method
        function replaceEntry ($search, $replace, $search_key, $array) {
-               if ((FILE_READABLE($this->inc)) && (is_writeable($this->inc))) {
+               if (($this->isCacheReadable()) && (is_writeable($this->fqfn))) {
                        // Load cache into dummy array
                        $dummy = $this->getArrayFromCache();
 
@@ -319,10 +324,11 @@ class CacheSystem {
                        } // END - if
                } else {
                        // Cannot write to cache!
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
+       // Writes the version of given extension to the cache file
        function storeExtensionVersion ($ext_name) {
                // Valid cache pointer?
                if (is_resource($this->pointer)) {
@@ -337,10 +343,11 @@ class CacheSystem {
                        //* DEBUG: */ print __METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): {$this->name} - {$ext_name}={$ext_ver}<br />\n";
                } else {
                        // Cannot create file
-                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".CACHE_PROBLEMS_DETECTED);
+                       addFatalMessage(__METHOD__, __LINE__, "(<font color=\"#0000aa\">".__LINE__."</font>): ".getMessage('CACHE_PROBLEMS_DETECTED'));
                }
        }
 
+       // Checks wether versions from cache and extension matches
        function extensionVersionMatches ($ext_name) {
                // Load cache (dummy)
                $this->getArrayFromCache();
@@ -353,13 +360,15 @@ class CacheSystem {
                        //* DEBUG: */ print __METHOD__."(<font color=\"#0000aa\">".__LINE__."</font>): cache={$this->name},ext_name={$ext_name} - {$ext_ver}/{$this->version[$this->name][$ext_name]}<br />\n";
                } else {
                        // No cache version found!
-                       DEBUG_LOG(__METHOD__, __LINE__, "Cache {$this->name} has missing entry for extension {$ext_name}!");
+                       DEBUG_LOG(__METHOD__, __LINE__, "Cache {$this->name} has missing version entry for extension {$ext_name}!");
                }
 
                // Compare both
                return ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver));
        }
 
+       // Rewrit the entry so it can be stored in cache file
+       // @TODO Add support for more types which break in last else-block
        function rewriteEntry ($key, $value) {
                // Init line
                $line = "";
@@ -374,8 +383,10 @@ class CacheSystem {
                } elseif (is_bool($value)) {
                        // Boolean value
                        if ($value === true) {
+                               // True
                                $line = "\$data['".$key."'][] = true;\n";
                        } else {
+                               // False
                                $line = "\$data['".$key."'][] = false;\n";
                        }
                } else {
@@ -387,10 +398,16 @@ class CacheSystem {
                return $line;
        }
 
+       // Getter for cache status
        function getStatus () {
                return $this->ret;
        }
-}
+
+       // Checks wether the current cache file is readable
+       function isCacheReadable () {
+               return INCLUDE_READABLE($this->inc);
+       }
+} // END - class
 
 // Destroy the cache on extension changes
 function FILTER_CACHE_DESTROY_ON_EXT_CHANGE ($data) {
index eaef396..7c467d9 100644 (file)
@@ -1556,8 +1556,8 @@ LIMIT 1",
        return $nextId;
 }
 // -----------------------------------------------------------------------------
-// PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE ELSE THEY "WRAP" THE
-// $GLOBALS['cache_array']['surfbar'] ARRAY!
+// PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE IF THEY DON'T "WRAP"
+// THE $GLOBALS['cache_array']['surfbar'] ARRAY!
 // -----------------------------------------------------------------------------
 // Private getter for data elements
 function SURFBAR_GET_DATA ($element) {
index d33fd89..49dcaa8 100644 (file)
@@ -89,7 +89,7 @@ function WERNIS_SEND_REQUEST ($scriptName, $requestData =  array()) {
        } // END - if
 
        // Add more request data
-       $requestData['api_id']  = bigintval(getConfig('wernis_api_id'));
+       $requestData['api_id']  = getConfig(('wernis_api_id'));
        $requestData['api_key'] = getConfig('wernis_api_md5');
 
        // Construct the request string
index 41ea321..61116d9 100644 (file)
@@ -82,14 +82,14 @@ function YOOMEDIA_QUERY_API ($script, $countQuery = true) {
                // Prepare the low-level request
                $requestString = sprintf("http://www.yoomedia.de/interface_2.0/%s?id=%s&sid=%s&pw=%s&reload=%s&ma=%s&uebrig=%s&verguetung=%s&erotik=%s",
                        $script,
-                       bigintval(getConfig('yoomedia_id')),
-                       bigintval(getConfig('yoomedia_sid')),
+                       getConfig(('yoomedia_id')),
+                       getConfig(('yoomedia_sid')),
                        getConfig('yoomedia_passwd'),
-                       bigintval(getConfig('yoomedia_tm_max_reload')),
-                       bigintval(getConfig('yoomedia_tm_min_wait')),
-                       bigintval(getConfig('yoomedia_tm_clicks_remain')),
-                       bigintval(getConfig('yoomedia_tm_min_pay')),
-                       bigintval(getConfig('yoomedia_erotic_allowed'))
+                       getConfig(('yoomedia_tm_max_reload')),
+                       getConfig(('yoomedia_tm_min_wait')),
+                       getConfig(('yoomedia_tm_clicks_remain')),
+                       getConfig(('yoomedia_tm_min_pay')),
+                       getConfig(('yoomedia_erotic_allowed'))
                );
 
                // Run the query
index 1a60276..4bdef34 100644 (file)
@@ -37,11 +37,8 @@ if (!defined('__SECURITY')) {
        require($INC);
 }
 
-// Load more cache includes
-$INC_POOL = GET_DIR_AS_ARRAY("inc/loader/", "load_cache-");
-
 // Run the filter
-runFilterChain('load_includes', $INC_POOL);
+runFilterChain('load_includes', GET_DIR_AS_ARRAY("inc/loader/", "load_cache-"));
 
 //
 ?>
index dff3faf..dd8c722 100644 (file)
@@ -10,6 +10,8 @@
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Alle Erweiterungen laden                         *
  * -------------------------------------------------------------------- *
+ * @TODO Rewrite this whole file to load_cache-extensions.php           *
+ * -------------------------------------------------------------------- *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
@@ -113,7 +115,7 @@ if ($GLOBALS['cacheMode'] == "load") {
                $GLOBALS['cache_instance']->destroyCacheFile();
 
                // Retry it
-               LOAD_INC(__FILE__);
+               require(__FILE__);
                return;
        } // END -  if
 
index 3237733..7ffffb8 100644 (file)
@@ -102,8 +102,8 @@ ORDER BY login", __FILE__, __LINE__);
        // Close cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 // Next cached table are the admins_acls...
@@ -132,8 +132,8 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
                // Close cache
                $GLOBALS['cache_instance']->finalize();
 
-               // Reload the cache
-               LOAD_INC(__FILE__);
+               // Include loader again
+               require(__FILE__);
        }
 } // END - if
 
index ad5b5df..ad3342a 100644 (file)
@@ -61,8 +61,8 @@ if (($GLOBALS['cache_instance']->loadCacheFile("config", true)) && ($GLOBALS['ca
        // Close the cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 //
index 0ff8842..03489db 100644 (file)
@@ -91,8 +91,8 @@ FROM `{!_MYSQL_PREFIX!}_mod_reg` ORDER BY `id`", __FILE__, __LINE__);
        // Close the cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 //
index 4e73cb1..5658eae 100644 (file)
@@ -59,8 +59,8 @@ if (($GLOBALS['cache_instance']->loadCacheFile("refdepths")) && ($GLOBALS['cache
        // Close the cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 //
index e87dbf0..8c2080d 100644 (file)
@@ -59,8 +59,8 @@ if (($GLOBALS['cache_instance']->loadCacheFile("refsystem")) && ($GLOBALS['cache
        // Close the cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 //
index fcfd809..299935f 100644 (file)
@@ -86,8 +86,8 @@ if (($GLOBALS['cache_instance']->loadCacheFile("themes")) && ($GLOBALS['cache_in
        // Close the cache
        $GLOBALS['cache_instance']->finalize();
 
-       // Reload the cache
-       LOAD_INC(__FILE__);
+       // Include loader again
+       require(__FILE__);
 }
 
 //
index f73c5c7..104f4e6 100644 (file)
@@ -305,7 +305,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        $GLOBALS['menu']['title'] = array();
 
        // Is there a cache instance?
-       if ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
+       if ((isCacheInstanceValid()) && (getConfig('cache_admin_menu') == "Y")) {
                // Create cache name
                $cacheName = "admin_".$act."_".$wht."_".GET_LANGUAGE()."_".strtolower(get_session('admin_login'));
 
@@ -444,7 +444,7 @@ function ADD_ADMIN_MENU($act, $wht, $return=false) {
        eval($eval);
 
        // Is there a cache instance again?
-       if ((isset($GLOBALS['cache_instance'])) && (is_object($GLOBALS['cache_instance'])) && (getConfig('cache_admin_menu') == "Y")) {
+       if ((isCacheInstanceValid()) && (getConfig('cache_admin_menu') == "Y")) {
                // Init cache
                $GLOBALS['cache_instance']->init($cacheName);
 
index 8b26a7b..b1d8d57 100644 (file)
@@ -62,8 +62,8 @@ if (IS_FORM_SENT()) {
 }  else {
        // Prepare data for template output
        $content = array(
-               'min_payout'    => bigintval(getConfig('primera_min_payout')),
-               'min_withdraw'  => bigintval(getConfig('primera_min_withdraw')),
+               'min_payout'    => getConfig(('primera_min_payout')),
+               'min_withdraw'  => getConfig(('primera_min_withdraw')),
                'api_name'              => getConfig('primera_api_name'),
                'api_md5'               => getConfig('primera_api_md5'),
                'refid'                 => getConfig('primera_refid')
index 599f4b7..3edee54 100644 (file)
@@ -46,8 +46,8 @@ if (IS_FORM_SENT()) {
 } else {
        // Prepare content
        $content = array(
-               'refback_min_perc' => bigintval(getConfig('refback_min_perc')),
-               'refback_max_perc' => bigintval(getConfig('refback_max_perc'))
+               'refback_min_perc' => getConfig(('refback_min_perc')),
+               'refback_max_perc' => getConfig(('refback_max_perc'))
        );
 
        // Add more content
index 29320d1..c711588 100644 (file)
@@ -46,9 +46,9 @@ if (IS_FORM_SENT()) {
 }
 
 // Prepare constants for template
-define('__TRANS_MAX_VALUE'    , bigintval(getConfig('transfer_max')));
-define('__TRANS_BALANCE_VALUE', bigintval(getConfig('transfer_balance')));
-define('__TRANS_CODE_VALUE'   , bigintval(getConfig('transfer_code')));
+define('__TRANS_MAX_VALUE'    , getConfig(('transfer_max')));
+define('__TRANS_BALANCE_VALUE', getConfig(('transfer_balance')));
+define('__TRANS_CODE_VALUE'   , getConfig(('transfer_code')));
 
 // Autppurge expired transfer entries?
 switch (getConfig('ap_transfer')) {
index 1dc18f6..8751885 100644 (file)
@@ -64,18 +64,18 @@ if (IS_FORM_SENT()) {
 }  else {
        // Prepare data for template output
        $content = array(
-               'min_payout'           => bigintval(getConfig('wernis_min_payout')),
-               'min_withdraw'         => bigintval(getConfig('wernis_min_withdraw')),
-               'api_id'               => bigintval(getConfig('wernis_api_id')),
+               'min_payout'           => getConfig(('wernis_min_payout')),
+               'min_withdraw'         => getConfig(('wernis_min_withdraw')),
+               'api_id'               => getConfig(('wernis_api_id')),
                'api_md5'              => getConfig('wernis_api_md5'),
                'api_url'              => getConfig('wernis_api_url'),
-               'refid'                => bigintval(getConfig('wernis_refid')),
+               'refid'                => getConfig(('wernis_refid')),
                'payout_factor'        => TRANSLATE_COMMA(getConfig('wernis_payout_factor')),
                'withdraw_factor'      => TRANSLATE_COMMA(getConfig('wernis_withdraw_factor')),
                'payout_fee_percent'   => TRANSLATE_COMMA(getConfig('wernis_payout_fee_percent')),
                'withdraw_fee_percent' => TRANSLATE_COMMA(getConfig('wernis_withdraw_fee_percent')),
-               'payout_fee_fix'       => bigintval(getConfig('wernis_payout_fee_fix')),
-               'withdraw_fee_fix'     => bigintval(getConfig('wernis_withdraw_fee_fix'))
+               'payout_fee_fix'       => getConfig(('wernis_payout_fee_fix')),
+               'withdraw_fee_fix'     => getConfig(('wernis_withdraw_fee_fix'))
        );
 
        // Prepare payout Y/N selection
index b5b4c17..dfb103d 100644 (file)
@@ -56,13 +56,13 @@ if (IS_FORM_SENT()) {
 } else {
        // Prepare content
        $content = array(
-               'yoomedia_id'               => bigintval(getConfig('yoomedia_id')),
-               'yoomedia_sid'              => bigintval(getConfig('yoomedia_sid')),
+               'yoomedia_id'               => getConfig(('yoomedia_id')),
+               'yoomedia_sid'              => getConfig(('yoomedia_sid')),
                'yoomedia_passwd'           => getConfig('yoomedia_passwd'),
-               'yoomedia_tm_max_reload'    => bigintval(getConfig('yoomedia_tm_max_reload')),
-               'yoomedia_tm_min_wait'      => bigintval(getConfig('yoomedia_tm_min_wait')),
-               'yoomedia_tm_clicks_remain' => bigintval(getConfig('yoomedia_tm_clicks_remain')),
-               'yoomedia_tm_min_pay'       => bigintval(getConfig('yoomedia_tm_min_pay'))
+               'yoomedia_tm_max_reload'    => getConfig(('yoomedia_tm_max_reload')),
+               'yoomedia_tm_min_wait'      => getConfig(('yoomedia_tm_min_wait')),
+               'yoomedia_tm_clicks_remain' => getConfig(('yoomedia_tm_clicks_remain')),
+               'yoomedia_tm_min_pay'       => getConfig(('yoomedia_tm_min_pay'))
        );
 
        // Erotic?
index 4a1c8d7..5b5bddf 100644 (file)
@@ -94,7 +94,7 @@ if (empty($response[0]) && empty($response[1]) && empty($response[2]) && empty($
 
                                // I have removed the addional test for the stored timemark in database or you cannot find
                                // new updates on my server when you haven't installed it before I upload a patch... :-(
-                               if (bigintval($TEST) > bigintval(getConfig('patch_level'))) {
+                               if (bigintval($TEST) > getConfig(('patch_level'))) {
                                        // Copy every data from the response array
                                        $PATCHES['fname'][] = str_replace("\n", "", $response[$idx * 5 + 2]);
                                        $PATCHES['fsize'][] = str_replace("\n", "", $response[$idx * 5 + 3]);
index b89deb4..927fa84 100644 (file)
@@ -60,7 +60,7 @@ $content = array(); $points = false;
 // Is the mode set (payout only)
 if (!REQUEST_ISSET_GET(('mode'))) {
        // Get referal id
-       $content['refid'] = bigintval(getConfig('primera_refid'));
+       $content['refid'] = getConfig(('primera_refid'));
 
        // Get Primus id
        $result = SQL_QUERY_ESC("SELECT primera_userid FROM `{!_MYSQL_PREFIX!}_user_data` WHERE userid=%s LIMIT 1",
@@ -170,7 +170,7 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('PRIMERA_MEMBER_INVALID_AMOUNT'));
                        } elseif (REQUEST_POST('amount') < getConfig('primera_min_payout')) {
                                // Not enougth entered!
-                               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('PRIMERA_MEMBER_AMOUNT_SMALLER_MIN'), bigintval(getConfig('primera_min_payout'))));
+                               LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('PRIMERA_MEMBER_AMOUNT_SMALLER_MIN'), getConfig(('primera_min_payout'))));
                        } elseif (REQUEST_POST('amount') > $points) {
                                // Not enougth points left!
                                LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('PRIMERA_MEMBER_PAYOUT_POINTS_DEPLETED'), bigintval(REQUEST_POST('amount')), bigintval($points)));
index 7f3cedf..1f06a6e 100644 (file)
@@ -59,7 +59,7 @@ $content = array(); $points = false;
 // Is the mode set (withdraw or payout)
 if ((!REQUEST_ISSET_GET(('mode'))) || (REQUEST_GET('mode') == "choose")) {
        // Let the user choose what he wants to do
-       $content['refid']    = bigintval(getConfig('wernis_refid'));
+       $content['refid']    = getConfig(('wernis_refid'));
        $content['wds66_id'] = 0;
 
        // Get WDS66 id
@@ -219,7 +219,7 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                        case "withdraw": // Widthdraws WDS66 -> This exchange
                                if (REQUEST_POST('amount') < getConfig('wernis_min_withdraw')) {
                                        // Not enougth entered!
-                                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), bigintval(getConfig('wernis_min_withdraw'))));
+                                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), getConfig(('wernis_min_withdraw'))));
                                } else {
                                        // All is fine here so do the withdraw
                                        $success = WERNIS_EXECUTE_WITHDRAW(REQUEST_POST('wds66_id'), md5(REQUEST_POST('wds66_password')), REQUEST_POST('amount'));
@@ -248,7 +248,7 @@ if ((IS_FORM_SENT()) && (REQUEST_ISSET_GET(('mode')))) {
                        case "payout": // Payout this exchange -> WDS66
                                if (REQUEST_POST('amount') < getConfig('wernis_min_payout')) {
                                        // Not enougth entered!
-                                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), bigintval(getConfig('wernis_min_payout'))));
+                                       LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('WERNIS_MEMBER_AMOUNT_SMALLER_MIN'), getConfig(('wernis_min_payout'))));
                                } elseif (REQUEST_POST('amount') > $points) {
                                        // Not enougth points left!
                                        LOAD_TEMPLATE("admin_settings_saved", false, sprintf(getMessage('WERNIS_MEMBER_PAYOUT_POINTS_DEPLETED'), bigintval(REQUEST_POST('amount')), bigintval($points)));
index e4c4e8e..69f4a90 100644 (file)
@@ -50,12 +50,12 @@ $curr = date("m", time());
 if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
        // Extension "autopurge" is inactive or purging of inactive accounts is deactivated
        $whereStatement1 = "";
-       $whereStatement2 = bigintval(getConfig('beg_ranks'));
+       $whereStatement2 = getConfig(('beg_ranks'));
 
        // Shall we exclude webmaster's own userid?
        if ((getConfig('beg_include_own') != "Y") && (getConfig('beg_uid') > 0)) {
                // Exclude it
-               $whereStatement1 = sprintf(" AND userid != %s", bigintval(getConfig('beg_uid')));
+               $whereStatement1 = sprintf(" AND userid != %s", getConfig(('beg_uid')));
        } // END - if
 
        // Let's check if there are some points left we can "pay"...
@@ -63,7 +63,7 @@ if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getC
                // Use last online stamp only when autopurge for inactive members is activated
                if ((getConfig('ap_inactive_since') > 0) && (getConfig('beg_active') == "Y")) {
                        // Okay, include last online timestamp
-                       $whereStatement1 .= sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", bigintval(getConfig('ap_inactive_since')));;
+                       $whereStatement1 .= sprintf(" AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig(('ap_inactive_since')));;
                } // END - if
        } // END - if
 
index c4c7e8d..49c02b3 100644 (file)
@@ -49,7 +49,7 @@ $curr = date("m", time());
 if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($GLOBALS['output_mode'] != 1)) {
        // Extension "autopurge" is inactive or purging of inactive accounts is deactivated
        $whereStatement1 = "WHERE `status`='CONFIRMED'";
-       $whereStatement2 = bigintval(getConfig('bonus_ranks'));
+       $whereStatement2 = getConfig(('bonus_ranks'));
 
        // Shall I keep inactive members away from here? (mostly wanted in an "active-rallye" ...)
        if (EXT_IS_ACTIVE("autopurge")) {
@@ -57,7 +57,7 @@ if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && ($GL
                if (getConfig('ap_inactive_since') > 0) {
                        // Okay, include last online timestamp
                        $whereStatement1 = sprintf("WHERE `status`='CONFIRMED' AND last_online >= (UNIX_TIMESTAMP() - %s)", getConfig('ap_inactive_since'));
-                       $whereStatement2 = bigintval(getConfig('bonus_ranks'));
+                       $whereStatement2 = getConfig(('bonus_ranks'));
                } // END - if
        } // END - if
 
index ac66385..46c7002 100644 (file)
@@ -46,11 +46,8 @@ if (isResetModeEnabled()) {
 // Init counter
 $GLOBALS['pool_cnt'] = 0;
 
-// Load more cache includes
-$INC_POOL = GET_DIR_AS_ARRAY("inc/pool/", "pool-");
-
 // Run the filter
-runFilterChain('load_includes', $INC_POOL);
+runFilterChain('load_includes', GET_DIR_AS_ARRAY("inc/pool/", "pool-"));
 
 // Remove counter again
 unset($GLOBALS['pool_cnt']);