diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 9f49511..34096f8 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -24,7 +24,8 @@ "20150620", "20150621", "20150627", - "20150628" + "20150628", + "20150629" ] @@ -1349,6 +1350,19 @@ "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." + } + ] } diff --git a/_sakura/components/Configuration.php b/_sakura/components/Configuration.php index fb6017a..cddc7d1 100644 --- a/_sakura/components/Configuration.php +++ b/_sakura/components/Configuration.php @@ -11,7 +11,7 @@ class Configuration { public static $_LCNF; 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) { // Check if the configuration file exists @@ -63,62 +63,62 @@ class Configuration { } - // Get values from the configuration on the file system - public static function getLocalConfig($key, $subkey = null) { + // Get values from the configuration on the file system + public static function getLocalConfig($key, $subkey = null) { // 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 - return self::$_LCNF[$key][$subkey]; + return self::$_LCNF[$key][$subkey]; - } else { + } else { // 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 - public static function setLocalConfig($key, $subkey, $value) { + // Dynamically set local configuration values, does not update the configuration file + public static function setLocalConfig($key, $subkey, $value) { // 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(!isset(self::$_LCNF[$key])) { + if(!isset(self::$_LCNF[$key])) { - self::$_LCNF[$key] = array(); + self::$_LCNF[$key] = array(); } // And then assign the value - self::$_LCNF[$key][$subkey] = $value; + self::$_LCNF[$key][$subkey] = $value; - } else { + } else { // Otherwise we just straight up assign it - self::$_LCNF[$key] = $value; + self::$_LCNF[$key] = $value; } - } + } - // Get values from the configuration in the database - public static function getConfig($key) { + // Get values from the configuration in the database + public static function getConfig($key) { // 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 return self::$_DCNF[$key]; @@ -126,10 +126,10 @@ class Configuration { } else { // Then return the value - trigger_error('Unable to get configuration value', E_USER_ERROR); + trigger_error('Unable to get configuration value', E_USER_ERROR); } - } + } } diff --git a/_sakura/components/Database.php b/_sakura/components/Database.php index c94a557..f707caa 100644 --- a/_sakura/components/Database.php +++ b/_sakura/components/Database.php @@ -8,7 +8,7 @@ namespace Sakura; class Database { // Database container - public static $_DATABASE; + private static $_DATABASE; // Initialisation function public static function init($engine) { diff --git a/_sakura/components/Permissions.php b/_sakura/components/Permissions.php index 974d7b5..501c3fb 100644 --- a/_sakura/components/Permissions.php +++ b/_sakura/components/Permissions.php @@ -26,7 +26,7 @@ class Permissions { 'SITE' => [ '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 'CHANGE_AVATAR' => 8, // Can change their avatar 'CREATE_BACKGROUND' => 16, // Can create a background (different from changing) diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 30d35be..99ce04c 100644 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,16 +8,16 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20150628'); +define('SAKURA_VERSION', '20150629'); define('SAKURA_VLABEL', 'Eminence'); -define('SAKURA_VTYPE', 'Development'); +define('SAKURA_STABLE', false); define('SAKURA_COLOUR', '#6C3082'); // Define Sakura Path define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__))); // Error Reporting: 0 for production and -1 for testing -error_reporting(-1); +error_reporting(SAKURA_STABLE ? 0 : -1); // Include libraries require_once ROOT .'_sakura/vendor/autoload.php'; @@ -54,8 +54,8 @@ $renderData = [ 'version' => SAKURA_VERSION, 'vlabel' => SAKURA_VLABEL, - 'vtype' => SAKURA_VTYPE, 'vcolour' => SAKURA_COLOUR, + 'stable' => SAKURA_STABLE, 'urls' => Configuration::getLocalConfig('urls'), 'charset' => Configuration::getConfig('charset'), 'currentpage' => '//'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'], @@ -82,8 +82,8 @@ $renderData = [ 'perms' => [ - 'canUseChat' => Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1), - 'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1) + 'canViewOnline' => Permissions::check('SITE', 'USE_CHAT', Session::$userId, 1), + 'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1) ], diff --git a/_sakura/templates/yuuno/global/header.tpl b/_sakura/templates/yuuno/global/header.tpl index ef6e20e..a8f38ad 100644 --- a/_sakura/templates/yuuno/global/header.tpl +++ b/_sakura/templates/yuuno/global/header.tpl @@ -209,10 +209,10 @@ Home News - {% if perms.canUseChat %} Chat - {% endif %} + {% if perms.canUseForums %} Forums + {% endif %} Search {% if user.checklogin %} Support us @@ -272,4 +272,3 @@
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).
- diff --git a/main/changelog.php b/main/changelog.php index 0b27d46..1434d5f 100644 --- a/main/changelog.php +++ b/main/changelog.php @@ -103,11 +103,11 @@ foreach($changelog as $build => $buildData) { $tpl = file_get_contents(ROOT .'_sakura/templates/changeLog.tpl'); // Parse tags -$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl); -$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl); -$tpl = str_replace('{{ version_type }}', SAKURA_VTYPE, $tpl); -$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl); -$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl); +$tpl = str_replace('{{ version }}', SAKURA_VERSION, $tpl); +$tpl = str_replace('{{ version_label }}', SAKURA_VLABEL, $tpl); +$tpl = str_replace('{{ version_type }}', SAKURA_STABLE ? 'Stable' : 'Development', $tpl); +$tpl = str_replace('{{ colour }}', SAKURA_COLOUR, $tpl); +$tpl = str_replace('{{ changeloghtml }}', $changelogHTML, $tpl); // Print template print $tpl; diff --git a/main/index.php b/main/index.php index 51c2bdf..ad9d2fa 100644 --- a/main/index.php +++ b/main/index.php @@ -8,7 +8,8 @@ namespace Sakura; // Include components 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? $forumMode = isset($_GET['forums']) ? ($_GET['forums'] == true) : false; @@ -21,9 +22,9 @@ $renderData['page'] = [ ]; $renderData['board'] = [ - 'forums' => ($forumMode ? Forum::getForumList() : null), - 'viewforum' => false, - 'viewtopic' => false + 'forums' => ($forumMode ? Forum::getForumList() : null), + 'viewforum' => false, + 'viewtopic' => false ]; $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'), 'chatOnline' => ($_INDEX_CHAT_ONLINE = count(SockChat::getOnlineUsers())) .' user'. ($_INDEX_CHAT_ONLINE == 1 ? '' : 's'), 'onlineUsers' => Users::checkAllOnline(), - 'topicCount' => '0 topics', - 'postCount' => '0 posts' + 'topicCount' => ($_TOPICS = count(Database::fetch('topics'))) .' topic'. ($_TOPICS != 1 ? 's' : ''), + 'postCount' => ($_POSTS = count(Database::fetch('posts'))) .' post'. ($_POSTS != 1 ? 's' : '') ]; // Print page contents