diff --git a/ext/forum/main.php b/ext/forum/main.php index 491f365b..62951e4f 100644 --- a/ext/forum/main.php +++ b/ext/forum/main.php @@ -330,7 +330,7 @@ class Forum extends Extension { private function save_new_thread($user) { $title = html_escape($_POST["title"]); - $sticky = html_escape($_POST["sticky"]); + $sticky = !empty($_POST["sticky"]) ? html_escape($_POST["sticky"]) : "N"; if($sticky == ""){ $sticky = "N"; @@ -344,11 +344,11 @@ class Forum extends Extension { (?, ?, ?, now(), now())", array($title, $sticky, $user->id)); - $result = $database->get_row("SELECT LAST_INSERT_ID() AS threadID", array()); + $threadID = $database->get_last_insert_id("forum_threads_id_seq"); - log_info("forum", "Thread {$result["threadID"]} created by {$user->name}"); + log_info("forum", "Thread {$threadID} created by {$user->name}"); - return $result["threadID"]; + return $threadID; } private function save_new_post($threadID, $user) @@ -367,9 +367,9 @@ class Forum extends Extension { (?, ?, now(), ?)" , array($threadID, $userID, $message)); - $result = $database->get_row("SELECT LAST_INSERT_ID() AS postID", array()); + $postID = $database->get_last_insert_id("forum_posts_id_seq"); - log_info("forum", "Post {$result["postID"]} created by {$user->name}"); + log_info("forum", "Post {$postID} created by {$user->name}"); $database->execute("UPDATE forum_threads SET uptodate=now() WHERE id=?", array ($threadID)); }