diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index 9474f9757c..da58049aba 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -1,13 +1,5 @@ get_row("SELECT * FROM $tablesettings"); - ++$querycount; + $settings = get_alloptions(); $cache_settings = $settings; } else { $settings = $cache_settings; } + if (!isset($settings->$setting)) { + error_log("get_settings: Didn't find setting $setting"); + } return $settings->$setting; } +function get_alloptions() { + global $tableoptions, $wpdb; + $options = $wpdb->get_results("SELECT option_name, option_value FROM $tableoptions"); + ++$querycount; + if ($options) { + foreach ($options as $option) { + $all_options->{$option->option_name} = $option->option_value; + } + } + return $all_options; +} + function get_postdata($postid) { global $tableusers, $tablesettings, $tablecategories, $tableposts, $tablecomments, $querycount, $wpdb; $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = $postid"); @@ -576,16 +582,19 @@ function profile($user_login) { echo "user_login."','Profile','toolbar=0,status=1,location=0,directories=0,menuBar=1,scrollbars=1,resizable=0,width=480,height=320,left=100,top=100'); return false;\">$user_login"; } -function dropdown_categories($blog_ID=1) { +function dropdown_categories($blog_ID=1, $default=1) { global $postdata,$tablecategories,$mode,$querycount; $query="SELECT * FROM $tablecategories"; $result=mysql_query($query); ++$querycount; $width = ($mode=="sidebar") ? "100%" : "170px"; echo '