mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
ok, i am very sorry, but this needs to be fixed.
Generally, our config table is not really suited for holding large datasets. Because feed settings for the forums to enable news feeds and excluded forums rely on the forums itself we have decided to introduce a forum_options table where custom options can be stored. Additionally, for this to work across all DBMS we support, we added a new method to the DBAL for the bitwise AND operator. Also moved the forum/topic feed template variable to the location where they belong to (forum and topic view) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9965 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
45964352e3
commit
09ad10a734
23 changed files with 211 additions and 80 deletions
|
@ -263,6 +263,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||||
$tpl = '';
|
$tpl = '';
|
||||||
$name = 'config[' . $config_key . ']';
|
$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])
|
switch ($tpl_type[0])
|
||||||
{
|
{
|
||||||
case 'text':
|
case 'text':
|
||||||
|
@ -301,7 +307,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'select':
|
case 'select':
|
||||||
case 'select_multiple':
|
|
||||||
case 'custom':
|
case 'custom':
|
||||||
|
|
||||||
$return = '';
|
$return = '';
|
||||||
|
@ -340,21 +345,12 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($tpl_type[0] == 'select_multiple')
|
|
||||||
{
|
|
||||||
$new[$config_key] = @unserialize(trim($new[$config_key]));
|
|
||||||
}
|
|
||||||
|
|
||||||
$args = array($new[$config_key], $key);
|
$args = array($new[$config_key], $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
$return = call_user_func_array($call, $args);
|
$return = call_user_func_array($call, $args);
|
||||||
|
|
||||||
if ($tpl_type[0] == 'select_multiple')
|
if ($tpl_type[0] == 'select')
|
||||||
{
|
|
||||||
$tpl = '<select id="' . $key . '" name="' . $name . '[]" multiple="multiple">' . $return . '</select>';
|
|
||||||
}
|
|
||||||
else if ($tpl_type[0] == 'select')
|
|
||||||
{
|
{
|
||||||
$tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>';
|
$tpl = '<select id="' . $key . '" name="' . $name . '">' . $return . '</select>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1073,6 +1073,7 @@ function get_schema_struct()
|
||||||
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
|
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
|
||||||
'forum_last_poster_colour'=> array('VCHAR:6', ''),
|
'forum_last_poster_colour'=> array('VCHAR:6', ''),
|
||||||
'forum_flags' => array('TINT:4', 32),
|
'forum_flags' => array('TINT:4', 32),
|
||||||
|
'forum_options' => array('UINT:20', 0),
|
||||||
'display_subforum_list' => array('BOOL', 1),
|
'display_subforum_list' => array('BOOL', 1),
|
||||||
'display_on_index' => array('BOOL', 1),
|
'display_on_index' => array('BOOL', 1),
|
||||||
'enable_indexing' => array('BOOL', 1),
|
'enable_indexing' => array('BOOL', 1),
|
||||||
|
|
|
@ -563,6 +563,7 @@ function get_schema_struct()
|
||||||
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
|
'forum_last_poster_name'=> array('VCHAR_UNI', ''),
|
||||||
'forum_last_poster_colour'=> array('VCHAR:6', ''),
|
'forum_last_poster_colour'=> array('VCHAR:6', ''),
|
||||||
'forum_flags' => array('TINT:4', 32),
|
'forum_flags' => array('TINT:4', 32),
|
||||||
|
'forum_options' => array('UINT:20', 0),
|
||||||
'display_subforum_list' => array('BOOL', 1),
|
'display_subforum_list' => array('BOOL', 1),
|
||||||
'display_on_index' => array('BOOL', 1),
|
'display_on_index' => array('BOOL', 1),
|
||||||
'enable_indexing' => array('BOOL', 1),
|
'enable_indexing' => array('BOOL', 1),
|
||||||
|
|
|
@ -339,7 +339,17 @@ class phpbb_feed_factory
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'news':
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -534,7 +544,18 @@ class phpbb_feed
|
||||||
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user;
|
global $auth, $db, $config, $phpbb_root_path, $phpEx, $user;
|
||||||
|
|
||||||
// Which forums should not be searched ?
|
// 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
|
// Exclude forums the user is not able to read
|
||||||
$this->excluded_forums_ary = array_keys($auth->acl_getf('!f_read', true));
|
$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;
|
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))
|
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) . '
|
'WHERE' => $db->sql_in_set('t.forum_id', $in_fid_ary) . '
|
||||||
AND f.forum_id = t.forum_id
|
AND f.forum_id = t.forum_id
|
||||||
AND p.post_id = t.topic_first_post_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',
|
'ORDER_BY' => 't.topic_time DESC',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -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_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_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_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_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' => 'select_multiple', 'method' => 'select_exclude_forums', 'explain' => true),
|
'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
break;
|
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...
|
// 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)
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($config_name == 'auth_method')
|
if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id')
|
||||||
{
|
{
|
||||||
continue;
|
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];
|
$this->new_config[$config_name] = $config_value = $cfg_array[$config_name];
|
||||||
|
|
||||||
if ($config_name == 'email_function_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')
|
if ($mode == 'auth')
|
||||||
{
|
{
|
||||||
// Retrieve a list of auth plugins and check their config values
|
// Retrieve a list of auth plugins and check their config values
|
||||||
|
@ -902,17 +890,17 @@ class acp_board
|
||||||
{
|
{
|
||||||
global $user, $config;
|
global $user, $config;
|
||||||
|
|
||||||
// Determine ids to be selected
|
$forum_list = make_forum_select(false, false, true, true, true, false, true);
|
||||||
$select_ids = (sizeof($value)) ? $value : false;
|
|
||||||
|
|
||||||
$forum_list = make_forum_select($select_ids, false, true, true, true, false, true);
|
|
||||||
|
|
||||||
// Build forum options
|
// Build forum options
|
||||||
$s_forum_options = '';
|
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
||||||
foreach ($forum_list as $f_id => $f_row)
|
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 .= '<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;
|
return $s_forum_options;
|
||||||
}
|
}
|
||||||
|
@ -921,20 +909,48 @@ class acp_board
|
||||||
{
|
{
|
||||||
global $user, $config;
|
global $user, $config;
|
||||||
|
|
||||||
// Determine ids to be selected
|
$forum_list = make_forum_select(false, false, true, false, false, false, true);
|
||||||
$select_ids = (sizeof($value)) ? $value : false;
|
|
||||||
|
|
||||||
$forum_list = make_forum_select($select_ids, false, true, false, false, false, true);
|
|
||||||
|
|
||||||
// Build forum options
|
// Build forum options
|
||||||
$s_forum_options = '';
|
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
|
||||||
foreach ($forum_list as $f_id => $f_row)
|
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 .= '<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;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -93,6 +93,10 @@ define('FORUM_FLAG_ACTIVE_TOPICS', 16);
|
||||||
define('FORUM_FLAG_POST_REVIEW', 32);
|
define('FORUM_FLAG_POST_REVIEW', 32);
|
||||||
define('FORUM_FLAG_QUICK_REPLY', 64);
|
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
|
// Optional text flags
|
||||||
define('OPTION_FLAG_BBCODE', 1);
|
define('OPTION_FLAG_BBCODE', 1);
|
||||||
define('OPTION_FLAG_SMILIES', 2);
|
define('OPTION_FLAG_SMILIES', 2);
|
||||||
|
|
|
@ -411,6 +411,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.
|
* Run more than one insert statement.
|
||||||
*
|
*
|
||||||
|
|
|
@ -446,6 +446,11 @@ class dbal_firebird extends dbal
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _sql_bit_and($column_name, $bit, $compare = '')
|
||||||
|
{
|
||||||
|
return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return sql error array
|
* return sql error array
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -568,6 +568,11 @@ class dbal_oracle extends dbal
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _sql_bit_and($column_name, $bit, $compare = '')
|
||||||
|
{
|
||||||
|
return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : '');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return sql error array
|
* return sql error array
|
||||||
* @access private
|
* @access private
|
||||||
|
|
|
@ -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
|
* Generate page header
|
||||||
|
@ -4005,6 +4039,19 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
|
||||||
$forum_id = request_var('f', 0);
|
$forum_id = request_var('f', 0);
|
||||||
$topic_id = request_var('t', 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.
|
// The following assigns all _common_ variables that may be used at any point in a template.
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'SITENAME' => $config['sitename'],
|
'SITENAME' => $config['sitename'],
|
||||||
|
@ -4082,11 +4129,9 @@ function page_header($page_title = '', $display_online_list = true, $forum_id =
|
||||||
'S_TOPIC_ID' => $topic_id,
|
'S_TOPIC_ID' => $topic_id,
|
||||||
|
|
||||||
'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false,
|
'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_FORUMS' => ($config['feed_overall_forums']) ? true : false,
|
||||||
'S_ENABLE_FEEDS_TOPICS' => ($config['feed_overall_topics']) ? 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_NEWS' => ($s_feed_news) ? true : false,
|
||||||
'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && $topic_id && strpos($user->page['page_name'], 'viewtopic') !== false) ? true : false,
|
|
||||||
|
|
||||||
'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme',
|
'T_THEME_PATH' => "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme',
|
||||||
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template',
|
'T_TEMPLATE_PATH' => "{$phpbb_root_path}styles/" . $user->theme['template_path'] . '/template',
|
||||||
|
|
|
@ -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'));
|
$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
|
// 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 . '
|
FROM ' . FORUMS_TABLE . '
|
||||||
ORDER BY left_id ASC';
|
ORDER BY left_id ASC';
|
||||||
$result = $db->sql_query($sql, 600);
|
$result = $db->sql_query($sql, 600);
|
||||||
|
|
|
@ -707,6 +707,9 @@ function database_update_info()
|
||||||
PROFILE_FIELDS_TABLE => array(
|
PROFILE_FIELDS_TABLE => array(
|
||||||
'field_show_on_vt' => array('BOOL', 0),
|
'field_show_on_vt' => array('BOOL', 0),
|
||||||
),
|
),
|
||||||
|
FORUMS_TABLE => array(
|
||||||
|
'forum_options' => array('UINT:20', 0),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'change_columns' => array(
|
'change_columns' => array(
|
||||||
USERS_TABLE => array(
|
USERS_TABLE => array(
|
||||||
|
@ -1086,10 +1089,7 @@ function change_database_data(&$no_updates, $version)
|
||||||
|
|
||||||
set_config('feed_forum', '1');
|
set_config('feed_forum', '1');
|
||||||
set_config('feed_topic', '1');
|
set_config('feed_topic', '1');
|
||||||
set_config('feed_news_id', '');
|
|
||||||
|
|
||||||
set_config('feed_item_statistics', '1');
|
set_config('feed_item_statistics', '1');
|
||||||
set_config('feed_exclude_id', '');
|
|
||||||
|
|
||||||
// Entries for smiley pagination
|
// Entries for smiley pagination
|
||||||
set_config('smilies_per_page', '50');
|
set_config('smilies_per_page', '50');
|
||||||
|
|
|
@ -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_name VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE,
|
||||||
forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
forum_last_poster_colour VARCHAR(6) CHARACTER SET NONE DEFAULT '' NOT NULL,
|
||||||
forum_flags INTEGER DEFAULT 32 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_subforum_list INTEGER DEFAULT 1 NOT NULL,
|
||||||
display_on_index INTEGER DEFAULT 1 NOT NULL,
|
display_on_index INTEGER DEFAULT 1 NOT NULL,
|
||||||
enable_indexing INTEGER DEFAULT 1 NOT NULL,
|
enable_indexing INTEGER DEFAULT 1 NOT NULL,
|
||||||
|
|
|
@ -439,6 +439,7 @@ CREATE TABLE [phpbb_forums] (
|
||||||
[forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL ,
|
[forum_last_poster_name] [varchar] (255) DEFAULT ('') NOT NULL ,
|
||||||
[forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL ,
|
[forum_last_poster_colour] [varchar] (6) DEFAULT ('') NOT NULL ,
|
||||||
[forum_flags] [int] DEFAULT (32) 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_subforum_list] [int] DEFAULT (1) NOT NULL ,
|
||||||
[display_on_index] [int] DEFAULT (1) NOT NULL ,
|
[display_on_index] [int] DEFAULT (1) NOT NULL ,
|
||||||
[enable_indexing] [int] DEFAULT (1) NOT NULL ,
|
[enable_indexing] [int] DEFAULT (1) NOT NULL ,
|
||||||
|
|
|
@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_last_poster_name blob NOT NULL,
|
forum_last_poster_name blob NOT NULL,
|
||||||
forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL,
|
forum_last_poster_colour varbinary(6) DEFAULT '' NOT NULL,
|
||||||
forum_flags tinyint(4) DEFAULT '32' 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_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
display_on_index 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,
|
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
|
|
|
@ -249,6 +249,7 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
|
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
|
||||||
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
|
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
|
||||||
forum_flags tinyint(4) DEFAULT '32' 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_subforum_list tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
display_on_index 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,
|
enable_indexing tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
|
||||||
|
|
|
@ -505,6 +505,7 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_last_poster_name varchar2(765) DEFAULT '' ,
|
forum_last_poster_name varchar2(765) DEFAULT '' ,
|
||||||
forum_last_poster_colour varchar2(6) DEFAULT '' ,
|
forum_last_poster_colour varchar2(6) DEFAULT '' ,
|
||||||
forum_flags number(4) DEFAULT '32' NOT NULL,
|
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_subforum_list number(1) DEFAULT '1' NOT NULL,
|
||||||
display_on_index number(1) DEFAULT '1' NOT NULL,
|
display_on_index number(1) DEFAULT '1' NOT NULL,
|
||||||
enable_indexing number(1) DEFAULT '1' NOT NULL,
|
enable_indexing number(1) DEFAULT '1' NOT NULL,
|
||||||
|
|
|
@ -382,6 +382,7 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
|
forum_last_poster_name varchar(255) DEFAULT '' NOT NULL,
|
||||||
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
|
forum_last_poster_colour varchar(6) DEFAULT '' NOT NULL,
|
||||||
forum_flags INT2 DEFAULT '32' 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_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),
|
display_on_index INT2 DEFAULT '1' NOT NULL CHECK (display_on_index >= 0),
|
||||||
enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
|
enable_indexing INT2 DEFAULT '1' NOT NULL CHECK (enable_indexing >= 0),
|
||||||
|
|
|
@ -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_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_forum', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_topic', '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_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 ('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 ('force_server_vars', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('form_token_lifetime', '7200');
|
||||||
|
|
|
@ -242,6 +242,7 @@ CREATE TABLE phpbb_forums (
|
||||||
forum_last_poster_name varchar(255) NOT NULL DEFAULT '',
|
forum_last_poster_name varchar(255) NOT NULL DEFAULT '',
|
||||||
forum_last_poster_colour varchar(6) NOT NULL DEFAULT '',
|
forum_last_poster_colour varchar(6) NOT NULL DEFAULT '',
|
||||||
forum_flags tinyint(4) NOT NULL DEFAULT '32',
|
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_subforum_list INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||||
display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
display_on_index INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||||
enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
enable_indexing INTEGER UNSIGNED NOT NULL DEFAULT '1',
|
||||||
|
|
|
@ -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_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_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_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_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}&t={S_TOPIC_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}&t={S_TOPIC_ID}" /><!-- ENDIF -->
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -310,6 +310,7 @@ $template->assign_vars(array(
|
||||||
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
|
'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_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
|
||||||
'S_VIEWFORUM' => true,
|
'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&i=main&mode=forum_view", true, $user->session_id) : '',
|
'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&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&f=' . $forum_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&f=' . $forum_id) : '',
|
||||||
|
|
|
@ -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_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_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&t=$topic_id",
|
'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id",
|
||||||
'U_FORUM' => $server_path,
|
'U_FORUM' => $server_path,
|
||||||
|
|
Loading…
Add table
Reference in a new issue