diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index 26e8c90f2..feeac5b0e 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -373,7 +373,7 @@ function strip_all_but_one_link($text, $mylink) { function get_lastpostdate() { - global $tableposts, $cache_lastpostdate, $use_cache, $time_difference, $pagenow, $wpdb, $querycount; + global $tableposts, $cache_lastpostdate, $use_cache, $time_difference, $pagenow, $wpdb; if ((!isset($cache_lastpostdate)) OR (!$use_cache)) { $now = date("Y-m-d H:i:s",(time() + ($time_difference * 3600))); if ($pagenow != 'wp-post.php') { @@ -382,7 +382,6 @@ function get_lastpostdate() { $showcatzero = ''; } $lastpostdate = $wpdb->get_var("SELECT post_date FROM $tableposts WHERE $showcatzero post_date <= '$now' ORDER BY post_date DESC LIMIT 1"); - ++$querycount; $cache_lastpostdate = $lastpostdate; // echo $lastpostdate; } else { @@ -415,7 +414,7 @@ function get_currentuserinfo() { // a bit like get_userdata(), on steroids } function get_userdata($userid) { - global $wpdb, $querycount, $cache_userdata, $use_cache, $tableusers; + global $wpdb, $cache_userdata, $use_cache, $tableusers; if ((empty($cache_userdata[$userid])) || (!$use_cache)) { $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID = $userid"); $user->user_nickname = stripslashes($user->user_nickname); @@ -423,7 +422,6 @@ function get_userdata($userid) { $user->user_lastname = stripslashes($user->user_lastname); $user->user_firstname = stripslashes($user->user_firstname); $user->user_lastname = stripslashes($user->user_lastname); - ++$querycount; $cache_userdata[$userid] = $user; } else { $user = $cache_userdata[$userid]; @@ -445,10 +443,9 @@ function get_userdata2($userid) { // for team-listing } function get_userdatabylogin($user_login) { - global $tableusers, $querycount, $cache_userdata, $use_cache, $wpdb; + global $tableusers, $cache_userdata, $use_cache, $wpdb; if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) { $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$user_login'"); - ++$querycount; $cache_userdata["$user_login"] = $user; } else { $user = $cache_userdata["$user_login"]; @@ -457,11 +454,10 @@ function get_userdatabylogin($user_login) { } function get_userid($user_login) { - global $tableusers, $querycount, $cache_userdata, $use_cache, $wpdb; + global $tableusers, $cache_userdata, $use_cache, $wpdb; if ((empty($cache_userdata["$user_login"])) OR (!$use_cache)) { $user_id = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$user_login'"); - ++$querycount; $cache_userdata["$user_login"] = $user_id; } else { $user_id = $cache_userdata["$user_login"]; @@ -470,15 +466,14 @@ function get_userid($user_login) { } function get_usernumposts($userid) { - global $tableposts, $tablecomments, $querycount, $wpdb; - ++$querycount; + global $tableposts, $tablecomments, $wpdb; return $wpdb->get_var("SELECT COUNT(*) FROM $tableposts WHERE post_author = $userid"); } // examine a url (supposedly from this blog) and try to // determine the post ID it represents. function url_to_postid($url = '') { - global $wpdb, $querycount, $tableposts, $siteurl; + global $wpdb, $tableposts, $siteurl; // Take a link like 'http://example.com/blog/something' // and extract just the '/something': @@ -536,7 +531,6 @@ function url_to_postid($url = '') { if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' "; // Run the query to get the post ID: - ++$querycount; return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where)); } @@ -544,7 +538,7 @@ function url_to_postid($url = '') { /* Options functions */ function get_settings($setting) { - global $wpdb, $cache_settings, $use_cache, $querycount; + global $wpdb, $cache_settings, $use_cache; if ((empty($cache_settings)) OR (!$use_cache)) { $settings = get_alloptions(); $cache_settings = $settings; @@ -558,9 +552,8 @@ function get_settings($setting) { } function get_alloptions() { - global $tableoptions, $wpdb, $querycount; + 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; @@ -582,9 +575,8 @@ function add_option() { } function get_postdata($postid) { - global $tableusers, $tablecategories, $tableposts, $tablecomments, $querycount, $wpdb; + global $tableusers, $tablecategories, $tableposts, $tablecomments, $wpdb; $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = $postid"); - ++$querycount; $postdata = array ( 'ID' => $post->ID, @@ -625,14 +617,13 @@ function get_postdata2($postid=0) { // less flexible, but saves DB queries } function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // less flexible, but saves DB queries - global $postc,$id,$commentdata,$tablecomments,$querycount, $wpdb; + global $postc,$id,$commentdata,$tablecomments, $wpdb; if ($no_cache) { $query = "SELECT * FROM $tablecomments WHERE comment_ID = $comment_ID"; if (false == $include_unapproved) { $query .= " AND comment_approved = '1'"; } $myrow = $wpdb->get_row($query, ARRAY_A); - ++$querycount; } else { $myrow['comment_ID']=$postc->comment_ID; $myrow['comment_post_ID']=$postc->comment_post_ID; @@ -655,10 +646,9 @@ function get_commentdata($comment_ID,$no_cache=0,$include_unapproved=false) { // } function get_catname($cat_ID) { - global $tablecategories,$cache_catnames,$use_cache,$querycount, $wpdb; + global $tablecategories,$cache_catnames,$use_cache, $wpdb; if ((!$cache_catnames) || (!$use_cache)) { $results = $wpdb->get_results("SELECT * FROM $tablecategories") or die('Oops, couldn\'t query the db for categories.'); - $querycount++; foreach ($results as $post) { $cache_catnames[$post->cat_ID] = $post->cat_name; } @@ -673,16 +663,14 @@ function profile($user_login) { } function dropdown_categories($blog_ID=1, $default=1) { - global $postdata,$tablecategories,$mode,$querycount, $wpdb; + global $postdata,$tablecategories,$mode, $wpdb; $query="SELECT * FROM $tablecategories ORDER BY cat_name"; $results = $wpdb->get_results($query); - ++$querycount; $width = ($mode=="sidebar") ? "100%" : "170px"; echo '\n"; if (intval($optionall) == 1) { $all = apply_filters('list_cats', $all); @@ -1361,7 +1346,7 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_ // out of the b2 loop function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = 'blah', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1) { - global $tablecategories, $tableposts, $querycount, $wpdb; + global $tablecategories, $tableposts, $wpdb; global $pagenow, $siteurl, $blogfilename; global $querystring_start, $querystring_equal, $querystring_separator; if (($file == 'blah') || ($file == '')) { @@ -1381,7 +1366,6 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde $query .= " ORDER BY $sort_column $sort_order, post_date DESC"; $categories = $wpdb->get_results($query); - ++$querycount; if (!$categories) { if ($list) { $before = '
  • '; @@ -1434,13 +1418,12 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde // generic comments/trackbacks/pingbacks numbering function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) { - global $id, $comment, $tablecomments, $querycount, $wpdb; + global $id, $comment, $tablecomments, $wpdb; $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id"; if (false == $include_unapproved) { $query .= " AND comment_approved = '1'"; } $number = $wpdb->get_var($query); - ++$querycount; if ($number == 0) { $blah = $zero; } elseif ($number == 1) { @@ -1469,10 +1452,9 @@ function comments_popup_script($width=400, $height=400, $file='b2commentspopup.p } function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { - global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $querycount, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; + global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; global $querystring_start, $querystring_equal, $querystring_separator, $siteurl; $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'"); - ++$querycount; if (0 == $number && 'closed' == $post->comment_status) { echo $none; return; diff --git a/wp-admin/b2team.php b/wp-admin/b2team.php index b94c30c6b..47b02b522 100644 --- a/wp-admin/b2team.php +++ b/wp-admin/b2team.php @@ -103,7 +103,6 @@ default: get_results("SELECT ID FROM $tableusers WHERE user_level>0 ORDER BY ID"); - ++$querycount; foreach ($users as $user) { $user_data = get_userdata($user->ID); echo "\n\n"; @@ -139,7 +138,6 @@ default: get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID"); - ++$querycount; if ($users) { ?>
    diff --git a/wp-admin/b2verifauth.php b/wp-admin/b2verifauth.php index 313c32ba2..3fd4375ae 100644 --- a/wp-admin/b2verifauth.php +++ b/wp-admin/b2verifauth.php @@ -5,7 +5,7 @@ require_once('../wp-config.php'); /* checking login & pass in the database */ function veriflog() { global $HTTP_COOKIE_VARS,$cookiehash; - global $tableusers, $wpdb, $querycount; + global $tableusers, $wpdb; if (!empty($HTTP_COOKIE_VARS["wordpressuser_".$cookiehash])) { $user_login = $HTTP_COOKIE_VARS["wordpressuser_".$cookiehash]; @@ -20,7 +20,6 @@ function veriflog() { return false; $login = $wpdb->get_row("SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login'"); - ++$querycount; if (!$login) { return false; diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 0cec49030..6272f4d01 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -136,7 +136,6 @@ echo $comments_nav_bar; ORDER BY comment_date $commentorder LIMIT $commentstart, $commentend" ); - ++$querycount; // need to account for offet, etc. diff --git a/wp-admin/edit.php b/wp-admin/edit.php index a2fa0602b..8f8b747a1 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -145,7 +145,6 @@ echo $posts_nav_bar; get_results("SELECT * FROM $tablecategories"); - $querycount++; $width = ($mode=="sidebar") ? "100%" : "170px"; foreach ($categories as $category) { echo "