./inc/functions.php:1596: // @TODO Are these convertions still required?
./inc/functions.php:1614:// @TODO Rewrite this function to use readFromFile() and writeToFile()
./inc/functions.php:181:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2277: // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2454: // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:2187: // @TODO Find a way to cache this
+./inc/functions.php:2288: // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2468: // @TODO Rename column data_type to e.g. mail_status
./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
./inc/install-functions.php:57: // @TODO DEACTIVATED: changeDataInInclude(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
./inc/language/de.php:1082: // @TODO Rewrite these two constants
./inc/language/de.php:1103: // @TODO Rewrite these three constants
./inc/language/de.php:779:// @TODO Are these constants longer used?
-./inc/language-functions.php:243: // @TODO These are all valid languages, again hard-coded
+./inc/language-functions.php:250: // @TODO These are all valid languages, again hard-coded
./inc/language-functions.php:44:// @TODO Rewrite all language constants to this function.
./inc/language/newsletter_de.php:13: * @TODO This language file is completely out-dated, please do no *
./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings *
// Set the link resource
SQL_SET_LINK($linkResource);
-
- // Destroy cache
- unset($GLOBALS['is_sql_link_up']);
}
// SQL select database
// Close link
SQL_SET_LINK(null);
- // Destroy cache
- unset($GLOBALS['is_sql_link_up']);
-
// Return the result
return $close;
}
// Set it
$GLOBALS['sql_link'] = $link;
+
+ // Re-init cache
+ $GLOBALS['is_sql_link_up'] = is_resource($link);
}
// Checks if the link is up
$data = array(
'matches' => $matches,
'key' => $key,
- 'mode' => $outputMode,
+ 'mode' => getScriptOutputMode(),
'code' => $code,
'callback' => $callback,
'extra_func' => $extraFunction,
} // END - if
// Do we have non-HTML mode?
- if ((!isHtmlOutputMode()) || ($outputMode != '0')) $code = decodeEntities($code);
+ if (!isHtmlOutputMode()) {
+ $code = decodeEntities($code);
+ } // END - if
// Return compiled code
//* DEBUG: */ debugOutput(__FUNCTION__.'['.__LINE__.']:<pre>'.($code).'</pre>');
// Determines referal id and sets it
function determineReferalId () {
// Skip this in non-html-mode and outside ref.php
- if ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) return false;
+ if ((!isHtmlOutputMode()) && (basename($_SERVER['PHP_SELF']) != 'ref.php')) {
+ return false;
+ } // END - if
// Check if refid is set
if ((isset($GLOBALS['refid'])) && ($GLOBALS['refid'] > 0)) {
// And skip further processing
continue;
- } elseif (substr($baseFile, 0, strlen($prefix)) != $prefix) {
+ } elseif (!isFilePrefixFound($baseFile, $prefix)) {
// Skip this file
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Invalid prefix in file ' . $baseFile . ', prefix=' . $prefix);
continue;
continue;
}
+ // Get file' extension (last 4 chars)
+ $fileExtension = substr($baseFile, -4, 4);
+
// Is the file a PHP script or other?
//* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'baseDir=' . $baseDir . ',prefix=' . $prefix . ',baseFile=' . $baseFile);
- if ((substr($baseFile, -4, 4) == '.php') || (($fileIncludeDirs === true) && (isDirectory($FQFN)))) {
+ if (($fileExtension == '.php') || (($fileIncludeDirs === true) && (isDirectory($FQFN)))) {
// Is this a valid include file?
if ($extension == '.php') {
// Remove both for extension name
}
} else {
// We found .php file but should not search for them, why?
- debug_report_bug(__FUNCTION__, __LINE__, 'We should find files with extension=' . $extension . ', but we found a PHP script.');
+ debug_report_bug(__FUNCTION__, __LINE__, 'We should find files with extension=' . $extension . ', but we found a PHP script. (baseFile=' . $baseFile . ')');
}
- } elseif (substr($baseFile, -4, 4) == $extension) {
+ } elseif ($fileExtension == $extension) {
// Other, generic file found
$files[] = $fileName;
}
return $files;
}
+// Checks wether $prefix is found in $fileName
+function isFilePrefixFound ($fileName, $prefix) {
+ // @TODO Find a way to cache this
+ return (substr($fileName, 0, strlen($prefix)) == $prefix);
+}
+
// Maps a module name into a database table name
function mapModuleToTable ($moduleName) {
// Map only these, still lame code...
// 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) || (isRawOutputMode())) return $url;
+ if ((strpos($url, session_name()) !== false) || (isRawOutputMode())) {
+ // Raw output mode detected or session_name() found in URL
+ return $url;
+ } // END - if
// Do we have a valid session?
if (((!isset($GLOBALS['valid_session'])) || ($GLOBALS['valid_session'] === false) || (!isset($_COOKIE[session_name()]))) && (isSpider() === false)) {
// No question mark
$seperator = '?';
} elseif ((!isHtmlOutputMode()) || ($outputMode != '0')) {
- // Non-HTML mode
+ // Non-HTML mode (or forced non-HTML mode
$seperator = '&';
}
// "Getter" for language
function getLanguage () {
- // Default is 'de'. DO NOT CHANGE THIS!!!
- $ret = 'de';
-
- // Set default return value to default language from config
- if (isConfigEntrySet('DEFAULT_LANG')) $ret = getDefaultLanguage();
-
- // Is the variable set
- if (isGetRequestParameterSet('mx_lang')) {
- // Accept only first 2 chars
- $ret = substr(getRequestParameter('mx_lang'), 0, 2);
- } elseif (isset($GLOBALS['language'])) {
- // Use cached
- $ret = getCurrentLanguage();
- } elseif (isSessionVariableSet('mx_lang')) {
- // Return stored value from cookie
- $ret = getSession('mx_lang');
-
- // Fixes a warning before the session has the mx_lang constant
- if (empty($ret)) $ret = getDefaultLanguage();
- }
+ // Do we have cache?
+ if (!isset($GLOBALS['language'])) {
+ // Default is 'de'. DO NOT CHANGE THIS!!!
+ $ret = 'de';
+
+ // Set default return value to default language from config
+ if (isConfigEntrySet('DEFAULT_LANG')) {
+ $ret = getDefaultLanguage();
+ } // END - if
+
+ // Is the variable set
+ if (isGetRequestParameterSet('mx_lang')) {
+ // Accept only first 2 chars
+ $ret = substr(getRequestParameter('mx_lang'), 0, 2);
+ } elseif (isset($GLOBALS['language'])) {
+ // Use cached
+ $ret = getCurrentLanguage();
+ } elseif (isSessionVariableSet('mx_lang')) {
+ // Return stored value from cookie
+ $ret = getSession('mx_lang');
+
+ // Fixes a warning before the session has the mx_lang constant
+ if (empty($ret)) {
+ $ret = getDefaultLanguage();
+ } // END - if
+ }
- // Cache entry
- setCurrentLanguage($ret);
+ // Cache entry
+ setCurrentLanguage($ret);
+ } // END - if
- // Return value
- return $ret;
+ // Return cached value
+ return getCurrentLanguage();
}
// "Setter" for language
$str = addslashes($str);
} else {
// Remove escaping of single quotes
- $str = str_replace("\'", "'", $str);
+ $str = str_replace("\\'", "'", $str);
// Escape only double-quotes but prevent double-quoting
$str = str_replace("\\\\", "\\", str_replace('"', "\\\"", $str));
// Getter for 'output_mode' value
function getScriptOutputMode () {
- // Default is null
- $output_mode = null;
+ // Do we have cache?
+ if (!isset($GLOBALS[__FUNCTION__])) {
+ // Default is null
+ $output_mode = null;
- // Is the value set?
- if (isOutputModeSet(true)) {
- // Then use it
- $output_mode = $GLOBALS['output_mode'];
+ // Is the value set?
+ if (isOutputModeSet(true)) {
+ // Then use it
+ $output_mode = $GLOBALS['output_mode'];
+ } // END - if
+
+ // Store it in cache
+ $GLOBALS[__FUNCTION__] = $output_mode;
} // END - if
- // Return it
- return $output_mode;
+ // Return cache
+ return $GLOBALS[__FUNCTION__];
}
// Setter for 'output_mode' value
// Should we abort here?
if (($strict === true) && ($isset === false)) {
// Output backtrace
- debug_report_bug(__FUNCTION__, __LINE__, 'Output_mode is empty.');
+ debug_report_bug(__FUNCTION__, __LINE__, 'Output mode is not set.');
} // END - if
// Return it