<?php
/*<outscirt><version>20200922</version></outscirt>*/

function O__errorOut($O__errorType,$O__errorDesc,$O__errorFile,$O__errorLine,$O__errorDetail){
	global $O__errorDisplayOff,$O__userID;

	// Prep error message
	$O__message = "<center><b>Hello!  OutSCIRT has experienced an error and must now stop.</b>";
	if ($O__errorDisplayOff !== 1){ $O__message .= "<br><br><i>Error type:</i> " . $O__errorType . "<br><i>Description:</i> " . $O__errorDesc . "<br><i>File:</i> " . $O__errorFile . "<br><i>Line:</i> " . $O__errorLine; }
	$O__message .= "</center>";	

	// Sign error log
	if (function_exists("O__logger")){
		$O__logNotes = "type: " . $O__errorType. " | desc: " . $O__errorDesc . " | file: " . $O__errorFile . " | line: " . $O__errorLine;
		O__logger("errors",$_SERVER["REQUEST_URI"],"Error",$O__userID,$O__logNotes);
	}

	echo($O__message);
	die();
}

// System initialization and error checking
if (!file_exists($O__iniPath)) { O__errorOut("OutSCIRT System", "Can't find the *.ini file.  May not be able to write this error to the error log.  Please check the .ini path in the index.php file. <br><br><b>If this is your first time running OutSCIRT</b>, <a href=\"/O__setup.php\">click here</a> to proceed with setup."); } else { include($O__iniPath); }
if (!is_dir($O__rootPath)) { O__errorOut("OutSCIRT System", "The O__rootPath variable has not been properly defined.  Please check your .ini file. May not be able to write this error to the error log."); }
if (!is_dir($O__DBpath)) { O__errorOut("OutSCIRT System", "The O__DBpath variable has not been properly defined.  Please check your .ini file. May not be able to write this error to the error log."); }
if (!is_dir($O__libPath)) { O__errorOut("OutSCIRT System", "The O__libPath variable has not been properly defined.  Please check your .ini file. May not be able to write this error to the error log."); }

set_error_handler("O__errorOut");
?>
