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

79 lines
2.7 KiB
PHP
Raw Normal View History

2015-04-01 15:35:27 +00:00
<?php
/*
* Sakura C/PMS
* (c)Flashwave/Flashii.net 2013-2015 <http://flash.moe>
*/
// Declare namespace
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20150420');
2015-04-01 15:35:27 +00:00
// Define Sakura Path
2015-04-06 16:15:20 +00:00
define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__)));
2015-04-01 15:35:27 +00:00
// Error Reporting: 0 for production and -1 for testing
error_reporting(-1);
ini_set('log_errors', 1);
ini_set('error_log', ROOT .'errors.log');
2015-04-02 13:29:30 +00:00
// Start output buffering
ob_start();
2015-04-01 15:35:27 +00:00
// Include Configuration
require_once ROOT .'_sakura/config/config.php';
// Include libraries
require_once ROOT .'_sakura/vendor/autoload.php';
require_once ROOT .'_sakura/components/Main.php';
require_once ROOT .'_sakura/components/Hashing.php';
require_once ROOT .'_sakura/components/Configuration.php';
require_once ROOT .'_sakura/components/Templates.php';
require_once ROOT .'_sakura/components/Sessions.php';
require_once ROOT .'_sakura/components/Users.php';
2015-04-18 18:26:52 +00:00
require_once ROOT .'_sakura/components/Whois.php';
2015-04-01 15:35:27 +00:00
// Generate path to database driver
$_DBNGNPATH = ROOT .'_sakura/components/database/'. $sakuraConf['db']['driver'] .'.php';
// Include database driver
if(file_exists($_DBNGNPATH))
require_once $_DBNGNPATH;
else
die('<h1>Failed to load database driver.</h1>');
// Set Error handler
set_error_handler(array('Sakura\Main', 'ErrorHandler'));
// Initialise Flashii Class
Main::init($sakuraConf);
// Set base page rendering data
$renderData = array(
'sakura' => [
2015-04-06 21:23:54 +00:00
'version' => SAKURA_VERSION,
'urls' => Configuration::getLocalConfig('urls'),
'charset' => Configuration::getConfig('charset'),
2015-04-17 22:51:53 +00:00
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],
2015-04-13 10:14:59 +00:00
'recaptcha_public' => Configuration::getConfig('recaptcha_public'),
'recaptcha_enable' => Configuration::getConfig('recaptcha'),
'resources' => '//'. Configuration::getLocalConfig('urls')['content'] .'/data/'. strtolower(Templates::$_TPL),
'disableregister' => Configuration::getConfig('disable_registration'),
'requireregcodes' => Configuration::getConfig('require_registration_code'),
'requireactiveate' => Configuration::getConfig('require_activation'),
'sitename' => Configuration::getConfig('sitename')
2015-04-01 15:35:27 +00:00
],
'php' => [
'sessionid' => \session_id(),
'time' => \time(),
'self' => $_SERVER['PHP_SELF']
2015-04-01 15:35:27 +00:00
],
'user' => [
2015-04-18 11:35:16 +00:00
'checklogin' => Users::checkLogin(),
'session' => Session::$sessionId,
'data' => ($_init_udata = Users::getUser(Session::$userId)),
'rank' => Users::getRank($_init_udata['rank_main'])
2015-04-01 15:35:27 +00:00
]
);