diff --git a/config/routing.yml b/config/routing.yml index 68b4198..cd9d43d 100644 --- a/config/routing.yml +++ b/config/routing.yml @@ -1,10 +1,10 @@ spaceace_ajaxchat_popup: path: /chat/popup - defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction} + defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: popup} spaceace_ajaxchat_archive: path: /chat/archive - defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction} + defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: archive} spaceace_ajaxchat_edit: path: /chat/edit/{chat_id} @@ -28,4 +28,4 @@ spaceace_ajaxchat_quote: spaceace_ajaxchat_chat: path: /chat - defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction} \ No newline at end of file + defaults: {_controller: spaceace.ajaxchat.chat.controller:defaultAction, page: chat} \ No newline at end of file diff --git a/controller/chat.php b/controller/chat.php index bc99885..7a5bcdf 100644 --- a/controller/chat.php +++ b/controller/chat.php @@ -277,8 +277,21 @@ public function index() * * @return multi */ - public function defaultAction() + public function defaultAction($page) { + //Sets message amount depending on page being used + if ($page === 'popup') + { + $chat_message_total = $this->config['ajax_chat_popup_amount']; + } + if ($page === 'chat') + { + $chat_message_total = $this->config['ajax_chat_chat_amount']; + } + if ($page === 'archive') + { + $chat_message_total = $this->config['ajax_chat_archive_amount']; + } // sets a few variables before the actions $this->mode = $this->request->variable('mode', 'default'); $this->last_id = $this->request->variable('last_id', 0); @@ -292,7 +305,7 @@ public function defaultAction() LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id WHERE c.message_id > ' . (int) $this->last_id . ' ORDER BY c.message_id DESC'; - $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']); + $result = $this->db->sql_query_limit($sql, (int) $chat_message_total); $rows = $this->db->sql_fetchrowset($result); foreach ($rows as $row) @@ -516,7 +529,7 @@ public function readAction() LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id WHERE c.message_id > ' . (int) $this->last_id . ' ORDER BY c.message_id DESC'; - $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']); + $result = $this->db->sql_query_limit($sql, (int) $chat_message_total); $rows = $this->db->sql_fetchrowset($result); if (!sizeof($rows) && ((time() - 60) < $this->last_time)) @@ -823,7 +836,7 @@ public function addAction() LEFT JOIN ' . POSTS_TABLE . ' as p ON c.post_id = p.post_id WHERE c.message_id > ' . (int) $this->last_id . ' ORDER BY c.message_id DESC'; - $result = $this->db->sql_query_limit($sql, (int) $this->config['ajax_chat_chat_amount']); + $result = $this->db->sql_query_limit($sql, (int) $chat_message_total); $rows = $this->db->sql_fetchrowset($result); if (!sizeof($rows) && ((time() - 60) < $this->last_time)) diff --git a/styles/Bluespace/template/chat_body_font_colour_hold.html b/styles/Bluespace/template/chat_body_font_colour_hold.html index 471527c..2eb2e7d 100644 --- a/styles/Bluespace/template/chat_body_font_colour_hold.html +++ b/styles/Bluespace/template/chat_body_font_colour_hold.html @@ -1,4 +1,4 @@ -