r20151019

Signed-off-by: Flashwave <me@flash.moe>
This commit is contained in:
flash 2015-10-19 23:25:20 +02:00
parent fcbe6eccd2
commit 59460fb22a
8 changed files with 31 additions and 14 deletions

View file

@ -78,4 +78,12 @@ class Database
return self::$database->count($table, $data, $prefix); return self::$database->count($table, $data, $prefix);
} }
// Get the ID of the last inserted item
public static function lastInsertID($name = null)
{
return self::$database->lastInsertID($name);
}
} }

View file

@ -387,7 +387,9 @@ class Forum
]); ]);
// Fetch the last insert // Fetch the last insert
$getThread = Database::fetch('topics', false, null, ['topic_id', true]); $getThread = Database::fetch('topics', false, [
'topic_id' => [Database::lastInsertID(), '='],
]);
} }
// Insert the post // Insert the post
@ -404,12 +406,14 @@ class Forum
]); ]);
// Fetch the last insert // Fetch the last insert
$getPost = Database::fetch('posts', false, null, ['post_id', true]); $getPost = Database::fetch('posts', false, [
'post_id' => [Database::lastInsertID(), '='],
]);
// Update the topic with the last details // Update the topic with the last details
Database::update('topics', [ Database::update('topics', [
[ [
'topic_last_reply' => time(), 'topic_last_reply' => $getPost['post_id'],
], ],
[ [
'topic_id' => [$getPost['topic_id'], '='], 'topic_id' => [$getPost['topic_id'], '='],

View file

@ -388,4 +388,12 @@ class MySQL
return $query->fetch(PDO::FETCH_BOTH); return $query->fetch(PDO::FETCH_BOTH);
} }
// Get the ID of the last inserted item
public function lastInsertID($name = null)
{
return $this->sql->lastInsertID($name);;
}
} }

View file

@ -8,7 +8,7 @@
namespace Sakura; namespace Sakura;
// Define Sakura version // Define Sakura version
define('SAKURA_VERSION', '20151018'); define('SAKURA_VERSION', '20151019');
define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_VLABEL', 'Eminence');
define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_COLOUR', '#6C3082');
define('SAKURA_STABLE', false); define('SAKURA_STABLE', false);
@ -76,14 +76,10 @@ if (Configuration::getConfig('no_cron_service')) {
// Update last execution time // Update last execution time
Database::update('config', [ Database::update('config', [
[ [
'config_value' => time(), 'config_value' => time(),
], ],
[ [
'config_name' => ['no_cron_last', '='], 'config_name' => ['no_cron_last', '='],
], ],
]); ]);

View file

@ -29,7 +29,8 @@
<td class="forumLastColumn"> <td class="forumLastColumn">
<div> <div>
{% if forum.last_post.post_id %} {% if forum.last_post.post_id %}
<a href="{{ urls.format('FORUM_THREAD', [forum.last_post.topic_id]) }}" class="default">{{ forum.last_post.post_subject }}</a><br /><span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.data.user_id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.data.user_id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.data.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post.post_id]) }}#p{{ forum.last_poster.post.post_id }}" class="default fa fa-tag"></a> <a href="{{ urls.format('FORUM_THREAD', [forum.last_post.topic_id]) }}" class="default">{{ forum.last_post.post_subject }}</a><br />
<span title="{{ forum.last_post.post_time|date(sakura.dateFormat) }}">{{ forum.last_post.elapsed }}</span> by {% if forum.last_poster.data.user_id %}<a href="{{ urls.format('USER_PROFILE', [forum.last_poster.data.user_id]) }}" class="default" style="color: {{ forum.last_poster.colour }}; text-shadow: 0 0 5px {% if forum.last_poster.colour != 'inherit' %}{{ forum.last_poster.colour }}{% else %}#222{% endif %};">{{ forum.last_poster.data.username }}</a>{% else %}[deleted user]{% endif %} <a href="{{ urls.format('FORUM_POST', [forum.last_post.post_id]) }}#p{{ forum.last_post.post_id }}" class="default fa fa-tag"></a>
{% else %} {% else %}
There are no posts in this forum.<br />&nbsp; There are no posts in this forum.<br />&nbsp;
{% endif %} {% endif %}

View file

@ -8,7 +8,7 @@
<form id="forumPostingForm" method="post" action="{{ sakura.currentPage }}"> <form id="forumPostingForm" method="post" action="{{ sakura.currentPage }}">
<div class="head">Forum / Posting</div> <div class="head">Forum / Posting</div>
<div class="posting-subject"> <div class="posting-subject">
<input type="text" class="inputStyling" name="subject" placeholder="Subject" /> <input type="text" class="inputStyling" name="subject" placeholder="Subject" value="{{ posting.subject }}" />
</div> </div>
<hr class="default" /> <hr class="default" />
<div class="posting-bbcodes"> <div class="posting-bbcodes">
@ -24,7 +24,7 @@
</div> </div>
<hr class="default" /> <hr class="default" />
<div class="posting-text"> <div class="posting-text">
<textarea class="inputStyling" name="text" id="postingText"></textarea> <textarea class="inputStyling" name="text" id="postingText">{{ posting.text }}</textarea>
</div> </div>
<hr class="default" /> <hr class="default" />
<div class="posting-emotes"> <div class="posting-emotes">
@ -36,7 +36,7 @@
<div class="posting-options"> <div class="posting-options">
<div> <div>
<div> <div>
<input type="checkbox" id="enableSig" checked="checked" /> <label for="enableSig">Attach Signature</label> <input type="checkbox" id="enableSig" {% if posting.enabledSig %}checked="checked"{% endif %}/> <label for="enableSig">Attach Signature</label>
</div> </div>
<div> <div>
<input type="checkbox" id="enableEmotes" checked="checked" /> <label for="enableEmotes">Parse emoticons</label> <input type="checkbox" id="enableEmotes" checked="checked" /> <label for="enableEmotes">Parse emoticons</label>

View file

@ -21,7 +21,7 @@
<a href="{{ urls.format('USER_PROFILE', [topic.last_poster.data.user_id]) }}" class="default" style="color: {{ topic.last_poster.colour }}; text-shadow: 0 0 5px {% if topic.last_poster.colour != 'inherit' %}{{ topic.last_poster.colour }}{% else %}#222{% endif %};">{{ topic.last_poster.data.username }}</a> <a href="{{ urls.format('USER_PROFILE', [topic.last_poster.data.user_id]) }}" class="default" style="color: {{ topic.last_poster.colour }}; text-shadow: 0 0 5px {% if topic.last_poster.colour != 'inherit' %}{{ topic.last_poster.colour }}{% else %}#222{% endif %};">{{ topic.last_poster.data.username }}</a>
{% else %} {% else %}
[deleted user] [deleted user]
{% endif %} <a href="{{ urls.format('FORUM_POST', [topic.last_post.post.post_id]) }}#p{{ topic.last_post.post.post_id }}" class="default fa fa-tag"></a><br /> {% endif %} <a href="{{ urls.format('FORUM_POST', [topic.last_post.post_id]) }}#p{{ topic.last_post.post_id }}" class="default fa fa-tag"></a><br />
<span title="{{ topic.last_post.post.post_time|date(sakura.dateFormat) }}">{{ topic.last_post.elapsed }}</span> <span title="{{ topic.last_post.post.post_time|date(sakura.dateFormat) }}">{{ topic.last_post.elapsed }}</span>
</td> </td>
</tr> </tr>

View file

@ -218,7 +218,7 @@ function notifyRequest(session) {
} }
} else { } else if((notificationWatcher.status + '').substring(0, 1) == '5') {
// ELse tell the user there was an internal server error... // ELse tell the user there was an internal server error...
notifyUI({ notifyUI({