more shit
This commit is contained in:
parent
01f162945c
commit
58776ee047
18 changed files with 167 additions and 184 deletions
|
@ -228,24 +228,4 @@ class Post
|
||||||
// Return a new post object
|
// Return a new post object
|
||||||
return new Post($this->id);
|
return new Post($this->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The "elapsed" string for this post.
|
|
||||||
*
|
|
||||||
* @return string Readable time elapsed since this post was created.
|
|
||||||
*/
|
|
||||||
public function timeElapsed()
|
|
||||||
{
|
|
||||||
return Utils::timeElapsed($this->time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Time "elapsed" since the last edit.
|
|
||||||
*
|
|
||||||
* @return string Readable time elapsed since this post was last edited.
|
|
||||||
*/
|
|
||||||
public function editTimeElapsed()
|
|
||||||
{
|
|
||||||
return Utils::timeElapsed($this->editTime);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -334,26 +334,6 @@ class Thread
|
||||||
return Database::count('posts', ['topic_id' => [$this->id, '=']])[0];
|
return Database::count('posts', ['topic_id' => [$this->id, '=']])[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The "elapsed" string for this thread since it was created.
|
|
||||||
*
|
|
||||||
* @return string Readable time elapsed since this thread was created.
|
|
||||||
*/
|
|
||||||
public function timeElapsed()
|
|
||||||
{
|
|
||||||
return Utils::timeElapsed($this->time);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The "elapsed" string for this thread since the status was last changed.
|
|
||||||
*
|
|
||||||
* @return string Readble time elapsed since the status was last changed.
|
|
||||||
*/
|
|
||||||
public function statusChangeElapsed()
|
|
||||||
{
|
|
||||||
return Utils::timeElapsed($this->statusChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a user has read this thread before.
|
* Check if a user has read this thread before.
|
||||||
*
|
*
|
||||||
|
|
|
@ -457,29 +457,6 @@ class User
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the elapsed string for some of the user's dates
|
|
||||||
*
|
|
||||||
* @param string $append Append to the value.
|
|
||||||
* @param string $none Replace the 0 value with this.
|
|
||||||
*
|
|
||||||
* @return array The times.
|
|
||||||
*/
|
|
||||||
public function elapsed($append = ' ago', $none = 'Just now')
|
|
||||||
{
|
|
||||||
$times = [];
|
|
||||||
$dates = [
|
|
||||||
'joined' => $this->registered,
|
|
||||||
'lastOnline' => $this->lastOnline,
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($dates as $key => $val) {
|
|
||||||
$times[$key] = Utils::timeElapsed($val, $append, $none);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $times;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add ranks to a user.
|
* Add ranks to a user.
|
||||||
*
|
*
|
||||||
|
|
|
@ -686,50 +686,6 @@ class Utils
|
||||||
return $logs;
|
return $logs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Calculate the time that has elapsed since a certain data (doesn't take leap years in account).
|
|
||||||
*
|
|
||||||
* @param int $timestamp The timestamp.
|
|
||||||
* @param string $append Append to
|
|
||||||
* @param string $none Text if 0.
|
|
||||||
*
|
|
||||||
* @return string Returns the time elapsed in a readable format.
|
|
||||||
*/
|
|
||||||
public static function timeElapsed($timestamp, $append = ' ago', $none = 'Just now')
|
|
||||||
{
|
|
||||||
|
|
||||||
// Subtract the entered timestamp from the current timestamp
|
|
||||||
$time = time() - $timestamp;
|
|
||||||
|
|
||||||
// If the new timestamp is below 1 return a standard string
|
|
||||||
if ($time < 1) {
|
|
||||||
return $none;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Array containing time "types"
|
|
||||||
$times = [
|
|
||||||
365 * 24 * 60 * 60 => 'year',
|
|
||||||
30 * 24 * 60 * 60 => 'month',
|
|
||||||
24 * 60 * 60 => 'day',
|
|
||||||
60 * 60 => 'hour',
|
|
||||||
60 => 'minute',
|
|
||||||
1 => 'second',
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach ($times as $secs => $str) {
|
|
||||||
// Do a devision to check if the given timestamp fits in the current "type"
|
|
||||||
$calc = $time / $secs;
|
|
||||||
|
|
||||||
if ($calc >= 1) {
|
|
||||||
// Round the number
|
|
||||||
$round = floor($calc);
|
|
||||||
|
|
||||||
// Return the string
|
|
||||||
return $round . ' ' . $times[$secs] . ($round == 1 ? '' : 's') . $append;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the byte symbol for a unit from bytes.
|
* Get the byte symbol for a unit from bytes.
|
||||||
*
|
*
|
||||||
|
|
|
@ -106,6 +106,42 @@ var Sakura = (function () {
|
||||||
// Test it on the email var which'll return a boolean
|
// Test it on the email var which'll return a boolean
|
||||||
return re.test(email);
|
return re.test(email);
|
||||||
};
|
};
|
||||||
|
// Calculate the time that has elapsed since a certain data (doesn't take leap years in account).
|
||||||
|
Sakura.timeElapsed = function (timestamp, append, none) {
|
||||||
|
if (append === void 0) { append = ' ago'; }
|
||||||
|
if (none === void 0) { none = 'Just now'; }
|
||||||
|
// Subtract the entered timestamp from the current timestamp
|
||||||
|
var time = this.epoch() - timestamp;
|
||||||
|
// If the new timestamp is below 1 return a standard string
|
||||||
|
if (time < 1) {
|
||||||
|
return none;
|
||||||
|
}
|
||||||
|
// Times array
|
||||||
|
var times = {
|
||||||
|
31536000: 'year',
|
||||||
|
2592000: 'month',
|
||||||
|
86400: 'day',
|
||||||
|
3600: 'hour',
|
||||||
|
60: 'minute',
|
||||||
|
1: 'second'
|
||||||
|
};
|
||||||
|
//
|
||||||
|
var timeKeys = Object.keys(times).reverse();
|
||||||
|
// Iterate over the times
|
||||||
|
for (var i in timeKeys) {
|
||||||
|
// Do a devision to check if the given timestamp fits in the current "type"
|
||||||
|
var calc = time / parseInt(timeKeys[i]);
|
||||||
|
// Check if we have a match
|
||||||
|
if (calc >= 1) {
|
||||||
|
// Round the number
|
||||||
|
var display = Math.floor(calc);
|
||||||
|
// Return the formatted string
|
||||||
|
return display + " " + times[timeKeys[i]] + (display === 1 ? '' : 's') + append;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// If everything fails just return none
|
||||||
|
return none;
|
||||||
|
};
|
||||||
Sakura.cookiePrefix = ""; // Cookie prefix, gets prepended to cookie names
|
Sakura.cookiePrefix = ""; // Cookie prefix, gets prepended to cookie names
|
||||||
Sakura.cookiePath = "/"; // Cookie path, can in most cases be left untouched
|
Sakura.cookiePath = "/"; // Cookie path, can in most cases be left untouched
|
||||||
return Sakura;
|
return Sakura;
|
||||||
|
|
|
@ -128,6 +128,48 @@ class Sakura {
|
||||||
// Test it on the email var which'll return a boolean
|
// Test it on the email var which'll return a boolean
|
||||||
return re.test(email);
|
return re.test(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculate the time that has elapsed since a certain data (doesn't take leap years in account).
|
||||||
|
public static timeElapsed(timestamp: number, append: string = ' ago', none: string = 'Just now'): string {
|
||||||
|
// Subtract the entered timestamp from the current timestamp
|
||||||
|
var time: number = this.epoch() - timestamp;
|
||||||
|
|
||||||
|
// If the new timestamp is below 1 return a standard string
|
||||||
|
if (time < 1) {
|
||||||
|
return none;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Times array
|
||||||
|
var times: Object = {
|
||||||
|
31536000: 'year',
|
||||||
|
2592000: 'month',
|
||||||
|
86400: 'day',
|
||||||
|
3600: 'hour',
|
||||||
|
60: 'minute',
|
||||||
|
1: 'second'
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
var timeKeys: string[] = Object.keys(times).reverse();
|
||||||
|
|
||||||
|
// Iterate over the times
|
||||||
|
for (var i in timeKeys) {
|
||||||
|
// Do a devision to check if the given timestamp fits in the current "type"
|
||||||
|
var calc: number = time / parseInt(timeKeys[i]);
|
||||||
|
|
||||||
|
// Check if we have a match
|
||||||
|
if (calc >= 1) {
|
||||||
|
// Round the number
|
||||||
|
var display: number = Math.floor(calc);
|
||||||
|
|
||||||
|
// Return the formatted string
|
||||||
|
return display + " " + times[timeKeys[i]] + (display === 1 ? '' : 's') + append;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If everything fails just return none
|
||||||
|
return none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UTF-8 functions
|
// UTF-8 functions
|
||||||
|
|
|
@ -1498,11 +1498,6 @@ if (Users::checkLogin()) {
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Username changing
|
|
||||||
case 'account.username':
|
|
||||||
$renderData['difference'] = $currentUser->getUsernameHistory() ? Utils::timeElapsed($currentUser->getUsernameHistory()[0]['change_time']) : 0;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Sessions
|
// Sessions
|
||||||
case 'advanced.sessions':
|
case 'advanced.sessions':
|
||||||
$renderData['sessions'] = Database::fetch('sessions', true, ['user_id' => [$currentUser->id, '=']]);
|
$renderData['sessions'] = Database::fetch('sessions', true, ['user_id' => [$currentUser->id, '=']]);
|
||||||
|
|
|
@ -170,7 +170,7 @@ if (!defined('SAKURA_NO_TPL')) {
|
||||||
'siteLogo' => Config::get('sitelogo'),
|
'siteLogo' => Config::get('sitelogo'),
|
||||||
'siteDesc' => Config::get('sitedesc'),
|
'siteDesc' => Config::get('sitedesc'),
|
||||||
'siteTags' => json_decode(Config::get('sitetags'), true),
|
'siteTags' => json_decode(Config::get('sitetags'), true),
|
||||||
'dateFormat' => Config::get('date_format'),
|
'dateFormat' => 'r',
|
||||||
'currentPage' => (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null),
|
'currentPage' => (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : null),
|
||||||
'referrer' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null),
|
'referrer' => (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null),
|
||||||
'onlineTimeout' => Config::get('max_online_time'),
|
'onlineTimeout' => Config::get('max_online_time'),
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
All active users in the past {{ sakura.onlineTimeout / 60 }} minute{% if sakura.onlineTimeout != 60 %}s{% endif %}
|
All active users in the past {{ sakura.onlineTimeout / 60 }} minute{% if sakura.onlineTimeout != 60 %}s{% endif %}
|
||||||
<table class="panelTable">
|
<table class="panelTable">
|
||||||
{% for amount,onlineUser in stats.onlineUsers %}
|
{% for amount,onlineUser in stats.onlineUsers %}
|
||||||
<tr><td style="text-align: left;"><a href="{{ urls.format('USER_PROFILE', [onlineUser.id]) }}" style="font-weight: bold; color: {{ onlineUser.colour }};" class="default">{{ onlineUser.username }}</a></td><td title="{{ onlineUser.lastOnline|date(sakura.dateFormat) }}" style="text-align: right;">{{ onlineUser.elapsed.lastOnline }}</td></tr>
|
<tr><td style="text-align: left;"><a href="{{ urls.format('USER_PROFILE', [onlineUser.id]) }}" style="font-weight: bold; color: {{ onlineUser.colour }};" class="default">{{ onlineUser.username }}</a></td><td style="text-align: right;"><time>{{ onlineUser.lastOnline|date(sakura.dateFormat) }}</time></td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div class="news-post-time">
|
<div class="news-post-time">
|
||||||
Posted on {{ post.news_timestamp|date(sakura.dateFormat) }}{% if not (viewPost and postExists) %} <a class="default" href="{{ urls.format('SITE_NEWS_CAT_POST', [post.news_category, post.news_id]) }}#comments">{{ post.news_comments.count }} comment{% if post.news_comments.count != 1 %}s{% endif %}</a>{% endif %}
|
Posted on <time>{{ post.news_timestamp|date(sakura.dateFormat) }}</time>{% if not (viewPost and postExists) %} <a class="default" href="{{ urls.format('SITE_NEWS_CAT_POST', [post.news_category, post.news_id]) }}#comments">{{ post.news_comments.count }} comment{% if post.news_comments.count != 1 %}s{% endif %}</a>{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
<div>
|
<div>
|
||||||
{% if forum.lastPost.id %}
|
{% if forum.lastPost.id %}
|
||||||
<a href="{{ urls.format('FORUM_THREAD', [forum.lastPost.thread]) }}" class="default">{{ forum.lastPost.subject|slice(0, 30) }}{% if forum.lastPost.subject|length > 30 %}...{% endif %}</a><br />
|
<a href="{{ urls.format('FORUM_THREAD', [forum.lastPost.thread]) }}" class="default">{{ forum.lastPost.subject|slice(0, 30) }}{% if forum.lastPost.subject|length > 30 %}...{% endif %}</a><br />
|
||||||
<span title="{{ forum.lastPost.time|date(sakura.dateFormat) }}">{{ forum.lastPost.timeElapsed }}</span> by {% if forum.lastPost.poster.id %}<a href="{{ urls.format('USER_PROFILE', [forum.lastPost.poster.id]) }}" class="default" style="color: {{ forum.lastPost.poster.colour }}; text-shadow: 0 0 5px {% if forumlastPost.poster.colour != 'inherit' %}{{ forum.lastPost.poster.colour }}{% else %}#222{% endif %};">{{ forum.lastPost.poster.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.lastPost.id]) }}#p{{ forum.lastPost.id }}" class="default fa fa-tag"></a>
|
<time>{{ forum.lastPost.time|date(sakura.dateFormat) }}</time> by {% if forum.lastPost.poster.id %}<a href="{{ urls.format('USER_PROFILE', [forum.lastPost.poster.id]) }}" class="default" style="color: {{ forum.lastPost.poster.colour }}; text-shadow: 0 0 5px {% if forumlastPost.poster.colour != 'inherit' %}{{ forum.lastPost.poster.colour }}{% else %}#222{% endif %};">{{ forum.lastPost.poster.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.lastPost.id]) }}#p{{ forum.lastPost.id }}" class="default fa fa-tag"></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
There are no posts in this forum.<br />
|
There are no posts in this forum.<br />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
{% else %}
|
{% else %}
|
||||||
[deleted user]
|
[deleted user]
|
||||||
{% endif %} <a href="{{ urls.format('FORUM_POST', [thread.lastPost.id]) }}#p{{ thread.lastPost.id }}" class="default fa fa-tag"></a><br />
|
{% endif %} <a href="{{ urls.format('FORUM_POST', [thread.lastPost.id]) }}#p{{ thread.lastPost.id }}" class="default fa fa-tag"></a><br />
|
||||||
<span title="{{ thread.lastPost.time|date(sakura.dateFormat) }}">{{ thread.lastPost.timeElapsed }}</span>
|
<time>{{ thread.lastPost.time|date(sakura.dateFormat) }}</time>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
|
<a href="#p{{ post.id }}" class="clean">{{ post.subject|slice(0, 50) }}{% if post.subject|length > 50 %}...{% endif %}</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<a href="{{ urls.format('FORUM_POST', [post.id]) }}#p{{ post.id }}" class="clean" title="{{ post.time|date(sakura.dateFormat) }}">#{{ post.id }} - {{ post.timeElapsed }}</a>
|
<a href="{{ urls.format('FORUM_POST', [post.id]) }}#p{{ post.id }}" class="clean">#{{ post.id }} - <time>{{ post.time|date(sakura.dateFormat) }}</time></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,64 +58,6 @@
|
||||||
Sakura.cookiePrefix = "{{ sakura.cookie.prefix }}";
|
Sakura.cookiePrefix = "{{ sakura.cookie.prefix }}";
|
||||||
Sakura.cookiePath = "{{ sakura.cookie.path }}";
|
Sakura.cookiePath = "{{ sakura.cookie.path }}";
|
||||||
|
|
||||||
// Space for things that need to happen onload
|
|
||||||
window.addEventListener("load", function() {
|
|
||||||
{% if session.checkLogin %}
|
|
||||||
// Convert href to object in logout link
|
|
||||||
prepareAjaxLink('headerLogoutLink', 'submitPost', ', true, "Logging out..."');
|
|
||||||
{% elseif not sakura.lockAuth and php.self != '/authenticate.php' %}
|
|
||||||
// Make the header login form dynamic
|
|
||||||
prepareAjaxForm('headerLoginForm', 'Logging in...');
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if session.checkLogin %}
|
|
||||||
// Make notification requests (there's a seperate one to make it happen before the first 60 seconds)
|
|
||||||
notifyRequest('{{ php.sessionid }}');
|
|
||||||
|
|
||||||
// Create interval
|
|
||||||
setInterval(function() {
|
|
||||||
notifyRequest('{{ php.sessionid }}');
|
|
||||||
}, 60000);
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% 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 %}
|
|
||||||
|
|
||||||
{% if php.self == '/viewtopic.php' and session.checkLogin %}
|
|
||||||
var forumFriendToggles = document.querySelectorAll('.forum-friend-toggle');
|
|
||||||
|
|
||||||
for(var i in forumFriendToggles) {
|
|
||||||
prepareAjaxLink(forumFriendToggles[i], 'submitPost', ', true, "Please wait..."');
|
|
||||||
}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if php.self == '/authenticate.php' and not (sakura.lockAuth or session.checkLogin) %}
|
|
||||||
|
|
||||||
// AJAX Form Submission
|
|
||||||
var forms = {
|
|
||||||
{% if not auth.changingPass %}
|
|
||||||
"loginForm": 'Logging in...',
|
|
||||||
{% if not sakura.disableRegistration %}
|
|
||||||
"registerForm": 'Processing registration...',
|
|
||||||
{% endif %}
|
|
||||||
{% if sakura.requireActivation %}
|
|
||||||
"resendForm": 'Attempting to resend activation...',
|
|
||||||
{% endif %}
|
|
||||||
"passwordForm": 'Sending password recovery mail...'
|
|
||||||
{% else %}
|
|
||||||
"passwordForm": 'Changing password...'
|
|
||||||
{% endif %}
|
|
||||||
};
|
|
||||||
|
|
||||||
for(var i in forms) {
|
|
||||||
prepareAjaxForm(i, forms[i], (i == 'registerForm'));
|
|
||||||
}
|
|
||||||
|
|
||||||
{% endif %}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Error reporter
|
// Error reporter
|
||||||
window.onerror = function(msg, url, line, col, error) {
|
window.onerror = function(msg, url, line, col, error) {
|
||||||
notifyUI({
|
notifyUI({
|
||||||
|
@ -200,6 +142,7 @@
|
||||||
<div>A staff member has set your account to restricted mode most likely due to violation of the rules. While restricted you won't be able to use most public features of the site. If you think this is a mistake please <a href="{{ urls.format('INFO_PAGE', ['contact']) }}" style="color: inherit;">get in touch with one of our staff members</a>.</div>
|
<div>A staff member has set your account to restricted mode most likely due to violation of the rules. While restricted you won't be able to use most public features of the site. If you think this is a mistake please <a href="{{ urls.format('INFO_PAGE', ['contact']) }}" style="color: inherit;">get in touch with one of our staff members</a>.</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<noscript>
|
<noscript>
|
||||||
<div class="headerNotify">
|
<div class="headerNotify">
|
||||||
<h1>You have JavaScript disabled!</h1>
|
<h1>You have JavaScript disabled!</h1>
|
||||||
|
@ -259,6 +202,80 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
// Space for things that need to happen onload
|
||||||
|
window.addEventListener("load", function() {
|
||||||
|
{% if session.checkLogin %}
|
||||||
|
// Convert href to object in logout link
|
||||||
|
prepareAjaxLink('headerLogoutLink', 'submitPost', ', true, "Logging out..."');
|
||||||
|
{% elseif not sakura.lockAuth and php.self != '/authenticate.php' %}
|
||||||
|
// Make the header login form dynamic
|
||||||
|
prepareAjaxForm('headerLoginForm', 'Logging in...');
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if session.checkLogin %}
|
||||||
|
// Make notification requests (there's a seperate one to make it happen before the first 60 seconds)
|
||||||
|
notifyRequest('{{ php.sessionid }}');
|
||||||
|
|
||||||
|
// Create interval
|
||||||
|
setInterval(function() {
|
||||||
|
notifyRequest('{{ php.sessionid }}');
|
||||||
|
}, 60000);
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% 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 %}
|
||||||
|
|
||||||
|
{% if php.self == '/viewtopic.php' and session.checkLogin %}
|
||||||
|
var forumFriendToggles = document.querySelectorAll('.forum-friend-toggle');
|
||||||
|
|
||||||
|
for(var i in forumFriendToggles) {
|
||||||
|
prepareAjaxLink(forumFriendToggles[i], 'submitPost', ', true, "Please wait..."');
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if php.self == '/authenticate.php' and not (sakura.lockAuth or session.checkLogin) %}
|
||||||
|
|
||||||
|
// AJAX Form Submission
|
||||||
|
var forms = {
|
||||||
|
{% if not auth.changingPass %}
|
||||||
|
"loginForm": 'Logging in...',
|
||||||
|
{% if not sakura.disableRegistration %}
|
||||||
|
"registerForm": 'Processing registration...',
|
||||||
|
{% endif %}
|
||||||
|
{% if sakura.requireActivation %}
|
||||||
|
"resendForm": 'Attempting to resend activation...',
|
||||||
|
{% endif %}
|
||||||
|
"passwordForm": 'Sending password recovery mail...'
|
||||||
|
{% else %}
|
||||||
|
"passwordForm": 'Changing password...'
|
||||||
|
{% endif %}
|
||||||
|
};
|
||||||
|
|
||||||
|
for(var i in forms) {
|
||||||
|
prepareAjaxForm(i, forms[i], (i == 'registerForm'));
|
||||||
|
}
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Parse time elements
|
||||||
|
var timeElems = document.getElementsByTagName('time');
|
||||||
|
|
||||||
|
// Iterate over them
|
||||||
|
for (var timeElem in timeElems) {
|
||||||
|
// Attempt to parse it
|
||||||
|
var parsed = Date.parse(timeElems[timeElem].innerText);
|
||||||
|
|
||||||
|
// If it can be parsed do DOM edits
|
||||||
|
if (!isNaN(parsed)) {
|
||||||
|
timeElems[timeElem].title = timeElems[timeElem].innerText;
|
||||||
|
timeElems[timeElem].innerText = Sakura.timeElapsed(Math.floor(parsed / 1000));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% if sakura.dev.showChangelog and php.self == '/index.php' and stats %}
|
{% if sakura.dev.showChangelog and php.self == '/index.php' and stats %}
|
||||||
<script type="text/javascript" src="https://sakura.flash.moe/?get={{ sakura.versionInfo.version|slice(0, 4) }}-{{ sakura.versionInfo.version|slice(4, 2) }}-{{ sakura.versionInfo.version|slice(6, 2) }}&variable=true"></script>
|
<script type="text/javascript" src="https://sakura.flash.moe/?get={{ sakura.versionInfo.version|slice(0, 4) }}-{{ sakura.versionInfo.version|slice(4, 2) }}-{{ sakura.versionInfo.version|slice(6, 2) }}&variable=true"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
|
@ -80,11 +80,11 @@
|
||||||
<td>
|
<td>
|
||||||
<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>
|
<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>
|
||||||
<td title="{{ user.registered|date(sakura.dateFormat) }}">
|
<td>
|
||||||
{{ user.elapsed.joined }}
|
<time>{{ user.registered|date(sakura.dateFormat) }}</time>
|
||||||
</td>
|
</td>
|
||||||
<td title="{% if user.lastOnline == 0 %}Never logged in.{% else %}{{ user.lastOnline|date(sakura.dateFormat) }}{% endif %}">
|
<td>
|
||||||
{% if user.lastOnline == 0 %}<i>Never logged in.</i>{% else %}{{ user.elapsed.lastOnline }}{% endif %}
|
{% if user.lastOnline == 0 %}<i>Never logged in.</i>{% else %}<time>{{ user.lastOnline|date(sakura.dateFormat) }}</time>{% endif %}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{ user.title }}
|
{{ user.title }}
|
||||||
|
|
|
@ -82,12 +82,12 @@
|
||||||
{% if profile.isPremium[0] %}<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi" style="vertical-align: middle;" /> {% endif %}<img src="{{ sakura.contentPath }}/images/flags/{{ profile.country|lower }}.png" alt="{{ profile.country }}" style="vertical-align: middle;" title="{{ profile.country(true) }}" /> <span style="font-size: .8em;">{{ profile.title }}</span>
|
{% if profile.isPremium[0] %}<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi" style="vertical-align: middle;" /> {% endif %}<img src="{{ sakura.contentPath }}/images/flags/{{ profile.country|lower }}.png" alt="{{ profile.country }}" style="vertical-align: middle;" title="{{ profile.country(true) }}" /> <span style="font-size: .8em;">{{ profile.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="new-profile-dates">
|
<div class="new-profile-dates">
|
||||||
<b>Joined</b> <span title="{{ profile.registered|date(sakura.dateFormat) }}">{{ profile.elapsed.joined }}</span>
|
<b>Joined</b> <time>{{ profile.registered|date(sakura.dateFormat) }}</time>
|
||||||
<br />
|
<br />
|
||||||
{% if profile.lastOnline < 1 %}
|
{% if profile.lastOnline < 1 %}
|
||||||
<b>{{ profile.username }} hasn't logged in yet.</b>
|
<b>{{ profile.username }} hasn't logged in yet.</b>
|
||||||
{% else %}
|
{% else %}
|
||||||
<b>Last online</b> <span title="{{ profile.lastOnline|date(sakura.dateFormat) }}">{{ profile.elapsed.lastOnline }}</span>
|
<b>Last online</b> <time>{{ profile.lastOnline|date(sakura.dateFormat) }}</time>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if profile.birthday != '0000-00-00' and profile.birthday|split('-')[0] > 0 %}
|
{% if profile.birthday != '0000-00-00' and profile.birthday|split('-')[0] > 0 %}
|
||||||
<br /><b>Age</b> <span title="{{ profile.birthday }}">{{ profile.birthday(true) }} years old</span>
|
<br /><b>Age</b> <span title="{{ profile.birthday }}">{{ profile.birthday(true) }} years old</span>
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<input type="hidden" name="timestamp" value="{{ php.time }}" />
|
<input type="hidden" name="timestamp" value="{{ php.time }}" />
|
||||||
<input type="hidden" name="mode" value="username" />
|
<input type="hidden" name="mode" value="username" />
|
||||||
<h1 class="stylised" style="text-align: center; margin-top: 10px;{% if not eligible %} color: #c44;{% endif %}">You are {% if not eligible %}not {% endif %}eligible for a name change.</h1>
|
<h1 class="stylised" style="text-align: center; margin-top: 10px;{% if not eligible %} color: #c44;{% endif %}">You are {% if not eligible %}not {% endif %}eligible for a name change.</h1>
|
||||||
<h3 style="text-align: center;">{% if user.getUsernameHistory %}Your last name change was {{ difference }}.{% else %}This is your first username change.{% endif %}</h3>
|
<h3 style="text-align: center;">{% if user.getUsernameHistory %}Your last name change was <time>{{ user.getUsernameHistory[0]['change_time']|date(sakura.dateFormat) }}</time>.{% else %}This is your first username change.{% endif %}</h3>
|
||||||
{% if eligible %}
|
{% if eligible %}
|
||||||
<div class="profile-field">
|
<div class="profile-field">
|
||||||
<div><h2>Username</h2></div>
|
<div><h2>Username</h2></div>
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="notif-hist-time">
|
<div class="notif-hist-time">
|
||||||
{{ alert.alert_timestamp|date(sakura.dateFormat) }}
|
<time>{{ alert.alert_timestamp|date(sakura.dateFormat) }}</time>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
Reference in a new issue