private function new_thread($data) { if (isset($data['cat']) && isset($data['title']) && isset($data['content'])) { // Set variables $category_id = $data['cat']; // Check category's access permissions $category = category::get($category_id); if ($this->user['SiteRank'] >= $category['rankPost'] && $this->user['BanStatus'] == 0) { if ($data['title'] != ' ' && $data['title'] != '' && $data['title'] != null && $data['content'] != ' ' && $data['content'] != '' && $data['content'] != null) { $return = thread::create($category_id, $data, $this->user); // Set mail queue items self::notify_mail($category, array('subject' => guild_name . ' :: Forum - New Thread - ' . $data['title'], 'body' => $data['content'], 'author' => 'system')); // Update user stats self::user_count_both($this->user['Username']); json::resp(array('success' => true, 'createCategory' => (int) $return['createCategory'], 'threadCreated' => (int) $return['threadCreated'], 'postCreated' => (int) $return['postCreated'])); } else { self::errorJSON('Title & First post\'s body cannot be empty!'); } } else { self::errorJSON('User does not have proper permissions to post under this category.'); } } }