*** include/core.inc --- include/core.inc 2005-10-11 14:18:22.188346590 -0600 *************** *** 12,17 **** --- 12,26 ---- $FORUM_VERSION = "2.7.2"; + /* virtual support */ + if ($GLOBALS['SITES_DIR'] and isset($_SERVER['HTTP_HOST'])) { + $domain = explode('.', $_SERVER['HTTP_HOST']); + $count = count($domain) - 1; + # strip the dot name + $GLOBALS['FORUM_SITE'] = stripslashes($domain[$count-1] . '.' . $domain[$count]); + require($GLOBALS['SITES_DIR'].$GLOBALS['FORUM_SITE']); + } + ignore_user_abort('1'); set_magic_quotes_runtime(0); *************** *** 138,143 **** --- 147,165 ---- return 0; } + function __error_log($type, $error_msg) + { + return error_log('['.gmdate("D M j G:i:s T Y", __request_timestamp__).'] '. + str_replace("\n", '\n', str_replace('
', '\n', str_replace("
\n", '\n', $error_msg)))."\n", + 3, $GLOBALS['ERROR_PATH'].$type); + } + + function __error_log_explode($log_line) + { + list($time, $msg) = explode('] ', substr($log_line, 1), 2); + return array($time, str_replace('\n', "
\n", htmlspecialchars($msg))); + } + function fud_sql_error_handler($query, $error_string, $error_number, $server_version) { if (db_locked() && !in_array($query, array('COMMIT','COMMIT WORK','UNLOCK TABLES'))) { *************** *** 146,185 **** $_SERVER['PATH_TRANSLATED'] = ''; foreach (debug_backtrace() as $v) { ! $_SERVER['PATH_TRANSLATED'] .= "{$v['file']}:{$v['line']}
\n"; } ! $error_msg = "(".$_SERVER['PATH_TRANSLATED'].") ".$error_number.": ".$error_string."
\n"; ! $error_msg .= "Query: ".htmlspecialchars($query)."
\n"; if (!empty($_GET)) { $error_msg .= "_GET: "; if (count($_GET, 1) < 100) { ! $error_msg .= htmlspecialchars(var_export($_GET, 1)); } else { $error_msg .= "Too many vars: ".count($_GET, 1); } ! $error_msg .= "
\n"; } if (!empty($_POST)) { $error_msg .= "_POST: "; if (count($_POST, 1) < 100) { ! $error_msg .= htmlspecialchars(var_export($_POST, 1)); } else { $error_msg .= "Too many vars: ".count($_POST, 1); } ! $error_msg .= "
\n"; } ! $error_msg .= "Server Version: ".$server_version."
\n"; if (isset($_SERVER['HTTP_REFERER'])) { ! $error_msg .= "[Referring Page] ".htmlspecialchars($_SERVER['HTTP_REFERER'])."
\n"; } ! if (!error_log('['.gmdate("D M j G:i:s T Y", __request_timestamp__).'] '.base64_encode($error_msg)."\n", 3, $GLOBALS['ERROR_PATH'].'sql_errors')) { echo "UNABLE TO WRITE TO SQL LOG FILE
\n"; ! echo $error_msg; } else { if (defined('forum_debug') || (isset($GLOBALS['usr']->users_opt) && $GLOBALS['usr']->users_opt & 1048576)) { ! echo $error_msg; } else { trigger_error('SQL Error has occurred, please contact the administrator of the forum and have them review the forum's SQL query log', E_USER_ERROR); if (ini_get('display_errors') !== 1) { --- 168,207 ---- $_SERVER['PATH_TRANSLATED'] = ''; foreach (debug_backtrace() as $v) { ! $_SERVER['PATH_TRANSLATED'] .= "{$v['file']}:{$v['line']}\n"; } ! $error_msg = "(".$_SERVER['PATH_TRANSLATED'].") ".$error_number.": ".$error_string."\n"; ! $error_msg .= "Query: $query\n"; if (!empty($_GET)) { $error_msg .= "_GET: "; if (count($_GET, 1) < 100) { ! $error_msg .= str_replace("
\n", "\n", var_export($_GET, 1)); } else { $error_msg .= "Too many vars: ".count($_GET, 1); } ! $error_msg .= "\n"; } if (!empty($_POST)) { $error_msg .= "_POST: "; if (count($_POST, 1) < 100) { ! $error_msg .= str_replace("
\n", "\n", var_export($_POST, 1)); } else { $error_msg .= "Too many vars: ".count($_POST, 1); } ! $error_msg .= "\n"; } ! $error_msg .= "Server Version: ".$server_version."\n"; if (isset($_SERVER['HTTP_REFERER'])) { ! $error_msg .= "[Referring Page] ".$_SERVER['HTTP_REFERER']."\n"; } ! if (!__error_log('sql_errors', $error_msg)) { echo "UNABLE TO WRITE TO SQL LOG FILE
\n"; ! echo str_replace("\n", "
\n", htmlspecialchars($msg)); } else { if (defined('forum_debug') || (isset($GLOBALS['usr']->users_opt) && $GLOBALS['usr']->users_opt & 1048576)) { ! echo str_replace("\n", "
\n", htmlspecialchars($msg)); } else { trigger_error('SQL Error has occurred, please contact the administrator of the forum and have them review the forum's SQL query log', E_USER_ERROR); if (ini_get('display_errors') !== 1) {