r20151213

late edition

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
Pachira 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\User;
use Sakura\BBcode;
use Sakura\Config;
/**
* Class Post
@ -62,6 +63,14 @@ class Post
// Create a new post
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 ($thread) {
$thread = new Thread($thread);

View file

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

View file

@ -24,9 +24,14 @@ $_GET['t'] :
0
);
// Get the topic
if ($topicId) {
$thread = new Forum\Thread($topicId);
}
$forumId = isset($_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));
@ -172,13 +177,13 @@ if ($mode != 'f') {
// Check if a post is being made
if (isset($_POST['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
$renderData['page'] = [
'redirect' => $urls->format('FORUM_POST', [$post->id]) . '#p' . $post->id,
'message' => 'Made the post!',
'success' => 1,
'redirect' => $post ? $urls->format('FORUM_POST', [$post->id]) . '#p' . $post->id : '',
'message' => $post ? 'Made the post!' : 'Something is wrong with your post!',
'success' => $post ? 1 : 0,
];
// Print page contents or if the AJAX request is set only display the render data

View file

@ -8,7 +8,7 @@
namespace Sakura;
// Define Sakura version
define('SAKURA_VERSION', '20151212');
define('SAKURA_VERSION', '20151213');
define('SAKURA_VLABEL', 'Eminence');
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 content %}
{% include 'elements/settingsNavigation.tpl' %}
<div class="platform">
<div class="box">
<h1 class="sectionHead">
{{ page.category }} / {{ page.mode }}
{{ page.category }} <div class="fa">&#xf105;</div> {{ page.mode }}
</h1>
<div class="settings-explanation">
<h3>
{% for descline in page.description %}
<div>{{ include(template_from_string(descline)) }}</div>
{{ include(template_from_string(descline)) }}
{% endfor %}
</div>
{% include 'settings/' ~ current ~ '.tpl' %}
</h3>
</div>
{% include 'settings/' ~ current ~ '.tpl' %}
{% endblock %}

View file

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

View file

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