From 6723d53c030205c1da61aac33d6272a6f7a5434f Mon Sep 17 00:00:00 2001 From: mikelittle 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: http://svn.automattic.com/wordpress/trunk@216 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- 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 9474f9757..da58049ab 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 '