Changeset 1251

Show
Ignore:
Timestamp:
08/10/08 15:27:19 (4 months ago)
Author:
_ck_
Message:

0.0.2 array merge error fix, hardcoded bb_get_options displayed, 1.0 alpha compatibility fix for new bb_meta

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • all-settings/trunk/all-settings-admin.php

    r1249 r1251  
    1515  <table class="widefat"> 
    1616<?php 
    17 global $cache_options, $db_options, $bb_options
     17global $cache_options, $db_options, $bb_options, $get_options
    1818$options=all_settings_options(); 
    1919 
    2020foreach ( (array) $options as $option) : 
    2121        $disabled = ''; 
     22        $get_option=false; 
    2223        $bb_config=false; 
     24        if (in_array($option->option_name,$get_options)) { 
     25                        $disabled = ' disabled="disabled"'; 
     26                        $class = 'all-settings disabled';                
     27                        $get_option=true; 
     28        } else {         
    2329        if ($option->option_value != $cache_options[$option->option_name]->option_value && $option->option_value != $db_options[$option->option_name]->option_value) {$bb_config=true;} 
     30        } 
    2431        $option->option_name = attribute_escape($option->option_name); 
    2532        if ( is_serialized($option->option_value) ) { 
     
    4148                        $value = ($option->option_value) ? "true" : "false"; 
    4249                        $disabled = ' disabled="disabled"'; 
    43                         $class = 'all-settings disabled';        
     50                        $class = 'all-settings disabled';               
    4451        } else { 
    4552                $value = $option->option_value; 
    4653                $options_to_update[] = $option->option_name; 
    4754                $class = 'all-settings'; 
    48         } 
     55        }       
    4956        echo " 
    5057<tr> 
     
    5663         
    5764        if ($bb_config) {echo " (<small>bb-config.php</small>) ";} 
     65        if ($get_option) {echo " (<small>calculated</small>) ";} 
    5866 
    5967        echo "</td> 
     
    6573<p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Save Changes') ?>" /></p> 
    6674 
    67 <p><small>(bb-config.php) indicates option is either currently set in bb-config.php or might only be changeable from there via $bb->option=value;</small></p>  
     75<p><small>(bb-config.php) indicates option is either currently set in bb-config.php or might only be changeable from there via <b>$bb->option="value";</b></small></p>  
     76<p><small>(calcuated) indicates option has been determined by bbPress based on other options, might be changeable in bb-config.php</small></p> 
    6877   
    6978  </form> 
     
    7382 
    7483function all_settings_options() { 
    75 global $bb, $bbdb, $bb_topic_cache, $cache_options, $db_options, $bb_options; 
     84global $bb, $bbdb, $bb_topic_cache, $wp_object_cache, $cache_options, $db_options, $bb_options, $get_options; 
    7685 
    77 bb_cache_all_options(); 
    78 foreach ((array) $bb_topic_cache[0] as $name=>$value) {$cache_options[$name]->option_name=$name; $cache_options[$name]->option_value=$value;} 
     86bb_cache_all_options();   $options=(empty($bb_topic_cache[0])) ? $wp_object_cache->cache['bb_option'] : $bb_topic_cache[0]; 
     87foreach ((array) $options as $name=>$value) {$cache_options[$name]->option_name=$name; $cache_options[$name]->option_value=$value;} 
    7988 
    80 $options=$bbdb->get_results("SELECT meta_key as option_name, meta_value as option_value FROM $bbdb->topicmeta WHERE topic_id = 0 ORDER BY option_name"); 
     89if (bb_get_option('bb_db_version')>1600) {$optiontable="$bbdb->meta WHERE object_type='bb_option'";} 
     90else {$optiontable="$bbdb->topicmeta WHERE topic_id = 0";} 
     91 
     92$options=$bbdb->get_results("SELECT meta_key as option_name, meta_value as option_value FROM $optiontable ORDER BY option_name"); 
    8193foreach ((array) $options as $option) {$db_options[$option->option_name]->option_name=$option->option_name; $db_options[$option->option_name]->option_value=$option->option_value;} 
    8294 
     
    8597if ( version_compare(PHP_VERSION, '5.0', '>') ) {$constants=get_defined_constants(true); $constants=$constants['user'];}  // to do                                                       
    8698 
    87 $options = array_merge($cache_options, $db_options, $bb_options);               // merge options from everywhere 
     99$options=array();  // merge options from everywhere 
     100if (is_array($cache_options)) {$options=array_merge($options,$cache_options);} 
     101if (is_array($db_options)) {$options=array_merge($options,$db_options);} 
     102if (is_array($bb_options)) {$options=array_merge($options,$bb_options);} 
     103unset($options['topic_id']);    // messy 
    88104 
    89 // print_r($options); 
    90  
    91 unset($options['topic_id']);    // messy 
     105$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'); 
     106foreach ((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);}} 
    92107 
    93108return $options; 
  • all-settings/trunk/all-settings.php

    r1249 r1251  
    66Author: _ck_ 
    77Author URI: http://bbShowcase.org 
    8 Version: 0.0.1 
     8Version: 0.0.2 
    99 
    1010License: CC-GNU-GPL http://creativecommons.org/licenses/GPL/2.0/ 
  • all-settings/trunk/readme.txt

    r1249 r1251  
    5959* first public release 
    6060 
     61= Version 0.0.2 (2008-08-10) = 
     62 
     63* array merge error fix, hardcoded bb_get_options displayed, 1.0 alpha compatibility fix for new bb_meta  
     64 
    6165== To Do == 
    6266