Fixed first-time registration of sql_patches and possible fix for 'Cannot resolve...
[mailer.git] / inc / functions.php
index 320c774ce890aeec5c55e6b1ea4bd344273b5703..66b0c63e190892a6e095c919f5eabb0edf6bed47 100644 (file)
@@ -149,19 +149,21 @@ function sendHttpHeaders () {
 // Compiles the final output
 function compileFinalOutput () {
        // Init counter
-       $cnt = '0';
+       $cnt = 0;
 
        // Add page header and footer
        addPageHeaderFooter();
 
        // Compile all out
-       while (((strpos($GLOBALS['output'], '{--') > 0) || (strpos($GLOBALS['output'], '{!') > 0) || (strpos($GLOBALS['output'], '{?') > 0)) && ($cnt < 3)) {
+       while (((strpos($GLOBALS['output'], '{--') !== false) || (strpos($GLOBALS['output'], '{!') !== false) || (strpos($GLOBALS['output'], '{?') !== false) || (strpos($GLOBALS['output'], '{%') !== false)) && ($cnt < 3)) {
                // Init common variables
                $content = array();
                $newContent = '';
 
                // Compile it
-               $eval = "\$newContent = \"".compileCode(escapeQuotes($GLOBALS['output']))."\";";
+               //* DEBUG: */ print '<pre>'.htmlentities($GLOBALS['output']).'</pre>';
+               $eval = '$newContent = "' . compileCode(escapeQuotes($GLOBALS['output'])) . '";';
+               //* DEBUG: */ die('<pre>'.htmlentities($eval).'</pre>');
                eval($eval);
 
                // Was that eval okay?
@@ -169,6 +171,8 @@ function compileFinalOutput () {
                        // Something went wrong!
                        debug_report_bug('Evaluation error:<pre>' . linenumberCode($eval) . '</pre>', false);
                } // END - if
+
+               // Use it again
                $GLOBALS['output'] = $newContent;
 
                // Count round
@@ -1197,7 +1201,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 +1229,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 +2111,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')) {
@@ -3081,7 +3085,7 @@ function determineReferalId () {
        } elseif ((isExtensionInstalledAndNewer('user', '0.3.4')) && (getConfig('select_user_zero_refid') == 'Y')) {
                // Select a random user which has confirmed enougth mails
                $GLOBALS['refid'] = determineRandomReferalId();
-       } elseif ((isExtensionInstalled('sql_patches')) && (getConfig('def_refid') > 0)) {
+       } elseif ((isExtensionInstalledAndNewer('sql_patches', '0.1.2')) && (getConfig('def_refid') > 0)) {
                // Set default refid as refid in URL
                $GLOBALS['refid'] = getConfig('def_refid');
        } else {
@@ -4009,4 +4013,3 @@ if (!function_exists('http_build_query')) {
 
 // [EOF]
 ?>
-