big commit

This commit is contained in:
Pachira 2015-08-22 00:07:45 +02:00
parent 2f0a84295e
commit fb1b56e8f5
36 changed files with 877 additions and 329 deletions

View file

@ -5,6 +5,8 @@ SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP DATABASE IF EXISTS `sakura-development`;
CREATE DATABASE `sakura-development` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */;
USE `sakura-development`;
DROP TABLE IF EXISTS `sakura_actioncodes`;
@ -29,18 +31,17 @@ CREATE TABLE `sakura_apikeys` (
DROP TABLE IF EXISTS `sakura_bans`;
CREATE TABLE `sakura_bans` (
`id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`uid` bigint(128) unsigned NOT NULL COMMENT 'ID of user that was banned, 0 for just an IP ban.',
`ip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP to disallow access to the site.',
`type` tinyint(1) unsigned NOT NULL COMMENT 'The type of ban that should be enforced.',
`timestamp` int(16) unsigned NOT NULL COMMENT 'Timestamp when the user was banned.',
`bannedtill` int(16) unsigned NOT NULL COMMENT 'Timestamp when the user should regain access to the site.',
`modid` bigint(128) unsigned NOT NULL COMMENT 'ID of moderator that banned this user,',
`modip` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'IP of moderator that banned this user.',
`reason` varchar(255) COLLATE utf8_bin DEFAULT NULL COMMENT 'Reason given for the ban.',
`id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`uid` bigint(255) unsigned NOT NULL COMMENT 'ID of user that was banned, 0 for just an IP ban.',
`ban_begin` int(11) unsigned NOT NULL COMMENT 'Timestamp when the user was banned.',
`ban_end` int(11) unsigned NOT NULL COMMENT 'Timestamp when the user should regain access to the site.',
`ban_reason` varchar(512) COLLATE utf8_bin DEFAULT NULL COMMENT 'Reason given for the ban.',
`mod_id` bigint(255) unsigned NOT NULL COMMENT 'ID of moderator that banned this user,',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
CONSTRAINT `sakura_bans_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
KEY `mod_id` (`mod_id`),
CONSTRAINT `sakura_bans_ibfk_1` FOREIGN KEY (`uid`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sakura_bans_ibfk_2` FOREIGN KEY (`mod_id`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -49,20 +50,23 @@ CREATE TABLE `sakura_bbcodes` (
`id` int(64) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`regex` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Regular expression string for the BBCode.',
`replace` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'What to replace it with.',
`title` varchar(128) COLLATE utf8_bin NOT NULL COMMENT 'Button title for this bbcode.',
`description` varchar(512) COLLATE utf8_bin NOT NULL COMMENT 'Description of what this does.',
`on_posting` tinyint(1) unsigned NOT NULL COMMENT 'Set if this bbcode is displayed on the posting page.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `sakura_bbcodes` (`id`, `regex`, `replace`, `description`) VALUES
(1, '/\\[b\\](.*?)\\[\\/b\\]/is', '<b>$1</b>', 'Make text bold. Usage: [b]text[/b].'),
(2, '/\\[i\\](.*?)\\[\\/i\\]/is', '<i>$1</i>', 'Make text italic. Usage: [i]text[/i].'),
(3, '/\\[u\\](.*?)\\[\\/u\\]/is', '<u>$1</u>', 'Make text underlined. Usage: [u]text[/b].'),
(4, '/\\[s\\](.*?)\\[\\/s\\]/is', '<del>$1</del>', 'Put a line through text. Usage: [s]text[/s].'),
(5, '/\\[img\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/img\\]/is', '<img src=\"$1\" alt=\"Image\" />', 'Embed an image. Usage: [img]url[/img]'),
(6, '/\\[url=([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\](.*?)\\[\\/url\\]/is', '<a href=\"$1\" target=\"_blank\">$2</a>', 'Embed a URL. Usage: [url=http://google.com]Link to google![/url]'),
(7, '/\\[url\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/url\\]/is', '<a href=\"$1\" target=\"_blank\">$1</a>', 'Make a link clickable (if the automatic algorithm doesn\'t do it already). Usage: [url]http://google.com[/url]'),
(8, '/\\[quote\\=\\\"(.+)\\\"\\](.+)\\[\\/quote]/is', '<div class=\"quote\"><div class=\"quotee\">$1 wrote:</div><div class=\"text\">$2</div></div>', 'Quote a user\'s post. Usage: [quote=Flashwave]nookls is pretty[/quote]'),
(9, '/\\[quote\\](.+)\\[\\/quote]/is', '<div class=\"quote\"><div class=\"quotee\">Quote:</div><div class=\"text\">$1</div></div>', 'Quote a user\'s post. Usage: [quote]nookls is pretty[/quote]');
INSERT INTO `sakura_bbcodes` (`id`, `regex`, `replace`, `title`, `description`, `on_posting`) VALUES
(1, '/\\[b\\](.*?)\\[\\/b\\]/is', '<b>$1</b>', 'Bold', 'Make text bold. Usage: [b]text[/b].', 1),
(2, '/\\[i\\](.*?)\\[\\/i\\]/is', '<i>$1</i>', 'Italics', 'Make text italic. Usage: [i]text[/i].', 1),
(3, '/\\[u\\](.*?)\\[\\/u\\]/is', '<u>$1</u>', 'Underline', 'Make text underlined. Usage: [u]text[/u].', 1),
(4, '/\\[s\\](.*?)\\[\\/s\\]/is', '<del>$1</del>', 'Strikethrough', 'Put a line through text. Usage: [s]text[/s].', 1),
(5, '/\\[img\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/img\\]/is', '<img src=\"$1\" alt=\"Image\" />', 'Image', 'Embed an image. Usage: [img]url[/img]', 1),
(6, '/\\[url=([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\](.*?)\\[\\/url\\]/is', '<a href=\"$1\" target=\"_blank\">$2</a>', 'Link', 'Embed a URL. Usage: [url=http://google.com]Link to google![/url]', 0),
(7, '/\\[url\\]([a-zA-Z0-9\\.\\$\\-\\_\\.\\+\\*\\!\\\'\\(\\)\\/\\:\\#]+)\\[\\/url\\]/is', '<a href=\"$1\" target=\"_blank\">$1</a>', 'Link', 'Make a link clickable (if the automatic algorithm doesn\'t do it already). Usage: [url]http://google.com[/url]', 1),
(8, '/\\[quote\\=\\\"(.+)\\\"\\](.+)\\[\\/quote]/is', '<div class=\"quote\"><div class=\"quotee\">$1 wrote:</div><div class=\"text\">$2</div></div>', 'Quote', 'Quote a user\'s post. Usage: [quote=Flashwave]nookls is pretty[/quote]', 0),
(9, '/\\[quote\\](.+)\\[\\/quote]/is', '<div class=\"quote\"><div class=\"quotee\">Quote:</div><div class=\"text\">$1</div></div>', 'Quote', 'Quote a user\'s post. Usage: [quote]nookls is pretty[/quote]', 1)
ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `regex` = VALUES(`regex`), `replace` = VALUES(`replace`), `title` = VALUES(`title`), `description` = VALUES(`description`), `on_posting` = VALUES(`on_posting`);
DROP TABLE IF EXISTS `sakura_config`;
CREATE TABLE `sakura_config` (
@ -79,19 +83,18 @@ INSERT INTO `sakura_config` (`config_name`, `config_value`) VALUES
('cookie_path', '/'),
('site_style', 'yuuno'),
('manage_style', 'broomcloset'),
('allow_registration', '0'),
('smtp_server', ''),
('smtp_auth', ''),
('smtp_secure', ''),
('smtp_port', ''),
('smtp_username', ''),
('smtp_server', 'smtp-mail.outlook.com'),
('smtp_auth', '1'),
('smtp_secure', 'tls'),
('smtp_port', '587'),
('smtp_username', 'flashii@outlook.com'),
('smtp_password', ''),
('smtp_replyto_mail', ''),
('smtp_replyto_name', ''),
('smtp_from_email', ''),
('smtp_replyto_mail', 'admin@flashii.net'),
('smtp_replyto_name', 'Flashwave'),
('smtp_from_email', 'flashii@outlook.com'),
('smtp_from_name', 'Flashii Noreply'),
('sitename', 'Test Palace'),
('recaptcha', '1'),
('sitename', 'Cutting Edgii'),
('recaptcha', '0'),
('require_activation', '0'),
('require_registration_code', '0'),
('disable_registration', '0'),
@ -105,13 +108,42 @@ INSERT INTO `sakura_config` (`config_name`, `config_value`) VALUES
('username_max_length', '16'),
('lock_site', '1'),
('lock_site_reason', 'meow'),
('use_gzip', '1'),
('use_gzip', '0'),
('enable_tpl_cache', '0'),
('paypal_client_id', ''),
('paypal_secret', ''),
('premium_price_per_month', '1.49'),
('premium_rank_id', '8'),
('premium_amount_max', '24');
('premium_amount_max', '24'),
('alumni_rank_id', '9'),
('url_main', 'flashii.test'),
('disqus_shortname', 'flashii'),
('disqus_api_key', ''),
('disqus_api_secret', ''),
('front_page_news_posts', '3'),
('date_format', 'D Y-m-d H:i:s T'),
('news_posts_per_page', '3'),
('avatar_min_width', '20'),
('avatar_min_height', '20'),
('avatar_max_height', '512'),
('avatar_max_width', '512'),
('avatar_max_fsize', '2097152'),
('url_api', 'api.flashii.test'),
('content_path', '/content'),
('user_uploads', 'uploads'),
('no_avatar_img', 'main/content/images/no-av.png'),
('deactivated_avatar_img', 'main/content/images/deactivated-av.png'),
('banned_avatar_img', 'main/content/images/banned-av.png'),
('no_background_img', 'main/content/pixel.png'),
('no_header_img', 'main/content/images/triangles.png'),
('pixel_img', 'main/content/pixel.png'),
('background_max_fsize', '5242880'),
('background_max_width', '2560'),
('background_max_height', '1440'),
('background_min_height', '16'),
('background_min_width', '16'),
('max_online_time', '500')
ON DUPLICATE KEY UPDATE `config_name` = VALUES(`config_name`), `config_value` = VALUES(`config_value`);
DROP TABLE IF EXISTS `sakura_emoticons`;
CREATE TABLE `sakura_emoticons` (
@ -120,42 +152,45 @@ CREATE TABLE `sakura_emoticons` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `sakura_emoticons` (`emote_string`, `emote_path`) VALUES
(':amu:', 'images/emoticons/amu.png'),
(':angrier:', 'images/emoticons/angrier.png'),
(':angriest:', 'images/emoticons/angriest.png'),
(':angry:', 'images/emoticons/angry.gif'),
(':blank:', 'images/emoticons/blank.png'),
(':childish:', 'images/emoticons/childish.png'),
(':congrats:', 'images/emoticons/congrats.png'),
(':crying:', 'images/emoticons/crying.gif'),
(':dizzy:', 'images/emoticons/dizzy.gif'),
(':eat:', 'images/emoticons/eat.gif'),
(':evil:', 'images/emoticons/evil.png'),
(':extreme:', 'images/emoticons/extreme.png'),
(':glare:', 'images/emoticons/glare.gif'),
(':happy:', 'images/emoticons/happy.gif'),
(':horror:', 'images/emoticons/horror.gif'),
(':idea:', 'images/emoticons/idea.png'),
(':jew:', 'images/emoticons/jew.png'),
(':kiss:', 'images/emoticons/kiss.gif'),
(':lmao:', 'images/emoticons/lmao.gif'),
(':lol:', 'images/emoticons/lol.gif'),
(':love:', 'images/emoticons/love.png'),
(':meow:', 'images/emoticons/meow.png'),
(':omg:', 'images/emoticons/omg.gif'),
(':ouch:', 'images/emoticons/ouch.gif'),
(':puke:', 'images/emoticons/puke.gif'),
(':ruse:', 'images/emoticons/ruse.png'),
(':sad:', 'images/emoticons/sad.png'),
(':sigh:', 'images/emoticons/sigh.gif'),
(':suspicious:', 'images/emoticons/suspicious.gif'),
(':sweat:', 'images/emoticons/sweat.gif'),
(':tired:', 'images/emoticons/tired.gif'),
(':yay:', 'images/emoticons/vhappy.gif'),
(':winxp:', 'images/emoticons/winxp.png'),
(':wtf:', 'images/emoticons/wtf.gif'),
(':sleep:', 'images/emoticons/zzz.gif'),
(':what:', 'images/emoticons/what.png');
(':amu:', '/content/images/emoticons/amu.png'),
(':angrier:', '/content/images/emoticons/angrier.png'),
(':angriest:', '/content/images/emoticons/angriest.png'),
(':angry:', '/content/images/emoticons/angry.gif'),
(':blank:', '/content/images/emoticons/blank.png'),
(':childish:', '/content/images/emoticons/childish.png'),
(':congrats:', '/content/images/emoticons/congrats.png'),
(':crying:', '/content/images/emoticons/crying.gif'),
(':dizzy:', '/content/images/emoticons/dizzy.gif'),
(':eat:', '/content/images/emoticons/eat.gif'),
(':evil:', '/content/images/emoticons/evil.png'),
(':extreme:', '/content/images/emoticons/extreme.png'),
(':glare:', '/content/images/emoticons/glare.gif'),
(':happy:', '/content/images/emoticons/happy.gif'),
(':horror:', '/content/images/emoticons/horror.gif'),
(':huh:', '/content/images/emoticons/huh.png'),
(':idea:', '/content/images/emoticons/idea.png'),
(':jew:', '/content/images/emoticons/jew.png'),
(':kiss:', '/content/images/emoticons/kiss.gif'),
(':lmao:', '/content/images/emoticons/lmao.gif'),
(':lol:', '/content/images/emoticons/lol.gif'),
(':love:', '/content/images/emoticons/love.png'),
(':meow:', '/content/images/emoticons/meow.png'),
(':omg:', '/content/images/emoticons/omg.gif'),
(':ouch:', '/content/images/emoticons/ouch.gif'),
(':puke:', '/content/images/emoticons/puke.gif'),
(':ruse:', '/content/images/emoticons/ruse.png'),
(':sad:', '/content/images/emoticons/sad.png'),
(':sigh:', '/content/images/emoticons/sigh.gif'),
(':suspicious:', '/content/images/emoticons/suspicious.gif'),
(':sweat:', '/content/images/emoticons/sweat.gif'),
(':tired:', '/content/images/emoticons/tired.gif'),
(':yay:', '/content/images/emoticons/vhappy.gif'),
(':winxp:', '/content/images/emoticons/winxp.png'),
(':wtf:', '/content/images/emoticons/wtf.gif'),
(':sleep:', '/content/images/emoticons/zzz.gif'),
(':what:', '/content/images/emoticons/what.png'),
(':smug:', '/content/images/emoticons/smug.png')
ON DUPLICATE KEY UPDATE `emote_string` = VALUES(`emote_string`), `emote_path` = VALUES(`emote_path`);
DROP TABLE IF EXISTS `sakura_faq`;
CREATE TABLE `sakura_faq` (
@ -262,6 +297,20 @@ CREATE TABLE `sakura_notifications` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `sakura_optionfields`;
CREATE TABLE `sakura_optionfields` (
`id` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Unique identifier for accessing this option.',
`name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Description of the field in a proper way.',
`description` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Longer description of the option.',
`formtype` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Type attribute in the input element.',
`require_perm` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'The minimum permission level this option requires.',
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `sakura_optionfields` (`id`, `name`, `description`, `formtype`, `require_perm`) VALUES
('profileBackgroundSiteWide', 'Display profile background site wide', 'This will make the profile background you set on your profile appear on the entire site (except on other profiles).', 'checkbox', 'CREATE_BACKGROUND')
ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `name` = VALUES(`name`), `description` = VALUES(`description`), `formtype` = VALUES(`formtype`), `require_perm` = VALUES(`require_perm`);
DROP TABLE IF EXISTS `sakura_permissions`;
CREATE TABLE `sakura_permissions` (
`rid` bigint(128) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of the rank this permissions set is used for.',
@ -273,22 +322,23 @@ CREATE TABLE `sakura_permissions` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `sakura_permissions` (`rid`, `uid`, `siteperms`, `manageperms`, `forumperms`, `rankinherit`) VALUES
(1, 0, '000000000000000000000000001', '0', '1', '000'),
(2, 0, '000111111111100111101101100', '0', '1', '000'),
(3, 0, '001111111111111111111111100', '0', '1', '000'),
(4, 0, '111111111111111111111111100', '0', '1', '000'),
(5, 0, '001111111111111111111111100', '0', '1', '000'),
(6, 0, '000111111111100111101101100', '0', '0', '000'),
(7, 0, '001111111111111111111111100', '0', '1', '000'),
(8, 0, '001111111111111111111111100', '0', '1', '000'),
(9, 0, '001111111111111111111111100', '0', '1', '000');
(1, 0, '0000000000000000000000000001', '000', '1', '000'),
(2, 0, '0000111111111100111101101100', '000', '1', '000'),
(3, 0, '0001111111111111111111111100', '011', '1', '000'),
(4, 0, '0111111111111111111111111100', '111', '1', '000'),
(5, 0, '0001111111111111111111111100', '101', '1', '000'),
(6, 0, '0000111111111100111101101100', '000', '0', '000'),
(7, 0, '0001111111111111111111111100', '011', '1', '000'),
(8, 0, '0001111111111111111111111100', '000', '1', '000'),
(9, 0, '0001111111111111111111111100', '000', '1', '000')
ON DUPLICATE KEY UPDATE `rid` = VALUES(`rid`), `uid` = VALUES(`uid`), `siteperms` = VALUES(`siteperms`), `manageperms` = VALUES(`manageperms`), `forumperms` = VALUES(`forumperms`), `rankinherit` = VALUES(`rankinherit`);
DROP TABLE IF EXISTS `sakura_posts`;
CREATE TABLE `sakura_posts` (
`post_id` bigint(255) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL Generated ID used for sorting.',
`topic_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of topic this post is a part of.',
`forum_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of forum this was posted in.',
`poster_id` bigint(255) unsigned NOT NULL DEFAULT '0' COMMENT 'ID of poster of this post.',
`poster_id` bigint(255) unsigned DEFAULT '0' COMMENT 'ID of poster of this post.',
`poster_ip` varchar(40) COLLATE utf8_bin NOT NULL COMMENT 'IP of poster.',
`post_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Time this post was made.',
`parse_mode` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Switch the type of parser that''s used.',
@ -304,8 +354,7 @@ CREATE TABLE `sakura_posts` (
KEY `forum_id` (`forum_id`),
KEY `poster_id` (`poster_id`),
CONSTRAINT `sakura_posts_ibfk_1` FOREIGN KEY (`topic_id`) REFERENCES `sakura_topics` (`topic_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sakura_posts_ibfk_2` FOREIGN KEY (`forum_id`) REFERENCES `sakura_forums` (`forum_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `sakura_posts_ibfk_3` FOREIGN KEY (`poster_id`) REFERENCES `sakura_users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
CONSTRAINT `sakura_posts_ibfk_2` FOREIGN KEY (`forum_id`) REFERENCES `sakura_forums` (`forum_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -334,7 +383,7 @@ CREATE TABLE `sakura_profilefields` (
INSERT INTO `sakura_profilefields` (`id`, `name`, `formtype`, `islink`, `linkformat`, `description`, `additional`) VALUES
(1, 'Website', 'url', 1, '{{ VAL }}', 'URL to your website', ''),
(2, 'Twitter', 'text', 1, 'https://twitter.com/{{ VAL }}', 'Your @twitter Username', ''),
(3, 'GitHub', 'text', 1, 'https://github.com/{{ VAL }}', 'Your GitHub Username', ''),
(3, 'BitBucket', 'text', 1, 'https://bitbucket.org/{{ VAL }}', 'Your BitBucket Username', ''),
(4, 'Skype', 'text', 1, 'skype:{{ VAL }}?userinfo', 'Your Skype Username', ''),
(5, 'YouTube', 'text', 0, '', 'ID or Username excluding http://youtube.com/*/', '{\"youtubetype\": [\"checkbox\", \"I <b>do not</b> have a Channel Username (url looks like https://www.youtube.com/channel/UCXZcw5hw5C7Neto-T_nRXBQ).\"]}'),
(6, 'SoundCloud', 'text', 1, 'https://soundcloud.com/{{ VAL }}', 'Your SoundCloud username', ''),
@ -342,29 +391,33 @@ INSERT INTO `sakura_profilefields` (`id`, `name`, `formtype`, `islink`, `linkfor
(8, 'osu!', 'text', 1, 'https://osu.ppy.sh/u/{{ VAL }}', 'Your osu! Username', ''),
(9, 'Origin', 'text', 0, '', 'Your Origin User ID', ''),
(10, 'Xbox Live', 'text', 1, 'https://account.xbox.com/en-GB/Profile?Gamertag={{ VAL }}', 'Your Xbox User ID', ''),
(11, 'PSN', 'text', 1, 'http://psnprofiles.com/{{ VAL }}', 'Your PSN User ID', '');
(11, 'PSN', 'text', 1, 'http://psnprofiles.com/{{ VAL }}', 'Your PSN User ID', ''),
(12, 'Last.fm', 'text', 1, 'http://last.fm/user/{{ VAL }}', 'Your Last.fm username', '')
ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `name` = VALUES(`name`), `formtype` = VALUES(`formtype`), `islink` = VALUES(`islink`), `linkformat` = VALUES(`linkformat`), `description` = VALUES(`description`), `additional` = VALUES(`additional`);
DROP TABLE IF EXISTS `sakura_ranks`;
CREATE TABLE `sakura_ranks` (
`id` bigint(128) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Automatically generated ID by MySQL for management.',
`name` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Display name of the rank.',
`multi` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Can the rank name have an s at the end?',
`hidden` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT 'Don''t show any public links to this rank.',
`colour` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Colour used for the username of a member of this rank.',
`description` text COLLATE utf8_bin NOT NULL COMMENT 'A description of what a user of this rank can do/is supposed to do.',
`title` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Default user title if user has none set.',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
INSERT INTO `sakura_ranks` (`id`, `name`, `multi`, `colour`, `description`, `title`) VALUES
(1, 'Deactivated', 0, '#555', 'Users that are yet to be activated or that deactivated their own account.', 'Deactivated'),
(2, 'Regular user', 1, 'inherit', 'Regular users with regular permissions.', 'Regular user'),
(3, 'Site moderator', 1, '#0A0', 'Users with special permissions like being able to ban and modify users if needed.', 'Staff'),
(4, 'Administrator', 1, '#C00', 'Users that manage the server and everything around that.', 'Administrator'),
(5, 'Developer', 1, '#824CA0', 'Users that either create or test new features of the site.', 'Staff'),
(6, 'Bot', 1, '#9E8DA7', 'Reserved user accounts for services.', 'Bot'),
(7, 'Chat moderator', 1, '#09F', 'Moderators of the chat room.', 'Staff'),
(8, 'Tenshi', 0, '#EE9400', 'Users that donated $5.00 or more in order to keep the site and it\'s services alive!', 'Tenshi'),
(9, 'Alumnii', 0, '#FF69B4', 'People who have contributed to the community but have moved on or resigned.', 'Alumnii');
INSERT INTO `sakura_ranks` (`id`, `name`, `multi`, `hidden`, `colour`, `description`, `title`) VALUES
(1, 'Deactivated', 0, 1, '#555', 'Users that are yet to be activated or that deactivated their own account.', 'Deactivated'),
(2, 'Regular user', 1, 0, 'inherit', 'Regular users with regular permissions.', 'Regular user'),
(3, 'Site moderator', 1, 0, '#0A0', 'Users with special permissions like being able to ban and modify users if needed.', 'Staff'),
(4, 'Administrator', 1, 0, '#C00', 'Users that manage the server and everything around that.', 'Administrator'),
(5, 'Developer', 1, 0, '#824CA0', 'Users that either create or test new features of the site.', 'Staff'),
(6, 'Bot', 1, 1, '#9E8DA7', 'Reserved user accounts for services.', 'Bot'),
(7, 'Chat moderator', 1, 0, '#09F', 'Moderators of the chat room.', 'Staff'),
(8, 'Tenshi', 0, 0, '#EE9400', 'Users that donated $5.00 or more in order to keep the site and it\'s services alive!', 'Tenshi'),
(9, 'Alumnii', 0, 0, '#FF69B4', 'People who have contributed to the community but have moved on or resigned.', 'Alumnii')
ON DUPLICATE KEY UPDATE `id` = VALUES(`id`), `name` = VALUES(`name`), `multi` = VALUES(`multi`), `hidden` = VALUES(`hidden`), `colour` = VALUES(`colour`), `description` = VALUES(`description`), `title` = VALUES(`title`);
DROP TABLE IF EXISTS `sakura_regcodes`;
CREATE TABLE `sakura_regcodes` (
@ -424,7 +477,8 @@ INSERT INTO `sakura_sock_perms` (`rid`, `uid`, `perms`) VALUES
(6, 0, '1,0,0,0,0,0'),
(7, 0, '1,2,1,1,1,1'),
(8, 0, '1,1,0,1,1,1'),
(9, 0, '1,1,0,1,1,1');
(9, 0, '1,1,0,1,1,1')
ON DUPLICATE KEY UPDATE `rid` = VALUES(`rid`), `uid` = VALUES(`uid`), `perms` = VALUES(`perms`);
DROP TABLE IF EXISTS `sakura_topics`;
CREATE TABLE `sakura_topics` (
@ -453,8 +507,8 @@ CREATE TABLE `sakura_users` (
`password_hash` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Hashing algo used for the password hash.',
`password_salt` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Salt used for the password hash.',
`password_algo` varchar(255) COLLATE utf8_bin NOT NULL COMMENT 'Algorithm used for the password hash.',
`password_iter` int(16) unsigned NOT NULL COMMENT 'Password hash iterations.',
`password_chan` int(16) unsigned NOT NULL COMMENT 'Last time the user changed their password.',
`password_iter` int(11) unsigned NOT NULL COMMENT 'Password hash iterations.',
`password_chan` int(11) 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(255) COLLATE utf8_bin NOT NULL COMMENT 'E-mail of the user for password restoring etc.',
`rank_main` mediumint(4) unsigned NOT NULL DEFAULT '0' COMMENT 'Main rank of the user.',
@ -463,12 +517,12 @@ CREATE TABLE `sakura_users` (
`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.',
`usertitle` varchar(64) COLLATE utf8_bin DEFAULT NULL COMMENT 'Custom user title of the user, when empty reverts to their derault group name.',
`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.',
`regdate` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Timestamp of account creation.',
`lastdate` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Last time anything was done on this account.',
`lastunamechange` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'Last username change.',
`birthday` varchar(16) COLLATE utf8_bin DEFAULT NULL COMMENT 'Birthdate of the user.',
`country` varchar(4) COLLATE utf8_bin NOT NULL COMMENT 'Contains ISO 3166 country code of user''s registration location.',
`userData` varchar(512) COLLATE utf8_bin NOT NULL DEFAULT '[]' COMMENT 'All additional profile data.',
`userData` text COLLATE utf8_bin COMMENT 'All additional profile data.',
PRIMARY KEY (`id`),
UNIQUE KEY `username_clean` (`username_clean`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -490,4 +544,4 @@ CREATE TABLE `sakura_warnings` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
-- 2015-07-05 15:02:41
-- 2015-08-21 22:06:54

View file

@ -45,7 +45,8 @@
"20150813",
"20150818",
"20150819",
"20150820"
"20150820",
"20150821"
]
@ -2105,7 +2106,77 @@
},
{
"type": "FIX",
"change": "Fixed the \"Enable JavaScript\" message look a bit less mentally challenged.",
"change": "Made the \"Enable JavaScript\" message look a bit less mentally challenged.",
"user": "Flashwave"
}
],
"20150821": [
{
"type": "UPD",
"change": "Moved image serving file to the new user api.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Changed /r/ urls to /p/ to not have it be confused with subreddit.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Added new options menu (replaces site wide background checkbox).",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed user uploads removal.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed an ancient issue where the avatar in the header leaves its containers.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Split the SQL fetch function up into select and fetch functions for possible future use.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed values of additional profile values not showing up properly.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Added banner to footer on unstable revisions.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Added a fallback to the User class that checks using a LIKE statement.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Implemented permission checking for all the settings in the Aesthetics category.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed youtubetype being ignored on the profile.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Switched to a less disgusting purple for the selection of user boxes.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed sitewide background making text on Members page unreadable.",
"user": "Flashwave"
}

View file

@ -25,6 +25,13 @@ class Database {
}
// Select from database
public static function select($table, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) {
return self::$_DATABASE->select($table, $data, $order, $limit, $group, $distinct, $column, $prefix);
}
// Fetch from database
public static function fetch($table, $fetchAll = true, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) {

View file

@ -12,10 +12,10 @@ class Permissions {
'rid' => 0,
'uid' => 0,
'siteperms' => '000000000000000000000000001',
'manageperms' => '0',
'forumperms' => '0',
'rankinherit' => '111'
'siteperms' => 1,
'manageperms' => 0,
'forumperms' => 0,
'rankinherit' => 111
];
@ -25,8 +25,8 @@ class Permissions {
// Site permissions
'SITE' => [
'DEACTIVATED' => 1, // Is a user in this group deactivated
'STATIC_PREMIUM' => 2, // Is always premium
'DEACTIVATED' => 1, // Is a user deactivated
'RESTRICTED' => 2, // Is a user restricted
'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)
@ -51,7 +51,8 @@ class Permissions {
'JOIN_GROUPS' => 8388608, // Can join groups
'CREATE_GROUP' => 16777216, // Can create a group
'MULTIPLE_GROUPS' => 33554432, // Can create multiple groups (requires single group perm)
'CHANGE_NAMECOLOUR' => 67108864 // Can change their username colour
'CHANGE_NAMECOLOUR' => 67108864, // Can change their username colour
'STATIC_PREMIUM' => 134217728 // Can change their username colour
],

View file

@ -16,7 +16,14 @@ class User {
function __construct($id) {
// Get the user database row
$this->data = Database::fetch('users', false, ['id' => [$id, '=', true], 'username_clean' => [$id, '=']]);
$this->data = Database::fetch('users', false, ['id' => [$id, '=', true], 'username_clean' => [Main::cleanString($id, true), '=', true]]);
// Check if anything like the username exists
if(empty($this->data)) {
$this->data = Database::fetch('users', false, ['username_clean' => ['%'. Main::cleanString($id, true) .'%', 'LIKE']]);
}
// Check if the user actually exists
if(empty($this->data)) {
@ -53,6 +60,33 @@ class User {
}
// Check if the user has the specified ranks
public function checkIfUserHasRanks($ranks) {
// Check if the main rank is the specified rank
if(in_array($this->mainRank['id'], $ranks)) {
return true;
}
// If not go over all ranks and check if the user has them
foreach($ranks as $rank) {
// We check if $rank is in $this->ranks and if yes return true
if(array_key_exists($rank, $this->ranks)) {
return true;
}
}
// If all fails return false
return false;
}
// Get the user's colour
public function colour() {
@ -107,6 +141,13 @@ class User {
}
// Check if the user has the proper permissions
public function checkPermission($layer, $action) {
return Permissions::check($layer, $action, $this->data['id'], 1);
}
// Get the user's profile fields
public function profileFields() {
@ -186,6 +227,56 @@ class User {
}
// Get the user's option fields
public function optionFields() {
// Get option fields
$optionFields = Database::fetch('optionfields');
// If there's nothing just return null
if(!count($optionFields)) {
return;
}
// Once again if nothing was returned just return null
if(empty($this->data['userData']['userOptions'])) {
return;
}
// Create output array
$options = [];
// Check if profile fields aren't fake
foreach($optionFields as $field) {
// Check if the user has the current field set otherwise continue
if(!array_key_exists($field['id'], $this->data['userData']['userOptions'])) {
continue;
}
// Make sure the user has the proper permissions to use this option
if(!$this->checkPermission('SITE', $field['require_perm'])) {
continue;
}
// Assign field to output with value
$options[$field['id']] = $this->data['userData']['userOptions'][$field['id']];
}
// Return appropiate profile data
return $options;
}
// Check if user has Premium
public function checkPremium() {

View file

@ -768,6 +768,40 @@ class Users {
}
// Get the available option fields
public static function getOptionFields() {
// Get option fields
$optionFields = Database::fetch('optionfields');
// If there's nothing just return null
if(!count($optionFields)) {
return null;
}
// Create output array
$fields = [];
// Iterate over the fields and clean them up
foreach($optionFields as $field) {
if(!Permissions::check('SITE', $field['require_perm'], Session::$userId, 1)) {
continue;
}
$fields[$field['id']] = $field;
}
// Return the yeahs
return $fields;
}
// Get user's profile fields
public static function getUserProfileFields($id, $inputIsData = false) {

View file

@ -82,8 +82,7 @@ class MySQL {
}
// Fetch array from database
public function fetch($table, $fetchAll = true, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) {
public function select($table, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) {
// Begin preparation of the statement
$prepare = 'SELECT '. ($distinct ? 'DISTINCT ' : '') . ($column == '*' ? '' : '`') . $column . ($column == '*' ? '' : '`') .' FROM `' . ($prefix ? $prefix : Configuration::getLocalConfig('database', 'prefix')) . $table . '`';
@ -94,11 +93,30 @@ class MySQL {
$prepare .= ' WHERE';
foreach($data as $key => $value) {
$prepare .= ' `'. $key .'` '. $value[1] .' :'. $key . ($key == key(array_slice($data, -1, 1, true)) ? '' : ' '. (isset($value[2]) && $value[2] ? 'OR' : 'AND'));
// Check if there's multiple statements
if(!is_array($value[0])) {
$temp = $value;
unset($value);
$value[0] = $temp;
}
// Go over each data thing
foreach($value as $sub => $val) {
$prepare .= ' `'. $key .'` '. $val[1] .' :'. $key .'_'. $sub . ($key == key(array_slice($data, -1, 1, true)) && $sub == key(array_slice($value, -1, 1, true)) ? '' : ' '. (isset($val[2]) && $val[2] ? 'OR' : 'AND'));
unset($sub);
unset($val);
}
// Unset variables to be safe
unset($key);
unset($value);
}
}
@ -150,11 +168,30 @@ class MySQL {
if(is_array($data)) {
foreach($data as $key => $value) {
$query->bindParam(':'. $key, $value[0]);
// Check if there's multiple statements
if(!is_array($value[0])) {
$temp = $value;
unset($value);
$value[0] = $temp;
}
// Go over each data thing
foreach($value as $sub => $val) {
$query->bindParam(':'. $key .'_'. $sub, $val[0]);
unset($sub);
unset($val);
}
// Unset variables to be safe
unset($key);
unset($value);
}
}
@ -162,6 +199,17 @@ class MySQL {
// Execute the prepared statements with parameters bound
$query->execute();
// Return the query
return $query;
}
// Fetch array from database
public function fetch($table, $fetchAll = true, $data = null, $order = null, $limit = null, $group = null, $distinct = false, $column = '*', $prefix = null) {
// Run a select statement
$query = $this->select($table, $data, $order, $limit , $group, $distinct, $column, $prefix);
// Return the output
return $fetchAll ? $query->fetchAll(PDO::FETCH_ASSOC) : $query->fetch(PDO::FETCH_ASSOC);

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20150820');
define('SAKURA_VERSION', '20150821');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false);
@ -56,6 +56,9 @@ Main::init(ROOT .'_sakura/config/config.ini');
// Start output buffering
ob_start(Configuration::getConfig('use_gzip') ? 'ob_gzhandler' : null);
// Create a user object for the current logged in user
$currentUser = new User(Session::$userId);
if(!defined('SAKURA_NO_TPL')) {
// Set base page rendering data
@ -111,13 +114,6 @@ if(!defined('SAKURA_NO_TPL')) {
],
'perms' => [
'canGetPremium' => Permissions::check('SITE', 'OBTAIN_PREMIUM', Session::$userId, 1),
'canUseForums' => Permissions::check('FORUM', 'USE_FORUM', Session::$userId, 1)
],
'php' => [
'sessionid' => \session_id(),
@ -134,7 +130,7 @@ if(!defined('SAKURA_NO_TPL')) {
],
'user' => new User(Session::$userId)
'user' => $currentUser
];

View file

@ -5,6 +5,7 @@
<div>General</div>
<a href="/settings/">Home</a>
<a href="/settings/profile">Edit Profile</a>
<a href="/settings/options">Site Options</a>
<a href="/settings/groups">Groups</a>
<div>Friends</div>
<a href="/settings/friendlisting">List</a>
@ -15,10 +16,18 @@
<a href="/messages/compose">Compose</a>
<div>Notifications</div>
<a href="/settings/notifications">History</a>
{% if ((user.data.userData.userPage is defined and user.checkPermission('SITE', 'CHANGE_USERPAGE')) or user.checkPermission('SITE', 'CREATE_USERPAGE')) or user.checkPermission('SITE', 'CHANGE_AVATAR') or ((user.data.userData.userPage is defined and user.checkPermission('SITE', 'CHANGE_USERPAGE')) or user.checkPermission('SITE', 'CREATE_USERPAGE')) %}
<div>Aesthetics</div>
{% if user.checkPermission('SITE', 'CHANGE_AVATAR') %}
<a href="/settings/avatar">Avatar</a>
{% endif %}
{% if (user.data.userData.profileBackground is defined and user.checkPermission('SITE', 'CHANGE_BACKGROUND')) or user.checkPermission('SITE', 'CREATE_BACKGROUND') %}
<a href="/settings/background">Background</a>
{% endif %}
{% if (user.data.userData.userPage is defined and user.checkPermission('SITE', 'CHANGE_USERPAGE')) or user.checkPermission('SITE', 'CREATE_USERPAGE') %}
<a href="/settings/userpage">Userpage</a>
{% endif %}
{% endif %}
<div>Account</div>
<a href="/settings/email">E-mail Address</a>
<a href="/settings/username">Username</a>

View file

@ -1,4 +1,11 @@
<a id="gotop" class="fa fa-angle-double-up hidden" href="#top"></a>
{% if not sakura.versionInfo.stable %}
<div style="background: repeating-linear-gradient(-45deg, #000, #000 10px, #FF0 10px, #FF0 20px); text-align: center; color: #FFF; box-shadow: 0px 0px 1em #FF0;">
<div style="background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .9) 10%, rgba(0, 0, 0, .9) 90%, rgba(0, 0, 0, 0) 100%); display: inline-block; padding: 0 40px;">
<h3><a style="color: inherit; text-decoration: none;" href="/changelog#r{{ sakura.versionInfo.version }}" target="_blank">Sakura Revision {{ sakura.versionInfo.version }} Development</a></h1>
</div>
</div>
{% endif %}
</div>
<div class="footer">
<div class="ftsections">
@ -23,10 +30,10 @@
<ul class="ftsection">
<li class="fthead">Information</li>
<li><a href="/faq" title="Questions that get Asked Frequently but not actually">FAQ</a></li>
<li><a href="/r/rules" title="Some Rules and Information kind of summing up the ToS">Rules</a></li>
<li><a href="/p/rules" title="Some Rules and Information kind of summing up the ToS">Rules</a></li>
<li><a href="/credits" title="Here everyone who's helped Flashii get to where it is now is listed">Credits</a></li>
<li><a href="http://status.flashii.net" target="_blank" title="Check the status on our Servers and related services">Server Status</a></li>
<li><a href="/r/terms" title="Our Terms of Service">Terms of Service</a></li>
<li><a href="/p/terms" title="Our Terms of Service">Terms of Service</a></li>
</ul>
</div>
</div>

View file

@ -147,7 +147,7 @@
}
{% endif %}
{% if php.self == '/profile.php' ? profile.data.userData.profileBackground is defined : (user.checkPremium[0] and user.data.userData.profileBackgroundSiteWide and user.data.userData.profileBackground is defined) %}
{% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide == 'true' and user.data.userData.profileBackground) %}
initialiseParallax('userBackground');
{% endif %}
@ -196,7 +196,7 @@
</div>
<div id="contentwrapper">
<div id="notifications"></div>
{% if php.self == '/profile.php' ? profile.data.userData.profileBackground is defined : (user.checkPremium[0] and user.data.userData.profileBackgroundSiteWide and user.data.userData.profileBackground is defined) %}
{% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide == 'true' and user.data.userData.profileBackground) %}
<div id="userBackground" style="background-image: url('/bg/{{ (php.self == '/profile.php' ? profile : user).data.id }}');"></div>
{% endif %}
{% if not session.checkLogin and php.self != '/authenticate.php' %}
@ -222,6 +222,12 @@
</div>
</form>
{% endif %}
{% if user.checkPermission('SITE', 'RESTRICTED') %}
<div class="headerNotify" style="padding-top: 10px; padding-bottom: 10px; background: repeating-linear-gradient(-45deg, #B33, #B33 10px, #B00 10px, #B00 20px); text-align: center; color: #FFF; border: 1px solid #C00; box-shadow: 0px 0px 3px #C00;">
<h1>Your account is current in <span style="font-width: 700 !important;">restricted mode</span>!</h1>
<div>A staff member has set your account to restricted mode most likely due to violation of the rules. You will <i>temporarily</i> not be able to use public features of the site. If you think this is a mistake please <a href="/contact" style="color: inherit;">get in touch with one of our staff members</a>.</div>
</div>
{% endif %}
<noscript>
<div class="headerNotify" style="padding-top: 10px; padding-bottom: 10px;">
<h1>You have JavaScript disabled!</h1>

View file

@ -126,7 +126,7 @@
</div>
{% endif %}
<div class="subLinks centreAlign">
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/r/terms" target="_blank">Terms of Service</a>.
<input class="inputStyling" name="tos" type="checkbox" class="ignore-css" id="registerToS" /><label for="registerToS">I agree to the <a class="default" href="/p/terms" target="_blank">Terms of Service</a>.
</div>
<div class="centreAlign">
<input class="inputStyling" type="submit" name="submit" value="Register" id="registerAccBtn" />

View file

@ -1,14 +1,18 @@
{% include 'global/header.tpl' %}
{% if session.checkLogin %}
<div class="membersPage" style="min-height: 500px;">
<div class="headerNotify" style="padding: 10px 0; margin-bottom: 1px;">
<h1 style="text-shadow: 0px 0px 5px #555;{% if page.active %} color: {{ page.ranks[page.active].colour }};{% endif %}">{% if not page.active %}All members{% else %}{{ page.ranks[page.active].name }}{% if page.ranks[page.active].multi %}s{% endif %}{% endif %}</h1>
<h3 style="padding: 0px 0px 10px;">{% if not page.active %}The entire user list.{% else %}{{ page.ranks[page.active].description }}{% endif %}</h3>
<h3>{% if not page.active %}The entire user list.{% else %}{{ page.ranks[page.active].description }}{% endif %}</h3>
</div>
<div class="membersPage" style="min-height: 500px;">
<div class="dropDown" style="margin: 0px auto; font-size: 1.5em; line-height: 1.5em; height: 30px;">
<div class="dropDownInner" style="float: left; color: #FFF;">
<a class="dropDownDesc">Rank:</a>
<a href="/members/"{% if not page.active %} class="dropDownSelected"{% endif %}>All members</a>
{% for rank in page.ranks %}
{% if not rank.hidden or (rank.hidden and page.active == rank.id) %}
<a href="/members/{% if page.sort != page.sorts[0] %}{{ page.sort }}/{% endif %}{{ rank.id }}/" style="color: {{ rank.colour }};"{% if page.active == rank.id %} class="dropDownSelected"{% endif %}>{{ rank.name }}{% if rank.multi %}s{% endif %}</a>
{% endif %}
{% endfor %}
</div>
<div class="dropDownInner" style="float: left;">

View file

@ -4,7 +4,7 @@
{% include 'elements/settingsNav.tpl' %}
</div>
<div class="content-left content-column">
<div class="head">
{#<div class="head">
Messages / Inbox
</div>
{% if messages|length %}
@ -29,7 +29,8 @@
{% else %}
<h1 class="stylised"style="line-height: 1.8em; text-align: center;">Nothing to view!</h1>
{% endif %}
<h3 style="text-align: center;">Click Compose in the menu on the right side to write a new message!</h3>
<h3 style="text-align: center;">Click Compose in the menu on the right side to write a new message!</h3>#}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">The PM system is currently unavailable.</h1>
</div>
<div class="clear"></div>
</div>

View file

@ -51,7 +51,7 @@
</td>
<td style="text-align: right;">
{% if name == 'youtube' %}
<a href="https://youtube.com/{% if field.youtubetype == 1 %}channel{% else %}user{% endif %}/{{ field.value }}" class="default">{% if field.youtubetype == 1 %}{{ profile.data.username }}'s Channel{% else %}{{ field.value }}{% endif %}</a>
<a href="https://youtube.com/{% if field.youtubetype == 'true' %}channel{% else %}user{% endif %}/{{ field.value }}" class="default">{% if field.youtubetype == 'true' %}{{ profile.data.username }}'s Channel{% else %}{{ field.value }}{% endif %}</a>
{% else %}
{% if field.islink %}
<a href="{{ field.link }}" class="default">

View file

@ -1,4 +1,5 @@
<form enctype="multipart/form-data" method="post" action="{{ setting.action }}">
{% if (user.data.userData.profileBackground is defined and user.checkPermission('SITE', 'CHANGE_BACKGROUND')) or user.checkPermission('SITE', 'CREATE_BACKGROUND') %}
<form enctype="multipart/form-data" method="post" action="{{ setting.action }}">
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="mode" value="background" />
@ -13,13 +14,11 @@
(Leave upload box empty to remove background)
</div>
</div>
{% if user.checkPremium[0] %}
<div style="padding: 10px;">
<input type="checkbox" name="sitewide" id="swbgbtn" /><label for="swbgbtn"> Display background sidewide when logged in</label>
</div>
{% endif %}
<div>
<input type="submit" value="Submit" name="submit" class="inputStyling" />
</div>
</div>
</form>
</form>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">You do not have the permission to change your background.</h1>
{% endif %}

View file

@ -1,4 +1,5 @@
<div class="notification-history">
{% if notifs %}
<div class="notification-history">
{% for notif in notifs[page.currentPage] %}
<a id="notif-hist-{{ notif.id }}" class="clean {% if notif.notif_read %}read{% endif %}"{% if notif.notif_link %} href="{{ notif.notif_link }}"{% endif %}>
<div class="notif-hist-icon">
@ -24,8 +25,8 @@
<div class="clear"></div>
</a>
{% endfor %}
</div>
{% if notifs|length > 1 %}
</div>
{% if notifs|length > 1 %}
<div>
<div class="pagination" style="float: right;">
{% if page.currentPage > 0 %}
@ -40,4 +41,7 @@
</div>
<div class="clear"></div>
</div>
{% endif %}
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">You don't have any notifications in your history!</h1>
{% endif %}

View file

@ -0,0 +1,41 @@
{% if options.fields %}
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="optionsForm">
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="mode" value="options" />
{% for field in options.fields %}
<div class="profile-field">
<div>
<h2>{{ field.name }}</h2>
<div style="font-size: .8em; line-height: 110%;">
{{ field.description }}
</div>
</div>
<div style="padding: 8px 0;">
<input type="{{ field.formtype }}" name="option_{{ field.id }}" class="inputStyling"{% if options.user[field.id] %}{% if field.formtype == 'checkbox' and options.user[field.id] == 'true' %} checked="checked"{% else %} value="{{ options.user[field.id] }}"{% endif %}{% endif %} />
</div>
</div>
{% endfor %}
<div class="profile-save">
<input type="submit" value="Save" name="submit" class="inputStyling" />
<input type="reset" value="Reset" name="reset" class="inputStyling" />
</div>
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
var optionsForm = document.getElementById('optionsForm');
var createInput = document.createElement('input');
var submit = optionsForm.querySelector('[type="submit"]');
createInput.setAttribute('name', 'ajax');
createInput.setAttribute('value', 'true');
createInput.setAttribute('type', 'hidden');
optionsForm.appendChild(createInput);
submit.setAttribute('type', 'button');
submit.setAttribute('onclick', 'submitPost(\''+ optionsForm.action +'\', formToObject(\'optionsForm\'), true, \'Changing Options...\');');
});
</script>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are currently no changeable options.</h1>
{% endif %}

View file

@ -8,12 +8,12 @@
<h2>{{ field.name }}</h2>
</div>
<div>
<input type="{{ field.formtype }}" name="profile_{{ field.ident }}" class="inputStyling" placeholder="{{ field.description }}"{% if profile.user[field.ident].value %} value="{{ profile.user[field.ident].value }}"{% endif %} />
<input type="{{ field.formtype }}" name="profile_{{ field.ident }}" class="inputStyling" placeholder="{{ field.description }}"{% if profile.user[field.ident].value %}{% if field.formtype == 'checkbox' and profile.user[field.ident].value == 'true' %} checked="checked"{% else %} value="{{ profile.user[field.ident].value }}"{% endif %}{% endif %} />
</div>
{% if field.addit %}
{% for id,addit in field.addit %}
<div>
<input type="{{ addit[0] }}" id="{{ id }}" name="profile_additional_{{ id }}" />
<input type="{{ addit[0] }}" id="{{ id }}" name="profile_additional_{{ id }}"{% if profile.user[field.ident][id] %}{% if addit[0] == 'checkbox' and profile.user[field.ident][id] == 'true' %} checked="checked"{% else %} value="{{ profile.user[field.ident][id] }}"{% endif %}{% endif %} />
<label for="{{ id }}" style="font-size: 10px;">{{ addit[1]|raw }}</label>
</div>
{% endfor %}

View file

@ -19,13 +19,13 @@ RewriteRule ^credits/?$ credits.php [L,QSA]
RewriteRule ^index/?$ index.php [L,QSA]
RewriteRule ^login/?$|^logout/?$|^activate/?$|^register/?$|^forgotpassword/?|^authenticate/?$ authenticate.php [L,QSA]
RewriteRule ^donate/?$|^support/?$ support.php [L,QSA]
RewriteRule ^contact/?$ infopage.php?r=contact [L,QSA]
RewriteRule ^contact/?$ infopage.php?p=contact [L,QSA]
RewriteRule ^changelog/?$ changelog.php [L,QSA]
RewriteRule ^faq/?$ faq.php [L,QSA]
RewriteRule ^search/?$ search.php [L,QSA]
# Info pages
RewriteRule ^r/([a-z]+)$ infopage.php?r=$1 [L,QSA]
RewriteRule ^p/([a-z]+)$ infopage.php?p=$1 [L,QSA]
# News
RewriteRule ^news/?$ news.php [L,QSA]

View file

@ -594,6 +594,7 @@ a#gotop.exit {
width: auto;
padding-left: 36px;
background: url('/pixel.png') no-repeat scroll left center / contain transparent;
background-size: auto 30px;
}
.header .menu .menu-item:hover {
@ -875,7 +876,7 @@ a#gotop.exit {
}
.membersPage .userBox:active {
box-shadow: 0 0 1.5em #609;
box-shadow: 0 0 1.5em #9475B2;
}
.membersPage .userBox img {

View file

@ -11,23 +11,31 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak
// Add page specific things
$renderData['page'] = [
'title' => 'Sakura Credits'
];
$renderData['contributors'] = [
'Flashwave' => ['Main developer.', 'http://flash.moe'],
'Kurasha244' => ['Writing the base for the old backend.', 'http://saibateku.net'],
'nookls' => ['Being nookls.', 'http://nookls.org'],
'MallocNull' => ['Sock Chat and debug help.', 'http://aroltd.com'],
'kamil' => ['Pointing out mistakes and fixing them and literally writing the entire payments system.', 'http://krakow.pw'],
'RandomGuy' => ['Coming up with cool things to add and security stuff.', 'http://flashii.net/u/12']
];
$renderData['thirdParty'] = [
'ReCAPTCHA' => ['Providing the Captcha system we use.', 'http://recaptcha.net'],
'Twig' => ['The templating engine used by Sakura.', 'http://twig.sensiolabs.org/'],
'Parsedown' => ['A PHP markdown parser.', 'http://parsedown.org/'],
'Defuse' => ['Making the PBKDF2 implementation for PHP', 'http://defuse.ca/'],
'PHPMailer' => ['Writing PHPMailer and making e-mail sending a not pain in the ass', 'https://github.com/PHPMailer/PHPMailer'],
'PayPal' => ['Making a PayPal API', 'https://paypal.com']
];
// Print page contents

View file

@ -11,8 +11,10 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak
// Add page specific things
$renderData['page'] = [
'title' => 'Frequently Asked Questions',
'questions' => Main::getFaqData()
];
// Print page contents

View file

@ -13,7 +13,7 @@ define('SAKURA_NO_TPL', true);
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
// Set Content type
header('Content-Type: application/octet-stream');
//header('Content-Type: application/octet-stream');
// Path to user uploads
$userDirPath = ROOT . Configuration::getConfig('user_uploads') . '/';
@ -36,28 +36,34 @@ if(isset($_GET['m'])) {
}
// Get user data
$user = Users::getUser($_GET['u']);
$user = new User($_GET['u']);
// If user is deactivated use deactive avatar
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
if($user->checkIfUserHasRanks([0, 1])) {
$serveImage = $deactiveAvatar;
break;
}
// Check if user is banned
if(Bans::checkBan($_GET['u'])) {
if($user->checkBan()) {
$serveImage = $bannedAvatar;
break;
}
// Check if user has an avatar set
if(empty($user['userData']['userAvatar']) || !file_exists($userDirPath . $user['userData']['userAvatar'])) {
if(empty($user->data['userData']['userAvatar']) || !file_exists($userDirPath . $user->data['userData']['userAvatar'])) {
$serveImage = $noAvatar;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user['userData']['userAvatar'];
$serveImage = $userDirPath . $user->data['userData']['userAvatar'];
break;
case 'background':
@ -66,33 +72,41 @@ if(isset($_GET['m'])) {
// If ?u= isn't set or if it isn't numeric
if(!isset($_GET['u']) || !is_numeric($_GET['u'])) {
$serveImage = $noBackground;
break;
}
// Get user data
$user = Users::getUser($_GET['u']);
$user = new User($_GET['u']);
// If user is deactivated use deactive avatar
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
if($user->checkIfUserHasRanks([0, 1])) {
$serveImage = $noBackground;
break;
}
// Check if user is banned
if(Bans::checkBan($_GET['u'])) {
$serveImage = $noBackground;
break;
}
// Check if user has a background set
if(empty($user['userData']['profileBackground']) || !file_exists($userDirPath . $user['userData']['profileBackground'])) {
if(empty($user->data['userData']['profileBackground']) || !file_exists($userDirPath . $user->data['userData']['profileBackground'])) {
$serveImage = $noBackground;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user['userData']['profileBackground'];
$serveImage = $userDirPath . $user->data['userData']['profileBackground'];
break;
case 'header':
@ -106,28 +120,34 @@ if(isset($_GET['m'])) {
}
// Get user data
$user = Users::getUser($_GET['u']);
$user = new User($_GET['u']);
// If user is deactivated use deactive avatar
if(Users::checkIfUserHasRanks([0, 1], $user, true)) {
if($user->checkIfUserHasRanks([0, 1])) {
$serveImage = $noHeader;
break;
}
// Check if user is banned
if(Bans::checkBan($_GET['u'])) {
$serveImage = $noHeader;
break;
}
// Check if user has a background set
if(empty($user['userData']['profileHeader']) || !file_exists($userDirPath . $user['userData']['profileHeader'])) {
if(empty($user->data['userData']['profileHeader']) || !file_exists($userDirPath . $user->data['userData']['profileHeader'])) {
$serveImage = $noHeader;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user['userData']['profileHeader'];
$serveImage = $userDirPath . $user->data['userData']['profileHeader'];
break;
default:
@ -135,9 +155,12 @@ if(isset($_GET['m'])) {
}
} else
} else {
$serveImage = ROOT . Configuration::getConfig('pixel_img');
}
$serveImage = file_get_contents($serveImage);
header('Content-Type: '. getimagesizefromstring($serveImage)['mime']);

View file

@ -28,7 +28,7 @@ $renderData['board'] = [
$renderData['stats'] = [
'userCount' => ($_INDEX_USER_COUNT = count($_INDEX_USERS = Users::getAllUsers(false))) .' user'. ($_INDEX_USER_COUNT == 1 ? '' : 's'),
'newestUser' => ($_INDEX_NEWEST_USER = empty($_INDEX_USERS) ? Users::getUser(0) : max($_INDEX_USERS)),
'newestUser' => ($_INDEX_NEWEST_USER = empty($_INDEX_USERS) ? (new User(0))->data : max($_INDEX_USERS)),
'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'),
'onlineUsers' => Users::checkAllOnline(),
'topicCount' => ($_TOPICS = count(Database::fetch('topics'))) .' topic'. ($_TOPICS != 1 ? 's' : ''),

View file

@ -16,12 +16,14 @@ $renderData['page'] = [
];
// Get info page data from the database
if($ipData = Main::loadInfoPage(isset($_GET['r']) ? strtolower($_GET['r']) : '')) {
if($ipData = Main::loadInfoPage(isset($_GET['p']) ? strtolower($_GET['p']) : '')) {
// Assign new proper variable
$renderData['page'] = [
'title' => $ipData['pagetitle'],
'content' => Main::mdParse($ipData['content'])
];
}

View file

@ -11,8 +11,11 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak
// Add page specific things
$renderData['page'] = [
'title' => 'Inbox'
];
$renderData['messages'] = Users::getPrivateMessages();
// Print page contents

View file

@ -13,24 +13,27 @@ use DOMDocument;
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
// Get user data
$disqus_user = Users::getUser(Session::$userId);
$disqus_user = new User(Session::$userId);
// Set disqus data
$disqus_data = [
$disqus_user['id'],
$disqus_user['username'],
$disqus_user['email'],
'http://'. Configuration::getConfig('url_main') .'/a/'. $disqus_user['id'],
'http://'. Configuration::getConfig('url_main') .'/u/'. $disqus_user['id']
$disqus_user->data['id'],
$disqus_user->data['username'],
$disqus_user->data['email'],
'http://'. Configuration::getConfig('url_main') .'/a/'. $disqus_user->data['id'],
'http://'. Configuration::getConfig('url_main') .'/u/'. $disqus_user->data['id']
];
// Add page specific things
$renderData['newsPosts'] = Main::getNewsPosts((isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])) ? $_GET['id'] : null, (isset($_GET['id']) && !isset($_GET['xml']) && is_numeric($_GET['id'])));
$renderData['page'] = [
'title' => (isset($_GET['id']) ? (count($renderData['newsPosts']) ? $renderData['newsPosts'][0]['title'] : 'Post does not exist!') : 'News'),
'disqus_sso' => (($disqus_message = base64_encode(json_encode($disqus_data))) .' '. Main::dsqHmacSha1($disqus_message .' '. time(), Configuration::getConfig('disqus_api_secret')) .' '. time()),
'view_post' => isset($_GET['id']) && count($renderData['newsPosts']),
'currentPage' => 0
];
// News XML feed
@ -42,7 +45,7 @@ if(isset($_GET['xml'])) {
'link' => ($_FEED_URL = 'http://'. Configuration::getConfig('url_main')),
'description' => 'News about '. $_FEED_TITLE,
'language' => 'en-gb',
'webMaster' => Users::getUser(1)['email'] .' ('. $_FEED_TITLE .' Webmaster)',
'webMaster' => (new User(1))->data['email'] .' ('. $_FEED_TITLE .' Webmaster)',
'pubDate' => ($_FEED_DATE = date('r', $renderData['newsPosts'][0]['date'])),
'lastBuildDate' => $_FEED_DATE,
];

View file

@ -18,9 +18,11 @@ $renderData['profile'] = $profile;
// Set proper page title
$renderData['page']['title'] = (
$profile->data['id'] < 1 || $profile->data['password_algo'] == 'nologin'
? 'User not found!'
: 'Profile of '. $profile->data['username']
);
// Print page contents

View file

@ -8,3 +8,5 @@ namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
print 'not yet';

View file

@ -11,7 +11,9 @@ require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sak
// Add page specific things
$renderData['page'] = [
'title' => 'Search'
];
// Print page contents

View file

@ -36,6 +36,7 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
// Add the notification to the display array
$notifications[$notif['timestamp']] = [
'read' => $notif['notif_read'],
'title' => $notif['notif_title'],
'text' => $notif['notif_text'],
@ -43,6 +44,7 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
'img' => $notif['notif_img'],
'timeout' => $notif['notif_timeout'],
'sound' => $notif['notif_sound']
];
}
@ -73,10 +75,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
}
$renderData['page'] = [
'title' => 'Action failed',
'redirect' => $redirect,
'message' => 'One of the required operators isn\'t set.',
'success' => 0
];
// Prevent
@ -88,10 +92,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
if($continue && $_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')] == Session::$userId) {
$renderData['page'] = [
'title' => 'Action failed',
'redirect' => $redirect,
'message' => 'You can\'t be friends with yourself, stop trying to bend reality.',
'success' => 0
];
// Prevent
@ -103,10 +109,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
if(!isset($_REQUEST['time']) || $_REQUEST['time'] < time() - 1000) {
$renderData['page'] = [
'title' => 'Action failed',
'redirect' => $redirect,
'message' => 'Timestamps differ too much, refresh the page and try again.',
'success' => 0
];
// Prevent
@ -118,10 +126,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
if(!isset($_REQUEST['session']) || $_REQUEST['session'] != session_id()) {
$renderData['page'] = [
'title' => 'Action failed',
'redirect' => $redirect,
'message' => 'Invalid session, please try again.',
'success' => 0
];
// Prevent
@ -137,42 +147,48 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
// Set the messages
$messages = [
'USER_NOT_EXIST' => 'The user you tried to add doesn\'t exist.',
'ALREADY_FRIENDS' => 'You are already friends with this person!',
'FRIENDS' => 'You are now mutual friends!',
'NOT_MUTUAL' => 'A friend request has been sent to this person.',
'ALREADY_REMOVED' => 'You aren\'t friends with this person.',
'REMOVED' => 'Removed this person from your friends list.'
];
// Notification strings
$notifStrings = [
'FRIENDS' => ['%s accepted your friend request!', 'You can now do mutual friend things!'],
'NOT_MUTUAL' => ['%s added you as a friend!', 'Click here to add them as well.'],
'REMOVED' => ['%s removed you from their friends.', 'You can no longer do friend things now ;_;']
];
// Add page specific things
$renderData['page'] = [
'title' => 'Managing Friends',
'redirect' => $redirect,
'message' => $messages[$action[1]],
'success' => $action[0]
];
// Create a notification
if(array_key_exists($action[1], $notifStrings)) {
// Get the current user's profile data
$user = Users::getUser(Session::$userId);
$user = new User(Session::$userId);
Users::createNotification(
$_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')],
sprintf($notifStrings[$action[1]][0], $user['username']),
sprintf($notifStrings[$action[1]][0], $user->data['username']),
$notifStrings[$action[1]][1],
60000,
'//'. Configuration::getConfig('url_main') .'/a/'. $user['id'],
'//'. Configuration::getConfig('url_main') .'/u/'. $user['id'],
'//'. Configuration::getConfig('url_main') .'/a/'. $user->data['id'],
'//'. Configuration::getConfig('url_main') .'/u/'. $user->data['id'],
'1'
);
@ -209,10 +225,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
if(!Users::checkLogin() || !$continue) {
$renderData['page'] = [
'title' => 'Settings',
'redirect' => '/authenticate',
'message' => 'You must be logged in to edit your settings.',
'success' => 0
];
break;
@ -223,10 +241,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
if(!isset($_REQUEST['timestamp']) || $_REQUEST['timestamp'] < time() - 1000 || !isset($_REQUEST['sessid']) || $_REQUEST['sessid'] != session_id() || !$continue) {
$renderData['page'] = [
'title' => 'Session expired',
'redirect' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/settings',
'message' => 'Your session has expired, please refresh the page and try again.',
'success' => 0
];
break;
@ -252,19 +272,38 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
case 'background':
$userDataKey = 'profileBackground';
$msgTitle = 'Background';
$permission = (!empty($currentUser->data['userData'][$userDataKey]) && $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND');
break;
case 'avatar':
default:
$userDataKey = 'userAvatar';
$msgTitle = 'Avatar';
$permission = $currentUser->checkPermission('SITE', 'CHANGE_AVATAR');
}
// Check if the user has the permissions to go ahead
if(!$permission) {
// Set render data
$renderData['page'] = [
'title' => $msgTitle,
'redirect' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/settings',
'message' => 'You are not allowed to alter your '. strtolower($msgTitle) .'.',
'success' => 0
];
break;
}
// Set path variables
$filepath = ROOT . Configuration::getConfig('user_uploads') .'/';
$filename = $filepath . $mode .'_'. Session::$userId;
$currfile = isset(Users::getUser(Session::$userId)['userData'][$userDataKey]) && !empty($_OLDFILE = Users::getUser(Session::$userId)['userData'][$userDataKey]) ? $_OLDFILE : null;
$currfile = isset($currentUser->data['userData'][$userDataKey]) && !empty($_OLDFILE = $currentUser->data['userData'][$userDataKey]) ? $_OLDFILE : null;
// Check if $_FILES is set
if(!isset($_FILES[$mode]) && empty($_FILES[$mode])) {
@ -283,8 +322,11 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
}
if(empty($_FILES[$mode]))
die('yes');
// Check if the upload went properly
if($_FILES[$mode]['error'] !== UPLOAD_ERR_OK) {
if($_FILES[$mode]['error'] !== UPLOAD_ERR_OK && $_FILES[$mode]['error'] !== UPLOAD_ERR_NO_FILE) {
// Get the error in text
switch($_FILES[$mode]['error']) {
@ -295,7 +337,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
break;
case UPLOAD_ERR_PARTIAL:
case UPLOAD_ERR_NO_FILE:
$msg = 'The upload was interrupted!';
break;
@ -325,6 +366,9 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
}
// Check if we're not in removal mode
if($_FILES[$mode]['error'] != UPLOAD_ERR_NO_FILE) {
// Get the meta data
$metadata = getimagesize($_FILES[$mode]['tmp_name']);
@ -413,6 +457,8 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
}
}
// Delete old avatar
if($currfile && file_exists($currfile)) {
@ -420,12 +466,13 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
}
if($_FILES[$mode]['error'] != UPLOAD_ERR_NO_FILE) {
// Append extension to filename
$filename .= image_type_to_extension($metadata[2]);
if(!move_uploaded_file($_FILES[$mode]['tmp_name'], $filename)) {
// Set render data
$renderData['page'] = [
@ -441,10 +488,10 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
// Create new array
$updated = [$userDataKey => basename($filename)];
// Check for the site wide name
if($mode == 'background') {
} else {
$updated['profileBackgroundSiteWide'] = isset($_REQUEST['sitewide']);
// Remove entry
$updated = [$userDataKey => null];
}
@ -517,6 +564,47 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
break;
// Profile
case 'options':
// Get profile fields and create storage var
$fields = Users::getOptionFields();
$store = [];
// Go over each field
foreach($fields as $field) {
// Add to the store array
if(isset($_POST['option_'. $field['id']]) && !empty($_POST['option_'. $field['id']])) {
// Make sure the user has sufficient permissions to complete this action
if(!$currentUser->checkPermission('SITE', $field['require_perm'])) {
continue;
}
$store[$field['id']] = $_POST['option_'. $field['id']];
}
}
// Update database
Users::updateUserDataField(Session::$userId, ['userOptions' => $store]);
// Set render data
$renderData['page'] = [
'title' => 'Options change',
'redirect' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/settings',
'message' => 'Changed your options!',
'success' => 1
];
break;
// Userpage
case 'userpage':
@ -577,15 +665,17 @@ if(Users::checkLogin()) {
// Settings page list
$pages = [
'home' => ['General', 'Home', ['Welcome to the Settings Panel. From here you can monitor, view and update your profile and preferences.']],
'profile' => ['General', 'Edit Profile', ['These are the external account links etc. on your profile, shouldn\'t need any additional explanation for this one.']],
'options' => ['General', 'Site Options', ['These are a few personalisation options for the site while you\'re logged in.']],
'groups' => ['General', 'Groups', ['{{ user.colour }}']],
'friendlisting' => ['Friends', 'List', ['Manage your friends.']],
'friendrequests' => ['Friends', 'Requests', ['Handle friend requests.']],
'notifications' => ['Notifications', 'History', ['This is the history of notifications that have been sent to you.']],
'avatar' => ['Aesthetics', 'Avatar', ['Your avatar which is displayed all over the site and on your profile.', 'Maximum image size is {{ avatar.max_width }}x{{ avatar.max_height }}, minimum image size is {{ avatar.min_width }}x{{ avatar.min_height }}, maximum file size is {{ avatar.max_size_view }}.']],
'background' => ['Aesthetics', 'Background', ['The background that is displayed on your profile.', 'Maximum image size is {{ background.max_width }}x{{ background.max_height }}, minimum image size is {{ background.min_width }}x{{ background.min_height }}, maximum file size is {{ background.max_size_view }}.']],
'userpage' => ['Aesthetics', 'Userpage', ['The custom text that is displayed on your profile.', '<a href="/r/markdown" class="default">Click here if you don\'t know how to markdown!</a>']],
'userpage' => ['Aesthetics', 'Userpage', ['The custom text that is displayed on your profile.', '<a href="/p/markdown" class="default">Click here if you don\'t know how to markdown!</a>']],
'email' => ['Account', 'E-mail Address', ['You e-mail address is used for password recovery and stuff like that, we won\'t spam you ;).']],
'username' => ['Account', 'Username', ['Probably the biggest part of your identity on a site.', '<b>You can only change this once every 30 days so choose wisely.</b>']],
'usertitle' => ['Account', 'User Title', ['That little piece of text displayed under your username on your profile.']],
@ -595,6 +685,7 @@ if(Users::checkLogin()) {
'regkeys' => ['Danger zone', 'Registration Keys', ['Sometimes we activate the registration key system which means that users can only register using your "referer" keys, this means we can keep unwanted people from registering.', 'Each user can generate 5 of these keys, bans and deactivates render these keys useless.']],
'deactivate' => ['Danger zone', 'Deactivate Account', ['You can deactivate your account here if you want to leave :(.']],
'notfound' => ['Settings', '404', ['This is an error.']]
];
// Current settings page
@ -603,9 +694,11 @@ if(Users::checkLogin()) {
// Render data
$renderData['current'] = $currentPage;
$renderData['page'] = [
'title' => $pages[$currentPage][0] .' / '. $pages[$currentPage][1],
'currentPage' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0,
'description' => $pages[$currentPage][2]
];
// Section specific
@ -623,12 +716,14 @@ if(Users::checkLogin()) {
case 'avatar':
case 'background':
$renderData[$currentPage] = [
'max_width' => Configuration::getConfig($currentPage .'_max_width'),
'max_height' => Configuration::getConfig($currentPage .'_max_height'),
'min_width' => Configuration::getConfig($currentPage .'_min_width'),
'min_height' => Configuration::getConfig($currentPage .'_min_height'),
'max_size' => Configuration::getConfig($currentPage .'_max_fsize'),
'max_size_view' => Main::getByteSymbol(Configuration::getConfig($currentPage .'_max_fsize'))
];
break;
@ -640,8 +735,20 @@ if(Users::checkLogin()) {
// Profile
case 'profile':
$renderData['profile'] = [
'user' => Users::getUserProfileFields(Session::$userId),
'user' => $currentUser->profileFields(),
'fields' => Users::getProfileFields()
];
break;
// Options
case 'options':
$renderData['options'] = [
'user' => $currentUser->optionFields(),
'fields' => Users::getOptionFields()
];
break;

View file

@ -125,11 +125,13 @@ if(isset($_REQUEST['mode']) && Users::checkLogin() && Permissions::check('SITE',
// Set default variables
$renderData['page'] = [
'title' => 'Support '. Configuration::getConfig('sitename'),
'fail' => isset($_GET['fail']),
'price' => Configuration::getConfig('premium_price_per_month'),
'current' => Users::checkUserPremium(Session::$userId),
'current' => $currentUser->checkPremium(),
'amount_max' => Configuration::getConfig('premium_amount_max')
];
// Print page contents

View file

@ -17,8 +17,10 @@ if(!$forum) {
// Set render data
$renderData['page'] = [
'title' => 'Information',
'message' => 'The subforum you tried to access does not exist.'
];
// Print template
@ -32,9 +34,11 @@ if($forum['forum']['forum_type'] === 2) {
// Set render data
$renderData['page'] = [
'title' => 'Information',
'message' => 'The forum you tried to access is a link. You\'re being redirected.',
'redirect' => $forum['forum']['forum_link']
];
// Print template
@ -44,16 +48,22 @@ if($forum['forum']['forum_type'] === 2) {
}
$renderData['page'] = [
'title' => 'Forums / '. $forum['forum']['forum_name']
];
$renderData['board'] = [
'forums' => [
$forum
],
'topics' => Forum::getTopics($forum['forum']['forum_id']),
'viewforum' => true,
'viewtopic' => false
];
// Print page contents

View file

@ -17,8 +17,10 @@ if(!$topic) {
// Set render data
$renderData['page'] = [
'title' => 'Information',
'message' => 'The topic you tried to access does not exist.'
];
// Print template
@ -29,13 +31,19 @@ if(!$topic) {
// Set additional render data
$renderData = array_merge($renderData, $topic, [
'board' => [
'viewforum' => false,
'viewtopic' => true,
],
'page' => [
'title' => $topic['topic']['topic_title']
]
]);
// Print page contents