diff --git a/_developer_data/structure.sql b/_developer_data/structure.sql
index e35ef6b..ceda280 100644
--- a/_developer_data/structure.sql
+++ b/_developer_data/structure.sql
@@ -15,7 +15,7 @@ CREATE TABLE `fii_actioncodes` (
`actkey` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The URL key for using this code.',
`instruction` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Things the backend should do upon using this code',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `fii_apikeys`;
@@ -53,14 +53,14 @@ INSERT INTO `fii_config` (`config_name`, `config_value`) VALUES
('recaptcha_public', ''),
('recaptcha_private', ''),
('charset', 'utf-8'),
-('cookie_prefix', 'fii_'),
-('cookie_domain', 'iihsalf.net'),
+('cookie_prefix', 'sakura_'),
+('cookie_domain', 'yourdomain.com'),
('cookie_path', '/'),
('site_style', 'yuuno'),
('manage_style', 'broomcloset'),
('allow_registration', '0'),
('smtp_server', ''),
-('smtp_auth', ''),
+('smtp_auth', '1'),
('smtp_secure', ''),
('smtp_port', ''),
('smtp_username', ''),
@@ -69,7 +69,7 @@ INSERT INTO `fii_config` (`config_name`, `config_value`) VALUES
('smtp_replyto_name', ''),
('smtp_from_email', ''),
('smtp_from_name', ''),
-('sitename', 'Development Palace'),
+('sitename', 'Sakura'),
('recaptcha', '1'),
('require_activation', '1'),
('require_registration_code', '0'),
@@ -101,8 +101,9 @@ CREATE TABLE `fii_forums` (
`forum_topics` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'Topic count of the forum.',
`forum_last_post_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of last post in forum.',
`forum_last_poster_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of last poster in forum.',
+ `forum_icon` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display icon for the forum.',
PRIMARY KEY (`forum_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `fii_infopages`;
@@ -138,6 +139,21 @@ CREATE TABLE `fii_news` (
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+DROP TABLE IF EXISTS `fii_notifications`;
+CREATE TABLE `fii_notifications` (
+ `id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
+ `uid` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'User ID this notification is intended for.',
+ `timestamp` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp when this notification was created.',
+ `notif_read` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Toggle for unread and read.',
+ `notif_title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Title displayed on the notification.',
+ `notif_text` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Text displayed.',
+ `notif_link` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Link (empty for no link).',
+ `notif_img` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Image path, prefix with font: to use a font class instead of an image.',
+ `notif_timeout` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'How long the notification should stay on screen in milliseconds, 0 for forever.',
+ PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+
+
DROP TABLE IF EXISTS `fii_posts`;
CREATE TABLE `fii_posts` (
`post_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
@@ -195,17 +211,6 @@ CREATE TABLE `fii_ranks` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-TRUNCATE `fii_ranks`;
-INSERT INTO `fii_ranks` (`id`, `name`, `multi`, `colour`, `description`, `title`, `is_premium`) VALUES
-(1, 'Deactivated', 0, '#555', 'Users that are yet to be activated or that deactivated their own account.', 'Deactivated', 0),
-(2, 'Regular user', 1, 'inherit', 'Regular users with regular permissions.', 'Regular user', 0),
-(3, 'Site moderator', 1, '#0A0', 'Users with special permissions like being able to ban and modify users if needed.', 'Staff', 1),
-(4, 'Administrator', 1, '#C00', 'Users that manage the server and everything around that.', 'Administrator', 1),
-(5, 'Developer', 1, '#824CA0', 'Users that either create or test new features of the site.', 'Staff', 1),
-(6, 'Bot', 1, '#9E8DA7', 'Reserved user accounts for services.', 'Bot', 0),
-(7, 'Chat moderator', 1, '#09F', 'Moderators of the chat room.', 'Staff', 1),
-(8, 'Tenshi', 0, '#EE9400', 'Users that donated $5.00 or more in order to keep the site and it\'s services alive!', 'Tenshi', 1),
-(9, 'Alumnii', 0, '#FF69B4', 'People who have contributed to the community but have moved on or resigned.', 'Alumnii', 1);
DROP TABLE IF EXISTS `fii_regcodes`;
CREATE TABLE `fii_regcodes` (
@@ -229,7 +234,7 @@ CREATE TABLE `fii_sessions` (
`expire` int(64) unsigned NOT NULL COMMENT 'The timestamp for when this session should end, -1 for permanent. ',
`remember` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'If set to 1 session will be extended each time a page is loaded.',
PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=65 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `fii_sock_perms`;
@@ -296,8 +301,8 @@ CREATE TABLE `fii_users` (
`password_chan` int(16) unsigned NOT NULL COMMENT 'Last time the user changed their password.',
`password_new` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Field with array containing new password data beit that they requested a password change.',
`email` varchar(32) COLLATE utf8_bin NOT NULL COMMENT 'E-mail of the user for password restoring etc.',
- `rank_main` mediumint(4) unsigned NOT NULL COMMENT 'Main rank of the user.',
- `ranks` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Array containing the ranks the user is part of.',
+ `rank_main` mediumint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Main rank of the user.',
+ `ranks` varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '[0]' COMMENT 'Array containing the ranks the user is part of.',
`name_colour` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Additional name colour, when empty colour defaults to group colour.',
`register_ip` varchar(16) COLLATE utf8_bin NOT NULL COMMENT 'IP used for the creation of this account.',
`last_ip` varchar(16) COLLATE utf8_bin NOT NULL COMMENT 'Last IP that was used to log into this account.',
@@ -305,15 +310,16 @@ CREATE TABLE `fii_users` (
`profile_md` text COLLATE utf8_bin COMMENT 'Markdown customise page thing on the profile of the user.',
`avatar_url` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Full url to the user''s avatar.',
`background_url` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Full url to the user''s profile background.',
- `regdate` int(16) unsigned NOT NULL COMMENT 'Timestamp of account creation.',
- `lastdate` int(16) unsigned NOT NULL COMMENT 'Last time anything was done on this account.',
- `lastunamechange` int(16) unsigned NOT NULL COMMENT 'Last username change.',
+ `regdate` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of account creation.',
+ `lastdate` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'Last time anything was done on this account.',
+ `lastunamechange` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'Last username change.',
`birthday` varchar(16) COLLATE utf8_bin DEFAULT NULL COMMENT 'Birthdate of the user.',
+ `posts` int(16) unsigned NOT NULL DEFAULT '0' COMMENT 'Amount of posts the user has made on the forum.',
`country` varchar(4) COLLATE utf8_bin NOT NULL COMMENT 'Contains ISO 3166 country code of user''s registration location.',
`profile_data` text COLLATE utf8_bin NOT NULL COMMENT 'Modular array containing profile data.',
PRIMARY KEY (`id`),
UNIQUE KEY `username_clean` (`username_clean`)
-) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `fii_warnings`;
@@ -328,4 +334,4 @@ CREATE TABLE `fii_warnings` (
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
--- 2015-05-05 06:18:36
+-- 2015-05-08 17:47:36
diff --git a/_sakura/changelog.json b/_sakura/changelog.json
index 762e263..97c0a56 100644
--- a/_sakura/changelog.json
+++ b/_sakura/changelog.json
@@ -2,6 +2,19 @@
"versions": {
+ "Eminence": {
+
+ "colour": "#6C3082",
+
+ "builds": [
+
+ "20150508",
+ "20150509"
+
+ ]
+
+ },
+
"Heliotrope": {
"colour": "#DF73FF",
@@ -964,6 +977,32 @@
"change": "Moved panel on the right site of the index to its own template file."
}
+ ],
+
+ "20150508": [
+
+ {
+ "type": "ADD",
+ "change": "Added notification system."
+ }
+
+ ],
+
+ "20150509": [
+
+ {
+ "type": "FIX",
+ "change": "Fixed missing newline in a template file."
+ },
+ {
+ "type": "ADD",
+ "change": "Added function to actually create notifications."
+ },
+ {
+ "type": "FIX",
+ "change": "Fixed avatar border being depositioned."
+ }
+
]
}
diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php
index c69343f..90ca877 100644
--- a/_sakura/components/Users.php
+++ b/_sakura/components/Users.php
@@ -932,4 +932,76 @@ class Users {
}
+ // Get a user's notifications
+ public static function getNotifications($uid = null, $timediff = 0, $excludeRead = true, $markRead = false) {
+
+ // Prepare conditions
+ $conditions = array();
+ $conditions['uid'] = [($uid ? $uid : Session::$userId), '='];
+ if($timediff)
+ $conditions['timestamp'] = [time() - $timediff, '>'];
+ if($excludeRead)
+ $conditions['notif_read'] = [0, '='];
+
+ // Get notifications for the database
+ $notifications = Database::fetch('notifications', true, $conditions);
+
+ // Mark the notifications as read
+ if($markRead) {
+
+ // Iterate over all entries
+ foreach($notifications as $notification) {
+
+ // If the notifcation is already read skip
+ if($notification['notif_read'])
+ continue;
+
+ // Mark them as read
+ self::markNotificationRead($notification['id']);
+
+ }
+
+ }
+
+ // Return the notifications
+ return $notifications;
+
+ }
+
+ // Marking notifications as read
+ public static function markNotificationRead($id, $mode = true) {
+
+ // Execute an update statement
+ Database::update('notifications', [
+ [
+ 'notif_read' => ($mode ? 1 : 0)
+ ],
+ [
+ 'id' => [$id, '=']
+ ]
+ ]);
+
+ }
+
+ // Adding a new notification
+ public static function createNotification($user, $title, $text, $timeout = 60000, $img = 'FONT:fa-info-circle', $link = '', $sound = 0) {
+
+ // Get current timestamp
+ $time = time();
+
+ // Insert it into the database
+ Database::insert('notifications', [
+ 'uid' => Session::$userId,
+ 'timestamp' => $time,
+ 'notif_read' => 0,
+ 'notif_sound' => ($sound ? 1 : 0),
+ 'notif_title' => $title,
+ 'notif_text' => $text,
+ 'notif_link' => $link,
+ 'notif_img' => $img,
+ 'notif_timeout' => $timeout
+ ]);
+
+ }
+
}
diff --git a/_sakura/sakura.php b/_sakura/sakura.php
index 2a3b0c0..167b8f5 100644
--- a/_sakura/sakura.php
+++ b/_sakura/sakura.php
@@ -8,10 +8,10 @@
namespace Sakura;
// Define Sakura version
-define('SAKURA_VERSION', '20150506');
-define('SAKURA_VLABEL', 'Heliotrope');
+define('SAKURA_VERSION', '20150508');
+define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_VTYPE', 'Development');
-define('SAKURA_COLOUR', '#DF73FF');
+define('SAKURA_COLOUR', '#6C3082');
// Define Sakura Path
define('ROOT', str_replace(basename(__DIR__), '', dirname(__FILE__)));
@@ -72,7 +72,10 @@ $renderData = array(
'lockauth' => Configuration::getConfig('lock_authentication'),
'requireregcodes' => Configuration::getConfig('require_registration_code'),
'requireactiveate' => Configuration::getConfig('require_activation'),
- 'sitename' => Configuration::getConfig('sitename')
+ 'sitename' => Configuration::getConfig('sitename'),
+ 'cookieprefix' => Configuration::getConfig('cookie_prefix'),
+ 'cookiedomain' => Configuration::getConfig('cookie_domain'),
+ 'cookiepath' => Configuration::getConfig('cookie_path')
],
'php' => [
'sessionid' => \session_id(),
diff --git a/_sakura/templates/yuuno/elements/indexPanel.tpl b/_sakura/templates/yuuno/elements/indexPanel.tpl
index a4c6cef..031bf9a 100644
--- a/_sakura/templates/yuuno/elements/indexPanel.tpl
+++ b/_sakura/templates/yuuno/elements/indexPanel.tpl
@@ -31,4 +31,4 @@ there's {{ stats.chatOnline }} in chat right now and the forum has {{
{% endfor %}
{% else %}
There were no online users in the past 5 minutes.
-{% endif %}
\ No newline at end of file
+{% endif %}
diff --git a/_sakura/templates/yuuno/global/header.tpl b/_sakura/templates/yuuno/global/header.tpl
index 8e3f90c..cff1276 100644
--- a/_sakura/templates/yuuno/global/header.tpl
+++ b/_sakura/templates/yuuno/global/header.tpl
@@ -28,6 +28,32 @@