2015-02-21 12:53:05 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2015-03-29 16:25:18 +00:00
|
|
|
* Sakura C/PMS
|
2015-02-21 12:53:05 +00:00
|
|
|
* (c)Flashwave/Flashii Media 2013-2015 <http://flash.moe>
|
|
|
|
*/
|
|
|
|
|
2015-03-29 15:54:27 +00:00
|
|
|
// Declare namespace
|
|
|
|
namespace Sakura;
|
|
|
|
|
2015-02-21 12:53:05 +00:00
|
|
|
// Start output buffering
|
|
|
|
ob_start();
|
2015-03-29 15:54:27 +00:00
|
|
|
|
2015-02-21 12:53:05 +00:00
|
|
|
// Define Sakura version
|
2015-03-29 15:54:27 +00:00
|
|
|
define('SAKURA_VERSION', '20150329');
|
2015-03-08 04:26:26 +00:00
|
|
|
|
|
|
|
// Define Sakura Path
|
|
|
|
define('ROOT_DIRECTORY', str_replace('_sakura', '', dirname(__FILE__)));
|
2015-02-21 12:53:05 +00:00
|
|
|
|
|
|
|
// Error Reporting: 0 for production and -1 for testing
|
|
|
|
error_reporting(-1);
|
|
|
|
|
|
|
|
// Include Configuration
|
2015-03-08 04:27:49 +00:00
|
|
|
require_once ROOT_DIRECTORY .'_sakura/config/config.php';
|
2015-02-21 12:53:05 +00:00
|
|
|
|
2015-03-08 04:14:57 +00:00
|
|
|
// Include libraries
|
2015-03-08 04:27:49 +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';
|
2015-03-25 09:55:52 +00:00
|
|
|
require_once ROOT_DIRECTORY .'_sakura/components/Sessions.php';
|
2015-03-29 15:54:27 +00:00
|
|
|
require_once ROOT_DIRECTORY .'_sakura/components/Users.php';
|
2015-03-08 04:14:57 +00:00
|
|
|
|
|
|
|
// Generate path to database driver
|
2015-03-29 16:28:41 +00:00
|
|
|
$_DBNGNPATH = ROOT_DIRECTORY .'_sakura/components/database/'. $sakuraConf['db']['driver'] .'.php';
|
2015-03-08 04:14:57 +00:00
|
|
|
|
|
|
|
// Include database driver
|
|
|
|
if(file_exists($_DBNGNPATH))
|
|
|
|
require_once $_DBNGNPATH;
|
|
|
|
else
|
|
|
|
die('<h1>Failed to load database driver.</h1>');
|
2015-02-21 12:53:05 +00:00
|
|
|
|
|
|
|
// Set Error handler
|
2015-03-25 09:59:10 +00:00
|
|
|
set_error_handler(array('Sakura\Main', 'ErrorHandler'));
|
2015-02-21 12:53:05 +00:00
|
|
|
|
|
|
|
// Initialise Flashii Class
|
2015-03-29 16:28:41 +00:00
|
|
|
Main::init($sakuraConf);
|
2015-03-08 04:47:28 +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-29 19:59:35 +00:00
|
|
|
],
|
2015-03-29 20:02:04 +00:00
|
|
|
'users' => function($uid) {return Users::getUser($uid);}//,
|
2015-03-29 19:59:35 +00:00
|
|
|
//'groups' => Users::getGroup($gid)
|
2015-03-08 04:47:28 +00:00
|
|
|
);
|