bread for now

This commit is contained in:
flash 2015-06-29 02:36:37 +02:00
parent 926f0e6653
commit b8d5ef0ebf
8 changed files with 62 additions and 48 deletions

View file

@ -24,7 +24,8 @@
"20150620", "20150620",
"20150621", "20150621",
"20150627", "20150627",
"20150628" "20150628",
"20150629"
] ]
@ -1349,6 +1350,19 @@
"change": "Changed Edit icon on profiles." "change": "Changed Edit icon on profiles."
} }
],
"20150629": [
{
"type": "ADD",
"change": "Added topic and post counters to the frontpage."
},
{
"type": "UPD",
"change": "Changed SAKURA_VTYPE to a SAKURA_STABLE boolean that can be used for only showing things on stable or development builds."
}
] ]
} }

View file

@ -11,7 +11,7 @@ class Configuration {
public static $_LCNF; public static $_LCNF;
public static $_DCNF; public static $_DCNF;
// Initialise configuration, does not contain database initialisation because explained below // Initialise configuration, does not contain database initialisation because explained below
public static function init($local) { public static function init($local) {
// Check if the configuration file exists // Check if the configuration file exists
@ -63,62 +63,62 @@ class Configuration {
} }
// Get values from the configuration on the file system // Get values from the configuration on the file system
public static function getLocalConfig($key, $subkey = null) { public static function getLocalConfig($key, $subkey = null) {
// Check if the key that we're looking for exists // Check if the key that we're looking for exists
if(array_key_exists($key, self::$_LCNF)) { if(array_key_exists($key, self::$_LCNF)) {
if($subkey) { if($subkey) {
// If we also have a subkey return the proper data // If we also have a subkey return the proper data
return self::$_LCNF[$key][$subkey]; return self::$_LCNF[$key][$subkey];
} else { } else {
// else we just return the default value // else we just return the default value
return self::$_LCNF[$key]; return self::$_LCNF[$key];
} }
} else {// If it doesn't exist trigger an error to avoid explosions } else {// If it doesn't exist trigger an error to avoid explosions
trigger_error('Unable to get local configuration value!', E_USER_ERROR); trigger_error('Unable to get local configuration value!', E_USER_ERROR);
} }
} }
// Dynamically set local configuration values, does not update the configuration file // Dynamically set local configuration values, does not update the configuration file
public static function setLocalConfig($key, $subkey, $value) { public static function setLocalConfig($key, $subkey, $value) {
// Check if we also do a subkey // Check if we also do a subkey
if($subkey) { if($subkey) {
// If we do we make sure that the parent key is an array // If we do we make sure that the parent key is an array
if(!isset(self::$_LCNF[$key])) { if(!isset(self::$_LCNF[$key])) {
self::$_LCNF[$key] = array(); self::$_LCNF[$key] = array();
} }
// And then assign the value // And then assign the value
self::$_LCNF[$key][$subkey] = $value; self::$_LCNF[$key][$subkey] = $value;
} else { } else {
// Otherwise we just straight up assign it // Otherwise we just straight up assign it
self::$_LCNF[$key] = $value; self::$_LCNF[$key] = $value;
} }
} }
// Get values from the configuration in the database // Get values from the configuration in the database
public static function getConfig($key) { public static function getConfig($key) {
// Check if the key that we're looking for exists // Check if the key that we're looking for exists
if(array_key_exists($key, self::$_DCNF)) { if(array_key_exists($key, self::$_DCNF)) {
// Then return the value // Then return the value
return self::$_DCNF[$key]; return self::$_DCNF[$key];
@ -126,10 +126,10 @@ class Configuration {
} else { } else {
// Then return the value // Then return the value
trigger_error('Unable to get configuration value', E_USER_ERROR); trigger_error('Unable to get configuration value', E_USER_ERROR);
} }
} }
} }

View file

@ -8,7 +8,7 @@ namespace Sakura;
class Database { class Database {
// Database container // Database container
public static $_DATABASE; private static $_DATABASE;
// Initialisation function // Initialisation function
public static function init($engine) { public static function init($engine) {

View file

@ -26,7 +26,7 @@ class Permissions {
'SITE' => [ 'SITE' => [
'DEACTIVATED' => 1, // Is a user in this group deactivated 'DEACTIVATED' => 1, // Is a user in this group deactivated
'USE_CHAT' => 2, // Can use the chatroom 'VIEW_ONLINE' => 2, // Can view the extended online list
'ALTER_PROFILE' => 4, // Can alter their profile data 'ALTER_PROFILE' => 4, // Can alter their profile data
'CHANGE_AVATAR' => 8, // Can change their avatar 'CHANGE_AVATAR' => 8, // Can change their avatar
'CREATE_BACKGROUND' => 16, // Can create a background (different from changing) 'CREATE_BACKGROUND' => 16, // Can create a background (different from changing)

View file

@ -8,16 +8,16 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20150628'); define('SAKURA_VERSION', '20150629');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_VTYPE', 'Development'); define('SAKURA_STABLE', false);
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');
// Define Sakura Path // Define Sakura Path
define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__))); define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__)));
// Error Reporting: 0 for production and -1 for testing // Error Reporting: 0 for production and -1 for testing
error_reporting(-1); error_reporting(SAKURA_STABLE ? 0 : -1);
// Include libraries // Include libraries
require_once ROOT .'_sakura/vendor/autoload.php'; require_once ROOT .'_sakura/vendor/autoload.php';
@ -54,8 +54,8 @@ $renderData = [
'version' => SAKURA_VERSION, 'version' => SAKURA_VERSION,
'vlabel' => SAKURA_VLABEL, 'vlabel' => SAKURA_VLABEL,
'vtype' => SAKURA_VTYPE,
'vcolour' => SAKURA_COLOUR, 'vcolour' => SAKURA_COLOUR,
'stable' => SAKURA_STABLE,
'urls' => Configuration::getLocalConfig('urls'), 'urls' => Configuration::getLocalConfig('urls'),
'charset' => Configuration::getConfig('charset'), 'charset' => Configuration::getConfig('charset'),
'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'], 'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'],
@ -82,8 +82,8 @@ $renderData = [
'perms' => [ 'perms' => [
'canUseChat' => Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1), 'canViewOnline' => Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1),
'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1) 'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1)
], ],

View file

@ -209,10 +209,10 @@
<!-- Navigation menu, displayed on left side of the bar. --> <!-- Navigation menu, displayed on left side of the bar. -->
<a class="menu-item" href="//{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a> <a class="menu-item" href="//{{ sakura.urls.main }}/" title="Return to the front page of Flashii">Home</a>
<a class="menu-item" href="//{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a> <a class="menu-item" href="//{{ sakura.urls.main }}/news" title="Here you can read updates on Flashii">News</a>
{% if perms.canUseChat %}
<a class="menu-item" href="//{{ sakura.urls.chat }}/" title="Chat with other Flashii members">Chat</a> <a class="menu-item" href="//{{ sakura.urls.chat }}/" title="Chat with other Flashii members">Chat</a>
{% endif %} {% if perms.canUseForums %}
<a class="menu-item" href="//{{ sakura.urls.main }}/forum" title="Discuss things with other members but static">Forums</a> <a class="menu-item" href="//{{ sakura.urls.main }}/forum" title="Discuss things with other members but static">Forums</a>
{% endif %}
<a class="menu-item" href="//{{ sakura.urls.main }}/search" title="Search on Flashii">Search</a> <a class="menu-item" href="//{{ sakura.urls.main }}/search" title="Search on Flashii">Search</a>
{% if user.checklogin %} {% if user.checklogin %}
<a class="menu-item menu-donate" href="//{{ sakura.urls.main }}/support" title="Give us money to keep the site (and other services) up and running">Support us</a> <a class="menu-item menu-donate" href="//{{ sakura.urls.main }}/support" title="Give us money to keep the site (and other services) up and running">Support us</a>
@ -272,4 +272,3 @@
<p>A lot of things on this site require JavaScript to be enabled (e.g. the chat), we try to keep both sides happy but it is highly recommended that you enable it (you'll also have to deal with this message being here if you don't enable it).</p> <p>A lot of things on this site require JavaScript to be enabled (e.g. the chat), we try to keep both sides happy but it is highly recommended that you enable it (you'll also have to deal with this message being here if you don't enable it).</p>
</div> </div>
</noscript> </noscript>

View file

@ -103,11 +103,11 @@ foreach($changelog as $build => $buildData) {
$tpl = file_get_contents(ROOT .'_sakura/templates/changeLog.tpl'); $tpl = file_get_contents(ROOT .'_sakura/templates/changeLog.tpl');
// Parse tags // Parse tags
$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl); $tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl);
$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl); $tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl);
$tpl = str_replace('{{ version_type }}', SAKURA_VTYPE, $tpl); $tpl = str_replace('{{ version_type }}', SAKURA_STABLE ? 'Stable' : 'Development', $tpl);
$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl); $tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl);
$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl); $tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl);
// Print template // Print template
print $tpl; print $tpl;

View file

@ -8,7 +8,8 @@ namespace Sakura;
// Include components // Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
//print Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1);
print Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1);
// Are we in forum mode? // Are we in forum mode?
$forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false; $forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false;
@ -21,9 +22,9 @@ $renderData['page'] = [
]; ];
$renderData['board'] = [ $renderData['board'] = [
'forums' => ($forumMode ? Forum::getForumList() : null), 'forums' => ($forumMode ? Forum::getForumList() : null),
'viewforum' => false, 'viewforum' => false,
'viewtopic' => false 'viewtopic' => false
]; ];
$renderData['stats'] = [ $renderData['stats'] = [
@ -32,8 +33,8 @@ $renderData['stats'] = [
'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'), 'lastRegDate' => ($_INDEX_LAST_REGDATE = date_diff(date_create(date('Y-m-d', $_INDEX_NEWEST_USER['regdate'])), date_create(date('Y-m-d')))->format('%a')) .' day'. ($_INDEX_LAST_REGDATE == 1 ? '' : 's'),
'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'), 'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'),
'onlineUsers' => Users::checkAllOnline(), 'onlineUsers' => Users::checkAllOnline(),
'topicCount' => '0 topics', 'topicCount' => ($_TOPICS = count(Database::fetch('topics'))) .' topic'. ($_TOPICS != 1 ? 's' : ''),
'postCount' => '0 posts' 'postCount' => ($_POSTS = count(Database::fetch('posts'))) .' post'. ($_POSTS != 1 ? 's' : '')
]; ];
// Print page contents // Print page contents