diff --git a/_sakura/components/Database.php b/_sakura/components/Database.php index a514921..809768e 100755 --- a/_sakura/components/Database.php +++ b/_sakura/components/Database.php @@ -78,4 +78,12 @@ class Database 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); + + } } diff --git a/_sakura/components/Forum.php b/_sakura/components/Forum.php index c443817..e5a0742 100755 --- a/_sakura/components/Forum.php +++ b/_sakura/components/Forum.php @@ -387,7 +387,9 @@ class Forum ]); // 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 @@ -404,12 +406,14 @@ class Forum ]); // 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 Database::update('topics', [ [ - 'topic_last_reply' => time(), + 'topic_last_reply' => $getPost['post_id'], ], [ 'topic_id' => [$getPost['topic_id'], '='], diff --git a/_sakura/components/database/mysql.php b/_sakura/components/database/mysql.php index e2ebe4b..542db69 100755 --- a/_sakura/components/database/mysql.php +++ b/_sakura/components/database/mysql.php @@ -388,4 +388,12 @@ class MySQL return $query->fetch(PDO::FETCH_BOTH); } + + // Get the ID of the last inserted item + public function lastInsertID($name = null) + { + + return $this->sql->lastInsertID($name);; + + } } diff --git a/_sakura/sakura.php b/_sakura/sakura.php index 557b4b3..bd6734d 100755 --- a/_sakura/sakura.php +++ b/_sakura/sakura.php @@ -8,7 +8,7 @@ namespace Sakura; // Define Sakura version -define('SAKURA_VERSION', '20151018'); +define('SAKURA_VERSION', '20151019'); define('SAKURA_VLABEL', 'Eminence'); define('SAKURA_COLOUR', '#6C3082'); define('SAKURA_STABLE', false); @@ -76,14 +76,10 @@ if (Configuration::getConfig('no_cron_service')) { // Update last execution time Database::update('config', [ [ - 'config_value' => time(), - ], [ - 'config_name' => ['no_cron_last', '='], - ], ]); diff --git a/_sakura/templates/yuuno/forum/forumEntry.tpl b/_sakura/templates/yuuno/forum/forumEntry.tpl index 8d77d0d..45414fd 100755 --- a/_sakura/templates/yuuno/forum/forumEntry.tpl +++ b/_sakura/templates/yuuno/forum/forumEntry.tpl @@ -29,7 +29,8 @@
{% if forum.last_post.post_id %} - {{ forum.last_post.post_subject }}
{{ forum.last_post.elapsed }} by {% if forum.last_poster.data.user_id %}{{ forum.last_poster.data.username }}{% else %}[deleted user]{% endif %} + {{ forum.last_post.post_subject }}
+ {{ forum.last_post.elapsed }} by {% if forum.last_poster.data.user_id %}{{ forum.last_poster.data.username }}{% else %}[deleted user]{% endif %} {% else %} There are no posts in this forum.
  {% endif %} diff --git a/_sakura/templates/yuuno/forum/posting.tpl b/_sakura/templates/yuuno/forum/posting.tpl index f6e9aa5..68678d4 100755 --- a/_sakura/templates/yuuno/forum/posting.tpl +++ b/_sakura/templates/yuuno/forum/posting.tpl @@ -8,7 +8,7 @@
Forum / Posting
- +

@@ -24,7 +24,7 @@

- +

@@ -36,7 +36,7 @@
- +
diff --git a/_sakura/templates/yuuno/forum/topicEntry.tpl b/_sakura/templates/yuuno/forum/topicEntry.tpl index f297439..d26c58f 100755 --- a/_sakura/templates/yuuno/forum/topicEntry.tpl +++ b/_sakura/templates/yuuno/forum/topicEntry.tpl @@ -21,7 +21,7 @@ {{ topic.last_poster.data.username }} {% else %} [deleted user] - {% endif %}
+ {% endif %}
{{ topic.last_post.elapsed }} diff --git a/public/content/data/yuuno/js/yuuno.js b/public/content/data/yuuno/js/yuuno.js index a36e40b..4279931 100755 --- a/public/content/data/yuuno/js/yuuno.js +++ b/public/content/data/yuuno/js/yuuno.js @@ -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... notifyUI({