Example #1
0
 public static function init($ErrorHandler, $OverrideEmail = '')
 {
     if (!empty($_SERVER['ISWEB']) && $_SERVER['ISWEB'] == "TRUE") {
         self::$IsWeb = TRUE;
     }
     self::$Host = "localhost";
     if (self::$IsWeb) {
         if (isset($_SERVER["DEFAULT_HOST"])) {
             self::$Host = $_SERVER["DEFAULT_HOST"];
         }
     } else {
         if (getenv("DEFAULT_HOST") !== FALSE) {
             self::$Host = getenv("DEFAULT_HOST");
         }
     }
     error_reporting(E_ALL);
     set_error_handler($ErrorHandler);
     $ConfigFileName = "Config.local";
     if (self::$IsWeb) {
         if (isset($_SERVER["ISTEST"])) {
             self::$IsTest = $_SERVER["ISTEST"] == "TRUE" ? TRUE : FALSE;
         }
         if (isset($_SERVER["MEMORY_LIMIT"])) {
             ini_set('memory_limit', $_SERVER["MEMORY_LIMIT"]);
         }
         if (isset($_SERVER["DISPLAY_ERRORS"])) {
             self::$DebugDisplays = TRUE;
         }
         if (isset($_SERVER["EMAIL_ERRORS_TO"])) {
             self::$EmailErrorsTo = $_SERVER["EMAIL_ERRORS_TO"];
         }
         if (isset($_SERVER["PHPERRORLOG"])) {
             self::$ErrorLog = $_SERVER["PHPERRORLOG"];
         }
         if (isset($_SERVER["SOLRPORT"])) {
             self::$SolrPort = $_SERVER["SOLRPORT"];
         }
         if (isset($_SERVER["SOLRHOST"])) {
             self::$SolrHost = $_SERVER["SOLRHOST"];
         }
         if (isset($_SERVER["CONFIGFILE"])) {
             $ConfigFileName = $_SERVER["CONFIGFILE"];
         }
     } else {
         if (getenv("ISTEST") !== FALSE) {
             self::$IsTest = getenv("ISTEST") == "TRUE" ? TRUE : FALSE;
         }
         if (getenv("MEMORY_LIMIT") !== FALSE) {
             ini_set('memory_limit', getenv("MEMORY_LIMIT"));
         }
         if (getenv("DISPLAY_ERRORS") !== FALSE) {
             self::$DebugDisplays = TRUE;
         }
         if (getenv("EMAIL_ERRORS_TO") !== FALSE) {
             self::$EmailErrorsTo = getenv("EMAIL_ERRORS_TO");
         }
         if (getenv("SOLRPORT") !== FALSE) {
             self::$SolrPort = getenv("SOLRPORT");
         }
         if (getenv("SOLRHOST") !== FALSE) {
             self::$SolrHost = getenv("SOLRHOST");
         }
         if (getenv("CONFIGFILE")) {
             $ConfigFileName = getenv("CONFIGFILE");
         }
     }
     if (!empty($OverrideEmail)) {
         self::$EmailErrorsTo = $OverrideEmail;
     }
     require $ConfigFileName;
     self::$MYSQL = $MysqlBin;
     self::$XLS2CSV = $XLS2CSV;
     self::$SED = $SED;
     self::$WINE = $WINE;
     self::$WGET = $WGET;
     self::$PERL = $PERL;
     $PHPConfgPath = get_cfg_var('cfg_file_path');
     if ($PHPConfgPath === FALSE) {
         $PHPConfgPath = "";
     } else {
         $PHPConfgPath = " -c {$PHPConfgPath}";
     }
     self::$PHPPATH = $PHPPATH . $PHPConfgPath;
     self::$LocalURL = $LOCALURL;
     self::$ScreenMenuXML = new SimpleXMLElement($ScreenMenuXML);
     self::$CookieDomain = $COOKIEDOMAIN;
     if (empty(self::$EmailErrorsTo)) {
         self::$EmailErrorsTo = $DefaultEmailErrorsTo;
     }
     return;
 }