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/_sakura/sakura.php

66 lines
1.9 KiB
PHP
Raw Normal View History

<?php
/*
2015-03-29 16:25:18 +00:00
* Sakura C/PMS
2015-04-01 15:24:50 +00:00
* (c)Flashwave/Flashii.net 2013-2015 <http://flash.moe>
*/
2015-03-29 15:54:27 +00:00
// Declare namespace
namespace Sakura;
2015-04-01 15:24:50 +00:00
2015-04-01 15:26:19 +00:00
// Error Reporting: 0 for production and -1 for testing
error_reporting(-1);
2015-04-01 15:30:18 +00:00
// Start output buffering with gzip and no gzip fallback
if(!ob_start('ob_gzhandler'))
ob_start();
2015-04-01 15:26:19 +00:00
// Define Sakura version
2015-03-30 15:45:27 +00:00
define('SAKURA_VERSION', '20150330');
2015-04-01 15:26:19 +00:00
2015-03-08 04:26:26 +00:00
// Define Sakura Path
define('ROOT_DIRECTORY', str_replace('_sakura', '', dirname(__FILE__)));
2015-04-01 15:26:19 +00:00
// Include Configuration
2015-03-08 04:27:49 +00:00
require_once ROOT_DIRECTORY .'_sakura/config/config.php';
2015-04-01 15:26:19 +00:00
// Include libraries
2015-04-01 15:26:19 +00:00
require_once ROOT_DIRECTORY .'_sakura/vendor/autoload.php';
require_once ROOT_DIRECTORY .'_sakura/components/Main.php';
require_once ROOT_DIRECTORY .'_sakura/components/Hashing.php';
require_once ROOT_DIRECTORY .'_sakura/components/Configuration.php';
require_once ROOT_DIRECTORY .'_sakura/components/Templates.php';
require_once ROOT_DIRECTORY .'_sakura/components/Sessions.php';
require_once ROOT_DIRECTORY .'_sakura/components/Users.php';
// Generate path to database driver
$_DBNGNPATH = ROOT_DIRECTORY .'_sakura/components/database/'. $sakuraConf['db']['driver'] .'.php';
2015-04-01 15:26:19 +00:00
// Include database driver
if(file_exists($_DBNGNPATH))
require_once $_DBNGNPATH;
else
die('<h1>Failed to load database driver.</h1>');
2015-04-01 15:26:19 +00:00
// Set Error handler
2015-03-25 09:59:10 +00:00
set_error_handler(array('Sakura\Main', 'ErrorHandler'));
2015-04-01 15:26:19 +00:00
// Initialise Flashii Class
Main::init($sakuraConf);
2015-04-01 15:26:19 +00:00
// Set base page rendering data
$renderData = array(
'sakura' => [
2015-03-29 18:39:22 +00:00
'version' => SAKURA_VERSION,
'urls' => Configuration::getLocalConfig('urls'),
'charset' => Configuration::getConfig('charset'),
'currentpage' => $_SERVER['PHP_SELF']
2015-03-29 17:33:06 +00:00
],
2015-03-29 19:04:55 +00:00
'php' => [
'sessionid' => \session_id(),
'time' => \time()
],
2015-03-29 17:33:06 +00:00
'user' => [
'loggedin' => Users::loggedIn()
2015-03-30 15:45:27 +00:00
]
);