r20151112
Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
parent
082bd62efc
commit
827a73efbf
8 changed files with 32 additions and 29 deletions
|
@ -690,7 +690,7 @@ class Main
|
|||
}
|
||||
|
||||
// Time elapsed
|
||||
public static function timeElapsed($timestamp, $append = ' ago', $none = 'Just now')
|
||||
public static function timeElapsed($timestamp, $append = ' ago', $none = 'Just now', $floor = false)
|
||||
{
|
||||
|
||||
// Subtract the entered timestamp from the current timestamp
|
||||
|
@ -717,7 +717,7 @@ class Main
|
|||
|
||||
if ($calc >= 1) {
|
||||
// Round the number
|
||||
$round = round($calc);
|
||||
$round = floor($calc);
|
||||
|
||||
// Return the string
|
||||
return $round . ' ' . $times[$secs] . ($round == 1 ? '' : 's') . $append;
|
||||
|
|
|
@ -12,14 +12,23 @@ namespace Sakura;
|
|||
class Rank
|
||||
{
|
||||
// Rank data
|
||||
private $data = [];
|
||||
private $data = [
|
||||
'rank_id' => 0,
|
||||
'rank_name' => 'Rank',
|
||||
'rank_hierarchy' => 0,
|
||||
'rank_multiple' => null,
|
||||
'rank_hidden' => 1,
|
||||
'rank_colour' => '#444',
|
||||
'rank_description' => '',
|
||||
'rank_title' => '',
|
||||
];
|
||||
|
||||
// Initialise the rank object
|
||||
public function __construct($rid)
|
||||
{
|
||||
|
||||
// Get the rank database row
|
||||
$this->data = Database::fetch(
|
||||
$getRank = Database::fetch(
|
||||
'ranks',
|
||||
false,
|
||||
[
|
||||
|
@ -28,9 +37,9 @@ class Rank
|
|||
);
|
||||
|
||||
// Check if the rank actually exists
|
||||
if (empty($this->data)) {
|
||||
if (!empty($getRank)) {
|
||||
// If not assign as the fallback rank
|
||||
$this->data = Users::$emptyRank;
|
||||
$this->data = $getRank;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,18 +11,6 @@ namespace Sakura;
|
|||
*/
|
||||
class Users
|
||||
{
|
||||
// Empty rank template
|
||||
public static $emptyRank = [
|
||||
'rank_id' => 0,
|
||||
'rank_name' => 'Rank',
|
||||
'rank_hierarchy' => 0,
|
||||
'rank_multiple' => null,
|
||||
'rank_hidden' => 1,
|
||||
'rank_colour' => '#444',
|
||||
'rank_description' => '',
|
||||
'rank_title' => '',
|
||||
];
|
||||
|
||||
// Check if a user is logged in
|
||||
public static function checkLogin($uid = null, $sid = null)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace Sakura;
|
||||
|
||||
// Define Sakura version
|
||||
define('SAKURA_VERSION', '20151111');
|
||||
define('SAKURA_VERSION', '20151112');
|
||||
define('SAKURA_VLABEL', 'Eminence');
|
||||
define('SAKURA_COLOUR', '#6C3082');
|
||||
define('SAKURA_STABLE', false);
|
||||
|
@ -39,8 +39,8 @@ require_once ROOT . '_sakura/components/Permissions.php';
|
|||
require_once ROOT . '_sakura/components/Session.php';
|
||||
require_once ROOT . '_sakura/components/User.php';
|
||||
require_once ROOT . '_sakura/components/Rank.php';
|
||||
require_once ROOT . '_sakura/components/Users.php'; //<
|
||||
require_once ROOT . '_sakura/components/Forums.php'; //<
|
||||
require_once ROOT . '_sakura/components/Users.php';
|
||||
require_once ROOT . '_sakura/components/Forums.php';
|
||||
require_once ROOT . '_sakura/components/News.php';
|
||||
require_once ROOT . '_sakura/components/Comments.php';
|
||||
require_once ROOT . '_sakura/components/Manage.php';
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
{% endif %}
|
||||
<div class="userdata">
|
||||
<div class="usertitle">{% if not post.user.userTitle %}{{ post.rank.title }}{% else %}{{ post.user.userTitle }}{% endif %}</div>
|
||||
<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 }}" />
|
||||
<img src="{{ sakura.contentPath }}/images/tenshi.png" alt="Tenshi"{% if not post.user.isPremium[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.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.id) != 0 %}
|
||||
<a class="fa fa-{% if post.user.checkFriends(user.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
|
||||
{% if user.isFriends(post.user.id) != 0 %}
|
||||
<a class="fa fa-{% if user.isFriends(post.user.id) == 2 %}heart{% else %}star{% endif %}" title="You are friends"></a>
|
||||
{% endif %}
|
||||
<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-user-{% if user.isFriends(post.user.id) == 0 %}plus{% else %}times{% endif %} forum-friend-toggle" title="{% if user.isFriends(post.user.id) == 0 %}Add {{ post.user.username }} as a friend{% else %}Remove friend{% endif %}" href="{% if user.isFriends(post.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>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
{% 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.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 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.short|lower }}.png" alt="{{ profile.country.short }}" style="vertical-align: middle;" /> <span style="font-size: .8em; line-height: 11px;">{{ profile.country.long }}</span>
|
||||
{% if session.checkLogin %}
|
||||
<div class="user-actions">
|
||||
{% if user.id == profile.id %}
|
||||
|
|
|
@ -12,9 +12,6 @@ define('SAKURA_NO_TPL', true);
|
|||
// Include components
|
||||
require_once str_replace(basename(__DIR__), '', dirname(__FILE__)) . '_sakura/sakura.php';
|
||||
|
||||
// Set Content type
|
||||
header('Content-Type: application/octet-stream');
|
||||
|
||||
// Path to user uploads
|
||||
$userDirPath = ROOT . Config::getConfig('user_uploads') . '/';
|
||||
|
||||
|
@ -150,8 +147,12 @@ if (isset($_GET['m'])) {
|
|||
$serveImage = ROOT . Config::getConfig('pixel_img');
|
||||
}
|
||||
|
||||
// Add original filename
|
||||
header('Content-Disposition: inline; filename="' . basename($serveImage) . '"');
|
||||
|
||||
$serveImage = file_get_contents($serveImage);
|
||||
|
||||
// Set content type
|
||||
header('Content-Type: ' . getimagesizefromstring($serveImage)['mime']);
|
||||
|
||||
print $serveImage;
|
||||
|
|
|
@ -54,6 +54,11 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
|||
$onlineFriends = isset($_SESSION['friendsOnline']) ? $_SESSION['friendsOnline'] : [];
|
||||
$onlineNotify = isset($_SESSION['friendsOnline']);
|
||||
|
||||
// Set friendsOnline
|
||||
if (!$onlineNotify) {
|
||||
$_SESSION['friendsOnline'] = [];
|
||||
}
|
||||
|
||||
// Populate the array
|
||||
foreach ($currentUser->friends(1) as $friend) {
|
||||
// Online status
|
||||
|
|
Reference in a new issue