This repository has been archived on 2019-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
sandpiper/index.php

32 lines
896 B
PHP

<?php
define("ROOT_DIR", dirname(__FILE__));
require("vendor/autoload.php");
require("utilities/transform.php");
// ---------------------------------------------------------------------------------
$aura_loader = new \Aura\Autoload\Loader;
$aura_loader->addPrefix('Sandpiper', '.');
$aura_loader->addPrefix('SBRL\Utilities', './utilities');
$aura_loader->register();
// ---------------------------------------------------------------------------------
$settings = new \SBRL\Utilities\TomlConfig("settings.toml", "default_settings.toml");
function send_error($code, $message) {
http_response_code($code);
header("content-type: text/plain");
exit("$message\n");
}
$action = $_GET["action"] ?? "Index";
$handler_name = "Sandpiper\\Actions\\$action";
if(!class_exists($handler_name))
send_error(404, "Unknown action $handler_name.");
$handler = new $handler_name();
$handler->handle();