Beispiel #1
0
$f3->route('GET /settings', function ($f3) {
    require_once $GLOBALS['dirCore'] . '/pages/settings.php';
});
$f3->route('GET /logout', function ($f3) {
    header("Location: core/controller/logout.php");
});
$f3->route('GET /compile', function ($f3) {
    require_once $GLOBALS['dirCore'] . '/pages/compileIndex.php';
});
$f3->route('GET /compile/@id', function ($f3) {
    require_once $GLOBALS['dirCore'] . '/pages/compileMain.php';
});
// API
// Generate public/private key pairs
$f3->route('GET ' . $apiBaseUrl . '/generate', function ($f3) {
    echo CWM_API::generate();
});
// Authorize user
$f3->route('POST ' . $apiBaseUrl . '/authorize/@data/@key/@hash', function ($f3) {
    $data = $f3->get('PARAMS.data');
    $publicApiKey = $f3->get('PARAMS.key');
    $hash = $f3->get('PARAMS.hash');
    echo CWM_API::authorize($data, $publicApiKey, $hash);
});
// Deauthorize user
$f3->route('POST ' . $apiBaseUrl . '/deauthorize/@tokenValue', function ($f3) {
    $tokenValue = $f3->get('PARAMS.tokenValue');
    echo CWM_API::deAuthorize($tokenValue);
});
// Get user
$f3->route('GET ' . $apiBaseUrl . '/user/@tokenValue', function ($f3) {