aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/index.php18
-rw-r--r--phpBB/develop/create_schema_files.php1
-rw-r--r--phpBB/develop/mysql_upgrader.php1
-rw-r--r--phpBB/feed.php41
-rw-r--r--phpBB/includes/acp/acp_board.php82
-rw-r--r--phpBB/includes/constants.php4
-rw-r--r--phpBB/includes/db/dbal.php18
-rw-r--r--phpBB/includes/db/firebird.php5
-rw-r--r--phpBB/includes/db/oracle.php5
-rw-r--r--phpBB/includes/functions.php57
-rw-r--r--phpBB/includes/functions_admin.php36
-rw-r--r--phpBB/install/database_update.php6
-rw-r--r--phpBB/install/schemas/firebird_schema.sql1
-rw-r--r--phpBB/install/schemas/mssql_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql1
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql1
-rw-r--r--phpBB/install/schemas/oracle_schema.sql1
-rw-r--r--phpBB/install/schemas/postgres_schema.sql1
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql1
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html4
-rw-r--r--phpBB/viewforum.php1
-rw-r--r--phpBB/viewtopic.php3
23 files changed, 211 insertions, 80 deletions
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 778070e2e1..b6b251d2fc 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -263,6 +263,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$tpl = '';
$name = 'config[' . $config_key . ']';
+ // Make sure there is no notice printed out for non-existent config options (we simply set them)
+ if (!isset($new[$config_key]))
+ {
+ $new[$config_key] = '';
+ }
+
switch ($tpl_type[0])
{
case 'text':
@@ -301,7 +307,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
break;
case 'select':
- case 'select_multiple':
case 'custom':
$return = '';
@@ -340,21 +345,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
}
else
{
- if ($tpl_type[0] == 'select_multiple')
- {
- $new[$config_key] = @unserialize(trim($new[$config_key]));
- }
-
$args = array($new[$config_key], $key);
}
$return = call_user_func_array($call, $args);
- if ($tpl_type[0] == 'select_multiple')
- {
- $tpl = '<select id="' . $key . '" name="' . $name . '[]" multiple="multiple">' . $return . '</select>';
- }
- else if ($tpl_type[0] == 'select')
+ if ($tpl_type[0] == 'select')
{
$tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>';
}
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index d8c34d0d76..b9017937c8 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -1073,6 +1073,7 @@ function get_schema_struct()
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''),
'forum_flags' => array('TINT:4', 32),
+ 'forum_options' => array('UINT:20', 0),
'display_subforum_list' => array('BOOL', 1),
'display_on_index' => array('BOOL', 1),
'enable_indexing' => array('BOOL', 1),
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index 1f8bccdd1f..034c1c0c20 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -563,6 +563,7 @@ function get_schema_struct()
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
'forum_last_poster_colour'=> array('VCHAR:6', ''),
'forum_flags' => array('TINT:4', 32),
+ 'forum_options' => array('UINT:20', 0),
'display_subforum_list' => array('BOOL', 1),
'display_on_index' => array('BOOL', 1),
'enable_indexing' => array('BOOL', 1),
diff --git a/phpBB/feed.php b/phpBB/feed.php
index f0e4435956..9603b27301 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -339,7 +339,17 @@ class phpbb_feed_factory
break;
case 'news':
- if (empty($config['feed_news_id']))
+ global $db;
+
+ // Get at least one news forum
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
+ $result = $db->sql_query_limit($sql, 1, 0, 600);
+ $s_feed_news = (int) $db->sql_fetchfield('forum_id');
+ $db->sql_freeresult($result);
+
+ if (!$s_feed_news)
{
return false;
}
@@ -534,7 +544,18 @@ class phpbb_feed
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user;
// Which forums should not be searched ?
- $exclude_forums = (!empty($config['feed_exclude_id'])) ? unserialize(trim($config['feed_exclude_id'])) : array();
+ $exclude_forums = array();
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '<> 0');
+ $result = $db->sql_query($sql);
+
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $exclude_forums[] = (int) $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
// Exclude forums the user is not able to read
$this->excluded_forums_ary = array_keys($auth->acl_getf('!f_read', true));
@@ -883,7 +904,18 @@ class phpbb_feed_news extends phpbb_feed
{
global $db, $config;
- $in_fid_ary = unserialize(trim($config['feed_news_id']));
+ // Get news forums...
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
+ $result = $db->sql_query($sql);
+
+ $in_fid_ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $in_fid_ary[] = (int) $row['forum_id'];
+ }
+ $db->sql_freeresult($result);
if (!sizeof($in_fid_ary))
{
@@ -905,7 +937,8 @@ class phpbb_feed_news extends phpbb_feed
'WHERE' => $db->sql_in_set('t.forum_id', $in_fid_ary) . '
AND f.forum_id = t.forum_id
AND p.post_id = t.topic_first_post_id
- AND t.topic_poster = u.user_id',
+ AND t.topic_poster = u.user_id
+ AND t.topic_moved_id = 0',
'ORDER_BY' => 't.topic_time DESC',
);
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index bd97c29f02..78ba5092a0 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -272,8 +272,8 @@ class acp_board
'feed_overall_topics_limit' => array('lang' => 'ACP_FEED_OVERALL_TOPIC_LIMIT', 'validate' => 'int:5', 'type' => 'text:3:4', 'explain' => false),
'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ),
- 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_news_forums', 'explain' => true ),
- 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'select_multiple', 'method' => 'select_exclude_forums', 'explain' => true),
+ 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true),
+ 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
)
);
break;
@@ -440,35 +440,16 @@ class acp_board
// We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to...
foreach ($display_vars['vars'] as $config_name => $null)
{
- if (strpos($config_name, 'legend') !== false)
+ if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false)
{
continue;
}
- if ($config_name == 'auth_method')
+ if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
{
continue;
}
- // It could happen that the cfg array is not set. This happens within feed settings if unselecting all forums in the multiple select fields for example (it is the same as checkbox handling)
- if (!isset($cfg_array[$config_name]))
- {
- $cfg_array[$config_name] = '';
- }
-
- // Erm, we spotted an array
- if ($null['type'] == 'select_multiple' && $submit && isset($_REQUEST['config'][$config_name]))
- {
- // Get config *array*
- $cfg_ = utf8_normalize_nfc(request_var('config', array('' => array('')), true));
-
- // Check if the variable is set and an array
- if (isset($cfg_[$config_name]) && is_array($cfg_[$config_name]))
- {
- $cfg_array[$config_name] = trim(serialize($cfg_[$config_name]));
- }
- }
-
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
if ($config_name == 'email_function_name')
@@ -484,6 +465,13 @@ class acp_board
}
}
+ // Store news and exclude ids
+ if ($mode == 'feed' && $submit)
+ {
+ $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id');
+ $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id');
+ }
+
if ($mode == 'auth')
{
// Retrieve a list of auth plugins and check their config values
@@ -902,17 +890,17 @@ class acp_board
{
global $user, $config;
- // Determine ids to be selected
- $select_ids = (sizeof($value)) ? $value : false;
-
- $forum_list = make_forum_select($select_ids, false, true, true, true, false, true);
+ $forum_list = make_forum_select(false, false, true, true, true, false, true);
// Build forum options
- $s_forum_options = '';
+ $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row)
{
+ $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_NEWS, $f_row['forum_options']);
+
$s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
+ $s_forum_options .= '</select>';
return $s_forum_options;
}
@@ -921,20 +909,48 @@ class acp_board
{
global $user, $config;
- // Determine ids to be selected
- $select_ids = (sizeof($value)) ? $value : false;
-
- $forum_list = make_forum_select($select_ids, false, true, false, false, false, true);
+ $forum_list = make_forum_select(false, false, true, false, false, false, true);
// Build forum options
- $s_forum_options = '';
+ $s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row)
{
+ $f_row['selected'] = phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $f_row['forum_options']);
+
$s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
+ $s_forum_options .= '</select>';
return $s_forum_options;
}
+
+ function store_feed_forums($option, $key)
+ {
+ global $db, $cache;
+
+ // Get key
+ $values = request_var($key, array(0 => 0));
+
+ // Empty option bit for all forums
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET forum_options = forum_options - ' . (1 << $option) . '
+ WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0');
+ $db->sql_query($sql);
+
+ // Already emptied for all...
+ if (sizeof($values))
+ {
+ // Set for selected forums
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET forum_options = forum_options + ' . (1 << $option) . '
+ WHERE ' . $db->sql_in_set('forum_id', $values);
+ $db->sql_query($sql);
+ }
+
+ // Empty sql cache for forums table because options changed
+ $cache->destroy('sql', FORUMS_TABLE);
+ }
+
}
?> \ No newline at end of file
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 2173f2ee68..98abf18b6f 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -93,6 +93,10 @@ define('FORUM_FLAG_ACTIVE_TOPICS', 16);
define('FORUM_FLAG_POST_REVIEW', 32);
define('FORUM_FLAG_QUICK_REPLY', 64);
+// Forum Options... sequential order. Modifications should begin at number 10 (number 29 is maximum)
+define('FORUM_OPTION_FEED_NEWS', 1);
+define('FORUM_OPTION_FEED_EXCLUDE', 2);
+
// Optional text flags
define('OPTION_FLAG_BBCODE', 1);
define('OPTION_FLAG_SMILIES', 2);
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 0e1d6cba33..5418ed394b 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -412,6 +412,24 @@ class dbal
}
/**
+ * Run binary AND operator on DB column.
+ * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}"
+ *
+ * @param string $column_name The column name to use
+ * @param int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
+ * @param string $compare Any custom SQL code after the check (for example "= 0")
+ */
+ function sql_bit_and($column_name, $bit, $compare = '')
+ {
+ if (method_exists($this, '_sql_bit_and'))
+ {
+ return $this->_sql_bit_and($column_name, $bit, $compare);
+ }
+
+ return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : '');
+ }
+
+ /**
* Run more than one insert statement.
*
* @param string $table table name to run the statements on
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 3b31942a8b..f5e8595382 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -446,6 +446,11 @@ class dbal_firebird extends dbal
return $data;
}
+ function _sql_bit_and($column_name, $bit, $compare = '')
+ {
+ return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
+ }
+
/**
* return sql error array
* @access private
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index a140c4b676..10f4a1a7a7 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -568,6 +568,11 @@ class dbal_oracle extends dbal
return $data;
}
+ function _sql_bit_and($column_name, $bit, $compare = '')
+ {
+ return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
+ }
+
/**
* return sql error array
* @access private
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 4f88ee9625..49e9f41704 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3505,7 +3505,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
$l_notify = '<p>Please notify the board administrator or webmaster: <a href="mailto:' . $config['board_contact'] . '">' . $config['board_contact'] . '</a></p>';
}
}
-
+
if (defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT'))
{
// let's avoid loops
@@ -3857,6 +3857,40 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum'
);
}
+/**
+* Get option bitfield from custom data
+*
+* @param int $bit The bit/value to get
+* @param int $data Current bitfield to check
+* @return bool Returns true if value of constant is set in bitfield, else false
+*/
+function phpbb_optionget($bit, $data)
+{
+ return ($data & 1 << (int) $bit) ? true : false;
+}
+
+/**
+* Set option bitfield
+*
+* @param int $bit The bit/value to set/unset
+* @param bool $set True if option should be set, false if option should be unset.
+* @param int $data Current bitfield to change
+*
+* @return int The new bitfield
+*/
+function phpbb_optionset($bit, $set, $data)
+{
+ if ($set && !($data & 1 << $bit))
+ {
+ $data += 1 << $bit;
+ }
+ else if (!$set && ($data & 1 << $bit))
+ {
+ $data -= 1 << $bit;
+ }
+
+ return $data;
+}
/**
* Generate page header
@@ -3917,7 +3951,7 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
* }
* </code>
*/
-
+
if ($forum_id)
{
$item_id = max($forum_id, 0);
@@ -3926,7 +3960,7 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
{
$item_id = 0;
}
-
+
// workaround legacy code
$item = 'forum';
$online_users = obtain_users_online($item_id, $item);
@@ -4005,6 +4039,19 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
$forum_id = request_var('f', 0);
$topic_id = request_var('t', 0);
+ $s_feed_news = false;
+
+ // Get option for news
+ if ($config['feed_enable'])
+ {
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0');
+ $result = $db->sql_query_limit($sql, 1, 0, 600);
+ $s_feed_news = (int) $db->sql_fetchfield('forum_id');
+ $db->sql_freeresult($result);
+ }
+
// The following assigns all _common_ variables that may be used at any point in a template.
$template->assign_vars(array(
'SITENAME' => $config['sitename'],
@@ -4082,11 +4129,9 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
'S_TOPIC_ID' => $topic_id,
'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false,
- 'S_ENABLE_FEEDS_NEWS' => ($config['feed_news_id'] != '') ? true : false,
'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false,
'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? true : false,
- 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_id && strpos($user->page['page_name'], 'viewforum') !== false) ? true : false,
- 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && $topic_id && strpos($user->page['page_name'], 'viewtopic') !== false) ? true : false,
+ 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false,
'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme',
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template',
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 44675b9cc0..1931ae3dfa 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -69,7 +69,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl =
$acl = ($ignore_acl) ? '' : (($only_acl_post) ? 'f_post' : array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'));
// This query is identical to the jumpbox one
- $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
+ $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
$result = $db->sql_query($sql, 600);
@@ -1364,15 +1364,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $topic_id_ary);
$db->sql_query($sql);
-
+
break;
}
-
+
$db->sql_transaction('commit');
break;
case 'topic_approved':
-
+
$db->sql_transaction('begin');
switch ($db->sql_layer)
{
@@ -1409,15 +1409,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_query($sql);
break;
}
-
+
$db->sql_transaction('commit');
break;
case 'post_reported':
$post_ids = $post_reported = array();
-
+
$db->sql_transaction('begin');
-
+
$sql = 'SELECT p.post_id, p.post_reported
FROM ' . POSTS_TABLE . " p
$where_sql
@@ -1468,7 +1468,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
WHERE ' . $db->sql_in_set('post_id', $post_ids);
$db->sql_query($sql);
}
-
+
$db->sql_transaction('commit');
break;
@@ -1481,7 +1481,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$topic_ids = $topic_reported = array();
$db->sql_transaction('begin');
-
+
$sql = 'SELECT DISTINCT(t.topic_id)
FROM ' . POSTS_TABLE . " t
$where_sql_and t.post_reported = 1";
@@ -1514,7 +1514,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
}
-
+
$db->sql_transaction('commit');
break;
@@ -1522,7 +1522,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$post_ids = $post_attachment = array();
$db->sql_transaction('begin');
-
+
$sql = 'SELECT p.post_id, p.post_attachment
FROM ' . POSTS_TABLE . " p
$where_sql
@@ -1573,7 +1573,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
WHERE ' . $db->sql_in_set('post_id', $post_ids);
$db->sql_query($sql);
}
-
+
$db->sql_transaction('commit');
break;
@@ -1619,15 +1619,15 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
$db->sql_query($sql);
}
-
+
$db->sql_transaction('commit');
-
+
break;
case 'forum':
$db->sql_transaction('begin');
-
+
// 1: Get the list of all forums
$sql = 'SELECT f.*
FROM ' . FORUMS_TABLE . " f
@@ -1828,7 +1828,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$db->sql_query($sql);
}
}
-
+
$db->sql_transaction('commit');
break;
@@ -1836,7 +1836,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
$topic_data = $post_ids = $approved_unapproved_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array();
$db->sql_transaction('begin');
-
+
$sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_approved, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_replies, t.topic_replies_real, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time
FROM ' . TOPICS_TABLE . " t
$where_sql";
@@ -2160,7 +2160,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false,
unset($topic_data);
$db->sql_transaction('commit');
-
+
// if some topics have been resync'ed then resync parent forums
// except when we're only syncing a range, we don't want to sync forums during
// batch processing.
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 8252cd4968..e77a170240 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -707,6 +707,9 @@ function database_update_info()
PROFILE_FIELDS_TABLE => array(
'field_show_on_vt' => array('BOOL', 0),
),
+ FORUMS_TABLE => array(
+ 'forum_options' => array('UINT:20', 0),
+ ),
),
'change_columns' => array(
USERS_TABLE => array(
@@ -1086,10 +1089,7 @@ function change_database_data(&$no_updates, $version)
set_config('feed_forum', '1');
set_config('feed_topic', '1');
- set_config('feed_news_id', '');
-
set_config('feed_item_statistics', '1');
- set_config('feed_exclude_id', '');
// Entries for smiley pagination
set_config('smilies_per_page', '50');
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 1e8b850645..f3defe9a54 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -363,6 +363,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL,
forum_flags INTEGER DEFAULT 32 NOT NULL,
+ forum_options INTEGER DEFAULT 0 NOT NULL,
display_subforum_list INTEGER DEFAULT 1 NOT NULL,
display_on_index INTEGER DEFAULT 1 NOT NULL,
enable_indexing INTEGER DEFAULT 1 NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 3c96299571..ac7c0928cd 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -439,6 +439,7 @@ CREATE TABLE [phpbb_forums] (
[forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL ,
[forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL ,
[forum_flags] [int] DEFAULT (32) NOT NULL ,
+ [forum_options] [int] DEFAULT (0) NOT NULL ,
[display_subforum_list] [int] DEFAULT (1) NOT NULL ,
[display_on_index] [int] DEFAULT (1) NOT NULL ,
[enable_indexing] [int] DEFAULT (1) NOT NULL ,
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 9a090f0936..4fcead787b 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name blob NOT NULL,
forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL,
forum_flags tinyint(4) DEFAULT '32' NOT NULL,
+ forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL,
display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index 1c0225b92c..34adf5674e 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
forum_flags tinyint(4) DEFAULT '32' NOT NULL,
+ forum_options int(20) UNSIGNED DEFAULT '0' NOT NULL,
display_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
display_on_index tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index c802bcedff..15692ea984 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -505,6 +505,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name varchar2(765) DEFAULT '' ,
forum_last_poster_colour varchar2(6) DEFAULT '' ,
forum_flags number(4) DEFAULT '32' NOT NULL,
+ forum_options number(20) DEFAULT '0' NOT NULL,
display_subforum_list number(1) DEFAULT '1' NOT NULL,
display_on_index number(1) DEFAULT '1' NOT NULL,
enable_indexing number(1) DEFAULT '1' NOT NULL,
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index aeb3265b81..46e77e64b4 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -382,6 +382,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
forum_flags INT2 DEFAULT '32' NOT NULL,
+ forum_options INT4 DEFAULT '0' NOT NULL CHECK (forum_options >= 0),
display_subforum_list INT2 DEFAULT '1' NOT NULL CHECK (display_subforum_list >= 0),
display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 3545fa9bc2..30acb90618 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -105,9 +105,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topic
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_overall_topics_limit', '15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_forum', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '1');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_news_id', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_item_statistics', '1');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_exclude_id', '');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('flood_interval', '15');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('force_server_vars', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200');
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index e201f8de64..d754219cdf 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -242,6 +242,7 @@ CREATE TABLE phpbb_forums (
forum_last_poster_name varchar(255) NOT NULL DEFAULT '',
forum_last_poster_colour varchar(6) NOT NULL DEFAULT '',
forum_flags tinyint(4) NOT NULL DEFAULT '32',
+ forum_options INTEGER UNSIGNED NOT NULL DEFAULT '0',
display_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1',
display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1',
enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1',
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index 23c3961aaa..9d4162591a 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -20,8 +20,8 @@
<!-- IF S_ENABLE_FEEDS_NEWS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FEED_NEWS}" href="{U_FEED}?mode=news" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_FORUMS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_FORUMS}" href="{U_FEED}?mode=forums" /><!-- ENDIF -->
<!-- IF S_ENABLE_FEEDS_TOPICS --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_ALL_TOPICS}" href="{U_FEED}?mode=topics" /><!-- ENDIF -->
- <!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF -->
- <!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&amp;t={S_TOPIC_ID}" /><!-- ENDIF -->
+ <!-- IF S_ENABLE_FEEDS_FORUM and S_FORUM_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_FORUM} - {FORUM_NAME}" href="{U_FEED}?f={S_FORUM_ID}" /><!-- ENDIF -->
+ <!-- IF S_ENABLE_FEEDS_TOPIC and S_TOPIC_ID --><link rel="alternate" type="application/atom+xml" title="{L_FEED} - {L_TOPIC} - {TOPIC_TITLE}" href="{U_FEED}?f={S_FORUM_ID}&amp;t={S_TOPIC_ID}" /><!-- ENDIF -->
<!-- ENDIF -->
<!--
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index ad1bb64ff2..6e76cec051 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -310,6 +310,7 @@ $template->assign_vars(array(
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
'S_VIEWFORUM' => true,
+ 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&amp;i=main&amp;mode=forum_view", true, $user->session_id) : '',
'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&amp;f=' . $forum_id) : '',
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 10f782089b..baaf3cfaf1 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -620,6 +620,7 @@ $template->assign_vars(array(
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
+ 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options'])) ? true : false,
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&amp;t=$topic_id",
'U_FORUM' => $server_path,
@@ -1180,7 +1181,7 @@ if ($config['load_cpf_viewtopic'])
// Grab all profile fields from users in id cache for later use - similar to the poster cache
$profile_fields_tmp = $cp->generate_profile_fields_template('grab', $id_cache);
-
+
// filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs.
$profile_fields_cache = array();
foreach ($profile_fields_tmp as $profile_user_id => $profile_fields)