Changeset 558
- Timestamp:
- 11/25/2003 12:46:52 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2functions.php
r555 r558 479 479 // determine the post ID it represents. 480 480 function url_to_postid($url = '') { 481 global $wpdb, $ tableposts, $siteurl;481 global $wpdb, $querycount, $tableposts, $siteurl; 482 482 483 483 // Take a link like 'http://example.com/blog/something' … … 537 537 538 538 // Run the query to get the post ID: 539 return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where)); 539 ++$querycount; 540 return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where)); 540 541 } 541 542 … … 682 683 $default = $postdata["Category"]; 683 684 } 685 ++$querycount; 684 686 foreach($results as $post) { 685 687 echo "<option value=\"".$post->cat_ID."\""; … … 1440 1442 */ 1441 1443 function wp_get_comment_status($comment_id) { 1442 global $wpdb, $ tablecomments;1444 global $wpdb, $querycount, $tablecomments; 1443 1445 1444 1446 $result = $wpdb->get_var("SELECT comment_approved FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"); 1447 ++$querycount; 1445 1448 if ($result == NULL) { 1446 1449 return "deleted"; 1447 1450 } else if ($result == "1") { 1448 1451 return "approved"; 1449 1452 } else if ($result == "0") { 1450 1453 return "unapproved"; 1451 1454 } else { 1452 1455 return false; 1453 1456 } 1454 1457 } 1455 1458 1456 1459 function wp_notify_postauthor($comment_id, $comment_type) { 1457 global $wpdb, $ tablecomments, $tableposts, $tableusers;1460 global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers; 1458 1461 global $querystring_start, $querystring_equal, $querystring_separator; 1459 1462 global $blogfilename, $blogname, $siteurl; 1460 1463 1461 1464 $comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"); 1465 ++$querycount; 1462 1466 $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1"); 1467 ++$querycount; 1463 1468 $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1"); 1469 ++$querycount; 1464 1470 1465 1471 if ('' == $user->user_email) return false; // If there's no email to send the comment to … … 1512 1518 */ 1513 1519 function wp_notify_moderator($comment_id) { 1514 global $wpdb, $ tablecomments, $tableposts, $tableusers;1520 global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers; 1515 1521 global $querystring_start, $querystring_equal, $querystring_separator; 1516 1522 global $blogfilename, $blogname, $siteurl; 1517 1523 1518 1524 $comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1"); 1525 ++$querycount; 1519 1526 $post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1"); 1527 ++$querycount; 1520 1528 $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1"); 1529 ++$querycount; 1521 1530 1522 1531 $comment_author_domain = gethostbyaddr($comment->comment_author_IP); 1523 1532 $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $tablecomments WHERE comment_approved = '0'"); 1533 ++$querycount; 1524 1534 1525 1535 $notify_message = "A new comment on the post #$comment->comment_post_ID \"".stripslashes($post->post_title)."\" is waiting for your approval\r\n\r\n"; -
trunk/b2-include/b2template.functions.php
r557 r558 233 233 234 234 function get_calendar($daylength = 1) { 235 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts ;235 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts, $querycount; 236 236 237 237 // Quick check. If we have no posts at all, abort! 238 238 if (!$posts) { 239 239 $gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1"); 240 ++$querycount; 240 241 if (!$gotsome) 241 242 return; … … 254 255 $d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's 255 256 $thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')"); 257 ++$querycount; 256 258 } elseif (!empty($m)) { 257 259 $calendar = substr($m, 0, 6); … … 276 278 ORDER BY post_date DESC 277 279 LIMIT 1"); 280 ++$querycount; 278 281 $next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year 279 282 FROM $tableposts … … 283 286 ORDER BY post_date ASC 284 287 LIMIT 1"); 288 ++$querycount; 285 289 286 290 echo '<table id="wp-calendar"> … … 330 334 AND post_status = 'publish' 331 335 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N); 332 336 ++$querycount; 333 337 if ($dayswithposts) { 334 338 foreach ($dayswithposts as $daywith) { … … 356 360 ."AND post_status = 'publish'" 357 361 ); 362 ++$querycount; 358 363 if ($ak_post_titles) { 359 364 foreach ($ak_post_titles as $ak_post_title) { … … 406 411 function get_permalink($id=false) { 407 412 global $post, $wpdb, $tableposts; 408 global $siteurl, $blogfilename, $querystring_start, $querystring_equal; 413 global $siteurl, $blogfilename, $querystring_start, $querystring_equal, $querycount; 414 409 415 $rewritecode = array( 410 416 '%year%', … … 428 434 } else { // if an ID is given 429 435 $idpost = $wpdb->get_row("SELECT post_date, post_name FROM $tableposts WHERE ID = $id"); 436 ++$querycount; 430 437 if ('' != get_settings('permalink_structure')) { 431 438 $unixtime = strtotime($idpost->post_date); … … 1351 1358 1352 1359 $categories = $wpdb->get_results($query); 1353 1360 ++$querycount; 1354 1361 if (!$categories) { 1355 1362 if ($list) { … … 1360 1367 return; 1361 1368 } 1362 ++$querycount;1363 1369 if (intval($optionall) == 1) { 1364 1370 $all = apply_filters('list_cats', $all); … … 1406 1412 function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) { 1407 1413 global $id, $comment, $tablecomments, $querycount, $wpdb; 1408 $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$id'";1414 $query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id"; 1409 1415 if (false == $include_unapproved) { 1410 1416 $query .= " AND comment_approved = '1'"; 1411 1417 } 1412 1418 $number = $wpdb->get_var($query); 1419 ++$querycount; 1413 1420 if ($number == 0) { 1414 1421 $blah = $zero; … … 1439 1446 1440 1447 function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') { 1441 global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $ tablecomments, $HTTP_COOKIE_VARS, $cookiehash;1448 global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $querycount, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash; 1442 1449 global $querystring_start, $querystring_equal, $querystring_separator, $siteurl; 1443 1450 $number = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1'"); 1451 ++$querycount; 1444 1452 if (0 == $number && 'closed' == $post->comment_status) { 1445 1453 echo $none; -
trunk/b2comments.php
r549 r558 16 16 17 17 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); 18 ++$querycount; 18 19 ?> 19 20 -
trunk/b2comments.post.php
r555 r558 40 40 41 41 $commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID"); 42 42 ++$querycount; 43 43 if ('closed' == $commentstatus) 44 44 die('Sorry, comments are closed for this item.'); … … 69 69 /* Flood-protection */ 70 70 $lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1"); 71 ++$querycount; 71 72 $ok = true; 72 73 if (!empty($lasttime)) { … … 101 102 102 103 $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); 104 ++$querycount; 103 105 104 106 if (($moderation_notify) && (!$approved)) { -
trunk/b2commentspopup.php
r549 r558 31 31 // this line is WordPress' motor, do not delete it. 32 32 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date"); 33 ++$querycount; 33 34 $commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id"); 35 ++$querycount; 34 36 if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie 35 37 echo(get_the_password_form()); -
trunk/b2login.php
r546 r558 67 67 $redirect_to = $HTTP_POST_VARS["redirect_to"]; 68 68 } 69 69 70 70 function login() { 71 71 global $wpdb, $log, $pwd, $error, $user_ID; … … 87 87 $password = substr($password, 4, strlen($password)); 88 88 $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND MD5(user_pass) = '$password'"; 89 ++$querycount; 89 90 } else { 90 91 $pass_is_md5 = 0; 91 92 $query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'"; 93 ++$querycount; 92 94 } 93 95 $login = $wpdb->get_row($query); -
trunk/b2mail.php
r294 r558 205 205 $sql = "SELECT ID, user_level FROM $tableusers WHERE user_login='$user_login' AND user_pass='$user_pass' ORDER BY ID DESC LIMIT 1"; 206 206 $result = $wpdb->get_row($sql); 207 ++$querycount; 207 208 208 209 if (!$result) { -
trunk/b2register.php
r368 r558 81 81 /* checking the login isn't already used by another user */ 82 82 $result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'"); 83 if (count($result) >= 1) { 83 ++$querycount; 84 if (count($result) >= 1) { 84 85 die ('<strong>ERROR</strong>: This login is already registered, please choose another one.'); 85 86 } -
trunk/b2trackback.php
r555 r558 32 32 33 33 $pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id"); 34 ++$querycount; 34 35 35 36 if ('closed' == $pingstatus) … … 87 88 } else { 88 89 $comment_ID = $wpdb->get_var('SELECT last_insert_id()'); 90 ++$querycount; 89 91 if ($comments_notify) 90 92 wp_notify_postauthor($comment_ID, 'trackback'); -
trunk/blog.header.php
r554 r558 305 305 // echo $request; 306 306 $posts = $wpdb->get_results($request); 307 307 ++$querycount; 308 308 if (1 == count($posts)) { 309 309 if ($p || $name) { -
trunk/wp-admin/b2team.php
r222 r558 104 104 <?php 105 105 $users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level>0 ORDER BY ID"); 106 ++$querycount; 106 107 foreach ($users as $user) { 107 108 $user_data = get_userdata($user->ID); … … 139 140 <?php 140 141 $users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID"); 142 ++$querycount; 141 143 if ($users) { 142 144 ?> -
trunk/wp-admin/b2verifauth.php
r546 r558 6 6 function veriflog() { 7 7 global $HTTP_COOKIE_VARS,$cookiehash; 8 global $tableusers, $wpdb ;8 global $tableusers, $wpdb, $querycount; 9 9 10 10 if (!empty($HTTP_COOKIE_VARS["wordpressuser_".$cookiehash])) { … … 21 21 22 22 $login = $wpdb->get_row("SELECT user_login, user_pass FROM $tableusers WHERE user_login = '$user_login'"); 23 ++$querycount; 23 24 24 25 if (!$login) { -
trunk/wp-admin/edit-comments.php
r552 r558 137 137 LIMIT $commentstart, $commentend" 138 138 ); 139 ++$querycount; 139 140 140 141 // need to account for offet, etc. -
trunk/wp-admin/edit.php
r556 r558 269 269 270 270 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 271 ++$querycount; 271 272 if ($comments) { 272 273 ?> -
trunk/wp-admin/import-b2.php
r513 r558 140 140 $query = "SELECT link_updated FROM $tablelinks LIMIT 1"; 141 141 $q = @mysql_query($query); 142 ++$querycount; 142 143 if ($q != false) { 143 144 if ($row = mysql_fetch_object($q)) { … … 151 152 echo "<p>Looking for column link_rel...</p>\n"; 152 153 $query = "SELECT link_rel FROM $tablelinks LIMIT 1"; 154 ++$querycount; 153 155 $q = @mysql_query($query); 154 156 if ($q != false) { … … 167 169 echo "<p>Looking for category 1...</p>\n"; 168 170 $sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 "; 171 ++$querycount; 169 172 $result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error()); 170 173 if ($result != false) { -
trunk/wp-admin/import-blogger.php
r430 r558 70 70 // we'll check the author is registered already 71 71 $user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$post_author'"); 72 ++$querycount; 72 73 if (!$user) { // seems s/he's not, so let's register 73 74 $user_ip = '127.0.0.1'; … … 112 113 113 114 $post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'"); 115 ++$querycount; 114 116 115 117 $post_date = explode(' ', $post_date); … … 135 137 // Quick-n-dirty check for dups: 136 138 $dupcheck = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts WHERE post_date='$post_date' AND post_title='$post_title' LIMIT 1",ARRAY_A); 139 ++$querycount; 137 140 if ($dupcheck[0]['ID']) { 138 141 print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n"; -
trunk/wp-admin/import-greymatter.php
r503 r558 140 140 $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'"; 141 141 $result = mysql_query($sql); 142 ++$querycount; 142 143 if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2 143 144 $user_ip="127.0.0.1"; … … 160 161 161 162 $sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'"; 163 ++$querycount; 162 164 $result = mysql_query($sql); 163 165 $myrow = mysql_fetch_array($result); … … 196 198 197 199 $sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1"; 200 ++$querycount; 198 201 $result2 = mysql_query($sql2); 199 202 $myrow2 = mysql_fetch_array($result2); -
trunk/wp-admin/import-textpattern.php
r529 r558 81 81 // For now we're going to give everything the same author and same category 82 82 $author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_level = 10 LIMIT 1"); 83 ++$querycount; 83 84 $category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1"); 85 ++$querycount; 84 86 85 87 $posts = mysql_query('SELECT * FROM textpattern', $connection); 88 ++$querycount; 86 89 87 90 while ($post = mysql_fetch_array($posts)) { … … 109 112 // Get wordpress post id 110 113 $wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); 114 ++$querycount; 111 115 112 116 // Now let's insert comments if there are any for the TP post 113 117 $tp_id = $post['ID']; 114 118 $comments = mysql_query("SELECT * FROM txp_Discuss WHERE parentid = $tp_id"); 119 ++$querycount; 115 120 if ($comments) { 116 121 while($comment = mysql_fetch_object($comments)) { -
trunk/wp-admin/linkcategories.php
r438 r558 135 135 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 136 136 . " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id"); 137 ++$querycount; 137 138 if ($row) { 138 139 if ($row->list_limit == -1) { … … 325 326 . " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, " 326 327 . " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id"); 327 foreach ($results as $row) { 328 if ($row->list_limit == -1) { 329 $row->list_limit = 'none'; 330 } 331 $style = ($i % 2) ? ' class="alternate"' : ''; 328 ++$querycount; 329 foreach ($results as $row) { 330 if ($row->list_limit == -1) { 331 $row->list_limit = 'none'; 332 } 333 $style = ($i % 2) ? ' class="alternate"' : ''; 332 334 ?> 333 335 <tr valign="middle" <?php echo $style ?>> -
trunk/wp-admin/linkmanager.php
r526 r558 34 34 35 35 function category_dropdown($fieldname, $selected = 0) { 36 global $wpdb, $ tablelinkcategories;36 global $wpdb, $querycount, $tablelinkcategories; 37 37 38 38 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 39 ++$querycount; 39 40 echo ' <select name="'.$fieldname.'" size="1">'."\n"; 40 41 foreach ($results as $row) { … … 110 111 $all_links = join(',', $linkcheck); 111 112 $results = $wpdb->get_results("SELECT link_id, link_owner, user_level FROM $tablelinks LEFT JOIN $tableusers ON link_owner = ID WHERE link_id in ($all_links)"); 113 ++$querycount; 112 114 foreach ($results as $row) { 113 115 if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed … … 139 141 $all_links = join(',', $linkcheck); 140 142 $results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)"); 143 ++$querycount; 141 144 foreach ($results as $row) { 142 145 if ($row->link_visible == 'Y') { // ok to proceed … … 305 308 " FROM $tablelinks " . 306 309 " WHERE link_id = $link_id"); 310 ++$querycount; 307 311 308 312 if ($row) { … … 499 503 <?php 500 504 $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 505 ++$querycount; 501 506 echo " <select name=\"cat_id\">\n"; 502 507 echo " <option value=\"All\""; … … 561 566 LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id 562 567 LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner "; 568 ++$querycount; 563 569 564 570 if (isset($cat_id) && ($cat_id != 'All')) { … … 631 637 <?php 632 638 $results = $wpdb->get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID"); 639 ++$querycount; 633 640 echo " <select name=\"newowner\" size=\"1\">\n"; 634 641 foreach ($results as $row) { -
trunk/wp-admin/links.import.php
r504 r558 74 74 <?php 75 75 $categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id"); 76 ++$querycount; 76 77 foreach ($categories as $category) { 77 78 ?> -
trunk/wp-admin/optionhandler.php
r294 r558 51 51 ."WHERE option_id = $option_result->option_id " 52 52 ."ORDER BY optionvalue_seq"); 53 ++$querycount; 53 54 if ($select) { 54 55 foreach($select as $option) { … … 68 69 // first get the sql to run 69 70 $sql = $wpdb->get_var("SELECT optionvalue FROM $tableoptionvalues WHERE option_id = $option_result->option_id"); 71 ++$querycount; 70 72 if (!$sql) { 71 73 return $option_result->option_name . $editable; -
trunk/wp-admin/wp-edit.showposts.php
r546 r558 272 272 273 273 $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 274 ++$querycount; 274 275 if ($comments) { 275 276 ?> -
trunk/wp-commentsrss2.php
r546 r558 60 60 ORDER BY comment_date 61 61 LIMIT $posts_per_rss"); 62 ++$querycount; 62 63 } 63 64 else { // if no post id passed in, we'll just ue the last 10 comments. … … 79 80 ORDER BY comment_date DESC 80 81 LIMIT $posts_per_rss"); 82 ++$querycount; 81 83 } 82 84 // this line is WordPress' motor, do not delete it. -
trunk/wp-rdf.php
r535 r558 12 12 13 13 $maxdate = $wpdb->get_var($sql); 14 14 ++$querycount; 15 15 $unixtime = strtotime($maxdate); 16 16 -
trunk/wp-rss.php
r535 r558 12 12 13 13 $maxdate = $wpdb->get_var($sql); 14 14 ++$querycount; 15 15 $unixtime = strtotime($maxdate); 16 16 -
trunk/wp-rss2.php
r533 r558 12 12 13 13 $maxdate = $wpdb->get_var($sql); 14 ++$querycount; 14 15 15 16 $unixtime = strtotime($maxdate);
Note: See TracChangeset
for help on using the changeset viewer.