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

108 lines
4.2 KiB
PHP
Raw Normal View History

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-06-28 14:43:46 +00:00
define('SAKURA_VERSION', '20150628');
2015-05-09 00:56:55 +00:00
define('SAKURA_VLABEL', 'Eminence');
2015-04-26 16:01:28 +00:00
define('SAKURA_VTYPE', 'Development');
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
error_reporting(-1);
// 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-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,
'vtype' => SAKURA_VTYPE,
'vcolour' => SAKURA_COLOUR,
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'),
'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'),
'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' => [
'canUseChat' => Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1),
'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1)
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(),
'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-04-01 15:35:27 +00:00
]
2015-05-29 19:27:45 +00:00
];