Added Who is online? Block
This commit is contained in:
37
root/language/en/mods/portal/portal_whois_online_module.php
Normal file
37
root/language/en/mods/portal/portal_whois_online_module.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Who is online
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* DO NOT CHANGE
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($lang) || !is_array($lang))
|
||||||
|
{
|
||||||
|
$lang = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// DEVELOPERS PLEASE NOTE
|
||||||
|
//
|
||||||
|
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
|
||||||
|
//
|
||||||
|
// Placeholders can now contain order information, e.g. instead of
|
||||||
|
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
|
||||||
|
// translators to re-order the output of data while ensuring it remains correct
|
||||||
|
//
|
||||||
|
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
|
||||||
|
// equally where a string contains only two placeholders which are used to wrap text
|
||||||
|
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||||
|
$lang = array_merge($lang, array(
|
||||||
|
'PORTAL_WHOIS_ONLINE' => 'Who is online?',
|
||||||
|
));
|
||||||
|
|
||||||
|
?>
|
||||||
129
root/portal/modules/portal_whois_online.php
Normal file
129
root/portal/modules/portal_whois_online.php
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Portal - Who is online
|
||||||
|
* @version $Id$
|
||||||
|
* @copyright (c) 2009, 2010 Board3 Portal Team
|
||||||
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
|
if (!defined('IN_PHPBB'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package Who is online
|
||||||
|
*/
|
||||||
|
class portal_whois_online_module
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Allowed columns: Just sum up your options (Exp: left + right = 10)
|
||||||
|
* top 1
|
||||||
|
* left 2
|
||||||
|
* center 4
|
||||||
|
* right 8
|
||||||
|
* bottom 16
|
||||||
|
*/
|
||||||
|
var $columns = 21;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default modulename
|
||||||
|
*/
|
||||||
|
var $name = 'PORTAL_WHOIS_ONLINE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default module-image:
|
||||||
|
* file must be in "{T_THEME_PATH}/images/portal/"
|
||||||
|
*/
|
||||||
|
var $image_src = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* module-language file
|
||||||
|
* file must be in "language/{$user->lang}/mods/portal/"
|
||||||
|
*/
|
||||||
|
var $language = 'portal_whois_online_module';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* custom acp template
|
||||||
|
* file must be in "adm/style/portal/"
|
||||||
|
*/
|
||||||
|
var $custom_acp_tpl = '';
|
||||||
|
|
||||||
|
function get_template_center($module_id)
|
||||||
|
{
|
||||||
|
global $config, $template, $user, $auth, $db, $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
// Grab group details for legend display
|
||||||
|
if ($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';
|
||||||
|
}
|
||||||
|
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 = ' . $user->data['user_id'] . '
|
||||||
|
AND ug.user_pending = 0
|
||||||
|
)
|
||||||
|
WHERE g.group_legend = 1
|
||||||
|
AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
|
||||||
|
ORDER BY g.group_name ASC';
|
||||||
|
}
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$legend = array();
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : '';
|
||||||
|
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
||||||
|
|
||||||
|
if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')))
|
||||||
|
{
|
||||||
|
$legend[] = '<span' . $colour_text . '>' . $group_name . '</span>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$legend[] = '<a' . $colour_text . ' href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']) . '">' . $group_name . '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
|
$legend = implode(', ', $legend);
|
||||||
|
|
||||||
|
$template->assign_var('PORTAL_LEGEND', $legend);
|
||||||
|
|
||||||
|
return 'whois_online_center.html';
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_template_acp($module_id)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'title' => 'PORTAL_WHOIS_ONLINE',
|
||||||
|
'vars' => array(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API functions
|
||||||
|
*/
|
||||||
|
function install($module_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function uninstall($module_id)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<!--version $Id$ //-->
|
||||||
|
{$C_BLOCK_H_L}<dt><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></dt>{$C_BLOCK_H_R}
|
||||||
|
<ul class="topiclist bg1">
|
||||||
|
<li><dl>
|
||||||
|
<dd style="border-left:0px">
|
||||||
|
<p style="margin: 0 5px 0 5px;">{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}
|
||||||
|
<!-- IF LEGEND --><br /><em>{L_LEGEND}: {PORTAL_LEGEND}</em><!-- ENDIF --></p>
|
||||||
|
</dd>
|
||||||
|
</dl></li>
|
||||||
|
</ul>
|
||||||
|
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
|
||||||
Reference in New Issue
Block a user