diff --git a/composer.json b/composer.json index ae4b458..1ec2214 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "type": "phpbb-extension", "description": "mChat Extension for phpbb 3.1.x", "homepage": "http://www.dmzx-web.net", - "version": "0.0.9", + "version": "0.0.10", "time": "2015-03-10", "keywords": ["phpbb", "extension", "mchat"], "license": "GPL-2.0", diff --git a/core/render_helper.php b/core/render_helper.php index 7f3ba00..3919b43 100644 --- a/core/render_helper.php +++ b/core/render_helper.php @@ -889,20 +889,21 @@ class render_helper if ($this->config_mchat['whois']) { // Grab group details for legend display for who is online on the custom page. + $order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; if ($this->auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) { $sql = 'SELECT group_id, group_name, group_colour, group_type FROM ' . GROUPS_TABLE . ' - WHERE group_legend = 1 - ORDER BY group_name ASC'; + WHERE group_legend <> 0 + ORDER BY ' . $order_legend . ' ASC'; } else { $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type FROM ' . GROUPS_TABLE . ' g LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (g.group_id = ug.group_id AND ug.user_id = ' . $this->user->data['user_id'] . ' AND ug.user_pending = 0) - WHERE g.group_legend = 1 + WHERE g.group_legend <> 0 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . (int) $this->user->data['user_id'] . ') - ORDER BY g.group_name ASC'; + ORDER BY g.' . $order_legend . ' ASC'; } $result = $this->db->sql_query($sql); $legend = array(); diff --git a/event/listener.php b/event/listener.php index 996f709..101e532 100644 --- a/event/listener.php +++ b/event/listener.php @@ -59,6 +59,7 @@ class listener implements EventSubscriberInterface static public function getSubscribedEvents() { return array( + 'core.viewonline_overwrite_location' => 'add_page_viewonline', 'core.user_setup' => 'load_language_on_setup', 'core.page_header' => 'add_page_header_link', 'core.index_modify_page_title' => 'display_mchat_on_index', @@ -66,6 +67,17 @@ class listener implements EventSubscriberInterface ); } + public function add_page_viewonline($event) + { + global $user, $phpbb_container, $phpEx; + + if (strrpos($event['row']['session_page'], 'app.' . $phpEx . '/chat') === 0) + { + $event['location'] = $user->lang('MCHAT_TITLE'); + $event['location_url'] = $phpbb_container->get('controller.helper')->route('dmzx_mchat_controller'); + } + } + public function load_language_on_setup($event) { $lang_set_ext = $event['lang_set_ext']; @@ -144,7 +156,7 @@ class listener implements EventSubscriberInterface $uid = $bitfield = $options = ''; // will be modified by generate_text_for_storage generate_text_for_storage($message, $uid, $bitfield, $options, true, false, false); $sql_ary = array( - 'forum_id' => ($topic_type == POST_GLOBAL) ? 0 : $event['forum_id'], + 'forum_id' => $event['forum_id'], 'post_id' => $event['post_id'], 'user_id' => $this->user->data['user_id'], 'user_ip' => $this->user->data['session_ip'], diff --git a/migrations/mchat_schema.php b/migrations/mchat_schema.php index 525ad17..e0d1457 100644 --- a/migrations/mchat_schema.php +++ b/migrations/mchat_schema.php @@ -24,7 +24,7 @@ class mchat_schema extends \phpbb\db\migration\migration array('config.add', array('mchat_new_posts_edit', false)), array('config.add', array('mchat_new_posts_quote', false)), array('config.add', array('mchat_stats_index', false)), - array('config.add', array('mchat_version','0.0.9')), + array('config.add', array('mchat_version','0.0.10')), array('permission.add', array('u_mchat_use')), array('permission.add', array('u_mchat_view')), diff --git a/styles/prosilver/template/event/overall_header_navigation_append.html b/styles/prosilver/template/event/overall_header_navigation_append.html index 0ff1638..2c977b1 100644 --- a/styles/prosilver/template/event/overall_header_navigation_append.html +++ b/styles/prosilver/template/event/overall_header_navigation_append.html @@ -1 +1 @@ -
  • {L_MCHAT_TITLE}
  • +
  • {L_MCHAT_TITLE}
  • \ No newline at end of file