Enabling/disabling permissions for news & announcements
(Required translations)
This commit is contained in:
@@ -77,6 +77,7 @@ class acp_portal
|
|||||||
'portal_number_of_news' => array('lang' => 'PORTAL_NUMBER_OF_NEWS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'portal_number_of_news' => array('lang' => 'PORTAL_NUMBER_OF_NEWS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'portal_news_length' => array('lang' => 'PORTAL_NEWS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'portal_news_length' => array('lang' => 'PORTAL_NEWS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'portal_news_forum' => array('lang' => 'PORTAL_NEWS_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
|
'portal_news_forum' => array('lang' => 'PORTAL_NEWS_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
|
||||||
|
'portal_news_permissions' => array('lang' => 'PORTAL_NEWS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -90,7 +91,8 @@ class acp_portal
|
|||||||
'portal_number_of_announcements' => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'portal_number_of_announcements' => array('lang' => 'PORTAL_NUMBER_OF_ANNOUNCEMENTS' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'portal_announcements_day' => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'portal_announcements_day' => array('lang' => 'PORTAL_ANNOUNCEMENTS_DAY' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'portal_announcements_length' => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
'portal_announcements_length' => array('lang' => 'PORTAL_ANNOUNCEMENTS_LENGTH' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
|
||||||
'portal_global_announcements_forum' => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM', 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
|
'portal_global_announcements_forum' => array('lang' => 'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' , 'validate' => 'string', 'type' => 'text:10:200', 'explain' => true),
|
||||||
|
'portal_announcements_permissions' => array('lang' => 'PORTAL_ANNOUNCEMENTS_PERMISSIONS' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
$current_version = '0.2.2';
|
$current_version = '0.2.3';
|
||||||
|
|
||||||
// If only checking version, exit.
|
// If only checking version, exit.
|
||||||
if( defined('IN_PHPBB') )
|
if( defined('IN_PHPBB') )
|
||||||
|
|||||||
@@ -69,5 +69,9 @@ INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_birt
|
|||||||
# Version 0.2.2 #
|
# Version 0.2.2 #
|
||||||
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_attachments_forum_ids', '');
|
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_attachments_forum_ids', '');
|
||||||
|
|
||||||
|
# Version 0.2.3 #
|
||||||
|
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_permissions', '1');
|
||||||
|
INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_permissions', '1');
|
||||||
|
|
||||||
# POSTGRES COMMIT #
|
# POSTGRES COMMIT #
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,10 @@ $sql_update['0.2.0'] = array(
|
|||||||
$sql_update['0.2.2'] = array(
|
$sql_update['0.2.2'] = array(
|
||||||
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_attachments_forum_ids', '')",
|
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_attachments_forum_ids', '')",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$sql_update['0.2.3'] = array(
|
||||||
|
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_announcements_persmissions', '1')",
|
||||||
|
"INSERT INTO phpbb_portal_config (config_name, config_value) VALUES ('portal_news_persmissions', '1')",
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -96,6 +96,8 @@ $lang = array_merge($lang, array(
|
|||||||
'PORTAL_ANNOUNCEMENTS_LENGTH_EXPLAIN' => '0 means infinite',
|
'PORTAL_ANNOUNCEMENTS_LENGTH_EXPLAIN' => '0 means infinite',
|
||||||
'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' => 'Global global announcements forum ID',
|
'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM' => 'Global global announcements forum ID',
|
||||||
'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
'PORTAL_GLOBAL_ANNOUNCEMENTS_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
||||||
|
'PORTAL_ANNOUNCEMENTS_PERMISSIONS' => 'Enable/disable permissions',
|
||||||
|
'PORTAL_ANNOUNCEMENTS_PERMISSIONS_EXPLAIN' => 'Take forum viewing permissions into account when displaying announcements',
|
||||||
|
|
||||||
// news
|
// news
|
||||||
'ACP_PORTAL_NEWS_INFO' => 'News',
|
'ACP_PORTAL_NEWS_INFO' => 'News',
|
||||||
@@ -115,6 +117,8 @@ $lang = array_merge($lang, array(
|
|||||||
'PORTAL_NEWS_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
'PORTAL_NEWS_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
||||||
'PORTAL_EXCLUDE_FORUM' => 'Exclude Forum ID',
|
'PORTAL_EXCLUDE_FORUM' => 'Exclude Forum ID',
|
||||||
'PORTAL_EXCLUDE_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
'PORTAL_EXCLUDE_FORUM_EXPLAIN' => 'Forum we pull the articles from, leave blank to pull from all forums, separate by comma for multi-forums, eg. 1,2,5',
|
||||||
|
'PORTAL_NEWS_PERMISSIONS' => 'Enable/disable permissions',
|
||||||
|
'PORTAL_NEWS_PERMISSIONS_EXPLAIN' => 'Take forum viewing permissions into account when displaying news',
|
||||||
|
|
||||||
// recent topics
|
// recent topics
|
||||||
'ACP_PORTAL_RECENT_INFO' => 'Recent topics',
|
'ACP_PORTAL_RECENT_INFO' => 'Recent topics',
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ if (!defined('IN_PORTAL'))
|
|||||||
$announcement = request_var('announcement', -1);
|
$announcement = request_var('announcement', -1);
|
||||||
if($announcement < 0)
|
if($announcement < 0)
|
||||||
{
|
{
|
||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_number_of_announcements'], $portal_config['portal_announcements_length'], $portal_config['portal_announcements_day'], 'announcements');
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_announcements_permissions'], $portal_config['portal_number_of_announcements'], $portal_config['portal_announcements_length'], $portal_config['portal_announcements_day'], 'announcements');
|
||||||
|
|
||||||
if (count($fetch_news) == 0)
|
if (count($fetch_news) == 0)
|
||||||
{
|
{
|
||||||
@@ -85,7 +85,7 @@ if($announcement < 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_number_of_announcements'], 0, $portal_config['portal_announcements_day'], 'announcements');
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_forum'], $portal_config['portal_announcements_permissions'], $portal_config['portal_number_of_announcements'], 0, $portal_config['portal_announcements_day'], 'announcements');
|
||||||
|
|
||||||
$i = $announcement;
|
$i = $announcement;
|
||||||
$forum_id = $fetch_news[$i]['forum_id'];
|
$forum_id = $fetch_news[$i]['forum_id'];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ $template->assign_vars(array(
|
|||||||
$news = request_var('news', -1);
|
$news = request_var('news', -1);
|
||||||
if($news < 0)
|
if($news < 0)
|
||||||
{
|
{
|
||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], $portal_config['portal_news_length'], 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
||||||
|
|
||||||
if (count($fetch_news) == 0)
|
if (count($fetch_news) == 0)
|
||||||
{
|
{
|
||||||
@@ -91,7 +91,7 @@ if($news < 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], 0, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_news_permissions'], $portal_config['portal_number_of_news'], 0, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
|
||||||
|
|
||||||
$i = $news;
|
$i = $news;
|
||||||
$forum_id = $fetch_news[$i]['forum_id'];
|
$forum_id = $fetch_news[$i]['forum_id'];
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ function set_portal_config($config_name, $config_value)
|
|||||||
include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
|
include($phpbb_root_path . 'includes/message_parser.'.$phpEx);
|
||||||
|
|
||||||
// fetch post for news & announce
|
// fetch post for news & announce
|
||||||
function phpbb_fetch_posts($forum_from, $number_of_posts, $text_length, $time, $type)
|
function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_length, $time, $type)
|
||||||
{
|
{
|
||||||
global $db, $phpbb_root_path, $auth, $user, $bbcode_bitfield, $bbcode;
|
global $db, $phpbb_root_path, $auth, $user, $bbcode_bitfield, $bbcode;
|
||||||
|
|
||||||
@@ -83,7 +83,12 @@ function phpbb_fetch_posts($forum_from, $number_of_posts, $text_length, $time, $
|
|||||||
|
|
||||||
$str_where = '';
|
$str_where = '';
|
||||||
|
|
||||||
|
if( $permissions )
|
||||||
|
{
|
||||||
$allow_access = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
$allow_access = array_unique(array_keys($auth->acl_getf('f_read', true)));
|
||||||
|
} else {
|
||||||
|
$allow_access = array_unique(array_keys($auth->acl_getf('f_', true)));
|
||||||
|
}
|
||||||
|
|
||||||
if( sizeof($allow_access) ){
|
if( sizeof($allow_access) ){
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user