function __construct() { $config = SimpleSAML_Configuration::getInstance(); assert($config instanceof SimpleSAML_Configuration); /* Get the metadata handler option from the configuration. */ $this->logFile = $config->getPathValue('loggingdir', 'log/') . $config->getString('logging.logfile', 'simplesamlphp.log'); $this->processname = $config->getString('logging.processname', 'simpleSAMLphp'); if (@file_exists($this->logFile)) { if (!@is_writeable($this->logFile)) { throw new Exception("Could not write to logfile: " . $this->logFile); } } else { if (!@touch($this->logFile)) { throw new Exception("Could not create logfile: " . $this->logFile . " Loggingdir is not writeable for the webserver user."); } } SimpleSAML_Utilities::initTimezone(); }
set_error_handler('SimpleSAML_error_handler'); /** * Class which should print a warning every time a reference to $SIMPLESAML_INCPREFIX is made. */ class SimpleSAML_IncPrefixWarn { /** * Print a warning, as a call to this function means that $SIMPLESAML_INCPREFIX is referenced. * * @return A blank string. */ function __toString() { $backtrace = debug_backtrace(); $where = $backtrace[0]['file'] . ':' . $backtrace[0]['line']; error_log('Deprecated $SIMPLESAML_INCPREFIX still in use at ' . $where . '. The simpleSAMLphp library now uses an autoloader.'); return ''; } } /* Set the $SIMPLESAML_INCPREFIX to a reference to the class. */ $SIMPLESAML_INCPREFIX = new SimpleSAML_IncPrefixWarn(); $configdir = dirname(dirname(__FILE__)) . '/config'; if (!file_exists($configdir . '/config.php')) { header('Content-Type: text/plain'); echo "You have not yet created the simpleSAMLphp configuration files.\n"; echo "See: https://simplesamlphp.org/docs/devel/simplesamlphp-install-repo\n"; exit(1); } /* Set the timezone. */ SimpleSAML_Utilities::initTimezone();