From 2522352982ea0e51c3ca458498d89dc0890762b4 Mon Sep 17 00:00:00 2001 From: Darin Wilton Date: Sat, 18 Jun 2016 21:38:57 -0400 Subject: [PATCH] fixed chat amounts --- config/routing.yml | 6 +++--- controller/chat.php | 21 +++++++++++++++---- .../template/chat_body_font_colour_hold.html | 2 +- .../template/chat_body_font_colour_hold.html | 2 +- .../template/chat_body_font_colour_hold.html | 2 +- styles/all/template/chat_body_buttons.html | 4 ++-- .../event/overall_header_head_append.html | 2 +- styles/all/theme/ajax_chat.css | 5 ----- .../template/chat_body_font_colour_hold.html | 2 +- 9 files changed, 27 insertions(+), 19 deletions(-) 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 @@ -
+