Unreported: Attachments from specific forum(s) (block and installer)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$current_version = '0.2.1';
|
$current_version = '0.2.2';
|
||||||
|
|
||||||
// If only checking version, exit.
|
// If only checking version, exit.
|
||||||
if( defined('IN_PHPBB') )
|
if( defined('IN_PHPBB') )
|
||||||
|
|||||||
@@ -7,4 +7,7 @@ $sql_update['0.2.0'] = array(
|
|||||||
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_birthdays_ahead', '7')",
|
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_birthdays_ahead', '7')",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$sql_update['0.2.2'] = array(
|
||||||
|
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('pportal_attachments_forum_ids', '')",
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
@@ -19,17 +19,41 @@ if (!defined('IN_PORTAL'))
|
|||||||
{
|
{
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$portal_config['portal_attachments_forum_ids'] = '2';
|
||||||
|
|
||||||
|
$attach_forums = false;
|
||||||
$where = '';
|
$where = '';
|
||||||
$allowed_forums = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
|
||||||
foreach( $allowed_forums as $allowed_id )
|
if( $portal_config['portal_attachments_forum_ids'] !== '' )
|
||||||
{
|
{
|
||||||
$where .= 't.forum_id = \'' . $allowed_id . '\' OR ';
|
$attach_forums_config = ( strpos($portal_config['portal_attachments_forum_ids'], ',') !== FALSE ) ? explode(',', $portal_config['portal_attachments_forum_ids']) : array($portal_config['portal_attachments_forum_ids']);
|
||||||
|
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
||||||
|
|
||||||
|
$forum_list = array_unique( array_intersect($attach_forums_config, $forum_list) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if( sizeof($forum_list) )
|
||||||
|
{
|
||||||
|
foreach($forum_list as $af )
|
||||||
|
{
|
||||||
|
$af = (int) trim($af);
|
||||||
|
$attach_forums = true;
|
||||||
|
$where .= 't.forum_id = \''.$af.'\' OR ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( $where != '' )
|
if( $where != '' )
|
||||||
{
|
{
|
||||||
$where = 'AND (' . substr($where, 0, -4) . ')';
|
$where = 'AND (' . substr($where, 0, -4) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $attach_forums === TRUE )
|
||||||
|
{
|
||||||
// Just grab all attachment info from database
|
// Just grab all attachment info from database
|
||||||
$sql = 'SELECT
|
$sql = 'SELECT
|
||||||
a.*,
|
a.*,
|
||||||
@@ -70,5 +94,12 @@ $db->sql_freeresult($result);
|
|||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_DISPLAY_ATTACHMENTS' => true,
|
'S_DISPLAY_ATTACHMENTS' => true,
|
||||||
));
|
));
|
||||||
|
} else {
|
||||||
|
// Assign specific vars
|
||||||
|
$template->assign_vars(array(
|
||||||
|
'S_DISPLAY_ATTACHMENTS' => false,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user