2015-04-01 15:35:27 +00:00
|
|
|
<?php
|
|
|
|
/*
|
2015-05-24 22:06:53 +00:00
|
|
|
* Sakura Community Management System
|
2015-05-29 19:27:45 +00:00
|
|
|
* (c) 2013-2015 Flashwave <http://flash.moe> & Circlestorm <http://circlestorm.net>
|
2015-04-01 15:35:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Declare namespace
|
|
|
|
namespace Sakura;
|
|
|
|
|
|
|
|
// Define Sakura version
|
2015-07-03 17:33:02 +00:00
|
|
|
define('SAKURA_VERSION', '20150703');
|
2015-05-09 00:56:55 +00:00
|
|
|
define('SAKURA_VLABEL', 'Eminence');
|
2015-06-29 00:36:37 +00:00
|
|
|
define('SAKURA_STABLE', false);
|
2015-05-09 00:56:55 +00:00
|
|
|
define('SAKURA_COLOUR', '#6C3082');
|
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
|
2015-06-29 00:36:37 +00:00
|
|
|
error_reporting(SAKURA_STABLE ? 0 : -1);
|
2015-04-01 15:35:27 +00:00
|
|
|
|
|
|
|
// 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';
|
2015-05-29 19:27:45 +00:00
|
|
|
require_once ROOT .'_sakura/components/Database.php';
|
2015-04-01 15:35:27 +00:00
|
|
|
require_once ROOT .'_sakura/components/Templates.php';
|
2015-05-29 19:27:45 +00:00
|
|
|
require_once ROOT .'_sakura/components/Permissions.php';
|
2015-04-01 15:35:27 +00:00
|
|
|
require_once ROOT .'_sakura/components/Sessions.php';
|
|
|
|
require_once ROOT .'_sakura/components/Users.php';
|
2015-05-03 16:25:57 +00:00
|
|
|
require_once ROOT .'_sakura/components/Forum.php';
|
2015-04-30 23:01:01 +00:00
|
|
|
require_once ROOT .'_sakura/components/Manage.php';
|
2015-04-18 18:26:52 +00:00
|
|
|
require_once ROOT .'_sakura/components/Whois.php';
|
2015-06-29 12:40:00 +00:00
|
|
|
require_once ROOT .'_sakura/components/Payments.php';
|
2015-04-28 15:53:53 +00:00
|
|
|
require_once ROOT .'_sakura/components/SockChat.php';
|
2015-04-01 15:35:27 +00:00
|
|
|
|
2015-05-29 19:27:45 +00:00
|
|
|
// Include database extensions
|
|
|
|
foreach(glob(ROOT .'_sakura/components/database/*.php') as $driver)
|
|
|
|
require_once($driver);
|
2015-04-01 15:35:27 +00:00
|
|
|
|
|
|
|
// Set Error handler
|
2015-04-30 23:01:01 +00:00
|
|
|
set_error_handler(array('Sakura\Main', 'errorHandler'));
|
2015-04-01 15:35:27 +00:00
|
|
|
|
|
|
|
// Initialise Flashii Class
|
2015-05-29 19:27:45 +00:00
|
|
|
Main::init(ROOT .'_sakura/config/config.ini');
|
|
|
|
|
|
|
|
// Start output buffering
|
|
|
|
ob_start(Configuration::getConfig('use_gzip') ? 'ob_gzhandler' : null);
|
2015-04-01 15:35:27 +00:00
|
|
|
|
|
|
|
// Set base page rendering data
|
2015-05-29 19:27:45 +00:00
|
|
|
$renderData = [
|
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
'sakura' => [
|
2015-06-04 12:41:55 +00:00
|
|
|
|
2015-04-06 21:23:54 +00:00
|
|
|
'version' => SAKURA_VERSION,
|
2015-04-30 23:01:01 +00:00
|
|
|
'vlabel' => SAKURA_VLABEL,
|
|
|
|
'vcolour' => SAKURA_COLOUR,
|
2015-06-29 00:36:37 +00:00
|
|
|
'stable' => SAKURA_STABLE,
|
2015-04-06 21:23:54 +00:00
|
|
|
'urls' => Configuration::getLocalConfig('urls'),
|
|
|
|
'charset' => Configuration::getConfig('charset'),
|
2015-05-11 22:20:19 +00:00
|
|
|
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'],
|
2015-04-13 10:14:59 +00:00
|
|
|
'recaptcha_public' => Configuration::getConfig('recaptcha_public'),
|
2015-04-20 19:39:49 +00:00
|
|
|
'recaptcha_enable' => Configuration::getConfig('recaptcha'),
|
|
|
|
'resources' => '//'. Configuration::getLocalConfig('urls')['content'] .'/data/'. strtolower(Templates::$_TPL),
|
|
|
|
'disableregister' => Configuration::getConfig('disable_registration'),
|
2015-05-29 19:27:45 +00:00
|
|
|
'locksite' => Configuration::getConfig('lock_site'),
|
|
|
|
'locksitereason' => Configuration::getConfig('lock_site_reason'),
|
2015-04-24 19:31:09 +00:00
|
|
|
'lockauth' => Configuration::getConfig('lock_authentication'),
|
2015-04-20 19:39:49 +00:00
|
|
|
'requireregcodes' => Configuration::getConfig('require_registration_code'),
|
|
|
|
'requireactiveate' => Configuration::getConfig('require_activation'),
|
2015-05-09 00:56:55 +00:00
|
|
|
'sitename' => Configuration::getConfig('sitename'),
|
2015-05-24 22:06:53 +00:00
|
|
|
'sitedesc' => Configuration::getConfig('sitedesc'),
|
|
|
|
'sitetags' => implode(", ", json_decode(Configuration::getConfig('sitetags'), true)),
|
2015-05-09 00:56:55 +00:00
|
|
|
'cookieprefix' => Configuration::getConfig('cookie_prefix'),
|
|
|
|
'cookiedomain' => Configuration::getConfig('cookie_domain'),
|
2015-05-25 18:18:56 +00:00
|
|
|
'cookiepath' => Configuration::getConfig('cookie_path'),
|
|
|
|
'minpwdentropy' => Configuration::getConfig('min_entropy'),
|
|
|
|
'minusernamelength' => Configuration::getConfig('username_min_length'),
|
|
|
|
'maxusernamelength' => Configuration::getConfig('username_max_length')
|
2015-06-04 12:41:55 +00:00
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'perms' => [
|
|
|
|
|
2015-07-01 00:16:22 +00:00
|
|
|
'canGetPremium' => Permissions::check('SITE', 'OBTAIN_PREMIUM', Session::$userId, 1),
|
|
|
|
'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1)
|
2015-06-04 12:41:55 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
],
|
2015-05-29 19:27:45 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
'php' => [
|
2015-06-04 12:41:55 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
'sessionid' => \session_id(),
|
2015-04-20 19:39:49 +00:00
|
|
|
'time' => \time(),
|
|
|
|
'self' => $_SERVER['PHP_SELF']
|
2015-06-04 12:41:55 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
],
|
2015-05-29 19:27:45 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
'user' => [
|
2015-06-04 12:41:55 +00:00
|
|
|
|
2015-04-18 11:35:16 +00:00
|
|
|
'checklogin' => Users::checkLogin(),
|
|
|
|
'session' => Session::$sessionId,
|
|
|
|
'data' => ($_init_udata = Users::getUser(Session::$userId)),
|
2015-04-25 20:08:44 +00:00
|
|
|
'rank' => ($_init_rdata = Users::getRank($_init_udata['rank_main'])),
|
|
|
|
'colour' => ($_init_udata['name_colour'] == null ? $_init_rdata['colour'] : $_init_udata['name_colour'])
|
2015-07-01 00:16:22 +00:00
|
|
|
|
2015-04-01 15:35:27 +00:00
|
|
|
]
|
2015-05-29 19:27:45 +00:00
|
|
|
|
|
|
|
];
|