// error reporting (for testing)
ini_set('display_errors', 1); error_reporting(E_ALL);
-// Read DB settings
-$dbdata = json_decode(file_get_contents('/etc/kairo/auth_db.json'), true);
-if (!is_array($dbdata)) { trigger_error('DB configuration not found', E_USER_ERROR); }
-$settings = json_decode(file_get_contents('/etc/kairo/auth_settings.json'), true);
-if (!is_array($settings)) { trigger_error('Auth settings not found', E_USER_ERROR); }
-$settings['dbdata'] = $dbdata;
-
// Extended DOM document class
require_once(__DIR__.'/../php-utility-classes/classes/document.php-class');
// Class for sending emails
require_once(__DIR__.'/authutils.php-class');
// Instantiate server utils.
try {
- $utils = new AuthUtils($settings);
+ $utils = new AuthUtils();
$db = $utils->db;
+ $settings = $utils->settings;
}
catch (Exception $e) {
$utils = null;
+ print('Failed to set up utilities: '.$e->getMessage());
+ exit(1);
}
$utils->setUpL10n();
$settings['piwik_url'] = strlen(@$settings['piwik_url']) ? $settings['piwik_url'] : '/piwik/';
$settings['piwik_tracker_path'] = strlen(@$settings['piwik_tracker_path']) ? $settings['piwik_tracker_path'] : '../vendor/piwik/piwik-php-tracker/';
-/* Creating the DB tables:
-CREATE TABLE `auth_sessions` (
- `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
- `sesskey` VARCHAR(150) NOT NULL DEFAULT '' ,
- `user` MEDIUMINT UNSIGNED NULL DEFAULT NULL ,
- `logged_in` BOOLEAN NOT NULL DEFAULT FALSE ,
- `time_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
- `time_expire` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
- `saved_redirect` VARCHAR(255) NOT NULL DEFAULT '' ,
- PRIMARY KEY (`id`),
- INDEX (`sesskey`),
- INDEX (`time_expire`)
-);
-CREATE TABLE `auth_users` (
- `id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT ,
- `email` VARCHAR(255) NOT NULL ,
- `pwdhash` VARCHAR(255) NOT NULL ,
- `status` ENUM('unverified','ok') NOT NULL DEFAULT 'unverified' ,
- `verify_hash` VARCHAR(150) NULL DEFAULT NULL ,
- `group_id` MEDIUMINT UNSIGNED DEFAULT '0' ,
- PRIMARY KEY (`id`),
- UNIQUE (`email`)
-);
-CREATE TABLE `auth_log` (
- `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT ,
- `code` VARCHAR(100) NOT NULL ,
- `info` TEXT NULL DEFAULT NULL ,
- `ip_addr` VARCHAR(50) NULL DEFAULT NULL ,
- `time_logged` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
- PRIMARY KEY (`id`),
- INDEX (`time_logged`)
-);
-*/
-
// Set up our OAuth2 Server object
$server = $utils->getOAuthServer();
?>