More complete rewrite to use wrapper function isExtensionInstalledAndNewer(), some...
authorRoland Häder <roland@mxchange.org>
Thu, 1 Apr 2010 18:38:06 +0000 (18:38 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 1 Apr 2010 18:38:06 +0000 (18:38 +0000)
36 files changed:
inc/extensions-functions.php
inc/extensions/ext-order.php
inc/extensions/ext-rallye.php
inc/filter-functions.php
inc/filters.php
inc/functions.php
inc/gen_sql_patches.php
inc/libs/admins_functions.php
inc/libs/bonus_functions.php
inc/libs/rallye_functions.php
inc/libs/task_functions.php
inc/libs/theme_functions.php
inc/libs/user_functions.php
inc/loader/load_cache-them.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-config_mods.php
inc/modules/admin/what-config_points.php
inc/modules/admin/what-del_email.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-list_beg.php
inc/modules/admin/what-list_bonus.php
inc/modules/admin/what-list_user.php
inc/modules/admin/what-lock_user.php
inc/modules/admin/what-unlock_emails.php
inc/modules/guest/what-confirm.php
inc/modules/member/what-bonus.php
inc/modules/member/what-order.php
inc/modules/member/what-payout.php
inc/modules/member/what-points.php
inc/modules/member/what-support.php
inc/mysql-manager.php
inc/pool/pool-bonus.php
inc/pool/pool-user.php
inc/reset/reset_daily.php
inc/wrapper-functions.php
mailid_top.php

index 743f972..23c4d68 100644 (file)
@@ -939,7 +939,7 @@ function createExtensionDeactivationTask ($ext) {
        $subject = sprintf("[%s:] %s", $ext, getMessage('TASK_SUBJ_EXTENSION_DEACTIVATED'));
 
        // Not installed and do we have created a task for the admin?
-       if ((determineTaskIdBySubject($subject) == '0') && (getExtensionVersion($ext) != '')) {
+       if ((determineTaskIdBySubject($subject) == '0') && (isExtensionInstalled($ext))) {
                // Task not created so add it
                createNewTask($subject, SQL_ESCAPE(loadTemplate('task_ext_deactivated', true, $ext)), 'EXTENSION_DEACTIVATION');
        } // END - if
@@ -965,7 +965,7 @@ function ifModuleHasMenu ($mod, $forceDb = false) {
                        // Admin/guest/member/sponsor modules have always a menu!
                        $ret = in_array($mod, array('admin', 'index', 'login', 'sponsor'));
                }
-       } elseif ((isExtensionInstalled('sql_patches')) && (getExtensionVersion('sql_patches') >= '0.3.6') && ((!isExtensionActive('cache')) || ($forceDb === true))) {
+       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.3.6')) && ((!isExtensionActive('cache')) || ($forceDb === true))) {
                // Check database for entry
                $result = SQL_QUERY_ESC("SELECT `has_menu` FROM `{?_MYSQL_PREFIX?}_mod_reg` WHERE `module`='%s' LIMIT 1",
                        array($mod), __FUNCTION__, __LINE__);
index b3ec12f..4e15c55 100644 (file)
@@ -341,7 +341,7 @@ INDEX (`pool_id`)
 
        case 'init': // Do stuff when extension is initialized
                // Do daily reset only when installed and extension version is at least 0.1.1
-               if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (getExtensionVersion('order') >= '0.1.1')) {
+               if ((isResetModeEnabled()) && (isInstalled()) && (isAdminRegistered()) && (isExtensionInstalledAndNewer('order', '0.1.1'))) {
                        // Reset mail order values
                        $result_ext = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET mail_orders=0 WHERE mail_orders > 0", __FILE__, __LINE__);
                } // END - if
index 816f95c..a8c4d3d 100644 (file)
@@ -335,7 +335,7 @@ Zudem sollten Sie mindestens folgende Templates (in <strong>templates/".getLangu
 
                        // Add more data on higher versions
                        $ADD1 = ''; $ADD2 = ''; $OR = '';
-                       if (getExtensionVersion('rallye') >= '0.2.0') {
+                       if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
                                $ADD1 = ", `min_users`, `min_prices`";
                                $ADD2 = ", d.min_users, d.min_prices";
                                $OR   = " OR (d.min_users <= ".$total." AND d.min_users > 0)";
index 82747fe..7bc55f0 100644 (file)
@@ -60,7 +60,7 @@ function initFilterSystem () {
        } elseif ((!isInstallationPhase()) && (isExtensionInstalledAndNewer('sql_patches', '0.5.9'))) {
                // Init add
                $add = '';
-               if (getExtensionVersion('sql_patches') >= '0.6.0') $add = ", `filter_counter`";
+               if (isExtensionINstalledAndNewer('sql_patches', '0.6.0')) $add = ", `filter_counter`";
 
                // Load all active filers
                $result = SQL_QUERY("SELECT
index 4028bef..cc17b3e 100644 (file)
@@ -586,7 +586,7 @@ function FILTER_HTML_INCLUDE_USERS ($mode) {
 
        // HTML mail?
        if ($mode == 'html') $MORE = " AND `html`='Y'";
-       if ((isExtensionActive('holiday')) && (getExtensionVersion('holiday') >= '0.1.3')) {
+       if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                // Add something for the holiday extension
                $MORE .= " AND `holiday_active`='N'";
        } // END - if
index 320c774..8b1f6ce 100644 (file)
@@ -1197,7 +1197,7 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're
                        $year = date('Y', time());
 
                        // Use configured min age or fixed?
-                       if ((isExtensionActive('other')) && (getExtensionVersion('other') >= '0.2.1')) {
+                       if (isExtensionInstalledAndNewer('order', '0.2.1')) {
                                // Configured
                                $startYear = $year - getConfig('min_age');
                        } else {
@@ -1225,7 +1225,7 @@ function addSelectionBox ($type, $default, $prefix = '', $id = '0', $class = 're
                                // Get current year and subtract the configured minimum age
                                $OUT .= "<option value=\"".($minYear - 1)."\">&lt;" . $minYear."</option>\n";
                                // Calculate earliest year depending on extension version
-                               if ((isExtensionActive('other')) && (getExtensionVersion('other') >= '0.2.1')) {
+                               if (isExtensionInstalledAndNewer('order', '0.2.1')) {
                                        // Use configured minimum age
                                        $year = date('Y', time()) - getConfig('min_age');
                                } else {
@@ -2107,7 +2107,7 @@ function generateEmailLink ($email, $table = 'admins') {
        if ((isExtensionActive('admins')) && ($table == 'admins')) {
                // Create email link for contacting admin in guest area
                $EMAIL = generateAdminEmailLink($email);
-       } elseif ((isExtensionActive('user')) && (getExtensionVersion('user') >= '0.3.3') && ($table == 'user_data')) {
+       } elseif ((isExtensionInstalledAndNewer('user', '0.3.3')) && ($table == 'user_data')) {
                // Create email link for contacting a member within admin area (or later in other areas, too?)
                $EMAIL = generateUserEmailLink($email, 'admin');
        } elseif ((isExtensionActive('sponsor')) && ($table == 'sponsor_data')) {
index 91dd06e..594f984 100644 (file)
@@ -43,7 +43,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Check for version of sql_patches
-if (getExtensionVersion('sql_patches') < '0.3.6') return false;
+if (isExtensionInstalledAndNewer('sql_patches', '0.3.6')) return false;
 
 // Check if there is no scrambling string
 if (getConfig('pass_scramble') == '') {
@@ -114,5 +114,5 @@ if (getConfig('file_hash') == '') {
        } // END - if
 } // END - if
 
-//
-?>
\ No newline at end of file
+// [EOF]
+?>
index de6dcd9..3ec0d01 100644 (file)
@@ -636,10 +636,10 @@ function getAdminLastFailure ($adminLogin) {
 // Filter for adding extra data to the query
 function FILTER_ADD_EXTRA_SQL_DATA ($add = '') {
        // Is the admins extension updated? (should be!)
-       if (getExtensionVersion('admins') >= '0.3.0') $add .= ', `default_acl` AS def_acl';
-       if (getExtensionVersion('admins') >= '0.6.7') $add .= ', `la_mode`';
-       if (getExtensionVersion('admins') >= '0.7.2') $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
-       if (getExtensionVersion('admins') >= '0.7.3') $add .= ', `expert_settings`, `expert_warning`';
+       if (isExtensionInstalledAndNewer('admins', '0.3.0')) $add .= ', `default_acl` AS def_acl';
+       if (isExtensionInstalledAndNewer('admins', '0.6.7')) $add .= ', `la_mode`';
+       if (isExtensionInstalledAndNewer('admins', '0.7.2')) $add .= ', `login_failures`, UNIX_TIMESTAMP(`last_failure`) AS last_failure';
+       if (isExtensionInstalledAndNewer('admins', '0.7.3')) $add .= ', `expert_settings`, `expert_warning`';
 
        // Return it
        return $add;
index 08a4d61..f3424a4 100644 (file)
@@ -109,7 +109,7 @@ function addTurboBonus ($mid, $userid, $type) {
                        $points
                ), __FUNCTION__, __LINE__);
 
-       if ((getExtensionVersion('bonus') >= '0.3.5') && (getConfig('bonus_mode') != "ADD") && ($points > 0)) handleBonusPoints($points);
+       if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getConfig('bonus_mode') != 'ADD') && ($points > 0)) handleBonusPoints($points);
 }
 
 //
index 59c1f01..ba5e615 100644 (file)
@@ -320,7 +320,7 @@ function addUserToReferalRallye ($userid, $content = array()) {
        $add = '';
 
        // Updated extension?
-       if (getExtensionVersion('rallye') >= '0.2.0') {
+       if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
                $add .= ", `min_users`, `min_prices`";
        } // END - if
 
@@ -340,7 +340,7 @@ LIMIT 1", __FUNCTION__, __LINE__);
                $min_users = '0'; $min_prices = '0';
 
                // Load data
-               if (getExtensionVersion('rallye') >= '0.2.0') {
+               if (isExtensionInstalledAndNewer('rallye', '0.2.0')) {
                        list($id, $title, $start, $end, $notify, $min_users, $min_prices) = SQL_FETCHROW($result);
                } else {
                        list($id, $title, $start, $end, $notify) = SQL_FETCHROW($result);
@@ -804,7 +804,7 @@ function addReferalRallyeTemplateSelection ($name = 'template', $default = '') {
 //
 function getReferalRallyeRefsCount ($userid, $old = '0') {
        // Check current refs
-       if (getExtensionVersion('cache') >= '0.1.2') {
+       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
                // Get refs from cache
                $cnt = '0';
                foreach ($GLOBALS['cache_array']['refsystem']['userid'] as $id => $userid) {
index c6c61aa..ed919e1 100644 (file)
@@ -246,7 +246,7 @@ function outputAdvancedOverview (&$result_main) {
                if (isExtensionActive('beg'))                  $EXCLUDE_LIST .= " AND d.userid != ".getConfig('beg_userid')."";
                if (isExtensionActive('bonus'))                $EXCLUDE_LIST .= " AND d.userid != ".getConfig('bonus_userid')."";
                if (isExtensionActive('doubler'))              $EXCLUDE_LIST .= " AND d.userid != ".getConfig('doubler_userid')."";
-               if ((isExtensionActive('holiday')) && (getExtensionVersion('holiday') >= '0.1.3')) {
+               if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                        // Recent ext-holiday found
                        $EXCLUDE_LIST .= " AND d.`holiday_active`='N'";
                } // END - if
@@ -323,7 +323,7 @@ ORDER BY
 
        if (isExtensionInstalledAndNewer('bonus', '0.2.3')) {
                // Active rallye
-               if (getExtensionVersion('bonus') >= '0.6.9') {
+               if (isExtensionInstalledAndNewer('bonus', '0.6.9')) {
                        // Add more bonus points here
                        $USE = '(0';
                        if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
@@ -358,7 +358,7 @@ ORDER BY
                $TITLEs[] = getMessage('ADMIN_TASK_LIST_BONUS_TITLE');
        }
 
-       if ((isExtensionActive('beg')) && (getExtensionVersion('beg') >= '0.1.2')) {
+       if (isExtensionInstalledAndNewer('beg', '0.1.2')) {
                // Begging rallye
 
                // Autopurge installed?
index 2fb7de3..c733441 100644 (file)
@@ -127,7 +127,7 @@ function getThemeVersion ($name) {
 
                // Count up
                incrementStatsEntry('cache_hits');
-       } elseif (getExtensionVersion('cache') != '0.1.8') {
+       } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) {
                // Load version from database
                $result = SQL_QUERY_ESC("SELECT `theme_ver` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' LIMIT 1",
                        array($name), __FUNCTION__, __LINE__);
@@ -170,7 +170,7 @@ function isThemeActive ($name) {
 
                // Count up
                incrementStatsEntry('cache_hits');
-       } elseif (getExtensionVersion('cache') != '0.1.8') {
+       } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT `theme_active` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1",
                        array($name), __FUNCTION__, __LINE__);
@@ -204,7 +204,7 @@ function getCurrentThemeName () {
 
                // Count up
                incrementStatsEntry('cache_hits');
-       } elseif (getExtensionVersion('cache') != '0.1.8') {
+       } elseif (isExtensionInstalledAndNewer('cache', '0.1.8')) {
                // Check if current theme is already imported or not
                $result = SQL_QUERY_ESC("SELECT `theme_name` FROM `{?_MYSQL_PREFIX?}_themes` WHERE `theme_path`='%s' AND `theme_active`='Y' LIMIT 1",
                        array($name), __FUNCTION__, __LINE__);
index 61ae0ea..af1e552 100644 (file)
@@ -228,7 +228,7 @@ function determineRandomReferalId () {
        $refid = '0';
 
        // Is the extension version fine?
-       if (getExtensionVersion('user') >= '0.3.4') {
+       if (isExtensionInstalledAndNewer('user', '0.3.4')) {
                // Get all user ids
                $totalUsers = countSumTotalData('CONFIRMED', 'user_data', 'userid', 'status', true, " AND `rand_confirmed` >= ".getConfig('user_min_confirmed')."");
 
@@ -331,7 +331,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                $GLOBALS['bonus_payed'] = true;
 
                                // Subtract login bonus from userid's account or jackpot
-                               if ((getExtensionVersion('bonus') >= '0.3.5') && (getConfig('bonus_mode') != 'ADD')) handleBonusPoints('login_bonus');
+                               if ((isExtensionInstalledAndNewer('bonus', '0.3.5')) && (getConfig('bonus_mode') != 'ADD')) handleBonusPoints('login_bonus');
                        } // END - if
 
                        // @TODO Make this filter working: $URL = runFilterChain('do_login', array('content' => $content, 'addon' => $ADDON));
@@ -368,7 +368,7 @@ function doUserLogin ($userid, $passwd, $successUrl = '', $errorUrl = 'modules.p
                                // Cookies not setable!
                                $errorCode = getCode('COOKIES_DISABLED');
                        }
-               } elseif (getExtensionVersion('sql_patches') >= '0.6.1') {
+               } elseif (isExtensionInstalledAndNewer('sql_patches', '0.6.1')) {
                        // Update failture counter
                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `login_failures`=`login_failures`+1,`last_failure`=NOW() WHERE `userid`=%s LIMIT 1",
                                array($userid), __FUNCTION__, __LINE__);
index 76faa96..ad4766d 100644 (file)
@@ -77,7 +77,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('themes')) && ($GLOBALS['cache_in
        $GLOBALS['cache_instance']->init();
 
        // Load all themes and their data
-       if (getExtensionVersion('theme') >= '0.0.7') {
+       if (isExtensionInstalledAndNewer('theme', '0.0.7')) {
                $result = SQL_QUERY('SELECT id, theme_path, theme_active, theme_ver, theme_name FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id`', __FILE__, __LINE__);
        } else {
                $result = SQL_QUERY('SELECT id, theme_path, theme_active, theme_ver FROM `{?_MYSQL_PREFIX?}_themes` ORDER BY `id`', __FILE__, __LINE__);
index 3a053f1..7817289 100644 (file)
@@ -253,7 +253,7 @@ ORDER BY
                $OUT .= '<ul class="admin_menu_main">';
                // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                while (list($menu, $title, $descr) = SQL_FETCHROW($result_main)) {
-                       if ((isExtensionActive('admins')) && (getExtensionVersion('admins') > '0.2.0')) {
+                       if (isExtensionInstalledAndActive('admins', '0.2.0')) {
                                $ACL = adminsCheckAdminAcl($menu, '');
                        } else {
                                // @TODO ACL is 'allow'... hmmm
@@ -325,7 +325,7 @@ ORDER BY
                                        // @TODO Rewrite this to $content = SQL_FETCHARRAY()
                                        while (list($what_sub, $title_what, $desc_what) = SQL_FETCHROW($result_what)) {
                                                // Check for access level
-                                               if ((isExtensionActive('admins')) && (getExtensionVersion('admins') > '0.2.0')) {
+                                               if (isExtensionInstalledAndNewer('admins', '0.2.0')) {
                                                        $ACL = adminsCheckAdminAcl('', $what_sub);
                                                } else {
                                                        // @TODO ACL is 'allow'... hmmm
index 2048856..57c7327 100644 (file)
@@ -115,7 +115,7 @@ if (isPostRequestParameterSet('edit')) {
        runFilterChain('run_sqls');
 
        // Remove cache file if version matches
-       if (getExtensionVersion('cache') >= '0.1.2') {
+       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
                if ($GLOBALS['cache_instance']->loadCacheFile('modules')) $GLOBALS['cache_instance']->removeCacheFile();
        } // END - if
 
index c3a8ad7..73e80fc 100644 (file)
@@ -110,9 +110,10 @@ if (isFormSent()) {
                        }
 
                        // Update cache file
-                       if (getExtensionVersion('cache') >= '0.1.2') {
+                       // @TODO Rewrite this to a filter
+                       if (isExtensionInstalledAndNewer('cache', '0.1.2')) {
                                if ($GLOBALS['cache_instance']->loadCacheFile('refdepths')) $GLOBALS['cache_instance']->removeCacheFile();
-                       }
+                       } // END - if
                        break;
 
                case 'settings':
index e3e3146..6fb6f1c 100644 (file)
@@ -202,7 +202,7 @@ LIMIT 1",
 
        // Free result
        SQL_FREERESULT($result);
-} elseif ((isGetRequestParameterSet('nid')) && (getExtensionVersion('bonus') >= '0.8.7')) {
+} elseif ((isGetRequestParameterSet('nid')) && (isExtensionInstalledAndNewer('bonus', '0.8.7'))) {
        // Load data from bonus mail
        $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s",
                array(bigintval(getRequestParameter('nid'))), __FILE__, __LINE__);
index a940385..4e9b057 100644 (file)
@@ -88,7 +88,7 @@ if (isGetRequestParameterSet('reg_ext')) {
                                $active = postRequestParameter('active', $ext_id);
 
                                // Update extension's record
-                               if (getExtensionVersion('sql_patches') >= '0.0.6') {
+                               if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
                                        // Update also CSS column when extensions sql_patches is newer or exact v0.0.6
                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_extensions` SET `ext_has_css`='%s', `ext_active`='%s' WHERE `id`=%s LIMIT 1",
                                                array(postRequestParameter('css', $ext_id), $active, $ext_id), __FILE__, __LINE__);
@@ -121,7 +121,7 @@ if (isGetRequestParameterSet('reg_ext')) {
                                $css = 'N';
 
                                // Load required data
-                               if (getExtensionVersion('sql_patches') >= '0.0.6') {
+                               if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
                                        $result = SQL_QUERY_ESC("SELECT ext_has_css, ext_active FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `id`=%s LIMIT 1",
                                                array(bigintval($ext_id)), __FILE__, __LINE__);
                                        list($css, $active) = SQL_FETCHROW($result);
@@ -134,9 +134,11 @@ if (isGetRequestParameterSet('reg_ext')) {
                                        $css = 'X';
                                }
 
-                               // Output row
+                               // Prepare CSS column
                                $cssSelection = '---';
-                               if (getExtensionVersion('sql_patches') >= '0.0.6') $cssSelection = addSelectionBox('yn', $css, 'css', $ext_id);
+                               if (isExtensionInstalledAndNewer('sql_patches', '0.0.6')) {
+                                       $cssSelection = addSelectionBox('yn', $css, 'css', $ext_id);
+                               } // END - if
 
                                // Prepare data for the row template
                                $content = array(
@@ -352,7 +354,7 @@ ORDER BY `ext_name` ASC", __FILE__, __LINE__);
                                                        if ($GLOBALS['cache_instance']->loadCacheFile('extension')) $GLOBALS['cache_instance']->removeCacheFile();
                                                        if ($GLOBALS['cache_instance']->loadCacheFile('modules'))   $GLOBALS['cache_instance']->removeCacheFile();
                                                } // END - if
-                                       } elseif (getExtensionVersion($ext_name) != '') {
+                                       } elseif (isExtensionInstalled($ext_name)) {
                                                // Notify the admin that we have a problem here...
                                                loadTemplate('admin_settings_saved', false, getMessage('ADMIN_REG_FAILED_ALREADY'));
                                        } else {
index 75e0ecd..967b68e 100644 (file)
@@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__);
 
 if (getConfig('beg_rallye') == 'Y') {
        // Shall I withdraw now?
-       if (isPostRequestParameterSet(('withdraw'))) {
+       if (isPostRequestParameterSet('withdraw')) {
                // Okay, let's prepare...
                $curr = date('m', time()) - 1;
                if (strlen($curr) == 1) $curr = '0' . $curr;
index 75a28eb..aa6ca5f 100644 (file)
@@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__);
 
 if (getConfig('bonus_active') == 'Y') {
        // Shall I withdraw now?
-       if (isPostRequestParameterSet(('withdraw'))) {
+       if (isPostRequestParameterSet('withdraw')) {
                // Okay, let's prepare...
                $curr = date('m', time()) - 1;
                if (strlen($curr) == 1) $curr = '0' . $curr;
@@ -55,7 +55,7 @@ if (getConfig('bonus_active') == 'Y') {
                loadTemplate('admin_settings_saved', false, getMessage('ADMIN_BONUS_WITHDRAW_PREPARED'));
        } // END - if
 
-       if (getExtensionVersion('bonus') >= '0.6.9') {
+       if (isExtensionInstalledAndNewer('bonus', '0.6.9')) {
                // Add more bonus points here
                $USE = '(0';
                if (getConfig('bonus_click_yn') == 'Y') $USE .= ' + `turbo_bonus`';
index 4fa3748..b27461d 100644 (file)
@@ -65,12 +65,12 @@ if (isExtensionActive('nickname')) {
 }
 
 // Add random confirmed if extension version matches
-if (getExtensionVersion('user') >= '0.3.4') {
+if (isExtensionInstalledAndNewer('user', '0.3.4')) {
        // Add it...
        $MORE .= ", `rand_confirmed`";
 
        // Add lock reason?
-       if (getExtensionVersion('user') >= '0.3.5') {
+       if (isExtensionInstalledAndNewer('user', '0.3.5')) {
                // Add them...
                $MORE .= ", `lock_reason`, UNIX_TIMESTAMP(`lock_timestamp`) AS lock_timestamp";
        } // END - if
@@ -167,7 +167,7 @@ LIMIT 1",
                }
 
                // Is the user extension newer?
-               if (getExtensionVersion('user') >= '0.3.4') {
+               if (isExtensionInstalledAndNewer('user', '0.3.4')) {
                        // Then "translate" the number
                        $content['rand_confirmed'] = translateComma($content['rand_confirmed']);
                } // END - if
index c5d6866..5656c7b 100644 (file)
@@ -55,7 +55,7 @@ if (isGetRequestParameterSet('userid')) {
                // Is a lock reason set?
                if ((isPostRequestParameterSet('lock')) && (getUserData('status') != 'LOCKED')) {
                        // Ok, lock the account!
-                       if (getExtensionVersion('user') >= '0.3.5') {
+                       if (isExtensionInstalledAndNewer('user', '0.3.5')) {
                                // Lock with reason
                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `status`='LOCKED', `lock_reason`='%s', `lock_timestamp`=NOW() WHERE `userid`=%s LIMIT 1",
                                        array(postRequestParameter('reason'), bigintval(getRequestParameter('userid'))), __FILE__, __LINE__);
@@ -79,7 +79,7 @@ if (isGetRequestParameterSet('userid')) {
                        $ACT = true;
                } elseif ((isPostRequestParameterSet('unlock')) && (getUserData('status') == 'LOCKED')) {
                        // Ok, unlock the account!
-                       if (getExtensionVersion('user') >= '0.3.5') {
+                       if (isExtensionInstalledAndNewer('user', '0.3.5')) {
                                // Reset lock reason as well
                                SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_user_data`
index 194a3a0..9b7ed99 100644 (file)
@@ -93,7 +93,7 @@ LIMIT 1",
                                        } // END - if
 
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
-                                       if ((getExtensionVersion('bonus') >= '0.4.4') && (getConfig('bonus_active') == 'Y')) {
+                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (getConfig('bonus_active') == 'Y')) {
                                                // Add points directly
                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_order`=`bonus_order`+".getConfig('bonus_order')." WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($content['sender'])), __FILE__, __LINE__);
index 6fb1d87..75bf507 100644 (file)
@@ -100,7 +100,7 @@ if (isGetRequestParameterSet('hash')) {
                                        }
 
                                        // If version matches add ref bonus to refid's account
-                                       if ((getExtensionVersion('bonus') >= '0.4.4') && (getConfig('bonus_active') == 'Y')) {
+                                       if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (getConfig('bonus_active') == 'Y')) {
                                                // Add points (directly only!)
                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_ref`=`bonus_ref`+{?bonus_ref?} WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($rid)), __FILE__, __LINE__);
index 36bff36..5c9871a 100644 (file)
@@ -52,7 +52,7 @@ if ((!isExtensionActive('bonus')) && (!isAdmin())) {
        return;
 } // END - if
 
-if (getExtensionVersion('bonus') >= '0.6.9') {
+if (isExtensionInstalledAndNewer('bonus', '0.6.9')) {
        // Add more bonus points here
        // @TODO Rewrite this to a filter
        $USE = '(0';
index a73aaab..c9bfafc 100644 (file)
@@ -97,7 +97,7 @@ if (getConfig('order_max_full') == 'MAX') $ALLOWED = $MAXI;
 // Now check his points amount
 $total = countSumTotalData(getMemberId(), 'user_points', 'points') - countSumTotalData(getMemberId(), 'user_data', 'used_points');;
 
-if (($HOLIDAY == 'Y') && (getExtensionVersion('holiday') >= '0.1.3')) {
+if (($HOLIDAY == 'Y') && (isExtensionInstalledAndNewer('holiday', '0.1.3'))) {
        // Holiday is active!
        loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_ORDER_NOT_POSSIBLE'));
 } elseif ((isPostRequestParameterSet('frametester')) && ($ALLOWED > 0) && (postRequestParameter('receiver') > 0)) {
@@ -251,7 +251,7 @@ ORDER BY
                        // Load receivers from database
                        $TEST = array(); $cnt = '0';
                        while ($holidayContent = SQL_FETCHARRAY($result)) {
-                               if (getExtensionVersion('holiday') >= '0.1.3') {
+                               if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                                        // Check for his holiday status
                                        $result_holiday = SQL_QUERY_ESC("SELECT
        `id`
@@ -474,7 +474,7 @@ ORDER BY
                                while (list($ucat) = SQL_FETCHROW($result_userids)) {
                                        // Check for holiday system
                                        $HOL_ACTIVE = false;
-                                       if (isExtensionInstalledAndNewer('holiday', '0.1.3') {
+                                       if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                                                // Check user's holiday status
                                                $result_holiday = SQL_QUERY_ESC("SELECT
        d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d
index fd7daa8..95ccddf 100644 (file)
@@ -195,7 +195,7 @@ VALUES (%s,%s,%s, UNIX_TIMESTAMP(), 'NEW','%s','%s','%s')",
 
                                        // Load templates
                                        $message_mem = loadEmailTemplate('member_payout_request_banner', postRequestArray(), getMemberId());
-                                       if (getExtensionVersion('admins') >= '0.4.1') {
+                                       if (isExtensionInstalledAndNewer('admins', '0.4.1')) {
                                                $adm_tpl = 'admin_payout_request_banner';
                                        } else {
                                                $message_adm = loadEmailTemplate('admin_payout_request_banner', postRequestArray(), getMemberId());
@@ -219,7 +219,7 @@ VALUES (%s,%s,%s,'%s',%s, UNIX_TIMESTAMP(), 'NEW','%s')",
                                        $admin_tpl = '';
 
                                        // @TODO Rewrite this to a filter
-                                       if (getExtensionVersion('admins') >= '0.4.1') {
+                                       if (isExtensionInstalledAndNewer('admins', '0.4.1')) {
                                                $admin_tpl = 'admin_payout_request';
                                        } // END - if
                                }
index 0aceb6e..9f4ffc0 100644 (file)
@@ -141,7 +141,7 @@ if (isExtensionInstalledAndNewer('user', '0.1.2')) {
        $add = '';
        $CONFIRMED = getUserData('mails_confirmed');
 
-       if (getExtensionVersion('user') >= '0.1.4') {
+       if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                $SENT     = getUserData('emails_sent');
                $RECEIVED = getUserData('emails_received');
        } // END - if
@@ -178,7 +178,7 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu
        $content['stats'] = '0.00000';
 
        // Get more data if ext-bonus is newer
-       if (getExtensionVersion('bonus') >= '0.4.4') {
+       if (isExtensionInstalledAndNewer('bonus', '0.4.4')) {
                $content['ref']   = getUserData('bonus_ref');
                $content['order'] = getUserData('bonus_order');
                $content['stats'] = getUserData('bonus_stats');
@@ -191,7 +191,7 @@ if ((isExtensionInstalledAndNewer('bonus', '0.2.2')) && (isExtensionActive('bonu
        $content['turbo'] = translateComma($content['turbo']);
        $content['login'] = translateComma($content['login']);
 
-       if (getExtensionVersion('bonus') >= '0.4.4') {
+       if (isExtensionInstalledAndNewer('bonus', '0.4.4')) {
                // Add referal, stats and order bonys
                $content['ref']   = translateComma($content['ref']);
                $content['order'] = translateComma($content['order']);
index f24de73..253836a 100644 (file)
@@ -57,7 +57,7 @@ if ((!isFormSent()) || (!isPostRequestParameterSet(('qsummary')))) {
        loadTemplate('member_support_form', false, getUserDataArray());
 } else {
        // Load mail template based on your member's decision
-       if (getExtensionVersion('admins') >= '0.4.1') {
+       if (isExtensionInstalledAndNewer('admins', '0.4.1')) {
                $a_tpl = 'admin_support-' . postRequestParameter('qsummary');
        } else {
                $message_a = loadEmailTemplate('admin_support-' . postRequestParameter('qsummary'), array('text' => postRequestParameter('qdetails')), getMemberId());
index 44e8487..5209182 100644 (file)
@@ -1921,7 +1921,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
        } // END - if
 
        // Exclude users in holiday?
-       if (getExtensionVersion('holiday') >= '0.1.3') {
+       if (isExtensionInstalledAndNewer('holiday', '0.1.3')) {
                // Add something for the holiday extension
                $CAT_WHERE .= " AND d.`holiday_active`='N'";
        } // END - if
index d904d52..6276de6 100644 (file)
@@ -124,7 +124,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                                // Count one up and remove entry from dummy array
                                                $GLOBALS['pool_cnt']++; unset($dummy[$key]);
 
-                                               if (getExtensionVersion('user') >= '0.1.4') {
+                                               if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                                                        // Update mails received for receiver
                                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1",
                                                        array(bigintval($userid)), __FILE__, __LINE__);
@@ -141,7 +141,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                        } // END - foreach
 
                        // Update mediadata if version is 0.0.4 or higher
-                       if (getExtensionVersion('mediadata') >= '0.0.4') {
+                       if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                // Update entry (or add missing
                                $P = $GLOBALS['pool_cnt'];
                                if (!empty($cnt2) && empty($GLOBALS['pool_cnt'])) $P = $cnt2;
@@ -158,7 +158,7 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                                //* DEBUG: */ print("*L:".__LINE__."*<br />");
 
                                // Update mediadata if version is 0.0.4 or higher
-                               if (getExtensionVersion('mediadata') >= '0.0.4') {
+                               if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                        // Update entry (or add missing)
                                        //* DEBUG: */ print("*MEDIA/L:".__LINE__."*<br />");
                                        updateMediadataEntry(array('total_orders', 'bonus_orders'), 'add', 1);
index 981c43d..54e6bd0 100644 (file)
@@ -152,14 +152,14 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET emails_sent=emails_sent+1 WHERE `userid`=%s LIMIT 1",
                                                                        array(bigintval($DATA['sender'])), __FILE__, __LINE__);
 
-                                                               if (getExtensionVersion('user') >= '0.1.4') {
+                                                               if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                                                                        // Update mails received for receiver
                                                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1",
                                                                                array(bigintval($userid)), __FILE__, __LINE__);
                                                                } // END - if
 
                                                                // Update mediadata if version is 0.0.4 or higher
-                                                               if (getExtensionVersion('mediadata') >= '0.0.4') {
+                                                               if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                                                        // Update entry (or add missing)
                                                                        //* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*<br />");
                                                                        updateMediadataEntry(array('total_send', 'normal_send'), 'add', 1);
@@ -214,7 +214,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                $cnt2 += $GLOBALS['pool_cnt'];
 
                                                // Update mediadata if version is 0.0.4 or higher
-                                               if (getExtensionVersion('mediadata') >= '0.0.4') {
+                                               if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                                        // Update entry (or add missing)
                                                        //* DEBUG: */ outputHtml("*MEDIA/L:".__LINE__."*<br />");
                                                        updateMediadataEntry(array('total_orders', 'normal_orders'), 'add', 1);
index 37cc013..be14b25 100644 (file)
@@ -49,7 +49,7 @@ if ((getOutputMode() != 0) || (!isResetModeEnabled())) return;
 //* DEBUG: */ outputHtml(basename(__FILE__)."<br />");
 
 // Update user profiles
-if ((isExtensionActive('order')) && (getExtensionVersion('order') >= '0.1.1')) {
+if (isExtensionInstalledAndNewer('order', '0.1.1')) {
        // Latest version
        $result_daily = SQL_QUERY("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET receive_mails=max_mails, mail_orders=0 WHERE receive_mails != max_mails", __FILE__, __LINE__);
 } else {
@@ -86,7 +86,7 @@ LIMIT 1",
                                array($content['locked_points'], bigintval($content['userid']), $content['ref_depth']), __FILE__, __LINE__, false));
 
                                // Update mediadata as well
-                               if (getExtensionVersion('mediadata') >= '0.0.4') {
+                               if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                        // Update database
                                        updateMediadataEntry(array('total_points'), 'add', $content['locked_points']);
                                } // END - if
index 218bab2..2127a20 100644 (file)
@@ -368,8 +368,14 @@ function isSqlDebuggingEnabled () {
 
 // Checks wether we shall debug regular expressions
 function isDebugRegularExpressionEnabled () {
-       // Simply check it
-       return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
+       // Is cache set?
+       if (!isset($GLOBALS['is_regular_exp_debug_enabled'])) {
+               // Simply check it
+               $GLOBALS['is_regular_exp_debug_enabled'] = ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
+       } // END - if
+
+       // Return it
+       return $GLOBALS['is_regular_exp_debug_enabled'];
 }
 
 // Checks wether the cache instance is valid
@@ -707,16 +713,26 @@ function redirectToDereferedUrl ($URL) {
 
 // Wrapper function for checking if extension is installed and newer or same version
 function isExtensionInstalledAndNewer ($ext_name, $version) {
+       // Is an cache entry found?
+       if (!isset($GLOBALS['ext_installed_newer'][$ext_name][$version])) {
+               $GLOBALS['ext_installed_newer'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
+       } // END - if
+
        // Return it
-       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=&gt;'.$version.'<br />';
-       return ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
+       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=&gt;'.$version.':'.intval($GLOBALS['ext_installed_newer'][$ext_name][$version]).'<br />';
+       return $GLOBALS['ext_installed_newer'][$ext_name][$version];
 }
 
 // Wrapper function for checking if extension is installed and older than given version
 function isExtensionInstalledAndOlder ($ext_name, $version) {
+       // Is an cache entry found?
+       if (!isset($GLOBALS['ext_installed_older'][$ext_name][$version])) {
+               $GLOBALS['ext_installed_older'][$ext_name][$version] = ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
+       } // END - if
+
        // Return it
-       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'&lt;'.$version.'<br />';
-       return ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
+       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'&lt;'.$version.':'.intval($GLOBALS['ext_installed_older'][$ext_name][$version]).'<br />';
+       return $GLOBALS['ext_installed_older'][$ext_name][$version];
 }
 
 // Set username
@@ -750,7 +766,14 @@ function isInstallationPhase () {
 
 // Checks wether the extension demo is actuve and the admin login is demo (password needs to be demo, too!)
 function isDemoModeActive () {
-       return ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo'));
+       // Is cache set?
+       if (!isset($GLOBALS['demo_mode_active'])) {
+               // Simply check it
+               $GLOBALS['demo_mode_active'] = ((isExtensionActive('demo')) && (getSession('admin_login') == 'demo'));
+       } // END - if
+
+       // Return it
+       return $GLOBALS['demo_mode_active'];
 }
 
 // Getter for PHP caching value
index ff1cecd..29a08b5 100644 (file)
@@ -194,7 +194,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
                                                                                                array($url_mid), __FILE__, __LINE__);
 
                                                                                        // Update mediadata as well
-                                                                                       if (getExtensionVersion('mediadata') >= '0.0.4') {
+                                                                                       if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                                                                                // Update database
                                                                                                updateMediadataEntry(array('total_clicks', 'normal_clicks'), 'add', 1);
                                                                                        } // END - if
@@ -206,7 +206,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
                                                                                                array($url_bid), __FILE__, __LINE__);
 
                                                                                        // Update mediadata as well
-                                                                                       if (getExtensionVersion('mediadata') >= '0.0.4') {
+                                                                                       if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
                                                                                                // Update database
                                                                                                updateMediadataEntry(array('total_clicks', 'bonus_clicks'), 'add', 1);
                                                                                        } // END - if
@@ -224,13 +224,13 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
 
                                                                        // Only when user extension = v0.1.2: Update mails-confirmed counter
                                                                        // @TODO Rewrite these blocks to filter
-                                                                       if (getExtensionVersion('user') >= '0.1.2') {
+                                                                       if (isExtensionInstalledAndNewer('user', '0.1.2')) {
                                                                                // Update counter
                                                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET mails_confirmed=mails_confirmed + 1 WHERE `userid`=%s LIMIT 1",
                                                                                        array($url_userid), __FILE__, __LINE__);
 
                                                                                // Update random confirmed as well?
-                                                                               if (getExtensionVersion('user') >= '0.3.4') {
+                                                                               if (isExtensionInstalledAndNewer('user', '0.3.4')) {
                                                                                        // Update second counter
                                                                                        SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET rand_confirmed=rand_confirmed + 1 WHERE `userid`=%s LIMIT 1",
                                                                                                array($url_userid), __FILE__, __LINE__);
@@ -263,7 +263,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe
                                                                                addPointsThroughReferalSystem('mailid_okay', $url_userid, $payment, false, 0, $locked);
 
                                                                                // Shall I add bonus points for "turbo clickers" ?
-                                                                               if (getExtensionVersion('bonus') >= '0.2.2') {
+                                                                               if (isExtensionInstalledAndNewer('bonus', '0.2.2')) {
                                                                                        // Is an active-rallye running and this is not a notification mail?
                                                                                        if ((getConfig('bonus_active') == 'Y') && ($notify != 'Y')) {
                                                                                                // Shall I exclude the webmaster's own userid from the active-rallye?