// Add a fatal error message to the queue array
function addFatalMessage ($F, $L, $message, $extra="") {
+ debug_report_bug($message);
if (is_array($extra)) {
// Multiple extras for a message with masks
$message = call_user_func_array('sprintf', $extra);
//
function FRAMETESTER ($URL) {
// Prepare frametester URL
- $frametesterUrl = sprintf("%s/modules.php?module=frametester&url=%s",
- URL,
+ $frametesterUrl = sprintf("{!URL!}/modules.php?module=frametester&url=%s",
encodeString(compileUriCode($URL))
);
return $frametesterUrl;
default:
DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
- $ret = sprintf(getMessage('UNKNOWN_STATUS"'), $status);
+ $ret = sprintf(getMessage('UNKNOWN_STATUS'), $status);
break;
}
// Generate a hash for extra-security for all passwords
function generateHash ($plainText, $salt = "") {
- global $_SERVER;
-
// Is the required extension "sql_patches" there and a salt is not given?
if (((EXT_VERSION_IS_OLDER("sql_patches", "0.3.6")) || (!EXT_IS_ACTIVE("sql_patches"))) && (empty($salt))) {
// Extension sql_patches is missing/outdated so we hash the plain text with MD5
// Get current theme name
function GET_CURR_THEME() {
- global $INC_POOL;
-
// The default theme is 'default'... ;-)
$ret = "default";
}
// Add (maybe) found theme.php file to inclusion list
- $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE($ret));
+ $INC = sprintf("theme/%s/theme.php", SQL_ESCAPE($ret));
// Try to load the requested include file
- if (FILE_READABLE($theme)) $INC_POOL[] = $theme;
+ if (INCLUDE_READABLE($INC)) ADD_INC_TO_POOL($INC);
// Return theme value
return $ret;
case getCode('COOKIES_DISABLED') : $msg = getMessage('LOGIN_NO_COOKIES'); break;
case getCode('BEG_SAME_AS_OWN') : $msg = getMessage('BEG_SAME_UID_AS_OWN'); break;
case getCode('LOGIN_FAILED') : $msg = getMessage('LOGIN_FAILED_GENERAL'); break;
- default : $msg = sprintf(getMessage('UNKNOWN_MAILID_CODE'), $code); break;
+ case getCode('MODULE_MEM_ONLY') : $msg = sprintf(getMessage('MODULE_MEM_ONLY'), REQUEST_GET('mod')); break;
+
+ default:
+ // Missing/invalid code
+ $msg = sprintf(getMessage('UNKNOWN_MAILID_CODE'), $code);
+
+ // Log it
+ DEBUG_LOG(__FUNCTION__, __LINE__, $msg);
+ break;
} // END - switch
// Return the message
function DEBUG_LOG ($funcFile, $line, $message, $force=true) {
// Is debug mode enabled?
if ((isDebugModeEnabled()) || ($force === true)) {
+ // Remove CRLF
+ $message = str_replace("\r", "", str_replace("\n", "", $message));
+
// Log this message away
$fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or mxchange_die("Cannot write logfile debug.log!");
fwrite($fp, date("d.m.Y|H:i:s", time())."|".basename($funcFile)."|".$line."|".strip_tags($message)."\n");
} // END - if
// Get more daily reset scripts
- $INC_POOL = GET_DIR_AS_ARRAY("inc/reset/", "reset_");
+ SET_INC_POOL(GET_DIR_AS_ARRAY("inc/reset/", "reset_"));
// Update database
if (!defined('DEBUG_RESET')) UPDATE_CONFIG("last_update", time());
// Has it changed?
if (getConfig('last_week') != $currWeek) {
// Include weekly reset scripts
- $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY("inc/weekly/", "weekly_"));
+ MERGE_INC_POOL(GET_DIR_AS_ARRAY("inc/weekly/", "weekly_"));
// Update config
if (!defined('DEBUG_WEEKLY')) UPDATE_CONFIG("last_week", $currWeek);
// Has it changed?
if (getConfig('last_month') != $currMonth) {
// Include monthly reset scripts
- $INC_POOL = merge_array($INC_POOL, GET_DIR_AS_ARRAY("inc/monthly/", "monthly_"));
+ MERGE_INC_POOL(GET_DIR_AS_ARRAY("inc/monthly/", "monthly_"));
// Update config
if (!defined('DEBUG_MONTHLY')) UPDATE_CONFIG("last_month", $currMonth);
} // END - if
// Run the filter
- runFilterChain('load_includes', $INC_POOL);
+ runFilterChain('load_includes');
}
// Handle extra values
// Determines referal id and sets it
function DETERMINE_REFID () {
- global $CLICK, $_SERVER;
-
// Check if refid is set
- if ((!empty($_GET['user'])) && ($CLICK == 1) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
+ if ((!empty($_GET['user'])) && (basename($_SERVER['PHP_SELF']) == "click.php")) {
// The variable user comes from the click-counter script click.php and we only accept this here
$GLOBALS['refid'] = bigintval($_GET['user']);
} elseif (!empty($_POST['refid'])) {
if (SQL_IS_LINK_UP()) {
// Close link
SQL_CLOSE(__FILE__, __LINE__);
- } elseif (!isInstalling()) {
+ } elseif ((!isInstalling()) && (isInstalled())) {
// No database link
addFatalMessage(__FILE__, __LINE__, getMessage('NO_DB_LINK_SHUTDOWN'));
}
return $isDirectory;
}
+// Init INC_POOL
+function INIT_INC_POOL () {
+ $GLOBALS['inc_pool'] = array();
+}
+
+// Setter for INC_POOL
+function SET_INC_POOL ($includePool) {
+ $GLOBALS['inc_pool'] = (array) $includePool;
+}
+
+// Getter for INC_POOL
+function GET_INC_POOL () {
+ return $GLOBALS['inc_pool'];
+}
+
+// Count INC_POOL
+function COUNT_INC_POOL () {
+ return count($GLOBALS['inc_pool']);
+}
+
+// Merge INC_POOL into given
+function MERGE_INC_POOL ($includePool) {
+ SET_INC_POOL(merge_array(GET_INC_POOL(), $includePool));
+}
+
+// Add single include file to INC_POOL
+function ADD_INC_TO_POOL ($INC) {
+ $GLOBALS['inc_pool'][] = (string) $INC;
+}
+
+// Remove an include file from INC_POOL
+function REMOVE_INC_FROM_POOL ($INC) {
+ // First look it up
+ $key = array_search($INC, GET_INC_POOL());
+
+ // Is it valid?
+ if ($key !== false) {
+ // Then remove it
+ unset($GLOBALS['inc_pool'][$key]);
+
+ // And sort the list
+ asort($GLOBALS['inc_pool']);
+ } // END - if
+}
+
+// Handle message codes from URL
+function handleCodeMessage () {
+ if (REQUEST_ISSET_GET(('msg'))) {
+ // Default extension is "unknown"
+ $ext = "unknown";
+
+ // Is extension given?
+ if (REQUEST_ISSET_GET(('ext'))) $ext = REQUEST_GET(('ext'));
+
+ // Convert the 'msg' parameter from URL to a human-readable message
+ $msg = convertCodeToMessage(REQUEST_GET('msg'));
+
+ // Load message template
+ LOAD_TEMPLATE("message", false, $msg);
+ } // END - if
+}
+
//////////////////////////////////////////////////
// AUTOMATICALLY RE-GENERATED MISSING FUNCTIONS //
//////////////////////////////////////////////////