Removed tons of useless queries from the team block;

Fixed incorrect language vars for news block;
This commit is contained in:
Marc Alexander
2010-09-05 10:51:35 +00:00
parent b60422cb2e
commit 9aa25c8117
3 changed files with 19 additions and 84 deletions

View File

@@ -46,25 +46,25 @@ $lang = array_merge($lang, array(
// ACP // ACP
'ACP_PORTAL_NEWS_SETTINGS' => 'News settings', 'ACP_PORTAL_NEWS_SETTINGS' => 'News settings',
'ACP_PORTAL_NEWS_SETTINGS_EXPLAIN' => 'This is where you customize the news block.', 'ACP_PORTAL_NEWS_SETTINGS_EXP' => 'This is where you customize the news block.',
'PORTAL_NEWS_STYLE' => 'Compact news block style', 'PORTAL_NEWS_STYLE' => 'Compact news block style',
'PORTAL_NEWS_STYLE_EXPLAIN' => '"Yes" means use the compact style for news. "No" means use the large style (text view).', 'PORTAL_NEWS_STYLE_EXP' => '"Yes" means use the compact style for news. "No" means use the large style (text view).',
'PORTAL_SHOW_ALL_NEWS' => 'Show all of the articles in this forum', 'PORTAL_SHOW_ALL_NEWS' => 'Show all of the articles in this forum',
'PORTAL_SHOW_ALL_NEWS_EXPLAIN' => 'Includes stickies.', 'PORTAL_SHOW_ALL_NEWS_EXP' => 'Includes stickies.',
'PORTAL_NUMBER_OF_NEWS' => 'Number of news articles on the portal', 'PORTAL_NUMBER_OF_NEWS' => 'Number of news articles on the portal',
'PORTAL_NUMBER_OF_NEWS_EXPLAIN' => '0 means infinite', 'PORTAL_NUMBER_OF_NEWS_EXP' => '0 means infinite',
'PORTAL_NEWS_LENGTH' => 'Max length of news article', 'PORTAL_NEWS_LENGTH' => 'Max length of news article',
'PORTAL_NEWS_LENGTH_EXPLAIN' => '0 means infinite', 'PORTAL_NEWS_LENGTH_EXP' => '0 means infinite',
'PORTAL_NEWS_FORUM' => 'News Forums', 'PORTAL_NEWS_FORUM' => 'News Forums',
'PORTAL_NEWS_FORUM_EXPLAIN' => 'Forum(s) we pull the articles from, leave blank to pull from all forums. If "Exclude forums" is set to "Yes", select the forums you want to exclude.<br />If "Exclude forums" is set to "No" select the forums you want to see.<br />Select/Deselect multiple forums by holding <samp>CTRL</samp> and clicking.', 'PORTAL_NEWS_FORUM_EXP' => 'Forum(s) we pull the articles from, leave blank to pull from all forums. If "Exclude forums" is set to "Yes", select the forums you want to exclude.<br />If "Exclude forums" is set to "No" select the forums you want to see.<br />Select/Deselect multiple forums by holding <samp>CTRL</samp> and clicking.',
'PORTAL_NEWS_EXCLUDE' => 'Exclude forums', 'PORTAL_NEWS_EXCLUDE' => 'Exclude forums',
'PORTAL_NEWS_EXCLUDE_EXPLAIN' => 'Select "Yes" if you want to exlude the selected forums from the news block, and "No" if you want to see only the selected forums in the news block.', 'PORTAL_NEWS_EXCLUDE_EXP' => 'Select "Yes" if you want to exlude the selected forums from the news block, and "No" if you want to see only the selected forums in the news block.',
'PORTAL_NEWS_PERMISSIONS' => 'Enable/disable permissions', 'PORTAL_NEWS_PERMISSIONS' => 'Enable/disable permissions',
'PORTAL_NEWS_PERMISSIONS_EXPLAIN' => 'Take forum viewing permissions into account when displaying news', 'PORTAL_NEWS_PERMISSIONS_EXP' => 'Take forum viewing permissions into account when displaying news',
'PORTAL_NEWS_SHOW_LAST' => 'Sort in order to the newest posts', 'PORTAL_NEWS_SHOW_LAST' => 'Sort in order to the newest posts',
'PORTAL_NEWS_SHOW_LAST_EXPLAIN' => 'When activated, the newest will be sorted in order to the newest posts. When deactivated, the news will be sorted in order to the newest topic.', 'PORTAL_NEWS_SHOW_LAST_EXP' => 'When activated, the newest will be sorted in order to the newest posts. When deactivated, the news will be sorted in order to the newest topic.',
'PORTAL_NEWS_ARCHIVE' => 'Enable the news archive system', 'PORTAL_NEWS_ARCHIVE' => 'Enable the news archive system',
'PORTAL_NEWS_ARCHIVE_EXPLAIN' => 'If enabled the news archive system / page numbers will be displayed.', 'PORTAL_NEWS_ARCHIVE_EXP' => 'If enabled the news archive system / page numbers will be displayed.',
)); ));
?> ?>

View File

@@ -239,7 +239,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$attachments = array(); $attachments = array();
if(($auth->acl_get('u_download') && ($auth->acl_get('f_download', $row['forum_id']) || $row['forum_id'] == 0)) && $config['allow_attachments'] && $row['post_id']) if(($auth->acl_get('u_download') && ($auth->acl_get('f_download', $row['forum_id']) || $row['forum_id'] == 0)) && $config['allow_attachments'] && $row['post_id'] && $row['post_attachment'])
{ {
// Pull attachment data // Pull attachment data
$sql2 = 'SELECT * $sql2 = 'SELECT *

View File

@@ -146,58 +146,6 @@ class portal_leaders_module
} }
else else
{ {
$user_ary = $auth->acl_get_list(false, array('a_', 'm_'), false);
$admin_id_ary = $mod_id_ary = $forum_id_ary = array();
foreach ($user_ary as $forum_id => $forum_ary)
{
foreach ($forum_ary as $auth_option => $id_ary)
{
if (!$forum_id && $auth_option == 'a_')
{
$admin_id_ary = array_merge($admin_id_ary, $id_ary);
continue;
}
else
{
$mod_id_ary = array_merge($mod_id_ary, $id_ary);
}
if ($forum_id)
{
foreach ($id_ary as $id)
{
$forum_id_ary[$id][] = $forum_id;
}
}
}
}
$admin_id_ary = array_unique($admin_id_ary);
$mod_id_ary = array_unique($mod_id_ary);
// Admin group id...
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'ADMINISTRATORS'";
$result = $db->sql_query($sql);
$admin_group_id = (int) $db->sql_fetchfield('group_id');
$db->sql_freeresult($result);
$sql = 'SELECT forum_id, forum_name
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
$result = $db->sql_query($sql);
$forums = array();
while ($row = $db->sql_fetchrow($result))
{
$forums[$row['forum_id']] = $row['forum_name'];
}
$db->sql_freeresult($result);
$sql = $db->sql_build_query('SELECT', array( $sql = $db->sql_build_query('SELECT', array(
'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.user_colour, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id', 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.user_colour, u.user_allow_pm, g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id',
'FROM' => array( 'FROM' => array(
@@ -209,34 +157,21 @@ class portal_leaders_module
'FROM' => array(USER_GROUP_TABLE => 'ug'), 'FROM' => array(USER_GROUP_TABLE => 'ug'),
'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id']
)), )),
'WHERE' => $db->sql_in_set('u.user_id', array_unique(array_merge($admin_id_ary, $mod_id_ary))) . ' 'WHERE' => 'u.group_id = g.group_id AND ' . $db->sql_in_set('g.group_name', array('ADMINISTRATORS', 'GLOBAL_MODERATORS')),
AND u.group_id = g.group_id',
'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC' 'ORDER_BY' => 'g.group_name ASC, u.username_clean ASC'
)); ));
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) while ($row = $db->sql_fetchrow($result))
{ {
$which_row = (in_array($row['user_id'], $admin_id_ary)) ? 'admin' : 'mod'; if ($row['group_name'] == 'ADMINISTRATORS')
// We sort out admins not having the admin group as default
// The drawback is that only those admins are displayed which are within
// the special group 'Administrators' and also having it assigned as their default group.
// - might change
if ($which_row == 'admin' && $row['default_group'] != $admin_group_id)
{ {
// Remove from admin_id_ary, because the user may be a mod instead $which_row = 'admin';
unset($admin_id_ary[array_search($row['user_id'], $admin_id_ary)]); }
elseif ($row['group_name'] == 'GLOBAL_MODERATORS')
if (!in_array($row['user_id'], $mod_id_ary)) {
{ $which_row = 'mod';
continue;
}
else
{
$which_row = 'mod';
}
} }
if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id']) if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id'])