r20151024
Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
parent
0c77fa438e
commit
e3b7b8cc87
10 changed files with 102 additions and 37 deletions
|
@ -264,12 +264,6 @@ class Forum
|
||||||
'elapsed' => Main::timeElapsed($post['post_time']),
|
'elapsed' => Main::timeElapsed($post['post_time']),
|
||||||
'is_op' => ($post['poster_id'] == $firstPost['poster_id'] ? '1' : '0'),
|
'is_op' => ($post['poster_id'] == $firstPost['poster_id'] ? '1' : '0'),
|
||||||
'parsed_post' => self::parseMarkUp($post['post_text'], $post['post_parse'], $post['post_emotes']),
|
'parsed_post' => self::parseMarkUp($post['post_text'], $post['post_parse'], $post['post_emotes']),
|
||||||
'signature' => empty($_POSTER['userData']['signature']) ?
|
|
||||||
'' :
|
|
||||||
self::parseMarkUp(
|
|
||||||
$_POSTER['userData']['signature']['text'],
|
|
||||||
$_POSTER['userData']['signature']['mode']
|
|
||||||
),
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Just in case
|
// Just in case
|
||||||
|
|
15
_sakura/components/Trick.php
Normal file
15
_sakura/components/Trick.php
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Extension manager
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Sakura;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Trick
|
||||||
|
* @package Sakura
|
||||||
|
*/
|
||||||
|
class Trick
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
|
@ -461,7 +461,7 @@ class User
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all warnings issued to the user
|
// Get a user's userpage
|
||||||
public function userPage()
|
public function userPage()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -476,6 +476,22 @@ class User
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get a user's signature
|
||||||
|
public function signature()
|
||||||
|
{
|
||||||
|
|
||||||
|
return isset($this->data['user_data']['signature']) ?
|
||||||
|
Main::bbParse(
|
||||||
|
Main::parseEmotes(
|
||||||
|
base64_decode(
|
||||||
|
$this->data['user_data']['signature']
|
||||||
|
)
|
||||||
|
)
|
||||||
|
) :
|
||||||
|
null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Get username change history
|
// Get username change history
|
||||||
public function getUsernameHistory()
|
public function getUsernameHistory()
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,8 +15,8 @@ class Users
|
||||||
// Empty user template
|
// Empty user template
|
||||||
public static $emptyUser = [
|
public static $emptyUser = [
|
||||||
'user_id' => 0,
|
'user_id' => 0,
|
||||||
'username' => 'Sakura User',
|
'username' => 'User',
|
||||||
'username_clean' => 'sakura user',
|
'username_clean' => 'user',
|
||||||
'password_hash' => '',
|
'password_hash' => '',
|
||||||
'password_salt' => '',
|
'password_salt' => '',
|
||||||
'password_algo' => 'nologin',
|
'password_algo' => 'nologin',
|
||||||
|
@ -29,7 +29,7 @@ class Users
|
||||||
'user_colour' => '',
|
'user_colour' => '',
|
||||||
'register_ip' => '127.0.0.1',
|
'register_ip' => '127.0.0.1',
|
||||||
'last_ip' => '127.0.0.1',
|
'last_ip' => '127.0.0.1',
|
||||||
'user_title' => 'Internal fallback account',
|
'user_title' => '',
|
||||||
'user_registered' => 0,
|
'user_registered' => 0,
|
||||||
'user_last_online' => 0,
|
'user_last_online' => 0,
|
||||||
'user_birthday' => '',
|
'user_birthday' => '',
|
||||||
|
@ -40,11 +40,12 @@ class Users
|
||||||
// Empty rank template
|
// Empty rank template
|
||||||
public static $emptyRank = [
|
public static $emptyRank = [
|
||||||
'rank_id' => 0,
|
'rank_id' => 0,
|
||||||
'rank_name' => 'Sakura Rank',
|
'rank_name' => 'Rank',
|
||||||
|
'rank_hierarchy' => 0,
|
||||||
'rank_multiple' => null,
|
'rank_multiple' => null,
|
||||||
'rank_hidden' => 1,
|
'rank_hidden' => 1,
|
||||||
'rank_colour' => '#444',
|
'rank_colour' => '#444',
|
||||||
'rank_description' => 'A hardcoded dummy rank for fallback.',
|
'rank_description' => '',
|
||||||
'rank_title' => '',
|
'rank_title' => '',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace Sakura;
|
namespace Sakura;
|
||||||
|
|
||||||
// Define Sakura version
|
// Define Sakura version
|
||||||
define('SAKURA_VERSION', '20151022');
|
define('SAKURA_VERSION', '20151024');
|
||||||
define('SAKURA_VLABEL', 'Eminence');
|
define('SAKURA_VLABEL', 'Eminence');
|
||||||
define('SAKURA_COLOUR', '#6C3082');
|
define('SAKURA_COLOUR', '#6C3082');
|
||||||
define('SAKURA_STABLE', false);
|
define('SAKURA_STABLE', false);
|
||||||
|
@ -47,6 +47,7 @@ require_once ROOT . '_sakura/components/Manage.php';
|
||||||
require_once ROOT . '_sakura/components/Bans.php';
|
require_once ROOT . '_sakura/components/Bans.php';
|
||||||
require_once ROOT . '_sakura/components/Whois.php';
|
require_once ROOT . '_sakura/components/Whois.php';
|
||||||
require_once ROOT . '_sakura/components/Payments.php';
|
require_once ROOT . '_sakura/components/Payments.php';
|
||||||
|
require_once ROOT . '_sakura/components/Trick.php';
|
||||||
|
|
||||||
// Include database extensions
|
// Include database extensions
|
||||||
foreach (glob(ROOT . '_sakura/components/database/*.php') as $driver) {
|
foreach (glob(ROOT . '_sakura/components/database/*.php') as $driver) {
|
||||||
|
|
|
@ -49,10 +49,10 @@
|
||||||
<div class="post-text markdown">
|
<div class="post-text markdown">
|
||||||
{{ post.parsed_post|raw }}
|
{{ post.parsed_post|raw }}
|
||||||
</div>
|
</div>
|
||||||
{% if post.post_signature and post.signature %}
|
{% if post.user.signature and post.post_signature %}
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
<div class="signature">
|
<div class="signature">
|
||||||
{{ post.signature|raw }}
|
{{ post.user.signature|raw }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="signatureEditorForm">
|
||||||
|
<input type="hidden" name="sessid" value="{{ php.sessionid }}" />
|
||||||
|
<input type="hidden" name="timestamp" value="{{ php.time }}" />
|
||||||
|
<input type="hidden" name="mode" value="signature" />
|
||||||
|
<div><textarea name="signature" id="signatureEditor" class="inputStyling" style="width: calc(100% - 12px); height: 400px;">{{ signature }}</textarea></div>
|
||||||
|
<div class="profile-save">
|
||||||
|
<input type="submit" value="Save" name="submit" class="inputStyling" />
|
||||||
|
<input type="reset" value="Reset" name="reset" class="inputStyling" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
window.addEventListener('load', function() {
|
||||||
|
prepareAjaxForm('signatureEditorForm', 'Updating signature...');
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1973,11 +1973,11 @@ textarea.inputStyling {
|
||||||
|
|
||||||
.forum.viewtopic .posts .post-content .signature {
|
.forum.viewtopic .posts .post-content .signature {
|
||||||
border-top: 1px solid #B19EED;
|
border-top: 1px solid #B19EED;
|
||||||
margin-top: 16px;
|
padding-top: 2px;
|
||||||
padding-top: 4px;
|
margin-top: 20px;
|
||||||
display: block;
|
display: block;
|
||||||
min-width: 300px;
|
width: 100%;
|
||||||
max-height: 180px;
|
max-height: 200px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ if ($mode != 'f') {
|
||||||
$posting = array_merge($posting, [
|
$posting = array_merge($posting, [
|
||||||
'subject' => $post['post_subject'],
|
'subject' => $post['post_subject'],
|
||||||
'text' => $post['post_text'],
|
'text' => $post['post_text'],
|
||||||
'id' => $post['post_id']
|
'id' => $post['post_id'],
|
||||||
]);
|
]);
|
||||||
// Post deletion
|
// Post deletion
|
||||||
} elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) {
|
} elseif ($mode == 'p' && isset($_GET['delete']) && $_GET['delete'] == $_GET['p'] && array_key_exists($_GET['p'], $topic['posts'])) {
|
||||||
|
@ -134,8 +134,8 @@ if ($mode != 'f') {
|
||||||
$renderData = array_merge($renderData, [
|
$renderData = array_merge($renderData, [
|
||||||
'message' => 'Are you sure you want to delete your reply to ' . $topic['topic']['topic_title'] . '?',
|
'message' => 'Are you sure you want to delete your reply to ' . $topic['topic']['topic_title'] . '?',
|
||||||
'conditions' => [
|
'conditions' => [
|
||||||
'post_id' => $topic['posts'][$_GET['p']]['post_id']
|
'post_id' => $topic['posts'][$_GET['p']]['post_id'],
|
||||||
]
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Render confirmation form
|
// Render confirmation form
|
||||||
|
@ -167,7 +167,7 @@ if (isset($_POST['post'])) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to make the post
|
// Attempt to make the post
|
||||||
$makePost = Forum::createPost($currentUser->data['user_id'], $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse);
|
$makePost = Forum::createPost($currentUser->data['user_id'], $_POST['subject'], $_POST['text'], $forumId, $topicId, $parse, 1, 1);
|
||||||
|
|
||||||
// Add page specific things
|
// Add page specific things
|
||||||
$renderData['page'] = [
|
$renderData['page'] = [
|
||||||
|
|
|
@ -948,6 +948,24 @@ if (isset($_REQUEST['request-notifications']) && $_REQUEST['request-notification
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Signature
|
||||||
|
case 'signature':
|
||||||
|
// Base64 encode the signature
|
||||||
|
$signature = base64_encode($_POST['signature']);
|
||||||
|
|
||||||
|
// Update database
|
||||||
|
Users::updateUserDataField($currentUser->data['user_id'], ['signature' => $signature]);
|
||||||
|
|
||||||
|
// Set render data
|
||||||
|
$renderData['page'] = [
|
||||||
|
|
||||||
|
'redirect' => $redirect,
|
||||||
|
'message' => 'Your signature has been updated!',
|
||||||
|
'success' => 1,
|
||||||
|
|
||||||
|
];
|
||||||
|
break;
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
default:
|
default:
|
||||||
// Set render data
|
// Set render data
|
||||||
|
@ -1465,11 +1483,16 @@ if (Users::checkLogin()) {
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Profile
|
// User page
|
||||||
case 'appearance.userpage':
|
case 'appearance.userpage':
|
||||||
$renderData['userPage'] = isset($currentUser->data['user_data']['userPage']) ? base64_decode($currentUser->data['user_data']['userPage']) : '';
|
$renderData['userPage'] = isset($currentUser->data['user_data']['userPage']) ? base64_decode($currentUser->data['user_data']['userPage']) : '';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Signature
|
||||||
|
case 'appearance.signature':
|
||||||
|
$renderData['signature'] = isset($currentUser->data['user_data']['signature']) ? base64_decode($currentUser->data['user_data']['signature']) : '';
|
||||||
|
break;
|
||||||
|
|
||||||
// Username changing
|
// Username changing
|
||||||
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;
|
||||||
|
|
Reference in a new issue