&$thisConnection, 'db_type'=>$dbms, 'call_func'=>$fn, 'errno'=>$errno, 'db_msg'=>$errmsg, 'sql'=>$p1, 'p2'=>$p2); $logString = tiki_error_string( $dbParams ); /* * Log connection error somewhere * 0 message is sent to PHP's system logger, using the Operating System's system * logging mechanism or a file, depending on what the error_log configuration * directive is set to. * 1 message is sent by email to the address in the destination parameter. * This is the only message type where the fourth parameter, extra_headers is used. * This message type uses the same internal function as mail() does. * 2 message is sent through the PHP debugging connection. * This option is only available if remote debugging has been enabled. * In this case, the destination parameter specifies the host name or IP address * and optionally, port number, of the socket receiving the debug information. * 3 message is appended to the file destination */ error_log( $logString,0 ); $subject = isset( $_SERVER['SERVER_NAME'] ) ? $_SERVER['SERVER_NAME'] : 'BITWEAVER'; $fatal = FALSE; if ( ($fn == 'EXECUTE') && ($thisConnection->MetaError() != -5) ) { $subject .= ' FATAL'; $fatal = TRUE; } else { $subject .= ' SILENT'; } // You can prevent sending of error emails by adding define('ERROR_EMAIL', ''); in your config_inc.php $errorEmail = defined('ERROR_EMAIL') ? ERROR_EMAIL : !empty( $_SERVER['SERVER_ADMIN'] ) ? $_SERVER['SERVER_ADMIN'] : NULL; if( ( !defined('IS_LIVE') || !IS_LIVE) ) { print 'bitweaver - White Screen of Death'; print "\n

Click here to log a bug, if this appears to be an error with the application.

\n"; print "

Go here to begin the installation process, if you haven't done so already.

\n"; // print "

Upgrade Beta 1 to Beta 2

If you are getting this error because you just upgraded your bitweaver from Beta 1 to Beta 2, please follow this link to the installer, which will guide you through the upgrade process: Upgrade Beta 1 to Beta 2"; print "
".$logString."
"; print ""; } elseif( $errorEmail ) { mail( $errorEmail, "$subject $dbParams[db_msg]", $logString ); if( ( defined('AUTO_BUG_SUBMIT') && AUTO_BUG_SUBMIT) ) { mail( 'bugs@bitweaver.org',"$subject $dbParams[db_msg]",$logString ); } } if( $fatal ) { die(); } else { return $logString; } } function tiki_error_string( $iDBParms ) { global $gBitDb; global $gBitUser; global $_SERVER; $separator = "\n"; $indent = " "; $date = date("D M d H:i:s Y"); // [Tue Sep 24 12:19:20 2002] [error] if( isset( $gBitUser->mInfo ) ) { $acctStr = "ID: ".$gBitUser->mInfo['user_id']." - Login: ".$gBitUser->mInfo['login']." - e-mail: ".$gBitUser->mInfo['email']; } else { $acctStr = "User unknown"; } $info = "[ - ".BIT_VERSION." v".BIT_RELEASE."-".BIT_RELEASE_LEVEL." ".BIT_RELEASE_COUNT." - ] [ $date ]".$separator; $info .= $indent."#### USER AGENT: ".$_SERVER['HTTP_USER_AGENT'].$separator; $info .= $indent."#### ACCT: ".$acctStr.$separator; $info .= $indent."#### URL: http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'].$separator; if( isset($_SERVER['HTTP_REFERER'] ) ) { $info .= $indent."#### REFERRER: $_SERVER[HTTP_REFERER]".$separator; } $info .= $indent."#### HOST: $_SERVER[HTTP_HOST]".$separator; $info .= $indent."#### IP: $_SERVER[REMOTE_ADDR]".$separator; if( $gBitDb && isset( $php_errormsg ) ) { $info .= $indent."#### PHP: ".$php_errormsg.$separator; } if ( $iDBParms['sql'] ) { $badSpace = array("\n", "\t"); $info .= $indent."#### SQL: ".str_replace($badSpace, ' ', $iDBParms['sql']).$separator; } $errno = ((int)$iDBParms['errno'] ? 'Errno: '.$iDBParms['errno'] : ''); $info .= $indent."#### ADODB: ".$errno." Message: ".$iDBParms['db_msg']; $stackTrace = bt( 9999, FALSE ); //multiline expressions matched if ( preg_match_all("/.*adodb_error_handler\([^\}]*\)(.+\}.+)/ms", $stackTrace, $match) ) { $stackTrace = $match[1][0]; } $ret = $info.$separator.$separator.$stackTrace; return $ret; } if (!function_exists('bt')) { // Make sure another backtrace function does not exist function bt( $levels=9999, $iPrint=TRUE ) { $s = ''; if (PHPVERSION() >= 4.3) { $MAXSTRLEN = 64; $traceArr = debug_backtrace(); array_shift($traceArr); $tabs = sizeof($traceArr)-1; $indent = ''; $sClass = ''; foreach ($traceArr as $arr) { $levels -= 1; if ($levels < 0) break; $args = array(); for ($i=0; $i <= $tabs; $i++) { $indent .= '}'; } $tabs -= 1; if ( isset($arr['class']) ) { $sClass .= $arr['class'].'::'; } if ( isset($arr['args']) ) { foreach( $arr['args'] as $v ) { if (is_null($v) ) { $args[] = 'null'; } elseif (is_array($v)) { $args[] = 'Array['.sizeof($v).']'; } elseif (is_object($v)) { $args[] = 'Object:'.get_class($v); } elseif (is_bool($v)) { $args[] = $v ? 'true' : 'false'; } else { $v = (string) @$v; $str = htmlspecialchars(substr($v,0,$MAXSTRLEN)); if (strlen($v) > $MAXSTRLEN) $str .= '...'; $args[] = $str; } } } if( !preg_match( "*include*", $arr['function'] ) && !preg_match( "*silentlog*", strtolower( $arr['function'] ) ) ) { $s .= "\n ".$indent.' -> '; $s .= $sClass.$arr['function'].'('.implode(', ',$args).')'; } $s .= "\n ".$indent; $s .= @sprintf(" LINE: %4d, %s", $arr['line'],$arr['file']); $indent = ''; } $s .= "\n"; if( $iPrint ) { print '
'.$s."
\n"; } } return $s; } } // End if function_exists('bt') // var dump variable in something nicely readable in web browser function vd( $iVar ) { print '
';
	var_dump( $iVar );
	print "
\n"; } function va( $iVar ) { $dbg = var_export($iVar, 1); $dbg = highlight_string("", 1); echo "
Var Anatomy
"; echo "
$dbg
"; } ?>