r20160114

This commit is contained in:
flash 2016-01-14 21:43:33 +01:00
parent 6e48db4936
commit d6e22f1258
9 changed files with 60 additions and 114 deletions

View file

@ -1,81 +0,0 @@
<?php
/*
* Sakura Sock Chat authentication script
* By Flashwave
*/
// Filesystem path to the sakura root directory WITHOUT an ending /
// This can also be set before an include of this file in case
// you're using git to keep in sync and don't want conflicts
// You can also create a PHP file including this SockChat.php
// file so it's always up-to-date! Don't forget to include the
// variable below in the file __BEFORE__ the include!
if (!isset($sockSakuraPath)) {
$sockSakuraPath = '';
}
/* * * DON'T EDIT ANYTHING BELOW THIS LINE * * */
// Include Sakura
require_once $sockSakuraPath . '/sakura.php';
use Sakura\Perms;
use Sakura\Perms\Site;
use Sakura\Perms\Manage;
use Sakura\User;
use Sakura\Rank;
use Sakura\Users;
use sockchat\Auth;
if (Auth::getPageType() == AUTH_FETCH) {
// Check if user is logged into the Sakura backend if not deny
if ($data = Users::checkLogin()) {
// If so append the required arguments and accept
Auth::AppendArguments([$data[0], $data[1]]);
Auth::Accept();
} else {
Auth::Deny();
}
} else {
// Get arguments
$uid = $_REQUEST['arg1'];
$sid = $_REQUEST['arg2'];
// Check if session is active else deny
if ($data = Users::checkLogin($uid, $sid)) {
// Create a user object
$user = User::construct($uid);
// Check if they can access the chat
if ($user->permission(Site::DEACTIVATED) || $user->permission(Site::RESTRICTED)) {
Auth::Deny();
Auth::Serve();
exit;
}
// Set the user's data
Auth::SetUserData(
$user->id(),
$user->username(),
$user->colour()
);
// Set the common permissions
Auth::SetCommonPermissions(
Rank::construct($user->mainRank())->hierarchy(),
$user->permission(Manage::USE_MANAGE, Perms::MANAGE) ? 1 : 0,
$user->permission(Site::CREATE_BACKGROUND) ? 1 : 0,
$user->permission(Site::CHANGE_USERNAME) ? 1 : 0,
$user->permission(Site::MULTIPLE_GROUPS) ? 2 : (
$user->permission(Site::CREATE_GROUP) ? 1 : 0
)
);
Auth::Accept();
} else {
Auth::Deny();
}
}
// Serve the authentication data
Auth::Serve();

View file

@ -72,6 +72,8 @@ function notifyUI(content) {
// Append // Append
sound.appendChild(mp3); sound.appendChild(mp3);
sound.appendChild(ogg); sound.appendChild(ogg);
// Less loud
sound.volume = 0.5;
// And play // And play
sound.play(); sound.play();
} }

View file

@ -95,6 +95,9 @@ function notifyUI(content: Notification): void {
sound.appendChild(mp3); sound.appendChild(mp3);
sound.appendChild(ogg); sound.appendChild(ogg);
// Less loud
sound.volume = 0.5;
// And play // And play
sound.play(); sound.play();
} }

View file

@ -1388,6 +1388,11 @@ if (Users::checkLogin()) {
case 'account.username': case 'account.username':
$renderData['difference'] = $currentUser->getUsernameHistory() ? Main::timeElapsed($currentUser->getUsernameHistory()[0]['change_time']) : 0; $renderData['difference'] = $currentUser->getUsernameHistory() ? Main::timeElapsed($currentUser->getUsernameHistory()[0]['change_time']) : 0;
break; break;
// Sessions
case 'advanced.sessions':
$renderData['sessions'] = Database::fetch('sessions', true, ['user_id' => [$currentUser->id(), '=']]);
break;
} }
// Set parse variables // Set parse variables

View file

@ -65,7 +65,7 @@ if (isset($_REQUEST['mode'])
$total, $total,
$itemName, $itemName,
Config::get('sitename') . ' Premium Purchase', Config::get('sitename') . ' Premium Purchase',
'http://' . Config::get('url_main') . $urls->format('SITE_PREMIUM') 'http' . (isset($_SERVER['HTTPS']) ? 's' : '') . '://' . Config::get('url_main') . $urls->format('SITE_PREMIUM')
)) { )) {
// Store the amount of months in the global session array // Store the amount of months in the global session array
$_SESSION['premiumMonths'] = (int) $_POST['months']; $_SESSION['premiumMonths'] = (int) $_POST['months'];

View file

@ -8,9 +8,9 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20160110'); define('SAKURA_VERSION', '20160114');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Amethyst');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#9966CC');
// Define Sakura Path // Define Sakura Path
define('ROOT', __DIR__ . '/'); define('ROOT', __DIR__ . '/');
@ -125,8 +125,6 @@ if (!defined('SAKURA_NO_TPL')) {
'sakura' => [ 'sakura' => [
'versionInfo' => [ 'versionInfo' => [
'version' => SAKURA_VERSION, 'version' => SAKURA_VERSION,
'label' => SAKURA_VLABEL,
'colour' => SAKURA_COLOUR,
], ],
'dev' => [ 'dev' => [
@ -148,7 +146,7 @@ if (!defined('SAKURA_NO_TPL')) {
'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' => Config::get('date_format'),
'currentPage' => '//' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], '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'),
'announcementImage' => Config::get('header_announcement_image'), 'announcementImage' => Config::get('header_announcement_image'),

View file

@ -67,30 +67,44 @@
{% if profile.dates.birth != '0000-00-00' and profile.dates.birth|split('-')[0] > 0 %} {% 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> <br /><b>Age</b> <span title="{{ profile.dates.birth }}">{{ profile.elapsed(' old').birth }}</span>
{% endif %} {% endif %}
{% if profile.profileFields %} {% if profile.profileFields or user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')) %}
<hr class="default" /> <hr class="default" />
{% if session.checkLogin %} {% if session.checkLogin %}
<table style="width: 100%;"> <table style="width: 100%;">
{% for name,field in profile.profileFields %} {% for name,field in profile.profileFields %}
<tr> <tr>
<td style="text-align: left; font-weight: bold;"> <td style="text-align: left; font-weight: bold;">
{{ field.name }} {{ field.name }}
</td> </td>
<td style="text-align: right;"> <td style="text-align: right;">
{% if name == 'youtube' %} {% 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.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 %} {% else %}
{% if field.islink %} {% if field.islink %}
<a href="{{ field.link }}" class="default"> <a href="{{ field.link }}" class="default">
{% endif %}
{{ field.value }}
{% if field.islink %}
</a>
{% endif %}
{% endif %} {% endif %}
{{ field.value }} </td>
{% if field.islink %} </tr>
</a>
{% endif %}
{% endif %}
</td>
</tr>
{% endfor %} {% endfor %}
{% if user.permission(constant('Sakura\\Perms\\Manage::USE_MANAGE'), constant('Sakura\\Perms::MANAGE')) %}
<tr>
<td style="text-align: left; font-weight: bold;">E-mail address</td>
<td style="text-align: right;"><a href="mailto:{{ profile.email }}" class="default">{{ profile.email }}</a></td>
</tr>
<tr>
<td style="text-align: left; font-weight: bold;">Register IP</td>
<td style="text-align: right;">{{ profile.ip(false) }}</td>
</tr>
<tr>
<td style="text-align: left; font-weight: bold;">Last IP</td>
<td style="text-align: right;">{{ profile.ip(true) }}</td>
</tr>
{% endif %}
</table> </table>
{% else %} {% else %}
<b>Log in to view the full profile!</b> <b>Log in to view the full profile!</b>

View file

@ -0,0 +1,13 @@
<table class="settings-table">
<thead>
<tr><th>IP</th><th style="width: 370px;">Useragent</th><th>Login time</th><th></th></tr>
</thead>
<tfoot>
<tr><th>IP</th><th>Useragent</th><th>Login time</th><th></th></tr>
</tfoot>
<tbody>
{% for session in sessions %}
{% endfor %}
</tbody>
</table>

View file

@ -17,12 +17,4 @@
<li><a href="{{ urls.format('SETTING_MODE', ['advanced', 'sessions']) }}" class="default">Manage Active Sessions</a></li> <li><a href="{{ urls.format('SETTING_MODE', ['advanced', 'sessions']) }}" class="default">Manage Active Sessions</a></li>
<li><a href="{{ urls.format('SETTING_MODE', ['account', 'password']) }}" class="default">Change Password</a></li> <li><a href="{{ urls.format('SETTING_MODE', ['account', 'password']) }}" class="default">Change Password</a></li>
</ul> </ul>
<br />
<h1 class="stylised">Personal Statistics</h1>
<ul>
<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>
</ul>
</div> </div>