set_include_path(get_include_path() . PATH_SEPARATOR . 'src/main/php/' . PATH_SEPARATOR . '/usr/share/php/' . PATH_SEPARATOR . 'vendor/jwread/lib-allure/src/main/php/'); date_default_timezone_set('Europe/London'); function __autoload($class) { $class = DIRECTORY_SEPARATOR . $class . '.php'; foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { if (file_exists($path . $class)) { require_once $path . $class; return; } } } require_once 'includes/functions.php'; require_once 'libAllure/Exceptions.php'; require_once 'libAllure/ErrorHandler.php'; require_once 'libAllure/Database.php'; require_once 'libAllure/Form.php'; require_once 'libAllure/Logger.php'; require_once 'libAllure/User.php'; require_once 'libAllure/Inflector.php'; require_once 'libAllure/Session.php'; require_once 'libAllure/AuthBackend.php'; require_once 'libAllure/AuthBackendDatabase.php'; require_once 'libAllure/HtmlLinksCollection.php'; require_once 'config.php'; \libAllure\ErrorHandler::getInstance()->beGreedy(); $db = new \libAllure\Database(CFG_DB_DSN, CFG_DB_USER, CFG_DB_PASS); \libAllure\DatabaseFactory::registerInstance($db); \libAllure\AuthBackend::setBackend(new \libAllure\AuthBackendDatabase()); \libAllure\Session::checkCredentials('SYSTEM', '');
<?php require_once '../../includes/common.php'; use libAllure\Sanitizer; use libAllure\ErrorHandler; use libAllure\DatabaseFactory; use libAllure\Session; use libAllure\User; ErrorHandler::getInstance()->beGreedy(); function apiReturn($status, $message = null) { echo "{$status}\n"; if (isset($_REQUEST['debug'])) { echo $message; } exit; } function getEvent() { $sql = 'SELECT e.* FROM events e WHERE date_add(date, interval duration hour) > now() ORDER BY e.date ASC LIMIT 1'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->execute(); $event = $stmt->fetchRowNotNull(); return $event; } function getAuthenticatedMachines($user, $event) { $sql = 'SELECT a.id FROM authenticated_machines a WHERE a.user = :user AND a.event = :event'; $stmt = DatabaseFactory::getInstance()->prepare($sql); $stmt->bindValue(':user', $user); $stmt->bindValue(':event', $event);
<?php require_once 'includes/common.php'; use libAllure\ErrorHandler; $inContent = in_array('includes/widgets/header.php', get_included_files()); if ($inContent) { require_once 'includes/widgets/header.php'; } $error = isset($_GET['error']) ? intval($_GET['error']) : null; switch ($error) { case '404': ErrorHandler::getInstance()->handleHttpError(404); break; case '403': ErrorHandler::getInstance()->handleHttpError(403); break; default: throw new Exception('An unknown error has occoured.'); } require_once 'includes/widgets/footer.php';
class SimpleFatalError { } class PermissionException extends SimpleFatalError { } class PrivilegeException extends PermissionException { } $db = new \libAllure\Database('mysql:host=localhost;dbname=pfrog', 'root', ''); \libAllure\DatabaseFactory::registerInstance($db); \libAllure\Session::setSessionName('pfrogUser'); \libAllure\Session::start(); define('CFG_PASSWORD_SALT', 'asdf'); date_default_timezone_set('Europe/London'); $eh = \libAllure\ErrorHandler::getInstance(); $eh->beGreedy(); define('INC_COMMON', true); require_once 'core.php'; require_once 'libAllure/Database.php'; define('LEVEL_ADMIN', 30); if (\libAllure\Session::isLoggedIn()) { $user = \libAllure\Session::getUser(); } require_once 'libAllure/AuthBackendDatabase.php'; $backend = new \libAllure\AuthBackendDatabase(); \libAllure\AuthBackend::setBackend($backend); $breadcrumbs = array(); $breadcrumbs[] = '<a href = "index.php">index</a>'; require_once 'libAllure/Template.php'; $tpl = new \libAllure\Template('pfrog');