r20151213

late edition

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-12-14 00:29:53 +01:00
parent 9750b25816
commit 5c73e47908
9 changed files with 64 additions and 57 deletions

View file

@ -9,6 +9,7 @@ use Sakura\Main;
use Sakura\Database; use Sakura\Database;
use Sakura\User; use Sakura\User;
use Sakura\BBcode; use Sakura\BBcode;
use Sakura\Config;
/** /**
* Class Post * Class Post
@ -62,6 +63,14 @@ class Post
// Create a new post // Create a new post
public static function create($subject, $text, User $poster, $thread = 0, $forum = 0) public static function create($subject, $text, User $poster, $thread = 0, $forum = 0)
{ {
// Check if the data meets the requirements
if (strlen($subject) < Config::get('forum_title_min')
|| strlen($subject) > Config::get('forum_title_max')
|| strlen($text) < Config::get('forum_text_min')
|| strlen($text) > Config::get('forum_text_max')) {
return null;
}
// If no thread is specified create a new one // If no thread is specified create a new one
if ($thread) { if ($thread) {
$thread = new Thread($thread); $thread = new Thread($thread);

View file

@ -72,16 +72,17 @@ h5,
h6 { h6 {
font-family: "Exo2-0-LightItalic", sans-serif; font-family: "Exo2-0-LightItalic", sans-serif;
font-weight: 100; font-weight: 100;
color: #ab95bf;
text-shadow: 1px 1px 2px rgba(0, 0, 0, .75);
} }
h1.sectionHead { .box h1,
font-style: italic; .box h2,
font-size: 5em; .box h3,
color: rgb(148, 117, 178); .box h4,
opacity: 0.5; .box h5,
font-weight: 100; .box h6 {
line-height: 1.2em; color: #fff;
margin: 10px 20px;
} }
a.clean, a.clean,
@ -233,13 +234,20 @@ a:active {
background: #231C29; background: #231C29;
box-shadow: 0 2px 6px rgba(0, 0, 0, .75); box-shadow: 0 2px 6px rgba(0, 0, 0, .75);
padding: 2px; padding: 2px;
border: 1px solid rgba(148, 117, 178, .6); border: 1px solid #67517b;
} }
.platform:not(:last-child) { .platform:not(:last-child) {
margin-bottom: 5px; margin-bottom: 5px;
} }
.box {
margin: 10px;
padding: 5px;
background: #3A2E44;
box-shadow: 0 2px 6px rgba(0, 0, 0, .75);
}
/* /*
* Header navigation * Header navigation
*/ */

View file

@ -24,9 +24,14 @@ $_GET['t'] :
0 0
); );
// Get the topic
if ($topicId) {
$thread = new Forum\Thread($topicId);
}
$forumId = isset($_GET['f']) ? $forumId = isset($_GET['f']) ?
$_GET['f'] : $_GET['f'] :
($thread = new Forum\Thread($topicId))->forum; $thread->forum;
$mode = isset($_GET['f']) ? 'f' : (isset($_GET['t']) ? 't' : (isset($_GET['p']) ? 'p' : null)); $mode = isset($_GET['f']) ? 'f' : (isset($_GET['t']) ? 't' : (isset($_GET['p']) ? 'p' : null));
@ -172,13 +177,13 @@ if ($mode != 'f') {
// Check if a post is being made // Check if a post is being made
if (isset($_POST['post'])) { if (isset($_POST['post'])) {
// Attempt to make the post // Attempt to make the post
$post = Forum\Post::create($_POST['subject'], $_POST['text'], $currentUser, $topicId, $forumId); $post = Forum\Post::create($_POST['subject'], $_POST['text'], $currentUser, $topicId, $forumId);
// Add page specific things // Add page specific things
$renderData['page'] = [ $renderData['page'] = [
'redirect' => $urls->format('FORUM_POST', [$post->id]) . '#p' . $post->id, 'redirect' => $post ? $urls->format('FORUM_POST', [$post->id]) . '#p' . $post->id : '',
'message' => 'Made the post!', 'message' => $post ? 'Made the post!' : 'Something is wrong with your post!',
'success' => 1, 'success' => $post ? 1 : 0,
]; ];
// Print page contents or if the AJAX request is set only display the render data // Print page contents or if the AJAX request is set only display the render data

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20151212'); define('SAKURA_VERSION', '20151213');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');

View file

@ -1,3 +0,0 @@
<div class="platform" style="padding: 10px;">
<h1><a href="/settings/general/options">Go to Site Options</a></h1>
</div>

View file

@ -3,16 +3,15 @@
{% block title %}{{ page.category }} / {{ page.mode }}{% endblock %} {% block title %}{{ page.category }} / {{ page.mode }}{% endblock %}
{% block content %} {% block content %}
{% include 'elements/settingsNavigation.tpl' %} <div class="box">
<div class="platform">
<h1 class="sectionHead"> <h1 class="sectionHead">
{{ page.category }} / {{ page.mode }} {{ page.category }} <div class="fa">&#xf105;</div> {{ page.mode }}
</h1> </h1>
<div class="settings-explanation"> <h3>
{% for descline in page.description %} {% for descline in page.description %}
<div>{{ include(template_from_string(descline)) }}</div> {{ include(template_from_string(descline)) }}
{% endfor %} {% endfor %}
</div> </h3>
{% include 'settings/' ~ current ~ '.tpl' %}
</div> </div>
{% include 'settings/' ~ current ~ '.tpl' %}
{% endblock %} {% endblock %}

View file

@ -1,2 +1,4 @@
<h1 class="stylised">READ THIS BEFORE PUKING</h1> <div class="box">
These template files were quickly thrown into place to allow switching between the development style and the stable one. You can switch in the Site Options section. <h1>There's nothing here yet...</h1>
<h3>...aside from <a href="{{ urls.format('SETTING_MODE', ['general', 'options']) }}">Site Options</a>.</h3>
</div>

View file

@ -1,31 +1,18 @@
{% if options.fields %} <form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" class="box">
<form enctype="multipart/form-data" method="post" action="{{ sakura.currentPage }}" id="optionsForm"> <input type="hidden" name="sessid" value="{{ php.sessionid }}" />
<input type="hidden" name="sessid" value="{{ php.sessionid }}" /> <input type="hidden" name="timestamp" value="{{ php.time }}" />
<input type="hidden" name="timestamp" value="{{ php.time }}" /> <input type="hidden" name="mode" value="options" />
<input type="hidden" name="mode" value="options" /> {% for field in options.fields %}
{% for field in options.fields %} <div>
<div class="profile-field"> <div>
<div> <h2>{{ field.option_name }}</h2>
<h2>{{ field.option_name }}</h2> <h4>{{ field.option_description }}</h4>
<div style="font-size: .8em; line-height: 110%;"> </div>
{{ field.option_description }} <div>
</div> <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 style="padding: 8px 0;">
<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> </div>
{% endfor %}
<div class="profile-save">
<input type="submit" value="Save" name="submit" class="inputStyling" />
<input type="reset" value="Reset" name="reset" class="inputStyling" />
</div> </div>
</form> {% endfor %}
<script type="text/javascript"> <input type="submit" value="Save" name="submit" class="inputStyling" />
window.addEventListener("load", function() { <input type="reset" value="Reset" name="reset" class="inputStyling" />
prepareAjaxForm('optionsForm', 'Changing Options...'); </form>
});
</script>
{% else %}
<h1 class="stylised" style="margin: 2em auto; text-align: center;">There are currently no changeable options.</h1>
{% endif %}

View file

@ -14,7 +14,7 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% set num = (num / 10)|round + 1 %} {% set num = (num / 10)|round(0, 'floor') + 1 %}
{% set get = get|merge({'page': num}) %} {% set get = get|merge({'page': num}) %}
{% endif %} {% endif %}