aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/acp_board.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2009-08-12 15:00:47 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2009-08-12 15:00:47 +0000
commit09ad10a734c0993f9465e6ac3463951251602fc6 (patch)
tree80b534897042b0bff883687f9248f67b7af393f6 /phpBB/includes/acp/acp_board.php
parent45964352e37217277527480fcd89222b33c22280 (diff)
downloadforums-09ad10a734c0993f9465e6ac3463951251602fc6.tar
forums-09ad10a734c0993f9465e6ac3463951251602fc6.tar.gz
forums-09ad10a734c0993f9465e6ac3463951251602fc6.tar.bz2
forums-09ad10a734c0993f9465e6ac3463951251602fc6.tar.xz
forums-09ad10a734c0993f9465e6ac3463951251602fc6.zip
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
Diffstat (limited to 'phpBB/includes/acp/acp_board.php')
-rw-r--r--phpBB/includes/acp/acp_board.php82
1 files changed, 49 insertions, 33 deletions
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