cache['bb_option'] : $bb_topic_cache[0];
foreach ((array) $options as $name=>$value) {$cache_options[$name]->option_name=$name; $cache_options[$name]->option_value=$value;}
if (bb_get_option('bb_db_version')>1600) {$optiontable="$bbdb->meta WHERE object_type='bb_option'";}
else {$optiontable="$bbdb->topicmeta WHERE topic_id = 0";}
$options=$bbdb->get_results("SELECT meta_key as option_name, meta_value as option_value FROM $optiontable ORDER BY option_name");
foreach ((array) $options as $option) {$db_options[$option->option_name]->option_name=$option->option_name; $db_options[$option->option_name]->option_value=$option->option_value;}
foreach ($bb as $name => $value) {$bb_options[$name]->option_name=$name; $bb_options[$name]->option_value=$value;}
if ( version_compare(PHP_VERSION, '5.0', '>') ) {$constants=get_defined_constants(true); $constants=$constants['user'];} // to do
$options=array(); // merge options from everywhere
if (is_array($cache_options)) {$options=array_merge($options,$cache_options);}
if (is_array($db_options)) {$options=array_merge($options,$db_options);}
if (is_array($bb_options)) {$options=array_merge($options,$bb_options);}
unset($options['topic_id']); // messy
$get_options=array('language','text_direction','version','bb_db_version','html_type','charset','url','bb_table_prefix','table_prefix','mod_rewrite','page_topics','edit_lock','gmt_offset','uri_ssl');
foreach ((array) $get_options as $key) {if (array_key_exists($key,$options)) {unset($get_options[$key]);} else {$options[$key]->option_name=$key; $options[$key]->option_value=bb_get_option($key);}}
return $options;
}
function all_settings_process_post() {
if (empty($_POST) || $_POST['action']!="update") {return;}
if ( !bb_current_user_can('use_keys') )
bb_die(__('Cheatin’ uh?'));
bb_check_admin_referer('all-settings');
$any_changed = 0;
// print_r($_POST); exit();
if ( !$_POST['page_options'] ) {
foreach ( (array) $_POST as $key => $value) {
if ( !in_array($key, array('_wpnonce', '_wp_http_referer')) )
$options[] = $key;
}
} else {
$options = explode(',', stripslashes($_POST['page_options']));
}
if ($options) {
$compare=all_settings_options();
foreach ($options as $option) {
$option = trim($option);
$value = $_POST[$option];
if(!is_array($value)) $value = trim($value);
$value = stripslashes_deep($value);
if ($compare[$option]->option_value!=$value) {bb_update_option($option, $value); $any_changed++;}
}
}
bb_admin_notice("All Settings: $any_changed ".__('updated.')."");
// $goback = add_query_arg('updated', 'true', wp_get_referer()); wp_redirect($goback); break;
}
add_action( 'bb_admin-header.php','all_settings_process_post');
?>