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

40 lines
922 B
PHP
Raw Normal View History

2015-04-01 17:05:55 +00:00
<?php
/*
2016-01-30 13:25:18 +00:00
* Sakura Router
2015-04-01 17:05:55 +00:00
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once __DIR__ . '/../sakura.php';
2015-06-29 00:36:37 +00:00
// Start output buffering
ob_start(config('performance.compression') ? 'ob_gzhandler' : null);
// Initialise the router and include the routes file
Routerv1::init();
include_once path('routes.php');
// Initialise the current session
$cookiePrefix = config('cookie.prefix');
CurrentSession::start(
intval($_COOKIE["{$cookiePrefix}id"] ?? 0),
$_COOKIE["{$cookiePrefix}session"] ?? '',
Net::ip()
);
// Start templating engine and set base variables
Template::set(CurrentSession::$user->design());
Template::vars([
'get' => $_GET,
'user' => CurrentSession::$user,
'post' => $_POST,
'server' => $_SERVER,
'request' => $_REQUEST,
'session' => $_SESSION,
]);
2016-01-30 13:25:18 +00:00
// Handle requests
2016-09-11 14:25:22 +00:00
echo Routerv1::handle($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);