From 8767f6f90893c4298634584e5c1af20b6264d44e Mon Sep 17 00:00:00 2001 From: Mike Little Date: Thu, 12 Jun 2003 22:45:08 +0000 Subject: [PATCH] New function to pull new options from db. Added default parameter to dropdown_categories() require -> require_once git-svn-id: https://develop.svn.wordpress.org/trunk@216 602fd350-edb4-49c9-b593-d223f7449a82 --- b2-include/b2functions.php | 71 +++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 31 deletions(-) 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 '