示例#1
0
/////////////
//SETTINGS //
/////////////
const CONTACT_EMAIL = '*****@*****.**';
const UPLOAD_DIR = 'uploads/';
const UPLOAD_ALLOWED_EXTENSIONS = 'doc docx pdf xml jpg jpeg png gif txt rtf';
const UPLOAD_MAX_FILESIZE = 25000000;
//////////
//SETUP //
//////////
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/class/loader.php';
require_once __DIR__ . '/data.php';
$klein = new \Klein\Klein();
$klein->app()->renderer = new MustacheTemplateRenderer('templates', 'templates/partials', ['page' => 'templates/partials/pages']);
$routes = $klein->app()->routeData = json_decode(file_get_contents('routes.json'), true);
$klein->app()->prg = new FormPersister();
$klein->app()->mailer = Swift_Mailer::newInstance(Swift_SendmailTransport::newInstance());
$klein->app()->moddates = ['css' => filemtime('css/main.css'), 'js' => filemtime('js/main.js')];
$klein->app()->data = $data;
$klein->app()->production = !!apache_getenv('PRODUCTION');
/////////////////
//BASIC ROUTES //
/////////////////
$klein->respond('GET', '/', function ($req, $resp, $service, $app) {
    $routeData = $app->routeData;
    $routeData['about']['active'] = true;
    return $app->renderer->render('about', ['routes' => $routeData, 'moddates' => $app->moddates, 'production' => $app->production, 'data' => $app->data]);
});
foreach ($routes as $id => $data) {