lang}/mods/portal/" */ public $language = 'portal_whois_online_module'; /** * custom acp template * file must be in "adm/style/portal/" */ public $custom_acp_tpl = ''; /** @var \phpbb\auth\auth */ protected $auth; /** @var \phpbb\config\config */ protected $config; /** @var \phpbb\db\driver\driver_interface */ protected $db; /** @var \phpbb\template\template */ protected $template; /** @var \phpbb\user */ protected $user; /** @var string phpBB root path */ protected $phpbb_root_path; /** @var string PHP file extension */ protected $php_ext; /** * Construct a user menu object * * @param \phpbb\auth\auth $auth phpBB auth * @param \phpbb\config\config $config phpBB config * @param \phpbb\db\driver\driver_interface $db phpBB db driver * @param \phpbb\template\template $template phpBB template * @param \phpbb\user $user phpBB user * @param string $phpbb_root_path phpBB root path * @param string $phpEx php file extension */ public function __construct($auth, $config, $db, $template, $user, $phpbb_root_path, $phpEx) { $this->auth = $auth; $this->config = $config; $this->db = $db; $this->template = $template; $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $phpEx; } /** * {@inheritdoc} */ public function get_template_center($module_id) { $order_legend = ($this->config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; // Grab group details for legend display 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 > 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 = ' . (int) $this->user->data['user_id'] . ' AND ug.user_pending = 0 ) WHERE g.group_legend > 0 AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . (int) $this->user->data['user_id'] . ') ORDER BY g.' . $order_legend . ' ASC'; } $result = $this->db->sql_query($sql); $legend = array(); while ($row = $this->db->sql_fetchrow($result)) { $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $this->user->lang['G_' . $row['group_name']] : $row['group_name']; if ($row['group_name'] == 'BOTS' || ($this->user->data['user_id'] != ANONYMOUS && !$this->auth->acl_get('u_viewprofile'))) { $legend[] = '' . $group_name . ''; } else { $legend[] = 'phpbb_root_path}memberlist.{$this->php_ext}", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . ''; } } $this->db->sql_freeresult($result); $legend = implode(', ', $legend); $this->template->assign_var('PORTAL_LEGEND', $legend); return 'whois_online_center.html'; } /** * {@inheritdoc} */ public function get_template_side($module_id) { return 'whois_online_side.html'; } /** * {@inheritdoc} */ public function get_template_acp($module_id) { return array( 'title' => 'PORTAL_WHOIS_ONLINE', 'vars' => array(), ); } }