if (!is_array($settings)) { trigger_error('Auth settings not found', E_USER_ERROR); }
// Extended DOM document class
-require_once('../php-utility-classes/classes/document.php-class');
+require_once(__DIR__.'/../php-utility-classes/classes/document.php-class');
// Class for sending emails
-require_once('../php-utility-classes/classes/email.php-class');
-// Class for sending emails
-require_once(__DIR__.'/authutils.php-class');
-
+require_once(__DIR__.'/../php-utility-classes/classes/email.php-class');
+// Composer-provided libraries (oauth2-server-php, doctrine DBAL)
+require_once(__DIR__.'/../vendor/autoload.php');
// Connect to our MySQL DB
$db = new PDO($dbdata['dsn'], $dbdata['username'], $dbdata['password']);
-// Instantiate auth utils.
-$utils = new AuthUtils($settings, $db);
+// Authentication utilities
+require_once(__DIR__.'/authutils.php-class');
+// Instantiate server utils.
+try {
+ $utils = new AuthUtils($settings, $db);
+}
+catch (Exception $e) {
+ $utils = null;
+}
// This is an array of locale tags in browser style mapping to unix system locale codes to use with gettext.
$supported_locales = array(
// function checkForSecureConnection()
// Check is the connection is secure and return an array of error messages (empty if it's secure).
//
+ // function sendSecurityHeaders()
+ // Rend HTTP headers for improving security.
+ //
// function initSession()
// Initialize a session. Returns an associative array of all the DB fields of the session.
//
// $dbata needs to be set and be an associative array with the members 'dsn', 'username', and 'password'.
-// Autoloading (composer is preferred, but for this example let's just do this)
-require_once('../oauth2-server-php/src/OAuth2/Autoloader.php');
-OAuth2\Autoloader::register();
-
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
$oauth2_storage = new OAuth2\Storage\Pdo($dbdata);