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

36 lines
815 B
PHP
Raw Permalink 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 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-11-04 17:51:11 +00:00
echo Router::handle($_SERVER['REQUEST_METHOD'], $_SERVER['REQUEST_URI']);