From: Roland Häder Date: Thu, 22 Jul 2010 11:49:19 +0000 (+0000) Subject: New wrapper functions introduced X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=71c07e991fc7f5393317f4d9adf4ecdbc26b9aa3;p=mailer.git New wrapper functions introduced --- diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 63d458b082..b3d9154c8c 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -282,7 +282,7 @@ class CacheSystem { // Is the cache file not yet rebuilt? if ((!isset($this->rebuilt[$this->name])) && ($this->isCacheReadable())) { // Only run in regular output mode - if ((getScriptOutputMode() != 0) && ($force === false)) { + if ((!isHtmlOutputMode()) && ($force === false)) { // Debug message if allowed if (isDebugModeEnabled()) { // Debug message @@ -452,7 +452,7 @@ class CacheSystem { $GLOBALS[__METHOD__][$ext_name] = ((isset($this->version[$this->name][$ext_name])) && ($this->version[$this->name][$ext_name] == $ext_ver)); } elseif ($this->isCacheReadable()) { // No cache version found! - logDebugMessage(__METHOD__, __LINE__, "Cache {$this->name} has missing version entry for extension {$ext_name}! Purging cache..."); + logDebugMessage(__METHOD__, __LINE__, 'Cache ' . $this->name . ' has missing version entry for extension ' . $ext_name . '! Purging cache...'); // Remove the cache file $this->removeCacheFile(true); diff --git a/inc/config-functions.php b/inc/config-functions.php index 55d530bc89..db003aaf9e 100644 --- a/inc/config-functions.php +++ b/inc/config-functions.php @@ -278,7 +278,7 @@ function updateOldConfigFile () { // Update config entries function updateConfiguration ($entries, $values, $updateMode='', $config = '0') { // Do not update config in CSS mode - if ((getScriptOutputMode() == 1) || (getScriptOutputMode() == -1) || (isInstallationPhase())) { + if ((isCssOutputMode()) || (isRawOutputMode()) || (isInstallationPhase())) { return; } // END - if @@ -344,10 +344,10 @@ function updateConfiguration ($entries, $values, $updateMode='', $config = '0') } // Run database update - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "entries={$entries}"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'entries=' . $entries); SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_config` SET ".$entries." WHERE `config`=%s LIMIT 1", array(bigintval($config)), __FUNCTION__, __LINE__); - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "entries={$entries},affectedRows={$affectedRows}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'entries=' . $entries . ',affectedRows=' . SQL_AFFECTEDROWS()); // Rebuild cache rebuildCache('config', 'config'); diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index aada780666..206c868f5a 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -101,7 +101,7 @@ function SQL_QUERY ($sqlString, $F, $L, $enableCodes = true) { incrementConfigEntry('sql_count'); // Debug output - if ((getScriptOutputMode() != 1) && (isDebugModeEnabled()) && (isSqlDebuggingEnabled())) { + if ((!isCssOutputMode()) && (isDebugModeEnabled()) && (isSqlDebuggingEnabled())) { // // Debugging stuff... // diff --git a/inc/extensions-functions.php b/inc/extensions-functions.php index a7067ec005..9abe929fef 100644 --- a/inc/extensions-functions.php +++ b/inc/extensions-functions.php @@ -128,7 +128,7 @@ function loadExtension ($ext_name, $ext_mode, $ext_ver = '', $dry_run = false) { // Download functions file loadIncludeOnce($funcsInclude); } // END - if - } elseif ((!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name])) && (isDebugModeEnabled()) && (getScriptOutputMode() == '0') && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme') && (getExtensionMode() == 'test')) { + } elseif ((!isset($GLOBALS['cache_array']['extension']['ext_func'][$ext_name])) && (isDebugModeEnabled()) && (isHtmlOutputMode()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme') && (getExtensionMode() == 'test')) { // No functions file is not so good... logDebugMessage(__FUNCTION__, __LINE__, sprintf("NOTICE: Extension %s has no own functions file or we cannot read from it. mode=%s", $ext_name, @@ -604,7 +604,7 @@ function getExtensionVersion ($ext_name, $force = false) { // Count cache hits incrementStatsEntry('cache_hits'); - } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (getScriptOutputMode() != 0)) { + } elseif ((!isCacheInstanceValid()) || (isset($GLOBALS['cache_array']['extension'])) || (!isHtmlOutputMode())) { // Load from database $result = SQL_QUERY_ESC("SELECT `ext_version` FROM `{?_MYSQL_PREFIX?}_extensions` WHERE `ext_name`='%s' LIMIT 1", array($ext_name), __FUNCTION__, __LINE__); diff --git a/inc/extensions/ext-rallye.php b/inc/extensions/ext-rallye.php index 8b05ceb609..6b2fb3bdf0 100644 --- a/inc/extensions/ext-rallye.php +++ b/inc/extensions/ext-rallye.php @@ -329,7 +329,7 @@ Zudem sollten Sie mindestens folgende Templates (in templates/".getLangu case 'init': // Do stuff when extension is initialized // Do stuff only when not in CSS mode // @TODO Move this code into rallye_functions.php - if (getScriptOutputMode() != 1) { + if (!isCssOutputMode()) { // Get total member count $total = getTotalConfirmedUser(); diff --git a/inc/filters.php b/inc/filters.php index 77a02c56ca..254630b39e 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -524,7 +524,7 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) { } // END - if // Do we have non-HTML mode? - if ((getScriptOutputMode() != '0') || ($outputMode != '0')) $code = decodeEntities($code); + if ((!isHtmlOutputMode()) || ($outputMode != '0')) $code = decodeEntities($code); // Return compiled code //* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:
'.($code).'
'); @@ -548,7 +548,7 @@ function FILTER_UPDATE_EXTENSION_DATA ($ext_name) { // Load more reset scripts function FILTER_RUN_RESET_INCLUDES () { // Is the reset set or old sql_patches? - if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (getScriptOutputMode() == '0')) { + if (((!isResetModeEnabled()) || (!isExtensionInstalled('sql_patches'))) && (isHtmlOutputMode())) { // Then abort here debug_report_bug(__FUNCTION__, __LINE__, 'Cannot run reset! enabled='.intval(isResetModeEnabled()).',ext='.intval(isExtensionInstalled('sql_patches')).' Please report this bug. Thanks'); } // END - if @@ -638,14 +638,14 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // END - if // Get all values - if ((getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) { + if ((!isCssOutputMode()) && (!isRawOutputMode())) { // Fix module if (!isModuleSet()) { // Is the request element set? if (isGetRequestParameterSet('module')) { // Set module from request setModule(getRequestParameter('module')); - } elseif (getScriptOutputMode() == '0') { + } elseif (isHtmlOutputMode()) { // Set default module 'index' setModule('index'); } else { @@ -655,10 +655,14 @@ function FILTER_DETERMINE_WHAT_ACTION () { } // END - if // Fix 'what' if not yet set - if (!isWhatSet()) setWhat(getWhatFromModule(getModule())); + if (!isWhatSet()) { + setWhat(getWhatFromModule(getModule())); + } // END - if // Fix 'action' if not yet set - if (!isActionSet()) setAction(getActionFromModuleWhat(getModule(), getWhat())); + if (!isActionSet()) { + setAction(getActionFromModuleWhat(getModule(), getWhat())); + } // END - if } else { // Set action/what to empty setAction(''); @@ -667,7 +671,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { // Set default 'what' value //* DEBUG: */ debugOutput('-' . getModule() . '/' . getWhat() . '-'); - if ((!isWhatSet()) && (!isActionSet()) && (getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) { + if ((!isWhatSet()) && (!isActionSet()) && (!isCssOutputMode()) && (!isRawOutputMode())) { if (getModule() == 'admin') { // Set 'action' value to 'login' in admin menu setAction(getActionFromModuleWhat(getModule(), getWhat())); @@ -684,7 +688,7 @@ function FILTER_DETERMINE_WHAT_ACTION () { // Sends out pooled mails function FILTER_TRIGGER_SENDING_POOL () { // Are we in normal output mode? - if (getScriptOutputMode() != 0) { + if (!isHtmlOutputMode()) { // Only in normal output mode to prevent race-conditons! } // END - if @@ -722,7 +726,7 @@ function FILTER_RUN_DAILY_RESET () { if ((isInstallationPhase()) || (!isInstalled()) || (!isAdminRegistered()) || (!isExtensionInstalled('sql_patches'))) return; // Shall we run the reset scripts? If a day has changed, maybe also a week/month has changed... Simple! :D - if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (getScriptOutputMode() != 1)) { + if (((getDay(getConfig('last_update')) != getDay()) || ((isConfigEntrySet('DEBUG_RESET')) && (getConfig('DEBUG_RESET') == 'Y'))) && (!isInstallationPhase()) && (isAdminRegistered()) && (!isGetRequestParameterSet('register')) && (!isCssOutputMode())) { // Tell every module we are in reset-mode! doReset(); } // END - if @@ -784,7 +788,7 @@ function FILTER_COUNT_MODULE () { // Handles fatal errors function FILTER_HANDLE_FATAL_ERRORS () { // Do we have errors to handle and right output mode? - if ((!ifFatalErrorsDetected()) || (getScriptOutputMode() != '0')) { + if ((!ifFatalErrorsDetected()) || (!isHtmlOutputMode())) { // Abort executing here return false; } // END - if @@ -885,7 +889,7 @@ function FILTER_DISPLAY_COPYRIGHT () { function FILTER_DISPLAY_PARSING_TIME () { // Shall we display the parsing time and number of queries? // 1234 5 54 4 5 5 4 4 5 543 3 4432 2 33 2 2 21 - if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestParameterSet('frame'))) || (isInstallationPhase())) && (getScriptOutputMode() == '0') && ($GLOBALS['header_sent'] == 2)) { + if ((((isExtensionInstalledAndNewer('sql_patches', '0.4.1')) && (getConfig('show_timings') == 'Y') && (!isGetRequestParameterSet('frame'))) || (isInstallationPhase())) && (isHtmlOutputMode()) && ($GLOBALS['header_sent'] == 2)) { // Then display it here displayParsingTime(); } // END - if diff --git a/inc/footer.php b/inc/footer.php index 7d8b93402e..a036830ee2 100644 --- a/inc/footer.php +++ b/inc/footer.php @@ -47,7 +47,7 @@ $GLOBALS['page_footer'] = ''; // Footer disabled or already sent? // 1234 5 54 45 5 5 543 3 321 -if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != 1) && ($GLOBALS['footer_sent'] != 2))) && (getScriptOutputMode() != 1))) { +if ((((!isset($GLOBALS['footer_sent'])) || (($GLOBALS['footer_sent'] != 1) && ($GLOBALS['footer_sent'] != 2))) && (!isCssOutputMode()))) { // Run the filter, sweet huh? runFilterChain('page_footer'); diff --git a/inc/functions.php b/inc/functions.php index 296f031e70..f50a594a58 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -104,7 +104,7 @@ function getTotalFatalErrors () { // Send mail out to an email address function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '') { - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "TO={$toEmail},SUBJECT={$subject}
"); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'toEmail=' . $toEmail . ',subject=' . $subject . ',isHtml=' . $isHtml); // Compile subject line (for POINTS constant etc.) eval('$subject = decodeEntities("' . compileRawCode(escapeQuotes($subject)) . '");'); @@ -1839,7 +1839,7 @@ function rebuildCache ($cache, $inc = '', $force = false) { loadInclude($inc); } else { // Include not found! - logDebugMessage(__FUNCTION__, __LINE__, "Include {$inc} not found. cache={$cache}"); + logDebugMessage(__FUNCTION__, __LINE__, 'Include ' . $inc . ' not found. cache=' . $cache); } } // END - if } // END - if @@ -1909,7 +1909,7 @@ function addNewBonusMail ($data, $mode = '', $output=true) { // Determines referal id and sets it function determineReferalId () { // Skip this in non-html-mode and outside ref.php - if ((getScriptOutputMode() != 0) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) return false; + if ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) return false; // Check if refid is set if ((isset($GLOBALS['refid'])) && ($GLOBALS['refid'] > 0)) { @@ -2272,7 +2272,7 @@ function getModuleFromFileName ($file, $accessLevel) { // Encodes an URL for adding session id, etc. function encodeUrl ($url, $outputMode = '0') { // Do we have already have a PHPSESSID inside or view.php is called? Then abort here - if ((strpos($url, session_name()) !== false) || (getScriptOutputMode() == -3)) return $url; + if ((strpos($url, session_name()) !== false) || (isRawOutputMode())) return $url; // Do we have a valid session? if (((!isset($GLOBALS['valid_session'])) || ($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) { @@ -2282,7 +2282,7 @@ function encodeUrl ($url, $outputMode = '0') { if (strpos($url, '?') === false) { // No question mark $seperator = '?'; - } elseif ((getScriptOutputMode() != '0') || ($outputMode != '0')) { + } elseif ((!isHtmlOutputMode()) || ($outputMode != '0')) { // Non-HTML mode $seperator = '&'; } diff --git a/inc/header.php b/inc/header.php index 785ddd8ebb..2f5f4a1527 100644 --- a/inc/header.php +++ b/inc/header.php @@ -53,7 +53,7 @@ if (($GLOBALS['header_sent'] != 1) && ($GLOBALS['header_sent'] != 2)) { setHttpStatus('200 OK'); // If not in CSS mode generate the header - if (getScriptOutputMode() != 1) { + if (!isCssOutputMode()) { // Prepare the header for HTML output loadHtmlHeader(); } // END - if @@ -63,7 +63,7 @@ if (($GLOBALS['header_sent'] != 1) && ($GLOBALS['header_sent'] != 2)) { } // END - if // Add BODY tag or not? -if ((getScriptOutputMode() != 1) && (getScriptOutputMode() != -1) && ($GLOBALS['header_sent'] == 1) && ((getModule() != 'frametester') || (isGetRequestParameterSet('frame')))) { +if ((!isCssOutputMode()) && (!isRawOutputMode()) && ($GLOBALS['header_sent'] == 1) && ((getModule() != 'frametester') || (isGetRequestParameterSet('frame')))) { loadTemplate('page_body'); $GLOBALS['header_sent'] = 2; } // END - if diff --git a/inc/language-functions.php b/inc/language-functions.php index 303fa09d11..96f5e0c01b 100644 --- a/inc/language-functions.php +++ b/inc/language-functions.php @@ -192,7 +192,7 @@ function loadLanguageFile ($ext_name = 'none') { if (isLanguageIncludeReadable($ext_name)) { // Load language file loadLanguageInclude($ext_name); - } elseif ((isDebugModeEnabled()) && (getScriptOutputMode() == '0') && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) { + } elseif ((isDebugModeEnabled()) && (isHtmlOutputMode()) && ($ext_name != 'sql_patches') && (substr($ext_name, 0, 10) != 'admintheme')) { // No language file is not so good... logDebugMessage(__FUNCTION__, __LINE__, sprintf("NOTICE: Extension %s has no language file or we cannot read from it. lang=%s, mode=%s", $ext_name, diff --git a/inc/libs/theme_functions.php b/inc/libs/theme_functions.php index 2b82becd18..b9e61dbe09 100644 --- a/inc/libs/theme_functions.php +++ b/inc/libs/theme_functions.php @@ -242,7 +242,7 @@ function getActualTheme () { // Fix it to default $ret = 'default'; } // END - if - } elseif ((!isInstalled()) && ((isInstalling()) || (getScriptOutputMode() == true)) && ((isGetRequestParameterSet('theme')) || (isPostRequestParameterSet('theme')))) { + } elseif ((!isInstalled()) && ((isInstalling()) || (isHtmlOutputMode())) && ((isGetRequestParameterSet('theme')) || (isPostRequestParameterSet('theme')))) { // Prepare filename for checking $themeFile = sprintf("theme/%s/theme.php", getRequestParameter('theme')); diff --git a/inc/loader/load_cache- b/inc/loader/load_cache- index 16c17c6eac..2b61ce279e 100644 --- a/inc/loader/load_cache- +++ b/inc/loader/load_cache- @@ -49,7 +49,7 @@ if (!defined('__SECURITY')) { if (($GLOBALS['cache_instance']->loadCacheFile('foo')) && ($GLOBALS['cache_instance']->extensionVersionMatches('foo'))) { // Load cache $GLOBALS['cache_array']['foo'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (getOutputMode() != 1) { +} elseif (isHtmlMode()) { // Create cache file $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-admin.php b/inc/loader/load_cache-admin.php index 33d00a3a89..a0b883bce3 100644 --- a/inc/loader/load_cache-admin.php +++ b/inc/loader/load_cache-admin.php @@ -83,7 +83,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('admin')) && ($GLOBALS['cache_ins $GLOBALS['cache_instance']->removeCacheFile(); unset($GLOBALS['cache_array']['admin']); } -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file $GLOBALS['cache_instance']->init(); @@ -116,7 +116,7 @@ if (isExtensionInstalledAndNewer('admins', '0.3')) { if (($GLOBALS['cache_instance']->loadCacheFile('admin_acls')) && ($GLOBALS['cache_instance']->extensionVersionMatches('admins'))) { // Load referal system from cache $GLOBALS['cache_array']['admin_acls'] = $GLOBALS['cache_instance']->getArrayFromCache(); - } elseif (getScriptOutputMode() != 1) { + } elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-config.php b/inc/loader/load_cache-config.php index 952110fa9b..83866fe279 100644 --- a/inc/loader/load_cache-config.php +++ b/inc/loader/load_cache-config.php @@ -60,7 +60,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('config')) && ($GLOBALS['cache_in // Remove dummy array unset($config); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-extension.php b/inc/loader/load_cache-extension.php index cb0b30589d..3dc4a04629 100644 --- a/inc/loader/load_cache-extension.php +++ b/inc/loader/load_cache-extension.php @@ -132,7 +132,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('extension')) && ($GLOBALS['cache // Remove array and mark cache as loaded unset($EXT_POOL); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-filter.php b/inc/loader/load_cache-filter.php index f809685817..8bf3500481 100644 --- a/inc/loader/load_cache-filter.php +++ b/inc/loader/load_cache-filter.php @@ -52,7 +52,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('filter')) && ($GLOBALS['cache_in // Prepare the array here prepareFilterArray(); -} elseif ((getScriptOutputMode() != 1) && (isExtensionInstalled('sql_patches'))) { +} elseif ((isHtmlOutputMode()) && (isExtensionInstalled('sql_patches'))) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-impressum.php b/inc/loader/load_cache-impressum.php index 1e448562ab..2896bf127f 100644 --- a/inc/loader/load_cache-impressum.php +++ b/inc/loader/load_cache-impressum.php @@ -52,7 +52,7 @@ if (isInstallationPhase()) return; if (($GLOBALS['cache_instance']->loadCacheFile('imprint')) && ($GLOBALS['cache_instance']->extensionVersionMatches('imprint'))) { // Load cache $GLOBALS['cache_array']['imprint'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-modules.php b/inc/loader/load_cache-modules.php index cdace7bce7..7945b028af 100644 --- a/inc/loader/load_cache-modules.php +++ b/inc/loader/load_cache-modules.php @@ -86,7 +86,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('modules')) && ($GLOBALS['cache_i } // END - foreach } // END - foreach unset($modArray); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-refdepths.php b/inc/loader/load_cache-refdepths.php index f4a8c2180b..8441ea54e1 100644 --- a/inc/loader/load_cache-refdepths.php +++ b/inc/loader/load_cache-refdepths.php @@ -49,7 +49,7 @@ if (isInstallationPhase()) return; if (($GLOBALS['cache_instance']->loadCacheFile('refdepths')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache $GLOBALS['cache_array']['refdepths'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-refsystem.php b/inc/loader/load_cache-refsystem.php index 049a8d8143..3128736316 100644 --- a/inc/loader/load_cache-refsystem.php +++ b/inc/loader/load_cache-refsystem.php @@ -49,7 +49,7 @@ if (isInstallationPhase()) return; if (($GLOBALS['cache_instance']->loadCacheFile('refsystem')) && ($GLOBALS['cache_instance']->extensionVersionMatches('sql_patches'))) { // Load referal system from cache $GLOBALS['cache_array']['refsystem'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-revision.php b/inc/loader/load_cache-revision.php index c6322d567a..7cfa22f9a9 100644 --- a/inc/loader/load_cache-revision.php +++ b/inc/loader/load_cache-revision.php @@ -46,7 +46,7 @@ if (!defined('__SECURITY')) { if ($GLOBALS['cache_instance']->loadCacheFile('revision')) { // Load revision from cache $GLOBALS['cache_array']['revision'] = $GLOBALS['cache_instance']->getArrayFromCache(); -} elseif ((getScriptOutputMode() != 1)) { +} elseif ((isHtmlOutputMode())) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/loader/load_cache-them.php b/inc/loader/load_cache-them.php index 3400831d45..d9b949e3a8 100644 --- a/inc/loader/load_cache-them.php +++ b/inc/loader/load_cache-them.php @@ -72,7 +72,7 @@ if (($GLOBALS['cache_instance']->loadCacheFile('themes')) && ($GLOBALS['cache_in // Remove dummy array unset($cache); -} elseif (getScriptOutputMode() != 1) { +} elseif (isHtmlOutputMode()) { // Create cache file here $GLOBALS['cache_instance']->init(); diff --git a/inc/mails/_mails.php b/inc/mails/_mails.php index 47136caee4..8c96a1fc5f 100644 --- a/inc/mails/_mails.php +++ b/inc/mails/_mails.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { } // Do not execute when script is in CSS mode -if (getScriptOutputMode() != 0) return; +if (!isHtmlOutputMode()) return; // [EOF] ?> diff --git a/inc/mails/beg_mails.php b/inc/mails/beg_mails.php index 936bbc8b44..abd0aff85e 100644 --- a/inc/mails/beg_mails.php +++ b/inc/mails/beg_mails.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { } // Do not execute when script is in CSS mode -if (getScriptOutputMode() != 0) return; +if (!isHtmlOutputMode()) return; // Create timemark from saved month $mark = mktime(0, 0, 0, getConfig('last_month'), getDay(), getYear()); diff --git a/inc/mails/bonus_mails.php b/inc/mails/bonus_mails.php index 2b9ff117c4..12bba3219e 100644 --- a/inc/mails/bonus_mails.php +++ b/inc/mails/bonus_mails.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { } // Do not execute when script is in CSS mode -if (getScriptOutputMode() != 0) return; +if (!isHtmlOutputMode()) return; // Create timemark from saved month $mark = mktime(0, 0, 0, getConfig('last_month'), getDay(), getYear()); diff --git a/inc/mails/doubler_mails.php b/inc/mails/doubler_mails.php index 2cabb5f490..85d852979a 100644 --- a/inc/mails/doubler_mails.php +++ b/inc/mails/doubler_mails.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { } // Do not execute when script is in CSS mode -if (getScriptOutputMode() != 0) return; +if (!isHtmlOutputMode()) return; // Initialize variables $jackpotPoints = '0'; $userPoints = '0'; diff --git a/inc/module-functions.php b/inc/module-functions.php index e58662787d..1c8e80957f 100644 --- a/inc/module-functions.php +++ b/inc/module-functions.php @@ -236,7 +236,7 @@ function checkModulePermissions ($module = '') { // Destroy cache here // @TODO Rewrite this to a filter - if ((getScriptOutputMode() == '0') || (getScriptOutputMode() == -1)) rebuildCache('modules', 'modules'); + if ((isHtmlOutputMode()) || (isRawOutputMode())) rebuildCache('modules', 'modules'); // And reload data unset($GLOBALS['module_status'][$module]); @@ -245,7 +245,7 @@ function checkModulePermissions ($module = '') { // Module not found we don't add it to the database $ret = '404'; } - } elseif (($ret == 'cache_miss') && (getScriptOutputMode() == '0')) { + } elseif (($ret == 'cache_miss') && (isHtmlOutputMode())) { // Rebuild the cache files rebuildCache('modules', 'modules'); } elseif ($found === false) { diff --git a/inc/modules/admin/admin-inc.php b/inc/modules/admin/admin-inc.php index b95b6a2523..c457b8489e 100644 --- a/inc/modules/admin/admin-inc.php +++ b/inc/modules/admin/admin-inc.php @@ -863,7 +863,7 @@ function adminBuilderStatusHandler ($mode, $IDs, $table, $columns, $filterFuncti } // END - if } elseif (isset($content[$column])) { // Unfinished! - debug_report_bug(__FUNCTION__, __LINE__, ":UNFINISHED: id={$id}/{$column}[".gettype($statusInfo)."] = {$content[$column]}"); + debug_report_bug(__FUNCTION__, __LINE__, ':UNFINISHED: id=' . $id . ',column=' . $column . '[' . gettype($statusInfo) . '] = ' . $content[$column]); } } // END - foreach diff --git a/inc/monthly/monthly_ b/inc/monthly/monthly_ index fe873c43c8..4a413e85a8 100644 --- a/inc/monthly/monthly_ +++ b/inc/monthly/monthly_ @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getOutputMode() == 1) || (isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('')) { diff --git a/inc/monthly/monthly_beg.php b/inc/monthly/monthly_beg.php index 2ce572fc9d..950b94884e 100644 --- a/inc/monthly/monthly_beg.php +++ b/inc/monthly/monthly_beg.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif ((!isExtensionActive('beg')) || (!isBegRallyeEnabled())) { @@ -52,7 +52,7 @@ if (!defined('__SECURITY')) { $curr = getMonth(); // Check if month is done -if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && (getScriptOutputMode() != 1)) { +if (($curr != getConfig('last_month')) && (getConfig('last_month') > 0) && (getConfig('beg_ranks') > 0) && (!isCssOutputMode())) { // Extension 'autopurge' is inactive or purging of inactive accounts is deactivated $whereStatement1 = ''; diff --git a/inc/monthly/monthly_bonus.php b/inc/monthly/monthly_bonus.php index 0210ff69b6..41e50053c0 100644 --- a/inc/monthly/monthly_bonus.php +++ b/inc/monthly/monthly_bonus.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('bonus')) { @@ -51,7 +51,7 @@ if (!defined('__SECURITY')) { // Get current month (2 digits) $curr = getMonth(); -if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && (getScriptOutputMode() != 1)) { +if (($curr != getConfig('last_month')) && (getConfig('bonus_ranks') > 0) && (!isCssOutputMode())) { // Extension 'autopurge' is inactive or purging of inactive accounts is deactivated $whereStatement1 = "WHERE `status`='CONFIRMED'"; diff --git a/inc/monthly/monthly_newsletter.php b/inc/monthly/monthly_newsletter.php index 8c36f32bc3..d43f4e9024 100644 --- a/inc/monthly/monthly_newsletter.php +++ b/inc/monthly/monthly_newsletter.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('newsletter')) { diff --git a/inc/monthly/monthly_surfbar.php b/inc/monthly/monthly_surfbar.php index 1d95e5bca6..0fc646ba23 100644 --- a/inc/monthly/monthly_surfbar.php +++ b/inc/monthly/monthly_surfbar.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('surfbar')) { diff --git a/inc/mysql-connect.php b/inc/mysql-connect.php index 8243597d66..959ccfd682 100644 --- a/inc/mysql-connect.php +++ b/inc/mysql-connect.php @@ -136,7 +136,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) { setConfigEntry('OUTPUT_MODE', 'direct'); // This hack prevents a backtrace in CSS output - if (getScriptOutputMode() == 1) { + if (isCssOutputMode()) { // Problem with config so set output mode setConfigEntry('OUTPUT_MODE', 'render'); } // END - if @@ -157,7 +157,7 @@ if ((!isInstalling()) && (!isInstallationPhase())) { runFilterChain('init'); // Are we installation routine? - if ((!isInstalling()) && (getScriptOutputMode() != 1) && (getScriptOutputMode() != -1)) { + if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) { // You have to install first! redirectToUrl('install.php'); } // END - if diff --git a/inc/reset/reset_ b/inc/reset/reset_ index f39419727a..7906ccaffa 100644 --- a/inc/reset/reset_ +++ b/inc/reset/reset_ @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('')) { diff --git a/inc/reset/reset_100_bonus.php b/inc/reset/reset_100_bonus.php index 87c197c2da..4686d55296 100644 --- a/inc/reset/reset_100_bonus.php +++ b/inc/reset/reset_100_bonus.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('bonus')) { diff --git a/inc/reset/reset_autopurge.php b/inc/reset/reset_autopurge.php index 6598d56c53..95424a6395 100644 --- a/inc/reset/reset_autopurge.php +++ b/inc/reset/reset_autopurge.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('autopurge')) { diff --git a/inc/reset/reset_beg.php b/inc/reset/reset_beg.php index a629fb122f..7ce84856c4 100644 --- a/inc/reset/reset_beg.php +++ b/inc/reset/reset_beg.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif ((!isExtensionActive('beg')) || (!isBegRallyeEnabled())) { diff --git a/inc/reset/reset_birthday.php b/inc/reset/reset_birthday.php index 4321e31bd4..3eeee01dfd 100644 --- a/inc/reset/reset_birthday.php +++ b/inc/reset/reset_birthday.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode return; } elseif (!isExtensionActive('birthday')) { diff --git a/inc/reset/reset_bonus.php b/inc/reset/reset_bonus.php index 52d886ba80..c8370019f5 100644 --- a/inc/reset/reset_bonus.php +++ b/inc/reset/reset_bonus.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('bonus')) { diff --git a/inc/reset/reset_daily.php b/inc/reset/reset_daily.php index 0d6c6b7fda..6b159cbcb2 100644 --- a/inc/reset/reset_daily.php +++ b/inc/reset/reset_daily.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('sql_patches')) { diff --git a/inc/reset/reset_doubler.php b/inc/reset/reset_doubler.php index 64e6348a4a..198d3c73e8 100644 --- a/inc/reset/reset_doubler.php +++ b/inc/reset/reset_doubler.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif ((!isExtensionActive('doubler')) || (getConfig('doubler_send_mode') != 'RESET')) { diff --git a/inc/reset/reset_engine.php b/inc/reset/reset_engine.php index be1eb1b9ea..a8e9bc84e3 100644 --- a/inc/reset/reset_engine.php +++ b/inc/reset/reset_engine.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('engine')) { diff --git a/inc/reset/reset_holiday.php b/inc/reset/reset_holiday.php index 8afdbb80b5..f31c6f52a1 100644 --- a/inc/reset/reset_holiday.php +++ b/inc/reset/reset_holiday.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || ((!isResetModeEnabled()) && (getConfig('holiday_mode') == 'RESET'))) { +} elseif ((!isHtmlOutputMode()) || ((!isResetModeEnabled()) && (getConfig('holiday_mode') == 'RESET'))) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('holiday')) { diff --git a/inc/reset/reset_profile.php b/inc/reset/reset_profile.php index 42d95ce89b..9c112856fa 100644 --- a/inc/reset/reset_profile.php +++ b/inc/reset/reset_profile.php @@ -41,7 +41,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('profile')) { diff --git a/inc/reset/reset_surfbar.php b/inc/reset/reset_surfbar.php index 73cb3ac473..411e273144 100644 --- a/inc/reset/reset_surfbar.php +++ b/inc/reset/reset_surfbar.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('surfbar')) { diff --git a/inc/reset/reset_yoomedia.php b/inc/reset/reset_yoomedia.php index 65f1fb165e..05da7efd03 100644 --- a/inc/reset/reset_yoomedia.php +++ b/inc/reset/reset_yoomedia.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() != 0) || (!isResetModeEnabled())) { +} elseif ((!isHtmlOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('yoomedia')) { diff --git a/inc/session-functions.php b/inc/session-functions.php index 4bb1253503..4bd00ec494 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -45,7 +45,7 @@ if (!defined('__SECURITY')) { // Unset/set session variables function setSession ($var, $value) { // Abort in CSS mode here - if (getScriptOutputMode() == 1) return true; + if (isCssOutputMode()) return true; // Trim value and session variable $var = trim(secureString($var)); $value = trim($value); diff --git a/inc/stylesheet.php b/inc/stylesheet.php index c8c0565234..14e3049545 100644 --- a/inc/stylesheet.php +++ b/inc/stylesheet.php @@ -54,7 +54,7 @@ if ((isInstallationPhase())) $stylesList[] = 'install.css'; if (!isConfigEntrySet('css_php')) setConfigEntry('css_php', 'FILE'); // Output CSS files or content or link to css.php ? -if ((getScriptOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) { +if ((isCssOutputMode()) || (getConfig('css_php') == 'DIRECT')) { // Load CSS files $stylesList = merge_array($stylesList, getExtensionCssFiles()); @@ -83,7 +83,7 @@ if ((getScriptOutputMode() == 1) || (getConfig('css_php') == 'DIRECT')) { } // END - switch } // END - if } // END - foreach -} elseif ((getScriptOutputMode() == '0') || (getConfig('css_php') == 'INLINE')) { +} elseif ((isHtmlOutputMode()) || (getConfig('css_php') == 'INLINE')) { // Load CSS files $stylesList = merge_array($stylesList, getExtensionCssFiles()); diff --git a/inc/template-functions.php b/inc/template-functions.php index 7134e1f0f2..1fe104422b 100644 --- a/inc/template-functions.php +++ b/inc/template-functions.php @@ -56,7 +56,7 @@ function enableTemplateHtml ($enable = true) { // Default: true function isTemplateHtml () { // Is the output_mode other than 0 (HTML), then no comments are enabled - if (getScriptOutputMode() != 0) { + if (!isHtmlOutputMode()) { // No HTML return false; } else { @@ -180,7 +180,7 @@ function compileFinalOutput () { $GLOBALS['output'] = doFinalCompilation($GLOBALS['output']); // Extension 'rewrite' installed? - if ((isExtensionActive('rewrite')) && (getScriptOutputMode() != 1)) { + if ((isExtensionActive('rewrite')) && (!isCssOutputMode())) { $GLOBALS['output'] = rewriteLinksInCode($GLOBALS['output']); } // END - if @@ -301,7 +301,7 @@ function loadTemplate ($template, $return = false, $content = array()) { $ret = ''; if ((strpos($GLOBALS['tpl_content'], '$') !== false) || (strpos($GLOBALS['tpl_content'], '{--') !== false) || (strpos($GLOBALS['tpl_content'], '{?') !== false) || (strpos($GLOBALS['tpl_content'], '{%') !== false)) { // Normal HTML output? - if (getScriptOutputMode() == '0') { + if (isHtmlOutputMode()) { // Add surrounding HTML comments to help finding bugs faster $ret = '' . $GLOBALS['tpl_content'] . ''; diff --git a/inc/weekly/weekly_ b/inc/weekly/weekly_ index ae51c50ab9..31941949aa 100644 --- a/inc/weekly/weekly_ +++ b/inc/weekly/weekly_ @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('')) { diff --git a/inc/weekly/weekly_surfbar.php b/inc/weekly/weekly_surfbar.php index bb11e6ceaf..744ced65e0 100644 --- a/inc/weekly/weekly_surfbar.php +++ b/inc/weekly/weekly_surfbar.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} elseif ((getScriptOutputMode() == 1) || (!isResetModeEnabled())) { +} elseif ((isCssOutputMode()) || (!isResetModeEnabled())) { // Do not execute when script is in CSS mode or no daily reset return; } elseif (!isExtensionActive('surfbar')) { diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index b101e22c8f..cdc48f6c54 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -559,7 +559,7 @@ function getAction ($strict = true) { $action = null; // Is the value set? - if (isActionSet(($strict) && (getScriptOutputMode() == 0))) { + if (isActionSet(($strict) && (isHtmlOutputMode()))) { // Then use it $action = $GLOBALS['action']; } // END - if @@ -1898,5 +1898,23 @@ function isExtensionTask ($content) { return $GLOBALS['is_extension_task'][$content['task_type'] . '_' . $content['infos']]; } +// Wrapper to check if output mode is CSS +function isCssOutputMode () { + // Determine it + return (getScriptOutputMode() == 1); +} + +// Wrapper to check if output mode is HTML +function isHtmlOutputMode () { + // Determine it + return (getScriptOutputMode() == 0); +} + +// Wrapper to check if output mode is RAW +function isRawOutputMode () { + // Determine it + return (getScriptOutputMode() == -1); +} + // [EOF] ?> diff --git a/view.php b/view.php index 16a41a7f02..d9cc6acfa6 100644 --- a/view.php +++ b/view.php @@ -42,7 +42,7 @@ require('inc/libs/security_functions.php'); // Set module $GLOBALS['module'] = 'view'; -$GLOBALS['output_mode'] = -3; +$GLOBALS['output_mode'] = -1; // Load the required file(s) require('inc/config-global.php');