r20151107

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-11-07 23:58:02 +01:00
parent 0be985edeb
commit 2a642ce381
49 changed files with 347 additions and 352 deletions

View file

@ -159,10 +159,10 @@ class Permissions
$user = new User($uid);
// Attempt to get the permission row of a user
$userPerms = Database::fetch('permissions', false, ['rank_id' => [0, '='], 'user_id' => [$user->data['user_id'], '=']]);
$userPerms = Database::fetch('permissions', false, ['rank_id' => [0, '='], 'user_id' => [$user->id(), '=']]);
// Get their rank permissions
$rankPerms = self::getRankPermissions(json_decode($user->data['user_ranks'], true));
$rankPerms = self::getRankPermissions(json_decode($user->ranks(), true));
// Just return the rank permissions if no special ones are set
if (empty($userPerms)) {

View file

@ -12,9 +12,9 @@ namespace Sakura;
class User
{
// User data
public $data = [];
public $ranks = [];
public $mainRank = [];
private $data = [];
private $ranks = [];
private $mainRank = [];
// Initialise the user object
public function __construct($uid)
@ -37,12 +37,10 @@ class User
// Decode the json in the user_data column
$this->data['user_data'] = json_decode(!empty($this->data['user_data']) ? $this->data['user_data'] : '[]', true);
// Decode the ranks json array
$ranks = json_decode($this->data['user_ranks'], true);
$this->data['ranks'] = json_decode($this->data['user_ranks'], true);
// Get the rows for all the ranks
foreach ($ranks as $rank) {
foreach ($this->data['ranks'] as $rank) {
// Store the database row in the array
$this->ranks[$rank] = new Rank($rank);
}
@ -61,6 +59,116 @@ class User
];
}
// Get user id
public function id()
{
return $this->data['user_id'];
}
// Get username (or clean variant)
public function username($clean = false)
{
return $this->data['username' . ($clean ? '_clean' : '')];
}
// Get password data
public function password()
{
return [
'password_hash' => $this->data['password_hash'],
'password_salt' => $this->data['password_salt'],
'password_algo' => $this->data['password_algo'],
'password_iter' => $this->data['password_iter'],
'password_chan' => $this->data['password_chan'],
'password_new' => $this->data['password_new'],
];
}
// Get email
public function email()
{
return $this->data['email'];
}
// Get main rank id
public function mainRank()
{
return $this->data['rank_main'];
}
// Get all rank ids
public function ranks()
{
return $this->data['user_ranks'];
}
// Get the user's colour
public function colour()
{
return empty($this->data['user_colour']) ? $this->mainRank->colour() : $this->data['user_colour'];
}
// Get the user's ip
public function ip($last = false)
{
return $this->data[($last ? 'last' : 'register') . '_ip'];
}
// Get the user's title
public function userTitle()
{
return empty($this->data['user_title']) ? $this->mainRank->title() : $this->data['user_title'];
}
// Get user event times
public function dates()
{
return [
'joined' => $this->data['user_registered'],
'lastOnline' => $this->data['user_last_online'],
'birth' => $this->data['user_birthday'],
];
}
// Get the user's long and short country names
public function country()
{
return [
'long' => Main::getCountryName($this->data['user_country']),
'short' => $this->data['user_country'],
];
}
// Get the user's raw additional settings
public function userData()
{
return $this->data['user_data'];
}
// Check if a user is online
public function checkOnline()
{
return $this->data['user_last_online'] > (time() - Config::getConfig('max_online_time'));
}
// Get user's forum statistics
public function forumStats()
{
return Forums::getUserStats($this->data['user_id']);
}
// Get amount of time since user events using the same format as dates()
public function elapsed($append = ' ago', $none = 'Just now')
{
$times = [];
foreach ($this->dates() as $key => $val) {
$times[$key] = Main::timeElapsed(is_string($val) ? strtotime($val) : $val, $append, $none);
}
return $times;
}
// Check if the user has the specified ranks
public function checkIfUserHasRanks($ranks)
{
@ -81,39 +189,6 @@ class User
return false;
}
// Get the user's colour
public function colour()
{
return empty($this->data['user_colour']) ? $this->mainRank->colour() : $this->data['user_colour'];
}
// Get the user's title
public function userTitle()
{
return empty($this->data['user_title']) ? $this->mainRank->title() : $this->data['user_title'];
}
// Get the user's long and short country names
public function country()
{
return [
'long' => Main::getCountryName($this->data['user_country']),
'short' => $this->data['user_country'],
];
}
// Check if a user is online
public function checkOnline()
{
return $this->data['user_last_online'] > (time() - Config::getConfig('max_online_time'));
}
// Get user's forum statistics
public function forumStats()
{
return Forums::getUserStats($this->data['user_id']);
}
// Add a new friend
public function addFriend($uid)
{
@ -225,16 +300,6 @@ class User
return new Comments('profile-' . $this->data['user_id']);
}
// Get amount of time since user events
public function elapsed($append = ' ago', $none = 'Just now')
{
return [
'joined' => Main::timeElapsed($this->data['user_registered'], $append, $none),
'lastOnline' => Main::timeElapsed($this->data['user_last_online'], $append, $none),
'birth' => Main::timeElapsed(strtotime($this->data['user_birthday']), $append, $none),
];
}
// Get the user's profile fields
public function profileFields()
{

View file

@ -51,7 +51,6 @@ class Users
// Check if a user is logged in
public static function checkLogin($uid = null, $sid = null)
{
// Assign $uid and $sid
$uid = $uid ? $uid : (isset($_COOKIE[Config::getConfig('cookie_prefix') . 'id'])
? $_COOKIE[Config::getConfig('cookie_prefix') . 'id']
@ -130,7 +129,6 @@ class Users
// Log a user in
public static function login($username, $password, $remember = false, $cookies = true)
{
// Check if authentication is disallowed
if (Config::getConfig('lock_authentication')) {
return [0, 'AUTH_LOCKED'];
@ -153,10 +151,10 @@ class Users
}
// Get account data
$user = self::getUser($uid);
$user = new User($uid);
// Validate password
switch ($user['password_algo']) {
switch ($user->password()['password_algo']) {
// Abyssing
case 'nologin':
return [0, 'NO_LOGIN'];
@ -164,12 +162,12 @@ class Users
// Default hashing method
default:
if (!Hashing::validatePassword($password, [
$user['password_algo'],
$user['password_iter'],
$user['password_salt'],
$user['password_hash'],
$user->password()['password_algo'],
$user->password()['password_iter'],
$user->password()['password_salt'],
$user->password()['password_hash'],
])) {
return [0, 'INCORRECT_PASSWORD', $user['user_id'], $user['password_chan']];
return [0, 'INCORRECT_PASSWORD', $user->id(), $user->password()['password_chan']];
}
}
@ -213,7 +211,6 @@ class Users
// Logout and kill the session
public static function logout()
{
// Check if user is logged in
if (!$check = self::checkLogin()) {
return false;
@ -247,7 +244,6 @@ class Users
// Register user
public static function register($username, $password, $confirmpass, $email, $tos, $captcha = null, $regkey = null)
{
// Check if authentication is disallowed
if (Config::getConfig('lock_authentication')) {
return [0, 'AUTH_LOCKED'];
@ -362,7 +358,6 @@ class Users
// Check if a user exists and then send the password forgot email
public static function sendPasswordForgot($username, $email)
{
// Check if authentication is disallowed
if (Config::getConfig('lock_authentication')) {
return [0, 'AUTH_LOCKED'];
@ -419,7 +414,6 @@ class Users
// Reset password with key
public static function resetPassword($verk, $uid, $newpass, $verpass)
{
// Check if authentication is disallowed
if (Config::getConfig('lock_authentication')) {
return [0, 'AUTH_LOCKED'];
@ -468,7 +462,6 @@ class Users
// Check if a user exists and then resend the activation e-mail
public static function resendActivationMail($username, $email)
{
// Check if authentication is disallowed
if (Config::getConfig('lock_authentication')) {
return [0, 'AUTH_LOCKED'];
@ -554,7 +547,6 @@ class Users
// Activating a user
public static function activateUser($uid, $requireKey = false, $key = null)
{
// Get the user data
$user = Database::fetch('users', false, ['user_id' => [$uid, '=']]);
@ -607,7 +599,6 @@ class Users
// Deactivating a user
public static function deactivateUser($uid)
{
// Get the user data
$user = Database::fetch('users', false, ['user_id' => [$uid, '=']]);
@ -639,7 +630,6 @@ class Users
// Check if registration code is valid
public static function checkRegistrationCode($code)
{
// Get registration key
$keyRow = Database::fetch('regcodes', true, ['code' => [$code, '='], 'key_used' => [0, '=']]);
@ -650,7 +640,6 @@ class Users
// Mark registration code as used
public static function markRegistrationCodeUsed($code, $uid = 0)
{
// Check if the code exists
if (!$id = self::checkRegistrationCode($code)) {
return false;
@ -674,7 +663,6 @@ class Users
// Create new registration code
public static function createRegistrationCode($userId)
{
// Check if we're logged in
if (!self::checkLogin()) {
return false;
@ -707,15 +695,11 @@ class Users
// Set the default rank of a user
public static function setDefaultRank($uid, $rid, $userIdIsUserData = false)
{
// Get the specified user
$user = $userIdIsUserData ? $uid : self::getUser($uid);
// Decode the json
$ranks = json_decode($user['user_ranks'], true);
$user = new User($uid);
// Check if the rank we're trying to set is actually there
if (!in_array($rid, $ranks)) {
if (!in_array($rid, $user->ranks())) {
return false;
}
@ -736,15 +720,11 @@ class Users
// Add a rank to a user
public static function addRanksToUser($ranks, $uid, $userIdIsUserData = false)
{
// Get the specified user
$user = $userIdIsUserData ? $uid : self::getUser($uid);
// Decode the array
$current = json_decode($user['user_ranks'], true);
$user = new User($uid);
// Go over all the new ranks
foreach ($ranks as $rank) {
foreach ($user->ranks() as $rank) {
// Check if the user already has this rank and set it if not
if (!in_array($rank, $current)) {
$current[] = (int) $rank;
@ -771,17 +751,13 @@ class Users
// Removing ranks from a user
public static function removeRanksFromUser($ranks, $uid, $userIdIsUserData = false)
{
// Get the specified user
$user = $userIdIsUserData ? $uid : self::getUser($uid);
// Get the ranks
$current = json_decode($user['user_ranks'], true);
$user = new User($uid);
// Check the current ranks for ranks in the set array
foreach ($current as $key => $rank) {
// Unset the rank
if (in_array($rank, $ranks)) {
if (in_array($rank, $user->ranks())) {
unset($current[$key]);
}
}
@ -806,13 +782,12 @@ class Users
// Check if a user has these ranks
public static function checkIfUserHasRanks($ranks, $userid, $userIdIsUserData = false)
{
return $userIdIsUserData ? $userid->checkIfUserHasRanks($ranks) : (new User($userid))->checkIfUserHasRanks($ranks);
return (new User($userid))->checkIfUserHasRanks($ranks);
}
// Check if a user exists
public static function userExists($user, $id = true)
{
// Clean string
$user = Main::cleanString($user, true);
@ -826,7 +801,6 @@ class Users
// Get the available profile fields
public static function getProfileFields()
{
// Get profile fields
$profileFields = Database::fetch('profilefields');
@ -852,7 +826,6 @@ class Users
// Get the available option fields
public static function getOptionFields()
{
// Get option fields
$optionFields = Database::fetch('optionfields');
@ -880,7 +853,6 @@ class Users
// Get user's profile fields
public static function getUserProfileFields($id, $inputIsData = false)
{
// Get profile fields
$profileFields = Database::fetch('profilefields');
@ -890,7 +862,7 @@ class Users
}
// Assign the profileData variable
$profileData = ($inputIsData ? $id : self::getUser($id)['user_data']);
$profileData = ($inputIsData ? $id : (new User($id))->userData());
// Once again if nothing was returned just return null
if (count($profileData) < 1 || $profileData == null || empty($profileData['profileFields'])) {
@ -949,9 +921,8 @@ class Users
// Updating the profile data of a user
public static function updateUserDataField($id, $data)
{
// We retrieve the current content from the database
$current = self::getUser($id)['user_data'];
$current = (new User($id))->userData();
// Merge the arrays
$data = array_merge($current, $data);
@ -973,37 +944,31 @@ class Users
// Check if a user is online
public static function checkUserOnline($id)
{
// Get user
$user = self::getUser($id);
// Return false if the user doesn't exist because a user that doesn't exist can't be online
if (empty($user)) {
return false;
}
// Return true if the user was online in the last 5 minutes
return ($user['user_last_online'] > (time() - 500));
return (new User($id))->checkOnline();
}
// Get all online users
public static function checkAllOnline()
{
// Assign time - 500 to a variable
$time = time() - 500;
$time = time() - Config::getConfig('max_online_time');
$return = [];
// Get all online users in the past 5 minutes
$getAll = Database::fetch('users', true, ['user_last_online' => [$time, '>']]);
foreach ($getAll as $user) {
$return[] = new User($user['user_id']);
}
// Return all the online users
return $getAll;
return $return;
}
// Add premium to a user
public static function addUserPremium($id, $seconds)
{
// Check if there's already a record of premium for this user in the database
$getUser = Database::fetch('premium', false, [
'user_id' => [$id, '='],
@ -1046,7 +1011,6 @@ class Users
// Check if user has Premium
public static function checkUserPremium($id)
{
// Check if the user has static premium
if (Permissions::check('SITE', 'STATIC_PREMIUM', $id, 1)) {
return [2, 0, time() + 1];
@ -1076,7 +1040,6 @@ class Users
// Update the premium data
public static function updatePremiumMeta($id)
{
// Get the ID for the premium user rank from the database
$premiumRank = Config::getConfig('premium_rank_id');
@ -1089,7 +1052,7 @@ class Users
self::addRanksToUser([$premiumRank], $id);
// Check if the user's default rank is standard user and update it to premium
if (self::getUser($id)['rank_main'] == 2) {
if (((new User($id))->mainRank()) == 2) {
self::setDefaultRank($id, $premiumRank);
}
} elseif ($check[0] == 0 && count($check) > 1) {
@ -1098,26 +1061,9 @@ class Users
}
}
// Get user data by id
public static function getUser($id)
{
// If user was found return user data
return (new User($id))->data;
}
// Get rank data by id
public static function getRank($id)
{
// If rank was found return rank data
return (new Rank($id))->data;
}
// Get user(s) by IP
public static function getUsersByIP($ip)
{
// Get users by registration IP
$registeredFrom = Database::fetch('users', true, ['register_ip' => [$ip, '=']]);
@ -1134,7 +1080,6 @@ class Users
// Get users in rank
public static function getUsersInRank($rankId, $users = null, $excludeAbyss = true)
{
// Get all users (or use the supplied user list to keep server load down)
if (!$users) {
$users = self::getAllUsers();
@ -1147,7 +1092,7 @@ class Users
foreach ($users as $user) {
// If so store the user's row in the array
if (self::checkIfUserHasRanks([$rankId], $user, true)
&& ($excludeAbyss ? $user->data['password_algo'] != 'nologin' : true)) {
&& ($excludeAbyss ? $user->password()['password_algo'] != 'nologin' : true)) {
$rank[] = $user;
}
}
@ -1159,7 +1104,6 @@ class Users
// Get all users
public static function getAllUsers($includeInactive = true, $includeAbyss = false)
{
// Execute query
$getUsers = Database::fetch('users', true);
@ -1188,7 +1132,6 @@ class Users
// Get all ranks
public static function getAllRanks()
{
// Execute query
$getRanks = Database::fetch('ranks', true);
@ -1207,7 +1150,6 @@ class Users
// Get all warnings issued to a user (or all warnings a user issued)
public static function getWarnings($uid = 0, $iid = false)
{
// Do the database query
$warnings = Database::fetch('warnings', true, ($uid ? [
($iid ? 'moderator_id' : 'user_id') => [$uid, '='],
@ -1220,7 +1162,6 @@ class Users
// Get a user's notifications
public static function getNotifications($uid = null, $timediff = 0, $excludeRead = true, $markRead = false)
{
// Prepare conditions
$conditions = [];
$conditions['user_id'] = [($uid ? $uid : self::checkLogin()[0]), '='];
@ -1257,7 +1198,6 @@ class Users
// Marking notifications as read
public static function markNotificationRead($id, $mode = true)
{
// Execute an update statement
Database::update('notifications', [
[
@ -1272,7 +1212,6 @@ class Users
// Adding a new notification
public static function createNotification($user, $title, $text, $timeout = 60000, $img = 'FONT:fa-info-circle', $link = '', $sound = 0)
{
// Get current timestamp
$time = time();
@ -1293,35 +1232,12 @@ class Users
// Getting a user's PMs
public static function getPrivateMessages($from = false)
{
// Get all messages from the database
$messages = Database::fetch('messages', true, [
($from ? 'from_user' : 'to_user') => [self::checkLogin()[0], '='],
]);
// Prepare a storage array
$store = [];
// Go over each message and check if they are for the current user
foreach ($messages as $message) {
// Store the message
$store[$message['id']] = $message;
// Store user data as well
$store[$message['id']]['data']['from']['user'] = ($_MSG_USR = self::getUser($message['from_user']));
$store[$message['id']]['data']['from']['rank'] = self::getRank($_MSG_USR['rank_main']);
$store[$message['id']]['data']['to']['user'] = ($_MSG_USR = self::getUser($message['to_user']));
$store[$message['id']]['data']['to']['rank'] = self::getRank($_MSG_USR['rank_main']);
}
// Return store array
return $store;
return [];
}
// Get friends
public static function getFriends($uid = null, $timestamps = false, $getData = false, $checkOnline = false)
{
// Assign $uid
if (!$uid) {
$uid = Users::checkLogin()[0];
@ -1340,8 +1256,8 @@ class Users
// Add friend to array
$friends[($timestamps ? $friend['friend_id'] : $key)] = $getData ? ([
'user' => ($_UDATA = self::getUser($friend['friend_id'])),
'rank' => self::getRank($_UDATA['rank_main']),
'user' => ($_UDATA = new User($friend['friend_id'])),
'rank' => new Rank($_UDATA->mainRank()),
]) : $friend[($timestamps ? 'friend_timestamp' : 'friend_id')];
}
@ -1351,7 +1267,7 @@ class Users
// Check each user
foreach ($friends as $key => $friend) {
$friends[
self::checkUserOnline($getData ? $friend['user']['user_id'] : $friend) ? 'online' : 'offline'
self::checkUserOnline($getData ? $friend['user']->id() : $friend) ? 'online' : 'offline'
][] = $friend;
}
}
@ -1363,7 +1279,6 @@ class Users
// Get non-mutual friends
public static function getPendingFriends($uid = null, $getData = false)
{
// Assign $of automatically if it's not set
if (!$uid) {
$uid = self::checkLogin()[0];
@ -1386,8 +1301,8 @@ class Users
if (!$user->checkFriends($friend['user_id'])) {
$pending[] = $getData ? ([
'user' => ($_UDATA = self::getUser($friend['user_id'])),
'rank' => self::getRank($_UDATA['rank_main']),
'user' => ($_UDATA = new User($friend['user_id'])),
'rank' => new Rank($_UDATA->mainRank()),
]) : $friend;
}

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20151106');
define('SAKURA_VERSION', '20151107');
define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false);
@ -103,11 +103,7 @@ $templateName =
defined('SAKURA_MANAGE') ?
Config::getConfig('manage_style') :
(
(
isset($currentUser->data['user_data']['userOptions']['useMisaki']) &&
$currentUser->data['user_data']['userOptions']['useMisaki'] &&
$currentUser->checkPermission('SITE', 'ALTER_PROFILE')
) ?
$currentUser->optionFields()['useMisaki'] ?
'misaki' :
Config::getConfig('site_style')
);
@ -197,7 +193,7 @@ if (!defined('SAKURA_NO_TPL')) {
}
// Ban checking
if ($authCheck && $ban = Bans::checkBan($currentUser->data['user_id'])) {
if ($authCheck && $ban = Bans::checkBan($currentUser->id())) {
// Additional render data
$renderData = array_merge($renderData, [

View file

@ -85,9 +85,9 @@
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="color: {{ user.colour }};">{{ user.data.username }} <span class="caret"></span></a>
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false" style="color: {{ user.colour }};">{{ user.username }} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="{{ urls.format('USER_PROFILE', [user.data.user_id]) }}">View Profile</a></li>
<li><a href="{{ urls.format('USER_PROFILE', [user.id]) }}">View Profile</a></li>
<li><a href="{{ urls.format('SETTINGS_INDEX') }}">Site settings</a></li>
<li role="separator" class="divider"></li>
<li><a href="{{ urls.format('SITE_HOME') }}">Back to site</a></li>

View file

@ -1,4 +1,4 @@
{% if not (viewPost and postExists) %}<h3 class="miotitle" id="{{ newsPost.id }}">{{ post.title }} by <a href="{{ urls.format('USER_PROFILE', [post.poster.data.id]) }}" style="text-decoration: none !important; color: {{ post.poster.colour }} !important;">{{ post.poster.data.username }}</a> - {{ post.date|date(sakura.dateFormat) }}<span class="permalink"><a href="{{ urls.format('SITE_NEWS') }}#{{ newsPost.id }}" title="Permalink">#</a> <a href="{{ urls.format('SITE_NEWS_POST', [post.id]) }}" title="Direct Link">@</a></span></h3>{% endif %}
{% if not (viewPost and postExists) %}<h3 class="miotitle" id="{{ newsPost.id }}">{{ post.title }} by <a href="{{ urls.format('USER_PROFILE', [post.poster.id]) }}" style="text-decoration: none !important; color: {{ post.poster.colour }} !important;">{{ post.poster.username }}</a> - {{ post.date|date(sakura.dateFormat) }}<span class="permalink"><a href="{{ urls.format('SITE_NEWS') }}#{{ newsPost.id }}" title="Permalink">#</a> <a href="{{ urls.format('SITE_NEWS_POST', [post.id]) }}" title="Direct Link">@</a></span></h3>{% endif %}
<div class="postcontent">
{{ post.content_parsed|raw }}
</div>

View file

@ -3,13 +3,13 @@
<a class="news-title floatLeft" href="{{ urls.format('SITE_NEWS_POST', [post.news_id]) }}">{{ post.news_title }}</a>
<div class="news-details floatRight">
<div>{{ post.news_timestamp|date(sakura.dateFormat) }}</div>
<div>Posted by <a class="username" style="color: {{ post.news_poster.colour }};" href="{{ urls.format('USER_PROFILE', [post.news_poster.data.user_id]) }}">{{ post.news_poster.data.username }}</a>{% if not (viewPost and postExists) %} / <a class="default" href="{{ urls.format('SITE_NEWS_POST', [post.news_id]) }}#comments">{{ post.news_comments.count }} comment{% if post.news_comments.count != 1 %}s{% endif %}</a>{% endif %}</div>
<div>Posted by <a class="username" style="color: {{ post.news_poster.colour }};" href="{{ urls.format('USER_PROFILE', [post.news_poster.id]) }}">{{ post.news_poster.username }}</a>{% if not (viewPost and postExists) %} / <a class="default" href="{{ urls.format('SITE_NEWS_POST', [post.news_id]) }}#comments">{{ post.news_comments.count }} comment{% if post.news_comments.count != 1 %}s{% endif %}</a>{% endif %}</div>
</div>
<div class="clear"></div>
</div>
<div class="news-content">
<div class="news-avatar">
<img src="{{ urls.format('IMAGE_AVATAR', [post.news_poster.data.user_id]) }}" alt="{{ post.news_poster.data.username }}" />
<img src="{{ urls.format('IMAGE_AVATAR', [post.news_poster.id]) }}" alt="{{ post.news_poster.username }}" />
</div>
<div class="news-text">
{{ post.news_content_parsed|raw }}

View file

@ -11,10 +11,10 @@
<span>{{ stats.onlineUsers|length }}</span>
</div>
</div>
<div title="Our newest user is {{ stats.newestUser.data.username }}">
<div title="Our newest user is {{ stats.newestUser.username }}">
<div>
<span class="fa fa-user-plus"></span>
<span><a href="/u/{{ stats.newestUser.data.user_id }}" style="color: {{ stats.newestUser.colour }}">{{ stats.newestUser.data.username }}</a></span>
<span><a href="/u/{{ stats.newestUser.id }}" style="color: {{ stats.newestUser.colour }}">{{ stats.newestUser.username }}</a></span>
</div>
</div>
<div title="It has been {{ stats.lastRegDate }} since the last user registered">

View file

@ -32,7 +32,7 @@
<div>
{% if forum.last_post.post_id %}
<a href="{{ urls.format('FORUM_THREAD', [forum.last_post.topic_id]) }}" class="default">{{ forum.last_post.post_subject }}</a><br />
<span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.data.user_id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.data.user_id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.data.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post_id]) }}#p{{ forum.last_post.post_id }}" class="default fa fa-tag"></a>
<span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post_id]) }}#p{{ forum.last_post.post_id }}" class="default fa fa-tag"></a>
{% else %}
There are no posts in this forum.
{% endif %}

View file

@ -62,7 +62,7 @@
// Space for things that need to happen onload
window.addEventListener("load", function() {
{% if php.self == '/profile.php' ? (profile.data.user_data.profileBackground and not profile.data.user_data.userOptions.disableProfileParallax) : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.user_data.userOptions.profileBackgroundSiteWide and user.data.user_data.profileBackground and not user.data.user_data.userOptions.disableProfileParallax) %}
{% if php.self == '/profile.php' ? (profile.userData.profileBackground and not profile.optionFields.disableProfileParallax) : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.optionFields.profileBackgroundSiteWide and user.userData.profileBackground and not user.optionFields.disableProfileParallax) %}
initialiseParallax('userBackground');
{% endif %}
@ -77,8 +77,8 @@
<div class="header-fade"></div>
<div id="notifications"></div>
<div id="wrapper">
{% if php.self == '/profile.php' ? profile.data.user_data.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.user_data.userOptions.profileBackgroundSiteWide and user.data.user_data.profileBackground) %}
<div id="userBackground" style="background-image: url('{{ urls.format('IMAGE_BACKGROUND', [(php.self == '/profile.php' ? profile : user).data.user_id]) }}');"></div>
{% if php.self == '/profile.php' ? profile.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.optionFields.profileBackgroundSiteWide and user.userData.profileBackground) %}
<div id="userBackground" style="background-image: url('{{ urls.format('IMAGE_BACKGROUND', [(php.self == '/profile.php' ? profile : user).id]) }}');"></div>
{% endif %}
<div id="navigation">
<ul class="site-menu">
@ -95,7 +95,7 @@
<a href="{% if session.checkLogin %}javascript:void(0);{% else %}{{ urls.format('SITE_LOGIN') }}{% endif %}">
<div>
<div class="nav-username"{% if session.checkLogin %} style="color: {{ user.colour }};"{% endif %}>
{% if session.checkLogin %}{{ user.data.username }} <span class="nav-user-dropdown"></span>{% else %}Guest{% endif %}
{% if session.checkLogin %}{{ user.username }} <span class="nav-user-dropdown"></span>{% else %}Guest{% endif %}
</div>
<div class="nav-userstats">
{% if session.checkLogin %}<span class="fa fa-envelope"></span> 0 / <span class="fa fa-user-plus"></span> 0 / <span class="fa fa-warning"></span> 0 / <span class="fa fa-reply"></span> 0{% else %}Please log in to proceed!{% endif %}
@ -104,7 +104,7 @@
</a>
{% if session.checkLogin %}
<ul>
<li><a href="{{ urls.format('USER_PROFILE', [user.data.user_id]) }}">My Profile</a></li>
<li><a href="{{ urls.format('USER_PROFILE', [user.id]) }}">My Profile</a></li>
<li><a href="{{ urls.format('SETTING_CAT', ['messages']) }}">Private Messages</a></li>
<li><a href="{{ urls.format('SETTINGS_INDEX') }}">User Settings</a></li>
<li><a href="{{ urls.format('MANAGE_INDEX') }}">Site Management</a></li>
@ -112,7 +112,7 @@
</ul>
{% endif %}
</li>
<li><a href="{% if session.checkLogin %}{{ urls.format('USER_PROFILE', [user.data.user_id]) }}{% else %}{{ urls.format('SITE_LOGIN') }}{% endif %}"><img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.data.username }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}');" class="nav-avatar" /></a></li>
<li><a href="{% if session.checkLogin %}{{ urls.format('USER_PROFILE', [user.id]) }}{% else %}{{ urls.format('SITE_LOGIN') }}{% endif %}"><img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.username }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.user_id]) }}');" class="nav-avatar" /></a></li>
</ul>
</div>
<div id="content">

View file

@ -3,11 +3,19 @@
{% block content %}
<div class="homepage">
{% include 'elements/statsHeader.tpl' %}
<div class="onlineUsers platform">
{% if stats.onlineUsers %}
{% for amount,onlineUser in stats.onlineUsers %}
<a href="{{ urls.format('USER_PROFILE', [onlineUser.id]) }}" style="background-color: {{ onlineUser.colour }};">{{ onlineUser.username }}</a>
{% endfor %}
{% else %}
<div>There were no online users in the past 5 minutes.</div>
{% endif %}
</div>
<div class="frontNews platform">
{% for post in news.getPosts(0, newsCount) %}
{% include 'elements/newsPost.tpl' %}
{% endfor %}
</div>
<div class="clear"></div>
</div>
{% endblock %}

View file

@ -1,22 +1,22 @@
{% extends 'global/master.tpl' %}
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.user_id != profile.data.user_id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.password.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.id != profile.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
{% set noUserpage = profile.userPage|length < 1 %}
{% set profileView = profileHidden ? 'hidden' : (noUserpage and profileView == 'index' ? 'comments' : profileView) %}
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.data.username }}{% endif %}{% endblock %}
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.username }}{% endif %}{% endblock %}
{% block css %}
<style type="text/css">
#profileHeader {
background-image: linear-gradient(0deg, transparent 0%, transparent 12%, rgba(0, 0, 0, .7) 30%,
transparent 76%, transparent 100%), url('{{ urls.format('IMAGE_HEADER', [profile.data.user_id]) }}');
transparent 76%, transparent 100%), url('{{ urls.format('IMAGE_HEADER', [profile.id]) }}');
}
#profileHeader.floating {
background-image: linear-gradient(90deg, transparent 0%, transparent 40%, #3A2E44 45%), url('{{ urls.format('IMAGE_HEADER', [profile.data.user_id]) }}');
background-image: linear-gradient(90deg, transparent 0%, transparent 40%, #3A2E44 45%), url('{{ urls.format('IMAGE_HEADER', [profile.id]) }}');
background-size: auto 130px;
background-repeat: no-repeat;
background-position: left top;
@ -44,13 +44,13 @@
{% endblock %}
{% block content %}
<div class="profile" id="u{{ profile.data.user_id }}">
<div class="profile" id="u{{ profile.id }}">
<div class="profileHeaderContent" id="profileHeader">
<div id="userAvatar" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [profile.data.user_id]) }}');">{{ profile.data.username }}'s Avatar</div>
<div id="userAvatar" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [profile.id]) }}');">{{ profile.username }}'s Avatar</div>
<div class="userData">
<div class="headerLeft">
<div class="profileUsername" style="color: {{ profile.colour }};"{% if profile.getUsernameHistory %} title="Known as {{ profile.getUsernameHistory[0]['username_old'] }} before {{ profile.getUsernameHistory[0]['change_time']|date(sakura.dateFormat) }}."{% endif %}>
{% if profileHidden %}Unknown user{% else %}{{ profile.data.username }}{% endif %}
{% if profileHidden %}Unknown user{% else %}{{ profile.username }}{% endif %}
</div>
<div class="profileUserTitle">
{% if profileHidden %}The requested user does not exist!{% else %}{{ profile.userTitle }}{% endif %}
@ -58,8 +58,8 @@
</div>
<div class="headerRight">
{% if not profileHidden %}
<div>Joined <span title="{{ profile.data.user_registered|date(sakura.dateFormat) }}">{{ profile.elapsed.joined }}</span></div>
<div>{% if profile.data.user_last_online < 1 %}User hasn't logged in yet.{% else %}Last Active <span title="{{ profile.data.user_last_online|date(sakura.dateFormat) }}">{{ profile.elapsed.lastOnline }}</span>{% endif %}</div>
<div>Joined <span title="{{ profile.dates.joined|date(sakura.dateFormat) }}">{{ profile.elapsed.joined }}</span></div>
<div>{% if profile.dates.lastOnline < 1 %}User hasn't logged in yet.{% else %}Last Active <span title="{{ profile.dates.lastOnline|date(sakura.dateFormat) }}">{{ profile.elapsed.lastOnline }}</span>{% endif %}</div>
{% endif %}
</div>
</div>
@ -91,12 +91,12 @@
<div class="profilePlatform userActions">
<div class="inner">
<ul class="actions">
{% if user.data.user_id == profile.data.user_id %}
{% if user.user_id == profile.user_id %}
<li class="edit"><a title="Edit your profile" href="{{ urls.format('SETTING_MODE', ['general', 'profile']) }}">Edit</a></li>
<li class="settings"><a title="Change your settings" href="{{ urls.format('SETTINGS_INDEX') }}">Settings</a></li>
{% else %}
<li class="{% if user.checkFriends(profile.data.user_id) == 2 %}mutualFriend{% elseif user.checkFriends(profile.data.user_id) == 1 %}pendingFriend{% else %}addFriend{% endif %}"><a href="{% if user.checkFriends(profile.data.user_id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}">{% if user.checkFriends(profile.data.user_id) == 0 %}Add friend{% else %}Friends{% endif %}</a></li>
<li class="report"><a href="{{ urls.format('USER_REPORT', [profile.data.user_id]) }}">Report</a></li>
<li class="{% if user.checkFriends(profile.id) == 2 %}mutualFriend{% elseif user.checkFriends(profile.id) == 1 %}pendingFriend{% else %}addFriend{% endif %}"><a href="{% if user.checkFriends(profile.id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}">{% if user.checkFriends(profile.id) == 0 %}Add friend{% else %}Friends{% endif %}</a></li>
<li class="report"><a href="{{ urls.format('USER_REPORT', [profile.id]) }}">Report</a></li>
{% endif %}
</ul>
</div>
@ -111,7 +111,7 @@
<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>
<a href="https://youtube.com/{% if field.youtubetype == 'true' %}channel{% else %}user{% endif %}/{{ field.value }}" class="default">{% if field.youtubetype == 'true' %}{{ profile.username }}'s Channel{% else %}{{ field.value }}{% endif %}</a>
{% else %}
{% if field.islink %}
<a href="{{ field.link }}">
@ -166,14 +166,14 @@
<div class="statsRow">
{% if profileView != (noUserpage ? 'comments' : 'index') %}
<div class="profilePlatform">
<a class="inner" title="Userpage" href="{{ urls.format('USER_PROFILE', [profile.data.user_id]) }}">
<a class="inner" title="Userpage" href="{{ urls.format('USER_PROFILE', [profile.id]) }}">
<div class="fa fa-user"></div>
</a>
</div>
{% endif %}
{% if profileView != 'friends' %}
<div class="profilePlatform">
<a class="inner" title="Friends" href="{{ urls.format('USER_FRIENDS', [profile.data.user_id]) }}">
<a class="inner" title="Friends" href="{{ urls.format('USER_FRIENDS', [profile.id]) }}">
<div class="fa fa-user-plus"></div>
<div class="count">{{ profile.getFriends|length }}</div>
</a>
@ -181,7 +181,7 @@
{% endif %}
{% if profileView != 'groups' %}
<div class="profilePlatform">
<a class="inner" title="Groups" href="{{ urls.format('USER_GROUPS', [profile.data.user_id]) }}">
<a class="inner" title="Groups" href="{{ urls.format('USER_GROUPS', [profile.id]) }}">
<div class="fa fa-users"></div>
<div class="count">0</div>
</a>
@ -189,7 +189,7 @@
{% endif %}
{% if profileView != 'comments' %}
<div class="profilePlatform">
<a class="inner" title="Comments" href="{{ urls.format('USER_COMMENTS', [profile.data.user_id]) }}">
<a class="inner" title="Comments" href="{{ urls.format('USER_COMMENTS', [profile.id]) }}">
<div class="fa fa-comments"></div>
<div class="count">{{ profile.profileComments.count }}</div>
</a>
@ -197,7 +197,7 @@
{% endif %}
{% if profileView != 'threads' %}
<div class="profilePlatform">
<a class="inner" title="Threads" href="{{ urls.format('USER_THREADS', [profile.data.user_id]) }}">
<a class="inner" title="Threads" href="{{ urls.format('USER_THREADS', [profile.id]) }}">
<div class="fa fa-list"></div>
<div class="count">{{ profile.forumStats.topics }}</div>
</a>
@ -205,7 +205,7 @@
{% endif %}
{% if profileView != 'posts' %}
<div class="profilePlatform">
<a class="inner" title="Posts" href="{{ urls.format('USER_POSTS', [profile.data.user_id]) }}">
<a class="inner" title="Posts" href="{{ urls.format('USER_POSTS', [profile.id]) }}">
<div class="fa fa-reply"></div>
<div class="count">{{ profile.forumStats.posts }}</div>
</a>

View file

@ -23,9 +23,7 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('optionsForm', 'Changing Options...');
});
</script>
{% else %}

View file

@ -1,16 +1,16 @@
<li id="comment-{{ comment.comment_id }}">
<div class="comment">
<a class="comment-avatar clean" href="{{ urls.format('USER_PROFILE', [comment.comment_poster.data.user_id]) }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [comment.comment_poster.data.user_id]) }}');"><span style="color: {{ comment.comment_poster.colour }};">{{ comment.comment_poster.data.username }}</span></a>
<a class="comment-avatar clean" href="{{ urls.format('USER_PROFILE', [comment.comment_poster.id]) }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [comment.comment_poster.id]) }}');"><span style="color: {{ comment.comment_poster.colour }};">{{ comment.comment_poster.username }}</span></a>
<div class="comment-pointer"></div>
<div class="comment-content">
<div class="comment-controls">
<ul>
{% if comment.comment_poster.data.user_id == user.data.user_id %}
{% if comment.comment_poster.id == user.id %}
<li><a href="{{ urls.format('COMMENT_DELETE', [comment.comment_id, comment.comment_category, php.sessionid])}}" class="clean fa fa-trash-o comment-deletion-link" title="Delete" id="comment-action-delete-{{ comment.comment_id }}"></a></li>
{% else %}
<li><a href="{{ urls.format('USER_REPORT', [comment.comment_poster.data.user_id]) }}" class="clean fa fa-exclamation-circle" title="Report" id="comment-action-report-{{ comment.comment_id }}"></a></li>
<li><a href="{{ urls.format('USER_REPORT', [comment.comment_poster.id]) }}" class="clean fa fa-exclamation-circle" title="Report" id="comment-action-report-{{ comment.comment_id }}"></a></li>
{% endif %}
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.comment_id }}, '{{ php.sessionid }}', '{{ comment.comment_category }}', '{{ urls.format('COMMENT_POST') }}', '{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}');" class="clean fa fa-reply" title="Reply" id="comment-action-reply-{{ comment.comment_id }}"></a></li>
<li><a href="javascript:void(0);" onclick="commentReply({{ comment.comment_id }}, '{{ php.sessionid }}', '{{ comment.comment_category }}', '{{ urls.format('COMMENT_POST') }}', '{{ urls.format('IMAGE_AVATAR', [user.id]) }}');" class="clean fa fa-reply" title="Reply" id="comment-action-reply-{{ comment.comment_id }}"></a></li>
<li class="shown voting like"><a href="{{ urls.format('COMMENT_VOTE', [comment.comment_id, 1, comment.comment_category, php.sessionid])}}" class="clean comment-like-link" id="comment-action-like-{{ comment.comment_id }}"><span class="fa fa-thumbs-up"></span> <span id="comment-{{ comment.comment_id }}-likes">{{ comment.comment_likes }}</span></a></li>
<li class="shown voting dislike"><a id="comment-action-dislike-{{ comment.comment_id }}" href="{{ urls.format('COMMENT_VOTE', [comment.comment_id, 0, comment.comment_category, php.sessionid])}}" class="clean comment-dislike-link"><span class="fa fa-thumbs-down"></span> <span id="comment-{{ comment.comment_id }}-dislikes">{{ comment.comment_dislikes }}</span></a></li>
</ul>

View file

@ -7,7 +7,7 @@
<input type="hidden" name="replyto" value="0" />
<input type="hidden" name="mode" value="comment" />
<div class="comment">
<div class="comment-avatar" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}');"></div>
<div class="comment-avatar" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.id]) }}');"></div>
<div class="comment-pointer"></div>
<textarea class="comment-content" name="comment" placeholder="Join the conversation..."></textarea>
<input class="comment-submit new" name="submit" type="submit" value="&#xf1d8;" />

View file

@ -1,7 +1,7 @@
<div id="indexPanel">
{% if session.checkLogin %}
<div class="head">Hi, {{ user.data.username }}!</div>
<a href="{{ urls.format('SETTING_MODE', ['appearance', 'avatar']) }}"><img src="{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}" class="default-avatar-setting homepage-menu-avatar" /></a>
<div class="head">Hi, {{ user.username }}!</div>
<a href="{{ urls.format('SETTING_MODE', ['appearance', 'avatar']) }}"><img src="{{ urls.format('IMAGE_AVATAR', [user.id]) }}" class="default-avatar-setting homepage-menu-avatar" /></a>
<ul class="panelQuickLinks">
<li><a href="{{ urls.format('SETTING_MODE', ['friends', 'requests']) }}" title="Pending friend requests"><span class="fa fa-user-plus"></span><span class="count">{{ page.friend_req|length }}</span></a></li>
<li><a href="{{ urls.format('MESSAGES_INDEX') }}" title="View private messages"><span class="fa fa-envelope"></span><span class="count">0</span></a></li>
@ -25,13 +25,13 @@
{% endif %}
<div class="head">Stats</div>
We have <b>{{ stats.userCount }} user{% if stats.userCount != 1 %}s{% endif %}</b>,
<b><a href="{{ urls.format('USER_PROFILE', [stats.newestUser.data.user_id]) }}" class="default">{{ stats.newestUser.data.username }}</a></b> is the newest user,
<b><a href="{{ urls.format('USER_PROFILE', [stats.newestUser.id]) }}" class="default">{{ stats.newestUser.username }}</a></b> is the newest user,
it has been <b>{{ stats.lastRegDate }}</b> since the last user registered and the forum has <b>{{ stats.topicCount }} thread{% if stats.topicCount != 1 %}s{% endif %}</b> and <b>{{ stats.postCount }} post{% if stats.postCount != 1 %}s{% endif %}</b>.
<div class="head">Online Users</div>
{% if stats.onlineUsers %}
All active users in the past 5 minutes:<br />
{% for amount,onlineUser in stats.onlineUsers %}
<a href="{{ urls.format('USER_PROFILE', [onlineUser.user_id]) }}" style="font-weight: bold;" class="default">{{ onlineUser.username }}</a>{% if amount != (stats.onlineUsers|length - 1) %}, {% endif %}
<a href="{{ urls.format('USER_PROFILE', [onlineUser.id]) }}" style="font-weight: bold; color: {{ onlineUser.colour }};" class="default">{{ onlineUser.username }}</a>{% if amount != (stats.onlineUsers|length - 1) %}, {% endif %}
{% endfor %}
{% else %}
There were no online users in the past 5 minutes.

View file

@ -1,9 +1,9 @@
{% if not (viewPost and postExists) %}<a href="{{ urls.format('SITE_NEWS_POST', [post.news_id]) }}" class="news-head" id="{{ post.news_category }}_{{ post.news_id }}">{{ post.news_title }}</a>{% endif %}
<div class="news-body">
<a class="no-underline" href="{{ urls.format('USER_PROFILE', [post.news_poster.data.user_id]) }}">
<a class="no-underline" href="{{ urls.format('USER_PROFILE', [post.news_poster.id]) }}">
<div class="news-poster">
<img src="{{ urls.format('IMAGE_AVATAR', [post.news_poster.data.user_id]) }}" alt="{{ post.news_poster.data.username }}" class="default-avatar-setting" />
<h1 style="color: {{ post.news_poster.colour }}; text-shadow: 0 0 7px {% if post.news_poster.colour != 'inherit' %}{{ post.news_poster.colour }}{% else %}#222{% endif %}; padding: 0 0 10px;">{{ post.news_poster.data.username }}</h1>
<img src="{{ urls.format('IMAGE_AVATAR', [post.news_poster.id]) }}" alt="{{ post.news_poster.username }}" class="default-avatar-setting" />
<h1 style="color: {{ post.news_poster.colour }}; text-shadow: 0 0 7px {% if post.news_poster.colour != 'inherit' %}{{ post.news_poster.colour }}{% else %}#222{% endif %}; padding: 0 0 10px;">{{ post.news_poster.username }}</h1>
</div>
</a>
<div class="markdown">

View file

@ -30,7 +30,7 @@
<div>
{% if forum.last_post.post_id %}
<a href="{{ urls.format('FORUM_THREAD', [forum.last_post.topic_id]) }}" class="default">{{ forum.last_post.post_subject }}</a><br />
<span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.data.user_id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.data.user_id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.data.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post_id]) }}#p{{ forum.last_post.post_id }}" class="default fa fa-tag"></a>
<span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post_id]) }}#p{{ forum.last_post.post_id }}" class="default fa fa-tag"></a>
{% else %}
There are no posts in this forum.<br />&nbsp;
{% endif %}

View file

@ -6,8 +6,8 @@
<a href="{{ urls.format('FORUM_THREAD', [topic.topic_id]) }}" class="default">{{ topic.topic_title }}</a>
</td>
<td class="topicAuthor">
{% if topic.first_poster.data.user_id %}
<a href="{{ urls.format('USER_PROFILE', [topic.first_poster.data.user_id]) }}" class="default" style="color: {{ topic.first_poster.colour }}; text-shadow: 0 0 5px {% if topic.first_poster.colour != 'inherit' %}{{ topic.first_poster.colour }}{% else %}#222{% endif %};">{{ topic.first_poster.data.username }}</a>
{% if topic.first_poster.id %}
<a href="{{ urls.format('USER_PROFILE', [topic.first_poster.id]) }}" class="default" style="color: {{ topic.first_poster.colour }}; text-shadow: 0 0 5px {% if topic.first_poster.colour != 'inherit' %}{{ topic.first_poster.colour }}{% else %}#222{% endif %};">{{ topic.first_poster.username }}</a>
{% else %}
[deleted user]
{% endif %}
@ -17,8 +17,8 @@
<div class="views" title="Amount of times this topic has been viewed.">{{ topic.topic_views }}</div>
</td>
<td class="topicLast">
{% if topic.last_poster.data.user_id %}
<a href="{{ urls.format('USER_PROFILE', [topic.last_poster.data.user_id]) }}" class="default" style="color: {{ topic.last_poster.colour }}; text-shadow: 0 0 5px {% if topic.last_poster.colour != 'inherit' %}{{ topic.last_poster.colour }}{% else %}#222{% endif %};">{{ topic.last_poster.data.username }}</a>
{% if topic.last_poster.id %}
<a href="{{ urls.format('USER_PROFILE', [topic.last_poster.id]) }}" class="default" style="color: {{ topic.last_poster.colour }}; text-shadow: 0 0 5px {% if topic.last_poster.colour != 'inherit' %}{{ topic.last_poster.colour }}{% else %}#222{% endif %};">{{ topic.last_poster.username }}</a>
{% else %}
[deleted user]
{% endif %} <a href="{{ urls.format('FORUM_POST', [topic.last_post.post_id]) }}#p{{ topic.last_post.post_id }}" class="default fa fa-tag"></a><br />

View file

@ -11,8 +11,8 @@
{% for post in posts[currentPage] %}
<tr class="post" id="p{{ post.post_id }}">
<td class="userpanel">
{% if not post.user.checkPermission('SITE', 'DEACTIVATED') or post.user.checkPermission('SITE', 'RESTRICTED') %}<a href="{{ urls.format('USER_PROFILE', [post.user.data.user_id]) }}" class="default username" style="color: {{ post.user.colour }}; text-shadow: 0 0 5px {% if post.user.colour != 'inherit' %}{{ post.user.colour }}{% else %}#222{% endif %};" title="Go to {{ post.user.data.username }}'s profile">{{ post.user.data.username }}</a>
<img src="{{ urls.format('IMAGE_AVATAR', [post.user.data.user_id]) }}" alt="{{ post.user.data.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.user.checkOnline %}484{% else %}844{% endif %};" />
{% if not post.user.checkPermission('SITE', 'DEACTIVATED') or post.user.checkPermission('SITE', 'RESTRICTED') %}<a href="{{ urls.format('USER_PROFILE', [post.user.id]) }}" class="default username" style="color: {{ post.user.colour }}; text-shadow: 0 0 5px {% if post.user.colour != 'inherit' %}{{ post.user.colour }}{% else %}#222{% endif %};" title="Go to {{ post.user.username }}'s profile">{{ post.user.username }}</a>
<img src="{{ urls.format('IMAGE_AVATAR', [post.user.id]) }}" alt="{{ post.user.username }}" class="avatar" style="box-shadow: 0 3px 7px #{% if post.user.checkOnline %}484{% else %}844{% endif %};" />
{% else %}
<a class="username">[deleted user]</a>
{% endif %}
@ -21,15 +21,15 @@
<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi"{% if not post.user.checkPremium[0] %} style="opacity: 0;"{% endif %} /> <img src="{{ sakura.contentPath }}/images/flags/{{ post.user.country.short|lower }}.png" alt="{{ post.user.country.long }}" />
{% if session.checkLogin %}
<div class="actions">
{% if user.data.user_id == post.user.data.user_id %}
{% if user.id == post.user.id %}
<a class="fa fa-pencil-square-o" title="Edit this post" href="{{ urls.format('FORUM_EDIT_POST', [post.post_id]) }}"></a>
<a class="fa fa-trash" title="Delete this post" href="{{ urls.format('FORUM_DELETE_POST', [post.post_id]) }}"></a>
{% elseif not post.user.checkPermission('SITE', 'DEACTIVATED') or post.user.checkPermission('SITE', 'RESTRICTED') %}
{% if post.user.checkFriends(user.data.user_id) != 0 %}
<a class="fa fa-{% if post.user.checkFriends(user.data.user_id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
{% if post.user.checkFriends(user.id) != 0 %}
<a class="fa fa-{% if post.user.checkFriends(user.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
{% endif %}
<a class="fa fa-user-{% if post.user.checkFriends(user.data.user_id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle" title="{% if post.user.checkFriends(user.data.user_id) == 0 %}Add {{ post.user.data.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if post.user.checkFriends(user.data.user_id) == 0 %}{{ urls.format('FRIEND_ADD', [post.user.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [post.user.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}"></a>
<a class="fa fa-flag" title="Report {{ post.user.data.username }}" href="{{ urls.format('USER_REPORT', [post.user.data.user_id]) }}"></a>
<a class="fa fa-user-{% if post.user.checkFriends(user.id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle" title="{% if post.user.checkFriends(user.id) == 0 %}Add {{ post.user.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if post.user.checkFriends(user.id) == 0 %}{{ urls.format('FRIEND_ADD', [post.user.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [post.user.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}"></a>
<a class="fa fa-flag" title="Report {{ post.user.username }}" href="{{ urls.format('USER_REPORT', [post.user.id]) }}"></a>
{% endif %}
<a class="fa fa-reply" title="Quote this post" href="{{ urls.format('FORUM_QUOTE_POST', [post.post_id]) }}"></a>
</div>

View file

@ -80,7 +80,7 @@
}, 60000);
{% endif %}
{% if php.self == '/profile.php' and session.checkLogin and user.data.user_id != profile.user.user_id %}
{% if php.self == '/profile.php' and session.checkLogin and user.id != profile.id %}
// Make friend button dynamic
prepareAjaxLink('profileFriendToggle', 'submitPost', ', true, "{% if profile.friend == 0 %}Adding{% else %}Removing{% endif %} friend..."');
{% endif %}
@ -117,7 +117,7 @@
{% endif %}
{% if php.self == '/profile.php' ? (profile.data.user_data.profileBackground and not profile.data.user_data.userOptions.disableProfileParallax) : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.user_data.userOptions.profileBackgroundSiteWide and user.data.user_data.profileBackground and not user.data.user_data.userOptions.disableProfileParallax) %}
{% if php.self == '/profile.php' ? (profile.userData.profileBackground and not profile.optionFields.disableProfileParallax) : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.optionFields.profileBackgroundSiteWide and user.userData.profileBackground and not user.optionFields.disableProfileParallax) %}
initialiseParallax('userBackground');
@ -129,7 +129,7 @@
"title": sakuraVars.siteName + " uses cookies!",
"text": "Click this if you're OK with that and want to hide this message.",
"img": "FONT:fa-asterisk",
"link": "javascript:cookieData('set', '"+ sakuraVars.cookie.prefix +"accept_cookies', 'true; expires="+ (new Date(2147483647000)).toUTCString() +"');notifyClose(this.parentNode.id);"
"link": "javascript:cookieData('set', '" + sakuraVars.cookie.prefix + "accept_cookies', 'true; expires=" + (new Date(2147483647000)).toUTCString() + "');notifyClose(this.parentNode.id);"
});
}
@ -169,7 +169,7 @@
<div class="menu-ucp" id="navMenuUser">
<!-- User menu, displayed on right side of the bar. -->
{% if session.checkLogin %}
<a class="menu-item avatar" href="{{ urls.format('USER_PROFILE', [user.data.user_id]) }}" title="Logged in as {{ user.data.username }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}'); width: auto; color: {{ user.colour }}; border-color: {{ user.colour }}; font-weight: 700;"></a>
<a class="menu-item avatar" href="{{ urls.format('USER_PROFILE', [user.id]) }}" title="Logged in as {{ user.username }}" style="background-image: url('{{ urls.format('IMAGE_AVATAR', [user.id]) }}'); width: auto; color: {{ user.colour }}; border-color: {{ user.colour }}; font-weight: 700;"></a>
<a class="menu-item fa-envelope" href="{{ urls.format('SETTING_CAT', ['messages']) }}" title="Messages"></a>
<a class="menu-item fa-gavel" href="{{ urls.format('MANAGE_INDEX') }}" title="Manage"></a>
<a class="menu-item fa-cogs" href="{{ urls.format('SETTINGS_INDEX') }}" title="Settings"></a>
@ -186,7 +186,7 @@
</div>
<div id="contentwrapper">
<div id="notifications"></div>
{% if php.self == '/profile.php' ? profile.data.user_data.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.data.user_data.userOptions.profileBackgroundSiteWide and user.data.user_data.profileBackground) %}
{% if php.self == '/profile.php' ? profile.userData.profileBackground : (user.checkPermission('SITE', 'CREATE_BACKGROUND') and user.optionFields.profileBackgroundSiteWide and user.userData.profileBackground) %}
<div id="userBackground" style="background-image: url('{{ urls.format('IMAGE_BACKGROUND', [(php.self == '/profile.php' ? profile : user).data.user_id]) }}');"></div>
{% endif %}
{% if not session.checkLogin and php.self != '/authenticate.php' %}

View file

@ -21,7 +21,7 @@
<li>You were banned on {{ ban.issued|date(sakura.dateFormat) }}.</li>
<li>{% if ban.expires %}This ban expires on {{ ban.expires|date(sakura.dateFormat) }}.{% else %}<b>You are permanently banned.</b>{% endif %}</li>
{% if ban.expires %}
<li>You were banned by <a href="{{ urls.format('USER_PROFILE', [ban.issuer.user_id]) }}" class="default">{{ ban.issuer.username }}</a>.</li>
<li>You were banned by <a href="{{ urls.format('USER_PROFILE', [ban.issuer.id]) }}" class="default">{{ ban.issuer.username }}</a>.</li>
{% endif %}
</ul>
</div>

View file

@ -66,13 +66,13 @@
#{{ page.active ? count + 1 : count }}
</td>
<td>
<a href="{{ urls.format('USER_PROFILE', [user.data.user_id]) }}" class="default" style="font-weight: bold; color: {{ user.colour }}; text-shadow: 0 0 5px {{ user.colour }};">{{ user.data.username }}</a>
<a href="{{ urls.format('USER_PROFILE', [user.id]) }}" class="default" style="font-weight: bold; color: {{ user.colour }}; text-shadow: 0 0 5px {{ user.colour }};">{{ user.username }}</a>
</td>
<td title="{{ user.data.user_registered|date(sakura.dateFormat) }}">
<td title="{{ user.dates.joined|date(sakura.dateFormat) }}">
{{ user.elapsed.joined }}
</td>
<td title="{% if user.data.user_last_online == 0 %}Never logged in.{% else %}{{ user.data.user_last_online|date(sakura.dateFormat) }}{% endif %}">
{% if user.data.user_last_online == 0 %}<i>Never logged in.</i>{% else %}{{ user.elapsed.lastOnline }}{% endif %}
<td title="{% if user.dates.lastOnline == 0 %}Never logged in.{% else %}{{ user.dates.lastOnline|date(sakura.dateFormat) }}{% endif %}">
{% if user.dates.lastOnline == 0 %}<i>Never logged in.</i>{% else %}{{ user.elapsed.lastOnline }}{% endif %}
</td>
<td>
{{ user.userTitle }}
@ -86,11 +86,11 @@
</table>
{% else %}
{% for user in page.users[page.page] %}
<a href="{{ urls.format('USER_PROFILE', [user.data.user_id]) }}">{# These comment tags are here to prevent the link extending too far
#}<div class="userBox" id="u{{ user.data.user_id }}">{#
#}<img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.data.username }}" style="background: url('{{ urls.format('IMAGE_AVATAR', [user.data.user_id]) }}') no-repeat center / contain;" />{#
<a href="{{ urls.format('USER_PROFILE', [user.id]) }}">{# These comment tags are here to prevent the link extending too far
#}<div class="userBox" id="u{{ user.id }}">{#
#}<img src="{{ sakura.contentPath }}/pixel.png" alt="{{ user.username }}" style="background: url('{{ urls.format('IMAGE_AVATAR', [user.id]) }}') no-repeat center / contain;" />{#
#}<span class="userBoxUserName" style="color: {{ user.colour }};">{#
#}{{ user.data.username }}{#
#}{{ user.username }}{#
#}</span>{#
#}</div>{#
#}</a>

View file

@ -1,12 +1,12 @@
{% extends 'global/master.tpl' %}
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.data.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.data.user_id != profile.data.user_id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
{% set profileHidden = profile.checkPermission('SITE', 'DEACTIVATED') or profile.password.password_algo == 'nologin' or (profile.checkPermission('SITE', 'RESTRICTED') and (user.id != profile.id and not user.checkPermission('MANAGE', 'USE_MANAGE'))) %}
{% set noUserpage = profile.userPage|length < 1 %}
{% set profileView = noUserpage and profileView == 'index' ? 'comments' : profileView %}
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.data.username }}{% endif %}{% endblock %}
{% block title %}{% if profileHidden %}User not found!{% else %}Profile of {{ profile.username }}{% endif %}{% endblock %}
{% block content %}
{% if profileHidden %}
@ -24,43 +24,43 @@
<div class="content profile">
<div class="content-right content-column">
<div style="text-align: center;">
<img src="{{ urls.format('IMAGE_AVATAR', [profile.data.user_id]) }}" alt="{{ profile.data.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.checkOnline %}484{% else %}844{% endif %};" /><br />
{% if profile.data.rank_main > 1 and profile.checkBan|length < 1 %}
<img src="{{ urls.format('IMAGE_AVATAR', [profile.id]) }}" alt="{{ profile.username }}'s Avatar" class="default-avatar-setting" style="box-shadow: 0 3px 7px #{% if profile.checkOnline %}484{% else %}844{% endif %};" /><br />
{% if profile.mainRank > 1 and profile.checkBan|length < 1 %}
<span style="font-size: .8em;">{{ profile.userTitle }}</span>
<h1 style="color: {{ profile.colour }}; text-shadow: 0 0 7px {% if profile.colour != 'inherit' %}{{ profile.colour }}{% else %}#222{% endif %}; padding: 0 0 2px;"{% if profile.getUsernameHistory %} title="Known as {{ profile.getUsernameHistory[0]['username_old'] }} before {{ profile.getUsernameHistory[0]['change_time']|date(sakura.dateFormat) }}."{% endif %}>{{ profile.data.username }}</h1>
<h1 style="color: {{ profile.colour }}; text-shadow: 0 0 7px {% if profile.colour != 'inherit' %}{{ profile.colour }}{% else %}#222{% endif %}; padding: 0 0 2px;"{% if profile.getUsernameHistory %} title="Known as {{ profile.getUsernameHistory[0]['username_old'] }} before {{ profile.getUsernameHistory[0]['change_time']|date(sakura.dateFormat) }}."{% endif %}>{{ profile.username }}</h1>
{% if profile.checkPremium[0] %}<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi" /> {% endif %}<img src="{{ sakura.contentPath }}/images/flags/{{ profile.country.short|lower }}.png" alt="{{ profile.country.short }}" /> <span style="font-size: .9em; line-height: 11px;">{{ profile.country.long }}</span>
{% if session.checkLogin %}
<div class="user-actions">
{% if user.data.user_id == profile.data.user_id %}
{% if user.id == profile.id %}
<a class="fa fa-pencil-square-o" title="Edit your profile" href="{{ urls.format('SETTING_MODE', ['general', 'profile']) }}"></a>
{% else %}
{% if user.checkFriends(profile.data.user_id) != 0 %}<a class="fa fa-{% if user.checkFriends(profile.data.user_id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
<a class="fa fa-user-{% if user.checkFriends(profile.data.user_id) == 0 %}plus{% else %}times{% endif %}" title="{% if user.checkFriends(profile.data.user_id) == 0 %}Add {{ profile.data.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.checkFriends(profile.data.user_id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.data.user_id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}" id="profileFriendToggle"></a>
<a class="fa fa-exclamation-circle" title="Report {{ profile.data.username }}" href="{{ urls.format('USER_REPORT', [profile.data.user_id]) }}"></a>
{% if user.checkFriends(profile.id) != 0 %}<a class="fa fa-{% if user.checkFriends(profile.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>{% endif %}
<a class="fa fa-user-{% if user.checkFriends(profile.id) == 0 %}plus{% else %}times{% endif %}" title="{% if user.checkFriends(profile.id) == 0 %}Add {{ profile.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.checkFriends(profile.id) == 0 %}{{ urls.format('FRIEND_ADD', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% else %}{{ urls.format('FRIEND_REMOVE', [profile.id, php.sessionid, php.time, sakura.currentPage]) }}{% endif %}" id="profileFriendToggle"></a>
<a class="fa fa-exclamation-circle" title="Report {{ profile.username }}" href="{{ urls.format('USER_REPORT', [profile.id]) }}"></a>
{% endif %}
<hr class="default" />
<a class="fa fa-file-text-o" title="View {{ profile.data.username }}'s user page" href="{{ urls.format('USER_PROFILE', [profile.data.user_id]) }}"></a>
<a class="fa fa-list" title="View {{ profile.data.username }}'s threads" href="{{ urls.format('USER_THREADS', [profile.data.user_id]) }}"></a>
<a class="fa fa-reply" title="View {{ profile.data.username }}'s posts" href="{{ urls.format('USER_POSTS', [profile.data.user_id]) }}"></a>
<a class="fa fa-user-plus" title="View {{ profile.data.username }}'s friends" href="{{ urls.format('USER_FRIENDS', [profile.data.user_id]) }}"></a>
{#<a class="fa fa-users" title="View {{ profile.data.username }}'s groups" href="{{ urls.format('USER_GROUPS', [profile.data.user_id]) }}"></a>#}
<a class="fa fa-file-text-o" title="View {{ profile.username }}'s user page" href="{{ urls.format('USER_PROFILE', [profile.id]) }}"></a>
<a class="fa fa-list" title="View {{ profile.username }}'s threads" href="{{ urls.format('USER_THREADS', [profile.id]) }}"></a>
<a class="fa fa-reply" title="View {{ profile.username }}'s posts" href="{{ urls.format('USER_POSTS', [profile.id]) }}"></a>
<a class="fa fa-user-plus" title="View {{ profile.username }}'s friends" href="{{ urls.format('USER_FRIENDS', [profile.id]) }}"></a>
{#<a class="fa fa-users" title="View {{ profile.username }}'s groups" href="{{ urls.format('USER_GROUPS', [profile.id]) }}"></a>#}
{% if not noUserpage %}
<a class="fa fa-comments-o" title="View {{ profile.data.username }}'s profile comments" href="{{ urls.format('USER_COMMENTS', [profile.data.user_id]) }}"></a>
<a class="fa fa-comments-o" title="View {{ profile.username }}'s profile comments" href="{{ urls.format('USER_COMMENTS', [profile.id]) }}"></a>
{% endif %}
</div>
{% endif %}
<hr class="default" />
<b>Joined</b> <span title="{{ profile.data.user_registered|date(sakura.dateFormat) }}">{{ profile.elapsed.joined }}</span>
<b>Joined</b> <span title="{{ profile.dates.joined|date(sakura.dateFormat) }}">{{ profile.elapsed.joined }}</span>
<br />
{% if profile.data.user_last_online < 1 %}
<b>{{ profile.data.username }} hasn't logged in yet.</b>
{% if profile.dates.lastOnline < 1 %}
<b>{{ profile.username }} hasn't logged in yet.</b>
{% else %}
<b>Last online</b> <span title="{{ profile.data.user_last_online|date(sakura.dateFormat) }}">{{ profile.elapsed.lastOnline }}</span>
<b>Last online</b> <span title="{{ profile.dates.lastOnline|date(sakura.dateFormat) }}">{{ profile.elapsed.lastOnline }}</span>
{% endif %}
<br />
<b>{{ profile.data.username }} has {% if not profile.forumStats.posts %}no{% else %}{{ profile.forumStats.posts }}{% endif %} forum post{% if profile.forumStats.posts != 1 %}s{% endif %}.</b>
{% if profile.data.birthday != '0000-00-00' and profile.data.birthday|split('-')[0] > 0 %}
<br /><b>Age</b> <span title="{{ profile.data.user_birthday }}">{{ profile.elapsed(' old').birth }}</span>
<b>{{ profile.username }} has {% if not profile.forumStats.posts %}no{% else %}{{ profile.forumStats.posts }}{% endif %} forum post{% if profile.forumStats.posts != 1 %}s{% endif %}.</b>
{% if profile.dates.birth != '0000-00-00' and profile.dates.birth|split('-')[0] > 0 %}
<br /><b>Age</b> <span title="{{ profile.dates.birth }}">{{ profile.elapsed(' old').birth }}</span>
{% endif %}
{% if profile.profileFields %}
<hr class="default" />
@ -73,7 +73,7 @@
</td>
<td style="text-align: right;">
{% 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>
<a href="https://youtube.com/{% if field.youtubetype == true %}channel{% else %}user{% endif %}/{{ field.value }}" class="default">{% if field.youtubetype == true %}{{ profile.username }}'s Channel{% else %}{{ field.value }}{% endif %}</a>
{% else %}
{% if field.islink %}
<a href="{{ field.link }}" class="default">
@ -92,7 +92,7 @@
{% endif %}
{% endif %}
{% else %}
<h1 style="color: #222; text-shadow: 0 0 7px #888; padding: 0 0 2px;">{{ profile.data.username }}</h1>
<h1 style="color: #222; text-shadow: 0 0 7px #888; padding: 0 0 2px;">{{ profile.username }}</h1>
{% endif %}
<hr class="default" />
<b>Account Standing</b>

View file

@ -40,7 +40,7 @@
{% for supporter in page.premiumTable[page.currentPage] %}
<tr>
<td>
<a href="{{ urls.format('USER_PROFILE', [page.premiumData.users[supporter.user_id].data.user_id]) }}" class="default" style="color: {{ page.premiumData.users[supporter.user_id].colour }}; text-shadow: 0 0 7px {% if page.premiumData.users[supporter.user_id].colour != 'inherit' %}{{ page.premiumData.users[supporter.user_id].colour }}{% else %}#222{% endif %};">{{ page.premiumData.users[supporter.user_id].data.username }}</a>
<a href="{{ urls.format('USER_PROFILE', [page.premiumData.users[supporter.user_id].id]) }}" class="default" style="color: {{ page.premiumData.users[supporter.user_id].colour }}; text-shadow: 0 0 7px {% if page.premiumData.users[supporter.user_id].colour != 'inherit' %}{{ page.premiumData.users[supporter.user_id].colour }}{% else %}#222{% endif %};">{{ page.premiumData.users[supporter.user_id].username }}</a>
</td>
<td style="color: {% if supporter.transaction_amount > 0 %}#0A0{% else %}#A00{% endif %};">
&#8364;{{ supporter.transaction_amount|number_format(2) }}

View file

@ -2,7 +2,7 @@
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="mode" value="email" />
<h3 style="text-align: center;">Your e-mail address is currently set to <span style="font-weight: 700;">{{ user.data.email }}</span>.</h3>
<h3 style="text-align: center;">Your e-mail address is currently set to <span style="font-weight: 700;">{{ user.email }}</span>.</h3>
<div class="profile-field">
<div><h2>E-mail address</h2></div>
<div><input type="text" name="email" placeholder="Enter your new e-mail address" class="inputStyling" /></div>
@ -14,8 +14,6 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('emailAddressChangeForm', 'Changing E-mail address...');
});
</script>

View file

@ -21,8 +21,6 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('changePasswordForm', 'Changing password...');
});
</script>

View file

@ -19,8 +19,6 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('changeUsernameForm', 'Changing username...');
});
</script>

View file

@ -14,8 +14,6 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('changeUserTitleForm', 'Updating Usertitle...');
});
</script>

View file

@ -28,8 +28,6 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('changePasswordForm', 'Changing password...');
});
</script>

View file

@ -1,4 +1,4 @@
{% if (user.data.userData.profileBackground is defined and user.checkPermission('SITE', 'CHANGE_BACKGROUND')) or user.checkPermission('SITE', 'CREATE_BACKGROUND') %}
{% if (user.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 }}" />
@ -6,7 +6,7 @@
<input type="hidden" name="MAX_FILE_SIZE" value="{{ background.max_size }}" />
<div style="text-align: center;">
<div>
<img src="/bg/{{ user.data.user_id }}" alt="Your Background" class="default-avatar-setting" style="max-width: 90%; max-height: 90%;" />
<img src="/bg/{{ user.id }}" alt="Your Background" class="default-avatar-setting" style="max-width: 90%; max-height: 90%;" />
</div>
<div>
<input type="file" name="background" />

View file

@ -13,13 +13,13 @@ window.addEventListener("load", function() {
{% if friends|length %}
<div class="friends-list">
{% for friend in friends[page.currentPage] %}
<div class="friend-container" id="friendslist-friend-{{ friend.user.user_id }}">
<a class="friends-list-data clean" href="/u/{{ friend.user.user_id }}">
<img src="/a/{{ friend.user.user_id }}" alt="{{ friend.user.username }}" class="friends-list-avatar default-avatar-setting" style="width: 150px; height: 150px;" />
<div class="friends-list-name" style="color: {% if friend.user.user_colour %}{{ friend.user.user_colour }}{% else %}{{ friend.rank.rank_colour }}{% endif %};">{{ friend.user.username }}</div>
<div class="friend-container" id="friendslist-friend-{{ friend.user.id }}">
<a class="friends-list-data clean" href="/u/{{ friend.user.id }}">
<img src="/a/{{ friend.user.id }}" alt="{{ friend.user.username }}" class="friends-list-avatar default-avatar-setting" style="width: 150px; height: 150px;" />
<div class="friends-list-name" style="color: {{ friend.user.colour }};">{{ friend.user.username }}</div>
</a>
<div class="friends-list-actions">
<a class="remove fill fa fa-remove" title="Remove friend" href="/friends?remove={{ friend.user.user_id }}&amp;session={{ php.sessionid }}&amp;time={{ php.time }}" id="friendslist-friend-action-remove-{{ friend.user.id }}"></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 }}" id="friendslist-friend-action-remove-{{ friend.user.id }}"></a>
<div class="clear"></div>
</div>
</div>

View file

@ -13,10 +13,10 @@ window.addEventListener("load", function() {
{% if friends|length %}
<div class="friends-list">
{% for friend in friends[page.currentPage] %}
<div class="friend-container" id="friend-{{ friend.user.user_id }}">
<a class="friends-list-data clean" href="/u/{{ friend.user.user_id }}">
<img src="/a/{{ friend.user.user_id }}" alt="{{ friend.user.username }}" class="friends-list-avatar default-avatar-setting" style="width: 150px; height: 150px;" />
<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="friend-container" id="friend-{{ friend.user.id }}">
<a class="friends-list-data clean" href="/u/{{ friend.user.id }}">
<img src="/a/{{ friend.user.id }}" alt="{{ friend.user.username }}" class="friends-list-avatar default-avatar-setting" style="width: 150px; height: 150px;" />
<div class="friends-list-name" style="color: {{ friend.user.colour }};">{{ friend.user.username }}</div>
</a>
<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 }}" id="friendslist-friend-action-add-{{ friend.user.id }}"></a>

View file

@ -20,7 +20,7 @@
<br />
<h1 class="stylised">Personal Statistics</h1>
<ul>
<li>You joined on <b>{{ user.data.user_registered|date(sakura.dateFormat) }}</b>.</li>
<li>You joined on <b>{{ user.dates.joined|date(sakura.dateFormat) }}</b>.</li>
<li>You have made <b>{{ user.forumStats.posts }} forum post{% if user.forumStats.posts != 1 %}s{% endif %}</b> and started <b>{{ user.forumStats.topics }} forum thread{% if user.forumStats.topics != 1 %}s{% endif %}</b>.</li>
<li>You have <b>x</b> warnings.</li>
<li>You have <b>{{ user.getFriends|length }} friend{% if user.getFriends|length != 1 %}s{% endif %}</b>.</li>
@ -30,7 +30,7 @@
<h2 style="color: #080;">Online</h2>
{% if user.getFriends(true, true, true).online %}
{% for key,friend in user.getFriends(true, true, true).online %}
<a href="/u/{{ friend.user.user_id }}" class="default" style="color: {% if friend.user.user_colour %}{{ friend.user.user_colour }}{% else %}{{ friend.rank.rank_colour }}{% endif %}">{{ friend.user.username }}</a>{% if key + 1 != user.getFriends(true, true, true).online|length %},{% endif %}
<a href="/u/{{ friend.user.id }}" class="default" style="color: {{ friend.user.colour }};">{{ friend.user.username }}</a>{% if key + 1 != user.getFriends(true, true, true).online|length %},{% endif %}
{% endfor %}
{% else %}
<h4>No friends are online.</h4>
@ -38,7 +38,7 @@
<h2 style="color: #800;">Offline</h2>
{% if user.getFriends(true, true, true).offline %}
{% for key,friend in user.getFriends(true, true, true).offline %}
<a href="/u/{{ friend.user.user_id }}" class="default" style="color: {% if friend.user.user_colour %}{{ friend.user.user_colour }}{% else %}{{ friend.rank.rank_colour }}{% endif %}">{{ friend.user.username }}</a>{% if key + 1 != user.getFriends(true, true, true).offline|length %},{% endif %}
<a href="/u/{{ friend.user.id }}" class="default" style="color: {{ friend.user.colour }};">{{ friend.user.username }}</a>{% if key + 1 != user.getFriends(true, true, true).offline|length %},{% endif %}
{% endfor %}
{% else %}
<h4>No friends are offline.</h4>

View file

@ -12,7 +12,7 @@
</div>
</div>
<div style="padding: 8px 0;">
<input type="{{ field.option_type }}" name="option_{{ field.option_id }}" class="inputStyling"{% if user.data.user_data.userOptions[field.option_id] %}{% if field.option_type == 'checkbox' and user.data.user_data.userOptions[field.option_id] %} checked="checked" value="option_{{ field.option_id }}"{% else %} value="{{ user.data.user_data.userOptions[field.option_id] }}"{% endif %}{% endif %} />
<input type="{{ field.option_type }}" name="option_{{ field.option_id }}" class="inputStyling"{% if user.optionFields[field.option_id] %}{% if field.option_type == 'checkbox' and user.optionFields[field.option_id] %} checked="checked" value="option_{{ field.option_id }}"{% else %} value="{{ user.optionFields[field.option_id] }}"{% endif %}{% endif %} />
</div>
</div>
{% endfor %}
@ -23,9 +23,7 @@
</form>
<script type="text/javascript">
window.addEventListener("load", function() {
prepareAjaxForm('optionsForm', 'Changing Options...');
});
</script>
{% else %}

View file

@ -1,4 +1,4 @@
{% set birthday = user.data.user_birthday|split('-') %}
{% set birthday = user.dates.birth|split('-') %}
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="editProfileForm">
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />

View file

@ -10,7 +10,7 @@
<tbody>
{% for message in messages %}
<tr>
<td><a href="/u/{{ message.data.from.user.user_id }}" class="default" style="font-weight: 700; color: {% if message.data.from.user.user_colour == null %}{{ message.data.from.rank.rank_colour }}{% else %}{{ message.data.from.user.user_colour }}{% endif %};">{{ message.data.from.user.username }}</a></td>
<td><a href="/u/{{ message.data.from.user.id }}" class="default" style="font-weight: 700; color: {{ message.data.from.user.colour }};">{{ 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>

View file

@ -203,7 +203,7 @@ if (isset($_REQUEST['mode'])) {
// Add page specific things
$renderData['page'] = [
'redirect' => $login[0] ? ((new User($login[2]))->data['user_last_online'] ? $_REQUEST['redirect'] : $urls->format('INFO_PAGE', ['welcome'])) : $urls->format('SITE_LOGIN'),
'redirect' => $login[0] ? ($currentUser->dates()['lastOnline'] ? $_REQUEST['redirect'] : $urls->format('INFO_PAGE', ['welcome'])) : $urls->format('SITE_LOGIN'),
'message' => $messages[$login[1]],
'success' => $login[0],

View file

@ -740,6 +740,33 @@ a:active {
float: right;
}
.homepage .onlineUsers {
display: flex;
text-align: center;
}
.homepage .onlineUsers a {
flex-grow: 1;
flex-shrink: 1;
color: #fff;
font-size: 0;
transition: .2s;
text-decoration: none !important;
}
.homepage .onlineUsers a:hover {
font-size: 1em;
}
.homepage .onlineUsers a:not(:last-child) {
border-right: 1px solid #9475b2;
}
.homepage .onlineUsers div {
flex-shrink: 0;
flex-grow: 1;
}
/*
* News
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -61,13 +61,13 @@ if (isset($_GET['m'])) {
}
// Check if user has an avatar set
if (empty($user->data['user_data']['userAvatar']) || !file_exists($userDirPath . $user->data['user_data']['userAvatar'])) {
if (empty($user->userData()['userAvatar']) || !file_exists($userDirPath . $user->userData()['userAvatar'])) {
$serveImage = $noAvatar;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user->data['user_data']['userAvatar'];
$serveImage = $userDirPath . $user->userData()['userAvatar'];
break;
case 'background':
@ -96,14 +96,14 @@ if (isset($_GET['m'])) {
}
// Check if user has a background set
if (empty($user->data['user_data']['profileBackground'])
|| !file_exists($userDirPath . $user->data['user_data']['profileBackground'])) {
if (empty($user->userData()['profileBackground'])
|| !file_exists($userDirPath . $user->userData()['profileBackground'])) {
$serveImage = $noBackground;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user->data['user_data']['profileBackground'];
$serveImage = $userDirPath . $user->userData()['profileBackground'];
break;
case 'header':
@ -132,14 +132,14 @@ if (isset($_GET['m'])) {
}
// Check if user has a background set
if (empty($user->data['user_data']['profileHeader'])
|| !file_exists($userDirPath . $user->data['user_data']['profileHeader'])) {
if (empty($user->userData()['profileHeader'])
|| !file_exists($userDirPath . $user->userData()['profileHeader'])) {
$serveImage = $noHeader;
break;
}
// Check if the avatar exist and assign it to a value
$serveImage = $userDirPath . $user->data['user_data']['profileHeader'];
$serveImage = $userDirPath . $user->userData()['profileHeader'];
break;
default:

View file

@ -71,7 +71,7 @@ $renderData['stats'] = [
date_create(
date(
'Y-m-d',
$_INDEX_NEWEST_USER->data['user_registered']
$_INDEX_NEWEST_USER->dates()['joined']
)
),
date_create(

View file

@ -13,7 +13,7 @@ define('SAKURA_MANAGE', true);
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) . '_sakura/sakura.php';
// Make sure user has the permissions to view this
if (!Permissions::check('MANAGE', 'USE_MANAGE', $currentUser->data['user_id'], 1)) {
if (!$currentUser->checkPermission('MANAGE', 'USE_MANAGE')) {
header('Location: /');
exit;
}

View file

@ -37,7 +37,7 @@ if (isset($_GET['xml'])) {
'link' => ['text' => $_FEED_URL . (new Urls())->format('SITE_NEWS_POST', ['0']), 'eval' => '$post["news_id"]'],
'guid' => ['text' => $_FEED_URL . (new Urls())->format('SITE_NEWS_POST', ['0']), 'eval' => '$post["news_id"]'],
'pubDate' => ['text' => '{EVAL}', 'eval' => 'date("D, d M Y G:i:s O", $post["news_timestamp"])'],
'dc:publisher' => ['text' => '0', 'eval' => '$post["news_poster"]->data["username"]'],
'dc:publisher' => ['text' => '0', 'eval' => '$post["news_poster"]->username()'],
'description' => ['cdata' => '0', 'eval' => '$post["news_content_parsed"]'],
];

View file

@ -68,7 +68,7 @@ if ($mode != 'f') {
// Post editing
} elseif ($mode == 'p' && isset($_GET['edit']) && $_GET['edit'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) {
// Checks
if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->data['user_id']) {
if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->id()) {
// Add page specific things
$renderData['page'] = [
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
@ -95,7 +95,7 @@ if ($mode != 'f') {
// Post deletion
} elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) {
// Checks
if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->data['user_id']) {
if ($topic['posts'][$_GET['p']]['poster_id'] != $currentUser->id()) {
// Add page specific things
$renderData['page'] = [
'redirect' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : $urls->format('FORUM_INDEX')),
@ -188,7 +188,7 @@ if (isset($_POST['post'])) {
}
// Attempt to make the post
$makePost = Forums::createPost($currentUser->data['user_id'], $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse, 1, 1);
$makePost = Forums::createPost($currentUser->id(), $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse, 1, 1);
// Add page specific things
$renderData['page'] = [

View file

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

View file

@ -127,7 +127,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
$comments->makeVote(
$currentUser->data['user_id'],
$currentUser->id(),
isset($_REQUEST['id']) ? $_REQUEST['id'] : 0,
isset($_REQUEST['state']) && $_REQUEST['state'] ? '1' : '0'
);
@ -163,7 +163,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Check if the comment was actually made by the current user
if ($comment['comment_poster'] !== $currentUser->data['id']) {
if ($comment['comment_poster'] !== $currentUser->id()) {
$renderData['page'] = [
'redirect' => $redirect,
'message' => 'You can\'t delete the comments of others.',
@ -193,7 +193,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Attempt to make a new comment
$comment = $comments->makeComment($currentUser->data['user_id'], $_POST['replyto'], $_POST['comment']);
$comment = $comments->makeComment($currentUser->id(), $_POST['replyto'], $_POST['comment']);
// Messages
$messages = [
@ -258,7 +258,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Compare time and session so we know the link isn't forged
if ($continue && $_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')] == $currentUser->data['user_id']) {
if ($continue && $_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')] == $currentUser->id()) {
$renderData['page'] = [
'redirect' => $redirect,
@ -339,15 +339,15 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
// Create a notification
if (array_key_exists($action[1], $notifStrings)) {
// Get the current user's profile data
$user = new User($currentUser->data['user_id']);
$user = new User($currentUser->id());
Users::createNotification(
$_REQUEST[(isset($_REQUEST['add']) ? 'add' : 'remove')],
sprintf($notifStrings[$action[1]][0], $user->data['username']),
sprintf($notifStrings[$action[1]][0], $user->username()),
$notifStrings[$action[1]][1],
60000,
'//' . Config::getConfig('url_main') . '/a/' . $user->data['user_id'],
'//' . Config::getConfig('url_main') . '/u/' . $user->data['user_id'],
'//' . Config::getConfig('url_main') . '/a/' . $user->id(),
'//' . Config::getConfig('url_main') . '/u/' . $user->id(),
'1'
);
}
@ -418,7 +418,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$userDataKey = 'profileBackground';
$msgTitle = 'Background';
$permission = (
!empty($currentUser->data['user_data'][$userDataKey])
!empty($currentUser->userData()[$userDataKey])
&& $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')
) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND');
break;
@ -446,9 +446,9 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
// Set path variables
$filepath = ROOT . Config::getConfig('user_uploads') . '/';
$filename = $filepath . $mode . '_' . $currentUser->data['user_id'];
$currfile = isset($currentUser->data['user_data'][$userDataKey])
&& !empty($_OLDFILE = $currentUser->data['user_data'][$userDataKey]) ? $_OLDFILE : null;
$filename = $filepath . $mode . '_' . $currentUser->id();
$currfile = isset($currentUser->userData()[$userDataKey])
&& !empty($_OLDFILE = $currentUser->userData()[$userDataKey]) ? $_OLDFILE : null;
// Check if $_FILES is set
if (!isset($_FILES[$mode]) && empty($_FILES[$mode])) {
@ -606,7 +606,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Update database
Users::updateUserDataField($currentUser->data['user_id'], $updated);
Users::updateUserDataField($currentUser->id(), $updated);
// Set render data
$renderData['page'] = [
@ -645,7 +645,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Update database
Users::updateUserDataField($currentUser->data['user_id'], ['profileFields' => $store]);
Users::updateUserDataField($currentUser->id(), ['profileFields' => $store]);
// Set render data
$renderData['page'] = [
@ -711,7 +711,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
'user_birthday' => $birthdate,
],
[
'user_id' => [$currentUser->data['user_id'], '='],
'user_id' => [$currentUser->id(), '='],
],
]);
}
@ -738,7 +738,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
}
// Update database
Users::updateUserDataField($currentUser->data['user_id'], ['userOptions' => $store]);
Users::updateUserDataField($currentUser->id(), ['userOptions' => $store]);
// Set render data
$renderData['page'] = [
@ -784,7 +784,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
'user_title' => (isset($_POST['usertitle']) ? $_POST['usertitle'] : null),
],
[
'user_id' => [$currentUser->data['user_id'], '='],
'user_id' => [$currentUser->id(), '='],
],
]
);
@ -939,7 +939,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$userPage = base64_encode($_POST['userpage']);
// Update database
Users::updateUserDataField($currentUser->data['user_id'], ['userPage' => $userPage]);
Users::updateUserDataField($currentUser->id(), ['userPage' => $userPage]);
// Set render data
$renderData['page'] = [
@ -957,7 +957,7 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
$signature = base64_encode($_POST['signature']);
// Update database
Users::updateUserDataField($currentUser->data['user_id'], ['signature' => $signature]);
Users::updateUserDataField($currentUser->id(), ['signature' => $signature]);
// Set render data
$renderData['page'] = [
@ -1210,7 +1210,7 @@ if (Users::checkLogin()) {
],
'access' => (
isset($currentUser->data['user_data']['profileBackground'])
isset($currentUser->userData()['profileBackground'])
&& $currentUser->checkPermission('SITE', 'CHANGE_BACKGROUND')
) || $currentUser->checkPermission('SITE', 'CREATE_BACKGROUND'),
'menu' => true,
@ -1225,7 +1225,7 @@ if (Users::checkLogin()) {
],
'access' => (
isset($currentUser->data['user_data']['userPage'])
isset($currentUser->userData()['userPage'])
&& $currentUser->checkPermission('SITE', 'CHANGE_USERPAGE')
) || $currentUser->checkPermission('SITE', 'CREATE_USERPAGE'),
'menu' => true,
@ -1495,12 +1495,12 @@ if (Users::checkLogin()) {
// User page
case 'appearance.userpage':
$renderData['userPage'] = isset($currentUser->data['user_data']['userPage']) ? base64_decode($currentUser->data['user_data']['userPage']) : '';
$renderData['userPage'] = isset($currentUser->userData()['userPage']) ? base64_decode($currentUser->userData()['userPage']) : '';
break;
// Signature
case 'appearance.signature':
$renderData['signature'] = isset($currentUser->data['user_data']['signature']) ? base64_decode($currentUser->data['user_data']['signature']) : '';
$renderData['signature'] = isset($currentUser->userData()['signature']) ? base64_decode($currentUser->userData()['signature']) : '';
break;
// Username changing

View file

@ -18,7 +18,7 @@ $template->setTemplate($templateName);
// Switch between modes (we only allow this to be used by logged in user)
if (isset($_REQUEST['mode'])
&& Users::checkLogin()
&& Permissions::check('SITE', 'OBTAIN_PREMIUM', $currentUser->data['user_id'], 1)) {
&& Permissions::check('SITE', 'OBTAIN_PREMIUM', $currentUser->id(), 1)) {
// Initialise Payments class
if (!Payments::init()) {
header('Location: ' . $urls->format('SITE_PREMIUM') . '?fail=true');
@ -94,12 +94,12 @@ if (isset($_REQUEST['mode'])
// Attempt to complete the transaction
if ($finalise) {
// Make the user premium
$expiration = Users::addUserPremium($currentUser->data['user_id'], (2628000 * $_SESSION['premiumMonths']));
Users::updatePremiumMeta($currentUser->data['user_id']);
$expiration = Users::addUserPremium($currentUser->id(), (2628000 * $_SESSION['premiumMonths']));
Users::updatePremiumMeta($currentUser->id());
Main::updatePremiumTracker(
$currentUser->data['user_id'],
$currentUser->id(),
((float) Config::getConfig('premium_price_per_month') * $_SESSION['premiumMonths']),
$currentUser->data['username']
$currentUser->username()
. ' bought premium for '
. $_SESSION['premiumMonths']
. ' month'
@ -119,7 +119,7 @@ if (isset($_REQUEST['mode'])
case 'complete':
$renderData = array_merge([
'page' => [
'expiration' => ($prem = Users::checkUserPremium($currentUser->data['user_id'])[2]) !== null ? $prem : 0,
'expiration' => ($prem = Users::checkUserPremium($currentUser->id())[2]) !== null ? $prem : 0,
],
], $renderData);