bunch of unstable shit

This commit is contained in:
Pachira 2015-08-24 00:08:36 +02:00
parent 731c3f4cda
commit 15ec4b04c7
49 changed files with 891 additions and 423 deletions

View file

@ -47,7 +47,8 @@
"20150819", "20150819",
"20150820", "20150820",
"20150821", "20150821",
"20150822" "20150822",
"20150823"
] ]
@ -2191,6 +2192,66 @@
"user": "Flashwave" "user": "Flashwave"
} }
],
"20150823": [
{
"type": "REM",
"change": "Removed a reference to the legacy password hashing method in Users::checkLogin().",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Added repeated linear gradient to the JavaScript message because I could.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed broken reference to current page variable in the logout link.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Rewrite settings page handling.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Merge messages.php and settings.php.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Add special cases for restricted users.",
"user": "Flashwave"
},
{
"type": "UPD",
"change": "Restructured the startup process.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fixed checkboxes not working properly in the AJAX submission function.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Add user controlled ability to switch to Misaki.",
"user": "Flashwave"
},
{
"type": "FIX",
"change": "Fix profiles on Misaki.",
"user": "Flashwave"
},
{
"type": "ADD",
"change": "Quickly backport the required templates to switch back to the Yuuno template.",
"user": "Flashwave"
}
] ]
} }

View file

@ -2,7 +2,7 @@
/* /*
* Main Class * Main Class
*/ */
namespace Sakura; namespace Sakura;
use Parsedown; use Parsedown;
@ -10,16 +10,9 @@ use PHPMailer;
class Main { class Main {
public static $_MD; // Markdown class container
public static $_MANAGE_MODE = false; // Management mode
// Constructor // Constructor
public static function init($config) { public static function init($config) {
// Stop the execution if the PHP Version is older than 5.4.0
if(version_compare(phpversion(), '5.4.0', '<'))
trigger_error('Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.');
// Configuration Management and local configuration // Configuration Management and local configuration
Configuration::init($config); Configuration::init($config);
@ -32,35 +25,12 @@ class Main {
// Create new session // Create new session
Session::init(); Session::init();
// Check if management mode was requested
self::$_MANAGE_MODE = defined('SAKURA_MANAGE');
// Templating engine
if(!defined('SAKURA_NO_TPL')) {
Templates::init(self::$_MANAGE_MODE ? Configuration::getConfig('manage_style') : Configuration::getConfig('site_style'));
}
// Assign servers file to whois class
Whois::setServers(ROOT .'_sakura/'. Configuration::getLocalConfig('data', 'whoisservers'));
// Markdown Parser
self::initMD();
}
// Initialise Parsedown
private static function initMD() {
self::$_MD = new Parsedown();
} }
// Parse markdown // Parse markdown
public static function mdParse($text) { public static function mdParse($text) {
return self::$_MD->text($text); return (new Parsedown())->text($text);
} }
@ -767,7 +737,7 @@ class Main {
// Return the string // Return the string
return $round .' '. $times[$secs] . ($round == 1 ? '' : 's') .' ago'; return $round .' '. $times[$secs] . ($round == 1 ? '' : 's') .' ago';
} }
} }

View file

@ -40,7 +40,7 @@ class Permissions {
'CHANGE_USERNAME' => 4096, // Can change their username 'CHANGE_USERNAME' => 4096, // Can change their username
'CHANGE_USERTITLE' => 8192, // Can change their usertitle 'CHANGE_USERTITLE' => 8192, // Can change their usertitle
'CHANGE_PASSWORD' => 16384, // Can change their password 'CHANGE_PASSWORD' => 16384, // Can change their password
'CHANGE_DEFAULT_RANK' => 32768, // Can change their default rank 'ALTER_RANKS' => 32768, // Can change their ranks
'MANAGE_SESSIONS' => 65536, // Can manage their sessions 'MANAGE_SESSIONS' => 65536, // Can manage their sessions
'CREATE_REGKEYS' => 131072, // Can create registration keys 'CREATE_REGKEYS' => 131072, // Can create registration keys
'DEACTIVATE_ACCOUNT' => 262144, // Can deactivate their account 'DEACTIVATE_ACCOUNT' => 262144, // Can deactivate their account
@ -51,8 +51,8 @@ class Permissions {
'JOIN_GROUPS' => 8388608, // Can join groups 'JOIN_GROUPS' => 8388608, // Can join groups
'CREATE_GROUP' => 16777216, // Can create a group 'CREATE_GROUP' => 16777216, // Can create a group
'MULTIPLE_GROUPS' => 33554432, // Can create multiple groups (requires single group perm) '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 'STATIC_PREMIUM' => 134217728 // User has static premium status
], ],

View file

@ -26,16 +26,22 @@ class Templates {
$confPath = ROOT .'_sakura/templates/'. self::$_TPL .'/template.ini'; $confPath = ROOT .'_sakura/templates/'. self::$_TPL .'/template.ini';
// Check if the configuration file exists // Check if the configuration file exists
if(!file_exists($confPath)) if(!file_exists($confPath)) {
trigger_error('Template configuration does not exist', E_USER_ERROR); trigger_error('Template configuration does not exist', E_USER_ERROR);
}
// Parse and store the configuration // Parse and store the configuration
self::$_CFG = parse_ini_file($confPath, true); self::$_CFG = parse_ini_file($confPath, true);
// Make sure we're not using a manage template for the main site or the other way around // Make sure we're not using a manage template for the main site or the other way around
if((bool)self::$_CFG['manage']['mode'] != (bool)Main::$_MANAGE_MODE) if(defined('SAKURA_MANAGE') && (bool)self::$_CFG['manage']['mode'] != (bool)SAKURA_MANAGE) {
trigger_error('Incorrect template type', E_USER_ERROR); trigger_error('Incorrect template type', E_USER_ERROR);
}
// Start Twig // Start Twig
self::twigLoader(); self::twigLoader();

View file

@ -134,6 +134,13 @@ class User {
} }
// Get all the friend of this user
public function getFriends() {
return Users::getFriends($this->data['id']);
}
// Check if the user is banned // Check if the user is banned
public function checkBan() { public function checkBan() {

View file

@ -47,13 +47,19 @@ class Users {
public static function checkLogin($uid = null, $sid = null, $bypassCookies = false) { public static function checkLogin($uid = null, $sid = null, $bypassCookies = false) {
// Set $uid and $sid if they're null // Set $uid and $sid if they're null
if($uid == null) if($uid == null) {
$uid = Session::$userId; $uid = Session::$userId;
}
// ^ // ^
if($sid == null) if($sid == null) {
$sid = Session::$sessionId; $sid = Session::$sessionId;
}
// Check if cookie bypass is false // Check if cookie bypass is false
if(!$bypassCookies) { if(!$bypassCookies) {
@ -92,10 +98,6 @@ class Users {
// Update the premium meta // Update the premium meta
Users::updatePremiumMeta($uid); Users::updatePremiumMeta($uid);
// Redirect people that need to change their password to the new format
if(self::getUser($uid)['password_algo'] == 'legacy' && $_SERVER['PHP_SELF'] != '/authenticate.php' && $_SERVER['PHP_SELF'] != '/imageserve.php')
header('Location: /authenticate.php?legacy=true');
// If everything went through return true // If everything went through return true
return true; return true;

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20150822'); define('SAKURA_VERSION', '20150823');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false); define('SAKURA_STABLE', false);
@ -22,6 +22,13 @@ error_reporting(SAKURA_STABLE ? 0 : -1);
// Set internal encoding method // Set internal encoding method
mb_internal_encoding('utf-8'); mb_internal_encoding('utf-8');
// Stop the execution if the PHP Version is older than 5.4.0
if(version_compare(phpversion(), '5.4.0', '<')) {
trigger_error('Sakura requires at least PHP 5.4.0, please upgrade to a newer PHP version.');
}
// Include libraries // Include libraries
require_once ROOT .'_sakura/vendor/autoload.php'; require_once ROOT .'_sakura/vendor/autoload.php';
require_once ROOT .'_sakura/components/Main.php'; require_once ROOT .'_sakura/components/Main.php';
@ -53,6 +60,9 @@ set_error_handler(array('Sakura\Main', 'errorHandler'));
// Initialise Main Class // Initialise Main Class
Main::init(ROOT .'_sakura/config/config.ini'); Main::init(ROOT .'_sakura/config/config.ini');
// Assign servers file to whois class
Whois::setServers(ROOT .'_sakura/'. Configuration::getLocalConfig('data', 'whoisservers'));
// Start output buffering // Start output buffering
ob_start(Configuration::getConfig('use_gzip') ? 'ob_gzhandler' : null); ob_start(Configuration::getConfig('use_gzip') ? 'ob_gzhandler' : null);
@ -61,6 +71,20 @@ $currentUser = new User(Session::$userId);
if(!defined('SAKURA_NO_TPL')) { if(!defined('SAKURA_NO_TPL')) {
// Initialise templating engine
Templates::init(
defined('SAKURA_MANAGE') ?
Configuration::getConfig('manage_style') : (
(
isset($currentUser->data['userData']['userOptions']['useMisaki']) &&
$currentUser->data['userData']['userOptions']['useMisaki'] &&
$currentUser->checkPermission('SITE', 'ALTER_PROFILE')
) ?
'misaki' :
Configuration::getConfig('site_style')
)
);
// Set base page rendering data // Set base page rendering data
$renderData = [ $renderData = [

View file

@ -0,0 +1 @@
<h2><a href="/settings/general/options">Go to Site Options</a></h2>

View file

@ -0,0 +1,8 @@
{% include 'global/header.tpl' %}
<div class="content standalone">
<h1 class="sectionHeader">Information</h1>
<hr class="default" />
{{ page.message }}
{% if page.redirect %}<br /><a href="{{ page.redirect }}" class="default">Click here if you aren't being redirected.</a>{% endif %}
</div>
{% include 'global/footer.tpl' %}

View file

@ -4,8 +4,8 @@
<div class="inner"> <div class="inner">
<div class="ft-logo"></div> <div class="ft-logo"></div>
<div class="ft-text"> <div class="ft-text">
<div>Copyright &copy; 2013-2015 <a href="http://flash.moe/" target="_blank">Flashwave</a> &amp; <a href="http://circlestorm.net/" target="_blank">Circlestorm</a>, <a href="//{{ sakura.urls.main }}/credits">et al</a>.</div> <div>Copyright &copy; 2013-2015 <a href="http://flash.moe/" target="_blank">Flashwave</a> &amp; <a href="http://circlestorm.net/" target="_blank">Circlestorm</a>, <a href="/credits">et al</a>.</div>
<div><a href="//{{ sakura.urls.main }}/r/terms">Terms of Service</a> | <a href="//{{ sakura.urls.main }}/contact">Contact</a> | <a href="//{{ sakura.urls.main }}/faq">FAQ</a> | <a href="//{{ sakura.urls.main }}/feedback">Feedback</a> | <a href="//{{ sakura.urls.main }}/r/rules">Rules</a> | <a href="//{{ sakura.urls.main }}/changelog">Changelog</a> | <a href="http://status.flashii.net/">Status</a></div> <div><a href="/r/terms">Terms of Service</a> | <a href="/contact">Contact</a> | <a href="/faq">FAQ</a> | <a href="/feedback">Feedback</a> | <a href="/p/rules">Rules</a> | <a href="/changelog">Changelog</a> | <a href="http://status.flashii.net/">Status</a></div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View file

@ -7,9 +7,26 @@
<meta name="description" content="{{ sakura.sitedesc }}" /> <meta name="description" content="{{ sakura.sitedesc }}" />
<meta name="keywords" content="{{ sakura.sitetags }}" /> <meta name="keywords" content="{{ sakura.sitetags }}" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="msapplication-TileColor" content="#fbeeff" />
<meta name="msapplication-TileImage" content="/content/images/icons/ms-icon-144x144.png" />
<meta name="theme-color" content="#9475B2" />
{% if page.redirect %} {% if page.redirect %}
<meta http-equiv="refresh" content="3; URL={{ page.redirect }}" /> <meta http-equiv="refresh" content="3; URL={{ page.redirect }}" />
{% endif %} {% endif %}
<link rel="apple-touch-icon" sizes="57x57" href="/content/images/icons/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="/content/images/icons/apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/content/images/icons/apple-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="76x76" href="/content/images/icons/apple-icon-76x76.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/content/images/icons/apple-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="120x120" href="/content/images/icons/apple-icon-120x120.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/content/images/icons/apple-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="152x152" href="/content/images/icons/apple-icon-152x152.png" />
<link rel="apple-touch-icon" sizes="180x180" href="/content/images/icons/apple-icon-180x180.png" />
<link rel="icon" type="image/png" sizes="192x192" href="/content/images/icons/android-icon-192x192.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/content/images/icons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="/content/images/icons/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/content/images/icons/favicon-16x16.png" />
<link rel="manifest" href="/manifest.json" />
<!-- CSS --> <!-- CSS -->
<link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/misaki.css" /> <link rel="stylesheet" type="text/css" href="{{ sakura.resources }}/css/misaki.css" />
{% if page.style %} {% if page.style %}
@ -25,6 +42,41 @@
{% endif %} {% endif %}
<!-- JS --> <!-- JS -->
<script type="text/javascript" src="{{ sakura.resources }}/js/misaki.js"></script> <script type="text/javascript" src="{{ sakura.resources }}/js/misaki.js"></script>
<script type="text/javascript">
// Create an object so we can access certain settings from remote JavaScript files
var sakuraVars = {
"cookie": {
"prefix": "{{ sakura.cookie.prefix }}",
"domain": "{{ sakura.cookie.domain }}",
"path": "{{ sakura.cookie.path }}"
},
"urlMain": "{{ sakura.urlMain }}",
"content": "{{ sakura.contentPath }}",
"resources": "{{ sakura.resources }}",
"recaptchaEnabled": "{{ sakura.recaptchaEnabled }}",
"minUserLen": {{ sakura.minUsernameLength }},
"maxUserLen": {{ sakura.maxUsernameLength }},
"minPwdEntropy": {{ sakura.minPwdEntropy }},
"checkLogin": {% if session.checkLogin %}true{% else %}false{% endif %}
};
// Space for things that need to happen onload
window.addEventListener("load", function() {
{% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground) %}
initialiseParallax('userBackground');
{% endif %}
});
</script>
</head> </head>
<body> <body>
<div id="container"> <div id="container">
@ -48,15 +100,15 @@
</div> </div>
</div> </div>
<div id="wrapper"> <div id="wrapper">
{% if profile.user.userData.profileBackground %} {% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground) %}
<div id="userBackground"></div> <div id="userBackground" style="background-image: url('/bg/{{ (php.self == '/profile.php' ? profile : user).data.id }}');"></div>
{% endif %} {% endif %}
<div id="content"> <div id="content">
<div id="navigation"> <div id="navigation">
<ul class="nav-left floatLeft"> <ul class="nav-left floatLeft">
<li><a href="/">Home</a></li> <li><a href="/">Home</a></li>
<li><a href="/news">News</a></li> <li><a href="/news">News</a></li>
<li><a href="//chat.{{ sakura.url_main }}/">Chat</a></li> <li><a href="//chat.{{ sakura.urlMain }}/">Chat</a></li>
<li><a href="/forum">Forum</a></li> <li><a href="/forum">Forum</a></li>
<li><a href="/members">Members</a></li> <li><a href="/members">Members</a></li>
<li><a href="/search">Search</a></li> <li><a href="/search">Search</a></li>
@ -64,21 +116,21 @@
</ul> </ul>
<ul class="nav-right floatRight"> <ul class="nav-right floatRight">
<li class="nav-usermenu"> <li class="nav-usermenu">
<a href="#"{% if user.checklogin %} style="color: {{ user.colour }};"{% endif %}>{% if user.checklogin %}{{ user.data.username }}{% else %}Guest{% endif %}</a> <a href="#"{% if session.checkLogin %} style="color: {{ user.colour }};"{% endif %}>{% if session.checkLogin %}{{ user.data.username }}{% else %}Guest{% endif %}</a>
<ul> <ul>
{% if user.checklogin %} {% if session.checkLogin %}
<li><a href="/u/{{ user.data.id }}">My Profile</a></li> <li><a href="/u/{{ user.data.id }}">My Profile</a></li>
<li><a href="/messages">View Messages</a></li> <li><a href="/messages">Private Messages</a></li>
<li><a href="/settings">User Settings</a></li> <li><a href="/settings">User Settings</a></li>
<li><a href="/manage">Site Management</a></li> <li><a href="/manage">Site Management</a></li>
<li><a href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentpage }}">Logout</a></li> <li><a href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentPage }}">Logout</a></li>
{% else %} {% else %}
<li><a href="/login">Login</a></li> <li><a href="/login">Login</a></li>
<li><a href="/register">Register</a></li> <li><a href="/register">Register</a></li>
{% endif %} {% endif %}
</ul> </ul>
</li> </li>
<li><a href="#" class="ignore"><img src="{{ sakura.content_path }}/pixel.png" alt="{{ user.data.username }}" style="background-image: url('/a/{{ user.data.id }}');" class="nav-avatar" /></a></li> <li><a href="/u/{{ user.data.id }}" class="ignore"><img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.data.username }}" style="background-image: url('/a/{{ user.data.id }}');" class="nav-avatar" /></a></li>
</ul> </ul>
<div class="clear"></div> <div class="clear"></div>
</div> </div>

View file

@ -1,138 +1,150 @@
{% include 'global/header.tpl' %} {% include 'global/header.tpl' %}
{% if profile.notset or profile.user.id == 0 or profile.user.password_algo == 'nologin' %} {% if profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
user not found, don't forget to make this sexy <div class="userNotFound">
{% else %} <h1 class="sectionHead">user not found!</h1>
<div class="profile" id="u{{ profile.user.id }}"> There are a few possible reasons for this:
<div class="profileHeader" style="background-image: url('/u/{{ profile.user.id }}/header');"> <ul>
<div class="profileFade"></div> <li>They changed their username.</li>
<div class="headerLeft"> <li>They may have been <a href="/faq#abyss" class="default">abyss'd</a>.</li>
<img class="userAvatar" src="/a/{{ profile.user.id }}" alt="{{ profile.user.username }}'s Avatar" /> <li>You made a typo.</li>
<div class="userData"> <li>They never existed.</li>
<div class="profileUsername" style="color: {{ profile.colour }};"> </ul>
{{ profile.user.username }}
</div>
<div class="profileUsertitle">
{{ profile.ranktitle }}
</div>
</div>
</div>
<div class="joinedLast">
<div>Joined {{ profile.user.regdate|date("l Y-m-d H:i T") }}</div>
<div>{% if profile.user.lastdate == 0 %}User hasn't logged in yet.{% else %}Last Active {{ profile.user.lastdate|date("l Y-m-d H:i T") }}{% endif %}</div>
</div>
<div class="clear"></div>
</div> </div>
<div class="profileContent"> {% else %}
<div class="userDataBar"> <div class="profile" id="u{{ profile.data.id }}">
{% if profile.user.rank_main > 1 %} <div class="profileHeader" style="background-image: url('/u/{{ profile.data.id }}/header');">
<div class="profilePlatform hierarchyContainer"> <div class="profileFade"></div>
<div class="inner"> <div class="headerLeft">
<ul class="hierarchies"> <img class="userAvatar" src="/a/{{ profile.data.id }}" alt="{{ profile.data.username }}'s Avatar" />
<li class="tenshi">Tenshi</li> <div class="userData">
<li class="staff">Staff</li> <div class="profileUsername" style="color: {{ profile.colour }};">
<li class="developer">Developer</li> {{ profile.data.username }}
<li class="alumnii">Alumnii</li>
</ul>
</div>
</div>
<div class="profilePlatform userAccounts">
<div class="inner">
{% if user.checklogin %}
{% if profile.fields %}
{% for name,field in profile.fields %}
<div class="field">
<div>{{ field.name }}</div>
<div>
{% if name == 'youtube' %}
<a href="https://youtube.com/{% if field.youtubetype == 1 %}channel{% else %}user{% endif %}/{{ field.value }}">{% if field.youtubetype == 1 %}{{ profile.user.username }}'s Channel{% else %}{{ field.value }}{% endif %}</a>
{% else %}
{% if field.islink %}
<a href="{{ field.link }}">
{% endif %}
{{ field.value }}
{% if field.islink %}
</a>
{% endif %}
{% endif %}
</div>
<div class="clear"></div>
</div> </div>
{% endfor %} <div class="profileUsertitle">
{% else %} {{ profile.userTitle }}
<div class="noAccounts">
<div class="fa fa-question"></div>
<div class="notif">This user has not set any accounts yet.</div>
</div> </div>
{% endif %}
{% else %}
<div class="noAccounts">
<div class="fa fa-exclamation-circle"></div>
<div class="notif">Log in to view the full profile.</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<div class="profilePlatform accountStanding">
<div class="inner">
<div class="title">Account Standing</div>
<div class="standing" style="color:
{% if profile.user.rank_main < 2 %}
#888;">Deactivated
{% else %}
{% if profile.warnings %}
#F22;">Bad
{% else %}
#2F2;">Good
{% endif %}
{% endif %}
</div> </div>
{% if profile.warnings %}
<div>This user has <b>{{ profile.warnings|length }}</b> warning{% if profile.warnings|length != 1 %}s{% endif %}!</div>
<div>After <b>10 warnings</b> a user may be permanently banned.</div>
{% endif %}
</div> </div>
</div> <div class="joinedLast">
</div> <div>Joined {{ profile.data.regdate|date(sakura.dateFormat) }}</div>
<div class="userPage"> <div>{% if profile.data.lastdate == 0 %}User hasn't logged in yet.{% else %}Last Active {{ profile.data.lastdate|date(sakura.dateFormat) }}{% endif %}</div>
{% if profile.user.rank_main > 1 %}
<div class="statsRow">
<div class="profilePlatform">
<a class="inner" href="/u/{{ profile.user.id }}/friends">
<div>Friends</div>
<div class="count">n/a</div>
</a>
</div>
<div class="profilePlatform">
<a class="inner" href="/u/{{ profile.user.id }}/groups">
<div>Groups</div>
<div class="count">n/a</div>
</a>
</div>
<div class="profilePlatform forumStats">
<div class="inner">
<div class="forumStatTitle">Forum stats</div>
<div class="forumStatCount">
<a class="posts" href="/u/{{ profile.user.id }}/posts">{{ profile.forum_stats.posts }} post{% if profile.forum_stats.posts != 1 %}s{% endif %}</a>
<a class="threads" href="/u/{{ profile.user.id }}/threads">{% if profile.forum_stats.topics %}{{ profile.forum_stats.topics }}{% else %}0{% endif %} thread{% if profile.forum_stats.topics != 1 %}s{% endif %}</a>
</div>
<div class="clear"></div>
</div>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
<div class="profilePage profilePlatform markdown{% if profile.profilePage|length < 1 %} hidden{% endif %}"> <div class="profileContent">
<div class="inner">{{ profile.profilePage|raw }}</div> <div class="userDataBar">
{% if not profile.checkPermission('SITE', 'DEACTIVATED') and (profile.checkPremium[0] or profile.checkPermission('MANAGE', 'USE_MANAGE')) %}
<div class="profilePlatform hierarchyContainer">
<div class="inner">
<ul class="hierarchies">
{% if profile.checkPremium[0] %}
<li class="tenshi">Tenshi</li>
{% endif %}
{% if profile.checkPermission('MANAGE', 'USE_MANAGE') %}
<li class="staff">Staff</li>
{% endif %}
{% if false %}
<li class="developer">Developer</li>
{% endif %}
{% if false %}
<li class="alumnii">Alumnii</li>
{% endif %}
</ul>
</div>
</div>
<div class="profilePlatform userAccounts">
<div class="inner">
{% if session.checkLogin %}
{% if profile.profileFields %}
{% for name,field in profile.profileFields %}
<div class="field">
<div>{{ field.name }}</div>
<div>
{% if name == 'youtube' %}
<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 }}">
{% endif %}
{{ field.value }}
{% if field.islink %}
</a>
{% endif %}
{% endif %}
</div>
<div class="clear"></div>
</div>
{% endfor %}
{% else %}
<div class="noAccounts">
<div class="fa fa-question"></div>
<div class="notif">This user has not set any links yet.</div>
</div>
{% endif %}
{% else %}
<div class="noAccounts">
<div class="fa fa-exclamation-circle"></div>
<div class="notif">Log in to view the full profile.</div>
</div>
{% endif %}
</div>
</div>
{% endif %}
<div class="profilePlatform accountStanding">
<div class="inner">
<div class="title">Account Standing</div>
{% if profile.checkPermission('SITE', 'DEACTIVATED') %}
<div class="standing" style="color: #800;">Deactivated</div>
{% elseif profile.checkBan %}
<h2 class="standing" style="color: #222;">Banned</h2>
{% else %}
{% if profile.getWarnings %}
<div class="standing" style="color: #A22;">Bad</div>
{% else %}
<div class="standing" style="color: #2A2;">Good</div>
{% endif %}
{% endif %}
{% if profile.getWarnings %}
<div>This user has <b>{{ profile.getWarnings|length }}</b> warning{% if profile.getWarnings|length != 1 %}s{% endif %}!</div>
<div>After <b>10 warnings</b> a user may be permanently banned.</div>
{% endif %}
</div>
</div>
</div>
<div class="userPage">
{% if not profile.checkPermission('SITE', 'DEACTIVATED') %}
<div class="statsRow">
<div class="profilePlatform">
<a class="inner" href="/u/{{ profile.data.id }}/friends">
<div>Friends</div>
<div class="count">{{ profile.getFriends|length }}</div>
</a>
</div>
<div class="profilePlatform">
<a class="inner" href="/u/{{ profile.data.id }}/groups">
<div>Groups</div>
<div class="count">n/a</div>
</a>
</div>
<div class="profilePlatform forumStats">
<div class="inner">
<div class="forumStatTitle">Forum stats</div>
<div class="forumStatCount">
<a class="posts" href="/u/{{ profile.data.id }}/posts">{{ profile.forumStats.posts }} post{% if profile.forumStats.posts != 1 %}s{% endif %}</a>
<a class="threads" href="/u/{{ profile.data.id }}/threads">{% if profile.forumStats.topics %}{{ profile.forumStats.topics }}{% else %}0{% endif %} thread{% if profile.forumStats.topics != 1 %}s{% endif %}</a>
</div>
<div class="clear"></div>
</div>
</div>
<div class="clear"></div>
</div>
<div class="userPage profilePlatform markdown{% if profile.userPage|length < 1 %} hidden{% endif %}">
<div class="inner">{{ profile.userPage|raw }}</div>
</div>
{% endif %}
</div>
<div class="clear"></div>
</div> </div>
{% endif %}
</div> </div>
<div class="clear"></div> {% endif %}
</div>
</div>
{% if profile.user.userData.profileBackground %}
<script type="text/javascript">
initialiseParallax('userBackground');
</script>
{% endif %}
{% endif %}
{% include 'global/footer.tpl' %} {% include 'global/footer.tpl' %}

View file

@ -0,0 +1,19 @@
{% include 'global/header.tpl' %}
<div class="content settings messages">
<div class="content-right content-column">
{% include 'elements/settingsNavigation.tpl' %}
</div>
<div class="content-left content-column">
<div class="head">
{{ page.title }}
</div>
<div class="settings-explanation">
{% for descline in page.description %}
<div>{{ include(template_from_string(descline)) }}</div>
{% endfor %}
</div>
{% include 'settings/' ~ current ~ '.tpl' %}
</div>
<div class="clear"></div>
</div>
{% include 'global/footer.tpl' %}

View file

@ -0,0 +1,2 @@
<h1 class="stylised">READ THIS BEFORE PUKING</h1>
These template files were quickly thrown into place to allow switching between the development style and the stable one. You can switch in the Site Options section.

View file

@ -0,0 +1,26 @@
{% 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] %} checked="checked" value="option_{{ field.id }}"{% 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>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are currently no changeable options.</h1>
{% endif %}

View file

@ -2,40 +2,12 @@
Navigation Navigation
</div> </div>
<div class="right-menu-nav"> <div class="right-menu-nav">
<div>General</div> {% for catname,category in pages %}
<a href="/settings/">Home</a> <div>{{ category.title }}</div>
<a href="/settings/profile">Edit Profile</a> {% for mname,mode in category.modes %}
<a href="/settings/options">Site Options</a> {% if mode.access %}
<a href="/settings/groups">Groups</a> <a href="/{% if catname != 'messages' %}settings/{% endif %}{{ catname }}/{{ mname }}/">{{ mode.title }}</a>
<div>Friends</div> {% endif %}
<a href="/settings/friendlisting">List</a> {% endfor %}
<a href="/settings/friendrequests">Requests</a> {% endfor %}
<div>Messages</div>
<a href="/messages/inbox">Inbox</a>
<a href="/messages/sent">Sent</a>
<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>
<a href="/settings/usertitle">User Title</a>
<a href="/settings/password">Password</a>
<a href="/settings/ranks">Ranks</a>
<div>Danger zone</div>
<a href="/settings/sessions">Sessions</a>
<a href="/settings/regkeys">Registration Keys</a>
<a href="/settings/deactivate">Deactivate Account</a>
</div> </div>

View file

@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="msapplication-TileColor" content="#fbeeff" /> <meta name="msapplication-TileColor" content="#fbeeff" />
<meta name="msapplication-TileImage" content="/content/images/icons/ms-icon-144x144.png" /> <meta name="msapplication-TileImage" content="/content/images/icons/ms-icon-144x144.png" />
<meta name="theme-color" content="#fbeeff" /> <meta name="theme-color" content="#9475B2" />
{% if page.redirect %} {% if page.redirect %}
<meta http-equiv="refresh" content="3; URL={{ page.redirect }}" /> <meta http-equiv="refresh" content="3; URL={{ page.redirect }}" />
{% endif %} {% endif %}
@ -147,7 +147,7 @@
} }
{% endif %} {% endif %}
{% 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) %} {% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground) %}
initialiseParallax('userBackground'); initialiseParallax('userBackground');
{% endif %} {% endif %}
@ -165,7 +165,9 @@
<a class="menu-item" href="/" title="Return to the front page of Flashii">Home</a> <a class="menu-item" href="/" title="Return to the front page of Flashii">Home</a>
<a class="menu-item" href="/news" title="Here you can read updates on Flashii">News</a> <a class="menu-item" href="/news" title="Here you can read updates on Flashii">News</a>
<a class="menu-item" href="//chat.{{ sakura.urlMain }}/" title="Chat with other Flashii members">Chat</a> <a class="menu-item" href="//chat.{{ sakura.urlMain }}/" title="Chat with other Flashii members">Chat</a>
<a class="menu-item" href="/forum" title="Discuss things with other members but static">Forums</a> {% if user.checkPermission('FORUM', 'USE_FORUM') %}
<a class="menu-item" href="/forum" title="Discuss things with other members but static">Forums</a>
{% endif %}
<a class="menu-item" href="/search" title="Search on Flashii">Search</a> <a class="menu-item" href="/search" title="Search on Flashii">Search</a>
{% if session.checkLogin %} {% if session.checkLogin %}
<a class="menu-item" href="/members" title="View a list with all the activated user accounts">Members</a> <a class="menu-item" href="/members" title="View a list with all the activated user accounts">Members</a>
@ -179,7 +181,7 @@
<a class="menu-item" href="/messages" title="Read your private message">Messages</a> <a class="menu-item" href="/messages" title="Read your private message">Messages</a>
<a class="menu-item" href="/manage" title="Manage the site">Manage</a> <a class="menu-item" href="/manage" title="Manage the site">Manage</a>
<a class="menu-item" href="/settings" title="Change your settings">Settings</a> <a class="menu-item" href="/settings" title="Change your settings">Settings</a>
<a class="menu-item" href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentpage }}" title="End your login session" id="headerLogoutLink">Logout</a> <a class="menu-item" href="/logout?mode=logout&amp;time={{ php.time }}&amp;session={{ php.sessionid }}&amp;redirect={{ sakura.currentPage }}" title="End your login session" id="headerLogoutLink">Logout</a>
{% else %} {% else %}
{% if sakura.lockAuth %} {% if sakura.lockAuth %}
<div class="menu-item" style="padding-left: 10px; padding-right: 10px;">Authentication is locked</div> <div class="menu-item" style="padding-left: 10px; padding-right: 10px;">Authentication is locked</div>
@ -196,7 +198,7 @@
</div> </div>
<div id="contentwrapper"> <div id="contentwrapper">
<div id="notifications"></div> <div id="notifications"></div>
{% 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) %} {% if php.self == '/profile.php' ? profile.data.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.userData.userOptions.profileBackgroundSiteWide and user.data.userData.profileBackground) %}
<div id="userBackground" style="background-image: url('/bg/{{ (php.self == '/profile.php' ? profile : user).data.id }}');"></div> <div id="userBackground" style="background-image: url('/bg/{{ (php.self == '/profile.php' ? profile : user).data.id }}');"></div>
{% endif %} {% endif %}
{% if not session.checkLogin and php.self != '/authenticate.php' %} {% if not session.checkLogin and php.self != '/authenticate.php' %}
@ -225,11 +227,11 @@
{% if user.checkPermission('SITE', 'RESTRICTED') %} {% 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;"> <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> <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>A staff member has set your account to restricted mode most likely due to violation of the rules. While restricted you won't be able to use most 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> </div>
{% endif %} {% endif %}
<noscript> <noscript>
<div class="headerNotify" style="padding-top: 10px; padding-bottom: 10px;"> <div class="headerNotify" style="padding-top: 10px; padding-bottom: 10px; background: repeating-linear-gradient(-45deg, #C2AFFE, #C2AFFE 10px, #D3BFFF 10px, #D3BFFF 20px);">
<h1>You have JavaScript disabled!</h1> <h1>You have JavaScript disabled!</h1>
<p style="padding: 0 10px;">A lot of things on this site require JavaScript to be enabled (e.g. the chat), we try to keep both sides happy but it is highly recommended that you enable it (you'll also have to deal with this message being here if you don't enable it).</p> <p style="padding: 0 10px;">A lot of things on this site require JavaScript to be enabled (e.g. the chat), we try to keep both sides happy but it is highly recommended that you enable it (you'll also have to deal with this message being here if you don't enable it).</p>
</div> </div>

View file

@ -1,37 +0,0 @@
{% include 'global/header.tpl' %}
<div class="content settings messages">
<div class="content-right content-column">
{% include 'elements/settingsNav.tpl' %}
</div>
<div class="content-left content-column">
{#<div class="head">
Messages / Inbox
</div>
{% if messages|length %}
<table class="msgTable">
<thead>
<tr>
<th>From</th>
<th>Subject</th>
<th>Sent on</th>
</tr>
</thead>
<tbody>
{% for message in messages %}
<tr>
<td><a href="/u/{{ message.data.from.user.id }}" class="default" style="font-weight: 700; color: {% if message.data.from.user.name_colour == null %}{{ message.data.from.rank.colour }}{% else %}{{ message.data.from.user.name_colour }}{% endif %};">{{ message.data.from.user.username }}</a></td>
<td><a href="/messages/read/{{ message.id }}" class="default">{{ message.subject }}</a></td>
<td>{{ message.time|date(sakura.dateFormat) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% 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>#}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">The PM system is currently unavailable.</h1>
</div>
<div class="clear"></div>
</div>
{% include 'global/footer.tpl' %}

View file

@ -1,5 +1,5 @@
{% include 'global/header.tpl' %} {% include 'global/header.tpl' %}
{% if profile.data.id < 1 or profile.data.password_algo == 'nologin' %} {% if profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.id != profile.data.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
<div class="content standalone" style="padding: 20px;"> <div class="content standalone" style="padding: 20px;">
<h1>The requested user does not exist!</h1> <h1>The requested user does not exist!</h1>
There are a few possible reasons for this: There are a few possible reasons for this:
@ -74,16 +74,18 @@
{% endif %} {% endif %}
<hr class="default" /> <hr class="default" />
<b>Account Standing</b> <b>Account Standing</b>
{% if profile.data.rank_main < 2 %} {% if profile.checkPermission('SITE', 'DEACTIVATED') %}
<h2 style="color: #888; text-shadow: 0 0 7px #888; margin-top: 0;">Deactivated</h2> <h2 style="color: #888; text-shadow: 0 0 7px #888; margin-top: 0;">Deactivated</h2>
{% elseif profile.checkBan %} {% elseif profile.checkBan %}
<h2 style="color: #222; text-shadow: 0 0 7px #222; margin-top: 0;">Banned</h2> <h2 style="color: #222; text-shadow: 0 0 7px #222; margin-top: 0;">Banned</h2>
{% elseif profile.checkPermission('SITE', 'RESTRICTED') %}
<h2 style="color: #800; text-shadow: 0 0 7px #800; margin-top: 0;">Restricted</h2>
{% else %} {% else %}
{% if profile.getWarnings %} {% if profile.getWarnings %}
<h2 style="color: red; text-shadow: 0 0 7px #888; margin-top: 0;">Bad</h2> <h2 style="color: #A00; text-shadow: 0 0 7px #A00; margin-top: 0;">Bad</h2>
<span style="font-size: 10px; line-height: 10px;">This user has <b>{{ profile.getWarnings|length }} warning{% if profile.getWarnings|length != 1 %}s{% endif %}</b>.<br />After 5 to 10 warnings (depending on what they are for) this user may be permanently banned.</span> <span style="font-size: 10px; line-height: 10px;">This user has <b>{{ profile.getWarnings|length }} warning{% if profile.getWarnings|length != 1 %}s{% endif %}</b>.<br />After 5 to 10 warnings (depending on what they are for) this user may be permanently banned.</span>
{% else %} {% else %}
<h2 style="color: green; text-shadow: 0 0 7px #888; margin-top: 0;">Good</h2> <h2 style="color: #0A0; text-shadow: 0 0 7px #0A0; margin-top: 0;">Good</h2>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>

View file

@ -7,7 +7,7 @@
<div class="friends-list-name" style="color: {% if friend.user.name_colour %}{{ friend.user.name_colour }}{% else %}{{ friend.rank.colour }}{% endif %};">{{ friend.user.username }}</div> <div class="friends-list-name" style="color: {% if friend.user.name_colour %}{{ friend.user.name_colour }}{% else %}{{ friend.rank.colour }}{% endif %};">{{ friend.user.username }}</div>
</a> </a>
<div class="friends-list-actions"> <div class="friends-list-actions">
<a class="remove fill fa fa-remove" title="Remove friend" href="/friends?remove={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/friends&amp;direct=true"></a> <a class="remove fill fa fa-remove" title="Remove friend" href="/friends?remove={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/listing/friends&amp;direct=true"></a>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
@ -18,13 +18,13 @@
<div> <div>
<div class="pagination" style="float: right;"> <div class="pagination" style="float: right;">
{% if page.currentPage > 0 %} {% if page.currentPage > 0 %}
<a href="/settings/friends/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a> <a href="/settings/friends/listing/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a>
{% endif %} {% endif %}
{% for id,npage in friends %} {% for id,npage in friends %}
<a href="/settings/friends/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a> <a href="/settings/friends/listing/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a>
{% endfor %} {% endfor %}
{% if page.currentPage + 1 < friends|length %} {% if page.currentPage + 1 < friends|length %}
<a href="/settings/friends/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a> <a href="/settings/friends/listing/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a>
{% endif %} {% endif %}
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View file

@ -8,7 +8,7 @@
</a> </a>
<div class="friends-list-actions"> <div class="friends-list-actions">
<a class="add fa fa-check" title="Add friend" href="/friends?add={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/friendrequests&amp;direct=true"></a> <a class="add fa fa-check" title="Add friend" href="/friends?add={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/friendrequests&amp;direct=true"></a>
<a class="remove fa fa-remove" title="Remove friend" href="/friends?remove={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/friendrequests&amp;direct=true"></a> <a class="remove fa fa-remove" title="Remove friend" href="/friends?remove={{ friend.user.id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}&amp;redirect=/settings/friends/requests&amp;direct=true"></a>
<div class="clear"></div> <div class="clear"></div>
</div> </div>
</div> </div>
@ -19,13 +19,13 @@
<div> <div>
<div class="pagination" style="float: right;"> <div class="pagination" style="float: right;">
{% if page.currentPage > 0 %} {% if page.currentPage > 0 %}
<a href="/settings/friends/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a> <a href="/settings/friends/requests/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a>
{% endif %} {% endif %}
{% for id,npage in friends %} {% for id,npage in friends %}
<a href="/settings/friends/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a> <a href="/settings/friends/requests/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a>
{% endfor %} {% endfor %}
{% if page.currentPage + 1 < friends|length %} {% if page.currentPage + 1 < friends|length %}
<a href="/settings/friends/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a> <a href="/settings/friends/requests/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a>
{% endif %} {% endif %}
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View file

@ -2,20 +2,20 @@
<h1 class="stylised">Common Tasks</h1> <h1 class="stylised">Common Tasks</h1>
<h2>Profile</h2> <h2>Profile</h2>
<ul> <ul>
<li><a href="/settings/avatar" class="default">Change Avatar</a></li> <li><a href="/settings/appearance/avatar" class="default">Change Avatar</a></li>
<li><a href="/settings/userpage" class="default">Change Userpage</a></li> <li><a href="/settings/appearance/userpage" class="default">Change Userpage</a></li>
<li><a href="/settings/signature" class="default">Change Signature</a></li> <li><a href="/settings/appearance/signature" class="default">Change Signature</a></li>
<li><a href="/settings/profile" class="default">Change Profile Details</a></li> <li><a href="/settings/general/profile" class="default">Change Profile Details</a></li>
</ul> </ul>
<h2>Messaging</h2> <h2>Messaging</h2>
<ul> <ul>
<li><a href="/messages/index" class="default">View Inbox</a></li> <li><a href="/messages/inbox" class="default">View Inbox</a></li>
<li><a href="/messages/compose" class="default">Send PM</a></li> <li><a href="/messages/compose" class="default">Send PM</a></li>
</ul> </ul>
<h2>Account</h2> <h2>Account</h2>
<ul> <ul>
<li><a href="/settings/sessions" class="default">Manage Active Sessions</a></li> <li><a href="/settings/advanced/sessions" class="default">Manage Active Sessions</a></li>
<li><a href="/settings/password" class="default">Change Password</a></li> <li><a href="/settings/account/password" class="default">Change Password</a></li>
</ul> </ul>
<br /> <br />
<h1 class="stylised">Personal Statistics</h1> <h1 class="stylised">Personal Statistics</h1>
@ -26,7 +26,7 @@
<li>You have <b>{{ settings.friends|length - (settings.friends.online ? 1 : 0) - (settings.friends.offline ? 1 : 0) }} friend{% if settings.friends|length - (settings.friends.online ? 1 : 0) - (settings.friends.offline ? 1 : 0) != 1 %}s{% endif %}</b>.</li> <li>You have <b>{{ settings.friends|length - (settings.friends.online ? 1 : 0) - (settings.friends.offline ? 1 : 0) }} friend{% if settings.friends|length - (settings.friends.online ? 1 : 0) - (settings.friends.offline ? 1 : 0) != 1 %}s{% endif %}</b>.</li>
</ul> </ul>
<br /> <br />
<h1 class="stylised"><a class="clean" href="/settings/friendlisting">Friends</a></h1> <h1 class="stylised"><a class="clean" href="/settings/friends/listing">Friends</a></h1>
<h2 style="color: #080;">Online</h2> <h2 style="color: #080;">Online</h2>
{% if settings.friends.online %} {% if settings.friends.online %}
{% for key,friend in settings.friends.online %} {% for key,friend in settings.friends.online %}

View file

@ -12,7 +12,7 @@
</div> </div>
</div> </div>
<div style="padding: 8px 0;"> <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 %} /> <input type="{{ field.formtype }}" name="option_{{ field.id }}" class="inputStyling"{% if options.user[field.id] %}{% if field.formtype == 'checkbox' and options.user[field.id] %} checked="checked" value="option_{{ field.id }}"{% else %} value="{{ options.user[field.id] }}"{% endif %}{% endif %} />
</div> </div>
</div> </div>
{% endfor %} {% endfor %}

View file

@ -0,0 +1,46 @@
{% if profile.fields %}
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="editProfileForm">
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="mode" value="profile" />
{% for field in profile.fields %}
<div class="profile-field">
<div>
<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 %}{% 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 }}"{% 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 %}
{% endif %}
</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 editProfileForm = document.getElementById('editProfileForm');
var createInput = document.createElement('input');
var submit = editProfileForm.querySelector('[type="submit"]');
createInput.setAttribute('name', 'ajax');
createInput.setAttribute('value', 'true');
createInput.setAttribute('type', 'hidden');
editProfileForm.appendChild(createInput);
submit.setAttribute('type', 'button');
submit.setAttribute('onclick', 'submitPost(\''+ editProfileForm.action +'\', formToObject(\'editProfileForm\'), true, \'Updating Profile...\');');
});
</script>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are no changeable profile fields.</h1>
{% endif %}

View file

@ -0,0 +1,23 @@
{% if messages|length %}
<table class="msgTable">
<thead>
<tr>
<th>From</th>
<th>Subject</th>
<th>Sent on</th>
</tr>
</thead>
<tbody>
{% for message in messages %}
<tr>
<td><a href="/u/{{ message.data.from.user.id }}" class="default" style="font-weight: 700; color: {% if message.data.from.user.name_colour == null %}{{ message.data.from.rank.colour }}{% else %}{{ message.data.from.user.name_colour }}{% endif %};">{{ message.data.from.user.username }}</a></td>
<td><a href="/messages/read/{{ message.id }}" class="default">{{ message.subject }}</a></td>
<td>{{ message.time|date(sakura.dateFormat) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% 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>

View file

@ -1 +0,0 @@
<h1 class="stylised" style="margin: 2em auto; text-align: center;">Could not find what you were looking for.</h1>

View file

@ -30,13 +30,13 @@
<div> <div>
<div class="pagination" style="float: right;"> <div class="pagination" style="float: right;">
{% if page.currentPage > 0 %} {% if page.currentPage > 0 %}
<a href="/settings/notifications/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a> <a href="/settings/notifications/history/p{{ page.currentPage }}"><span class="fa fa-step-backward"></span></a>
{% endif %} {% endif %}
{% for id,npage in notifs %} {% for id,npage in notifs %}
<a href="/settings/notifications/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a> <a href="/settings/notifications/history/p{{ id + 1 }}"{% if id == page.currentPage %} class="current"{% endif %}>{{ id + 1 }}</a>
{% endfor %} {% endfor %}
{% if page.currentPage + 1 < notifs|length %} {% if page.currentPage + 1 < notifs|length %}
<a href="/settings/notifications/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a> <a href="/settings/notifications/history/p{{ page.currentPage + 2 }}"><span class="fa fa-step-forward"></span></a>
{% endif %} {% endif %}
</div> </div>
<div class="clear"></div> <div class="clear"></div>

View file

@ -1,42 +0,0 @@
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="editProfileForm">
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="mode" value="profile" />
{% for field in profile.fields %}
<div class="profile-field">
<div>
<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 %}{% 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 }}"{% 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 %}
{% endif %}
</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 editProfileForm = document.getElementById('editProfileForm');
var createInput = document.createElement('input');
var submit = editProfileForm.querySelector('[type="submit"]');
createInput.setAttribute('name', 'ajax');
createInput.setAttribute('value', 'true');
createInput.setAttribute('type', 'hidden');
editProfileForm.appendChild(createInput);
submit.setAttribute('type', 'button');
submit.setAttribute('onclick', 'submitPost(\''+ editProfileForm.action +'\', formToObject(\'editProfileForm\'), true, \'Updating Profile...\');');
});
</script>

View file

@ -35,13 +35,14 @@ RewriteRule ^news.xml$ news.php?xml [L,QSA]
# Settings # Settings
RewriteRule ^settings/?$ settings.php [L,QSA] RewriteRule ^settings/?$ settings.php [L,QSA]
RewriteRule ^settings/([a-z]+)/?$ settings.php?mode=$1 [L,QSA] RewriteRule ^settings/([a-z]+)/?$ settings.php?cat=$1 [L,QSA]
RewriteRule ^settings/([a-z]+)/p([0-9]+)/?$ settings.php?mode=$1&page=$2 [L,QSA] RewriteRule ^settings/([a-z]+)/([a-z]+)/?$ settings.php?cat=$1&mode=$2 [L,QSA]
RewriteRule ^settings/([a-z]+)/([a-z]+)/p([0-9]+)/?$ settings.php?cat=$1&mode=$2&page=$3 [L,QSA]
RewriteRule ^friends/?$ settings.php?friend-action=true [L,QSA] RewriteRule ^friends/?$ settings.php?friend-action=true [L,QSA]
# Private Messages # Private Messages
RewriteRule ^messages/?$ messages.php [L,QSA] RewriteRule ^messages/?$ settings.php?cat=messages [L,QSA]
RewriteRule ^messages/([a-z]+)/?$ messages.php?mode=$1 [L,QSA] RewriteRule ^messages/([a-z]+)/?$ settings.php?cat=messages&mode=$1 [L,QSA]
# Members # Members
RewriteRule ^members/?$ members.php [L,QSA] RewriteRule ^members/?$ members.php [L,QSA]

View file

@ -9,5 +9,8 @@ namespace Sakura;
// Include components // Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php'; require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
// Set 404 header
header('HTTP/1.0 404 Not Found');
// Print page contents // Print page contents
print Templates::render('errors/http404.tpl', $renderData); print Templates::render('errors/http404.tpl', $renderData);

View file

@ -367,6 +367,18 @@ a:active {
/* /*
* Profiles * Profiles
*/ */
.userNotFound {
margin: 10px 14px;
font-family: "Exo2-0-LightItalic", sans-serif;
font-size: 1.5em;
line-height: 1.3em;
}
.userNotFound > ul {
padding-left: 18px;
list-style: square;
}
.profile { .profile {
text-shadow: 1px 1px 2px rgba(0, 0, 0, .75); text-shadow: 1px 1px 2px rgba(0, 0, 0, .75);
font-family: "Exo2-0-LightItalic", sans-serif; font-family: "Exo2-0-LightItalic", sans-serif;
@ -578,6 +590,19 @@ a:active {
line-height: 1em; line-height: 1em;
} }
/*
* User Background
*/
#userBackground {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: -1;
background: no-repeat center center / cover transparent;
}
/* /*
* Homepage * Homepage
*/ */

View file

@ -488,7 +488,7 @@ function formToObject(formId) {
if(typeof children[i] == 'object') { if(typeof children[i] == 'object') {
requestParts[children[i].name] = ((typeof children[i].type !== "undefined" && children[i].type.toLowerCase() == "checkbox") ? children[i].checked : children[i].value); requestParts[children[i].name] = ((typeof children[i].type !== "undefined" && children[i].type.toLowerCase() == "checkbox") ? (children[i].checked ? 1 : 0) : children[i].value);
} }

View file

@ -1,22 +0,0 @@
<?php
/*
* Sakura Private Messages
*/
// Declare Namespace
namespace Sakura;
// Include components
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) .'_sakura/sakura.php';
// Add page specific things
$renderData['page'] = [
'title' => 'Inbox'
];
$renderData['messages'] = Users::getPrivateMessages();
// Print page contents
print Templates::render('main/messages.tpl', $renderData);

View file

@ -19,7 +19,7 @@ $renderData['profile'] = $profile;
// Set proper page title // Set proper page title
$renderData['page']['title'] = ( $renderData['page']['title'] = (
$profile->data['id'] < 1 || $profile->data['password_algo'] == 'nologin' $profile->checkPermission('SITE', 'DEACTIVATED') || $profile->data['password_algo'] == 'nologin' || ($profile->checkPermission('SITE', 'RESTRICTED') && ($profile->data['id'] != $currentUser->data['id'] && !$currentUser->checkPermission('MANAGE', 'USE_MANAGE')))
? 'User not found!' ? 'User not found!'
: 'Profile of '. $profile->data['username'] : 'Profile of '. $profile->data['username']

View file

@ -322,9 +322,6 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
} }
if(empty($_FILES[$mode]))
die('yes');
// Check if the upload went properly // Check if the upload went properly
if($_FILES[$mode]['error'] !== UPLOAD_ERR_OK && $_FILES[$mode]['error'] !== UPLOAD_ERR_NO_FILE) { if($_FILES[$mode]['error'] !== UPLOAD_ERR_OK && $_FILES[$mode]['error'] !== UPLOAD_ERR_NO_FILE) {
@ -537,9 +534,12 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
foreach($field['additional'] as $addKey => $addVal) { foreach($field['additional'] as $addKey => $addVal) {
// Skip if the value is empty // Skip if the value is empty
if(!isset($_POST['profile_additional_'. $addKey]) || empty($_POST['profile_additional_'. $addKey])) if(!isset($_POST['profile_additional_'. $addKey]) || empty($_POST['profile_additional_'. $addKey])) {
continue; continue;
}
// Add to the array // Add to the array
$store[$addKey] = $_POST['profile_additional_'. $addKey]; $store[$addKey] = $_POST['profile_additional_'. $addKey];
@ -574,20 +574,16 @@ if(isset($_REQUEST['request-notifications']) && $_REQUEST['request-notifications
// Go over each field // Go over each field
foreach($fields as $field) { foreach($fields as $field) {
// Add to the store array // Make sure the user has sufficient permissions to complete this action
if(isset($_POST['option_'. $field['id']]) && !empty($_POST['option_'. $field['id']])) { if(!$currentUser->checkPermission('SITE', $field['require_perm'])) {
// Make sure the user has sufficient permissions to complete this action $store[$field['id']] = false;
if(!$currentUser->checkPermission('SITE', $field['require_perm'])) { continue;
continue;
}
$store[$field['id']] = $_POST['option_'. $field['id']];
} }
$store[$field['id']] = isset($_POST['option_'. $field['id']]) && !empty($_POST['option_'. $field['id']]) ? $_POST['option_'. $field['id']] : null;
} }
// Update database // Update database
@ -666,73 +662,358 @@ if(Users::checkLogin()) {
// Settings page list // Settings page list
$pages = [ $pages = [
'home' => ['General', 'Home', ['Welcome to the Settings Panel. From here you can monitor, view and update your profile and preferences.']], 'general' => [
'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.']], 'title' => 'General',
'groups' => ['General', 'Groups', ['{{ user.colour }}']],
'friendlisting' => ['Friends', 'List', ['Manage your friends.']], 'modes' => [
'friendrequests' => ['Friends', 'Requests', ['Handle friend requests.']],
'notifications' => ['Notifications', 'History', ['This is the history of notifications that have been sent to you.']], 'home' => [
'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 }}.']], 'title' => 'Home',
'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>']], 'description' => [
'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>']], 'Welcome to the Settings Panel. From here you can monitor, view and update your profile and preferences.'
'usertitle' => ['Account', 'User Title', ['That little piece of text displayed under your username on your profile.']],
'password' => ['Account', 'Password', ['Used to authenticate with the site and certain related services.']], ],
'ranks' => ['Account', 'Ranks', ['Manage what ranks you\'re in and what is set as your main rank. Your main rank is highlighted. You get the permissions of all of the ranks you\'re in combined.']], 'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED')
'sessions' => ['Danger zone', 'Sessions', ['Session keys are a way of identifying yourself with the system without keeping your password in memory.', 'If someone finds one of your session keys they could possibly compromise your account, if you see any sessions here that shouldn\'t be here hit the Kill button to kill the selected session.', 'If you get logged out after clicking one you\'ve most likely killed your current session, to make it easier to avoid this from happening your current session is highlighted.']],
'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 :(.']], 'profile' => [
'notfound' => ['Settings', '404', ['This is an error.']]
'title' => 'Edit Profile',
'description' => [
'These are the external account links etc. on your profile, shouldn\'t need any additional explanation for this one.'
],
'access' => $currentUser->checkPermission('SITE', 'ALTER_PROFILE')
],
'options' => [
'title' => 'Site Options',
'description' => [
'These are a few personalisation options for the site while you\'re logged in.'
],
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED')
],
'groups' => [
'title' => 'Groups',
'description' => [
'{{ user.colour }}'
],
'access' => $currentUser->checkPermission('SITE', 'JOIN_GROUPS')
]
]
],
'friends' => [
'title' => 'Friends',
'modes' => [
'listing' => [
'title' => 'Listing',
'description' => [
'Manage your friends.'
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS')
],
'requests' => [
'title' => 'Requests',
'description' => [
'Handle friend requests.'
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_FRIENDS')
]
]
],
'messages' => [
'title' => 'Messages',
'modes' => [
'inbox' => [
'title' => 'Inbox',
'description' => [
'The list of messages you\'ve received.'
],
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES')
],
'sent' => [
'title' => 'Sent',
'description' => [
'The list of messages you\'ve sent to other users.'
],
'access' => $currentUser->checkPermission('SITE', 'USE_MESSAGES')
],
'compose' => [
'title' => 'Compose',
'description' => [
'Write a new message.'
],
'access' => $currentUser->checkPermission('SITE', 'SEND_MESSAGES')
]
]
],
'notifications' => [
'title' => 'Notifications',
'modes' => [
'history' => [
'title' => 'History',
'description' => [
'The history of notifications that have been sent to you.'
],
'access' => !$currentUser->checkPermission('SITE', 'DEACTIVATED')
]
]
],
'appearance' => [
'title' => 'Appearance',
'modes' => [
'avatar' => [
'title' => 'Avatar',
'description' => [
'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 }}.'
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_AVATAR')
],
'background' => [
'title' => 'Background',
'description' => [
'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 }}.'
],
'access' => (isset($currentUser->data['userData']['profileBackground']) && $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND')
],
'userpage' => [
'title' => 'Userpage',
'description' => [
'The custom text that is displayed on your profile.'
],
'access' => (isset($currentUser->data['userData']['userPage']) && $currentUser->checkPermission('SITE', 'CHANGE_USERPAGE')) || $currentUser->checkPermission('SITE', 'CREATE_USERPAGE')
]
]
],
'account' => [
'title' => 'Account',
'modes' => [
'email' => [
'title' => 'E-mail Address',
'description' => [
'You e-mail address is used for password recovery and stuff like that, we won\'t spam you ;).'
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_EMAIL')
],
'username' => [
'title' => 'Username',
'description' => [
'Probably the biggest part of your identity on a site.',
'<b>You can only change this once every 30 days so choose wisely.</b>'
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERNAME')
],
'usertitle' => [
'title' => 'Username',
'description' => [
'That little piece of text displayed under your username on your profile.'
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_USERTITLE')
],
'password' => [
'title' => 'Password',
'description' => [
'Used to authenticate with the site and certain related services.'
],
'access' => $currentUser->checkPermission('SITE', 'CHANGE_PASSWORD')
],
'ranks' => [
'title' => 'Ranks',
'description' => [
'Manage what ranks you\'re in and what is set as your main rank. Your main rank is highlighted. You get the permissions of all of the ranks you\'re in combined.'
],
'access' => $currentUser->checkPermission('SITE', 'ALTER_RANKS')
]
]
],
'advanced' => [
'title' => 'Advanced',
'modes' => [
'sessions' => [
'title' => 'Sessions',
'description' => [
'Session keys are a way of identifying yourself with the system without keeping your password in memory.',
'If someone finds one of your session keys they could possibly compromise your account, if you see any sessions here that shouldn\'t be here hit the Kill button to kill the selected session.',
'If you get logged out after clicking one you\'ve most likely killed your current session, to make it easier to avoid this from happening your current session is highlighted.'
],
'access' => $currentUser->checkPermission('SITE', 'MANAGE_SESSIONS')
],
'registrationkeys' => [
'title' => 'Registration Keys',
'description' => [
'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.'
],
'access' => $currentUser->checkPermission('SITE', 'CREATE_REGKEYS')
],
'deactivate' => [
'title' => 'Deactivate Account',
'description' => [
'You can deactivate your account here if you want to leave :(.'
],
'access' => $currentUser->checkPermission('SITE', 'DEACTIVATE_ACCOUNT')
]
]
]
]; ];
// Current settings page // Current settings page
$currentPage = isset($_GET['mode']) ? (array_key_exists($_GET['mode'], $pages) ? $_GET['mode'] : 'notfound') : 'home'; $category = isset($_GET['cat']) ? (array_key_exists($_GET['cat'], $pages) ? $_GET['cat'] : false) : array_keys($pages)[0];
$mode = isset($_GET['mode']) && $category ? (array_key_exists($_GET['mode'], $pages[$category]['modes']) ? $_GET['mode'] : false) : array_keys($pages[array_keys($pages)[0]]['modes'])[0];
// Not found
if(!$category || empty($category) || !$mode || empty($mode) || !$pages[$category]['modes'][$mode]['access']) {
header('HTTP/1.0 404 Not Found');
print Templates::render('errors/http404.tpl', $renderData);
exit;
}
// Render data // Render data
$renderData['current'] = $currentPage; $renderData['current'] = $category .'.'. $mode;
// Settings pages
$renderData['pages'] = $pages;
// Page data
$renderData['page'] = [ $renderData['page'] = [
'title' => $pages[$currentPage][0] .' / '. $pages[$currentPage][1], 'title' => $pages[$category]['title'] .' / '. $pages[$category]['modes'][$mode]['title'],
'currentPage' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0, 'currentPage' => isset($_GET['page']) && ($_GET['page'] - 1) >= 0 ? $_GET['page'] - 1 : 0,
'description' => $pages[$currentPage][2] 'description' => $pages[$category]['modes'][$mode]['description']
]; ];
// Section specific // Section specific
switch($currentPage) { switch($category .'.'. $mode) {
// Homepage // Homepage
case 'home': case 'general.home':
$renderData['settings'] = [ $renderData['settings'] = [
'friends' => Users::getFriends(null, true, true, true) 'friends' => Users::getFriends(null, true, true, true)
]; ];
break; break;
// Avatar and background sizes
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;
// Profile // Profile
case 'userpage': case 'general.profile':
break;
// Profile
case 'profile':
$renderData['profile'] = [ $renderData['profile'] = [
'user' => $currentUser->profileFields(), 'user' => $currentUser->profileFields(),
@ -742,7 +1023,7 @@ if(Users::checkLogin()) {
break; break;
// Options // Options
case 'options': case 'general.options':
$renderData['options'] = [ $renderData['options'] = [
'user' => $currentUser->optionFields(), 'user' => $currentUser->optionFields(),
@ -752,20 +1033,45 @@ if(Users::checkLogin()) {
break; break;
// Friends // Friends
case 'friendlisting': case 'friends.listing':
$renderData['friends'] = array_chunk(array_reverse(Users::getFriends(null, true, true)), 12, true); $renderData['friends'] = array_chunk(array_reverse(Users::getFriends(null, true, true)), 12, true);
break; break;
// Pending Friend Requests // Pending Friend Requests
case 'friendrequests': case 'friends.requests':
$renderData['friends'] = array_chunk(array_reverse(Users::getPendingFriends(null, true)), 12, true); $renderData['friends'] = array_chunk(array_reverse(Users::getPendingFriends(null, true)), 12, true);
break; break;
// PM inbox
case 'messages.inbox':
$renderData['messages'] = Users::getPrivateMessages();
break;
// Notification history // Notification history
case 'notifications': case 'notifications.history':
$renderData['notifs'] = array_chunk(array_reverse(Users::getNotifications(null, 0, false, true)), 10, true); $renderData['notifs'] = array_chunk(array_reverse(Users::getNotifications(null, 0, false, true)), 10, true);
break; break;
// Avatar and background sizes
case 'appearance.avatar':
case 'appearance.background':
$renderData[$mode] = [
'max_width' => Configuration::getConfig($mode .'_max_width'),
'max_height' => Configuration::getConfig($mode .'_max_height'),
'min_width' => Configuration::getConfig($mode .'_min_width'),
'min_height' => Configuration::getConfig($mode .'_min_height'),
'max_size' => Configuration::getConfig($mode .'_max_fsize'),
'max_size_view' => Main::getByteSymbol(Configuration::getConfig($mode .'_max_fsize'))
];
break;
// Profile
case 'appearance.userpage':
break;
} }
// Print page contents // Print page contents