Changeset 282
- Timestamp:
- 07/30/2003 11:44:08 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
b2-include/b2functions.php (modified) (2 diffs)
-
b2-include/b2template.functions.php (modified) (3 diffs)
-
wp-admin/b2categories.php (modified) (3 diffs)
-
wp-admin/b2edit.showposts.php (modified) (4 diffs)
-
wp-admin/b2profile.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2functions.php
r271 r282 520 520 } 521 521 522 function get_postdata2($postid=0) { // less flexible, but saves mysqlqueries522 function get_postdata2($postid=0) { // less flexible, but saves DB queries 523 523 global $post; 524 524 $postdata = array ( … … 538 538 } 539 539 540 function get_commentdata($comment_ID,$no_cache=0) { // less flexible, but saves mysqlqueries540 function get_commentdata($comment_ID,$no_cache=0) { // less flexible, but saves DB queries 541 541 global $postc,$id,$commentdata,$tablecomments,$querycount, $wpdb; 542 542 if ($no_cache) { -
trunk/b2-include/b2template.functions.php
r274 r282 718 718 719 719 function next_posts_link($label='Next Page >>', $max_page=0) { 720 global $p, $paged, $result, $request, $posts_per_page, $what_to_show ;720 global $p, $paged, $result, $request, $posts_per_page, $what_to_show, $wpdb; 721 721 if ($what_to_show == 'paged') { 722 722 if (!$max_page) { 723 723 $nxt_request = $request; 724 //if the query includes a limit clause, call it again without that 725 //limit clause! 724 726 if ($pos = strpos(strtoupper($request), 'LIMIT')) { 725 727 $nxt_request = substr($request, 0, $pos); 726 728 } 727 $nxt_result = mysql_query($nxt_request);728 $numposts = mysql_num_rows($nxt_result);729 $nxt_result = $wpdb->query($nxt_request); 730 $numposts = $wpdb->num_rows; 729 731 $max_page = ceil($numposts / $posts_per_page); 730 732 } 731 if (!$paged) $paged = 1; 733 if (!$paged) 734 $paged = 1; 732 735 $nextpage = intval($paged) + 1; 733 736 if (empty($p) && (empty($paged) || $nextpage <= $max_page)) { … … 775 778 776 779 function posts_nav_link($sep=' :: ', $prelabel='<< Previous Page', $nxtlabel='Next Page >>') { 777 global $p, $what_to_show, $request, $posts_per_page ;780 global $p, $what_to_show, $request, $posts_per_page, $wpdb; 778 781 if (empty($p) && ($what_to_show == 'paged')) { 779 782 $nxt_request = $request; … … 781 784 $nxt_request = substr($request, 0, $pos); 782 785 } 783 $nxt_result = mysql_query($nxt_request);784 $numposts = mysql_num_rows($nxt_result);786 $nxt_result = $wpdb->query($nxt_request); 787 $numposts = $wpdb->num_rows; 785 788 $max_page = ceil($numposts / $posts_per_page); 786 789 if ($max_page > 1) { -
trunk/wp-admin/b2categories.php
r135 r282 48 48 $cat_name=addslashes($HTTP_POST_VARS["cat_name"]); 49 49 50 $query = "INSERT INTO $tablecategories (cat_ID,cat_name) VALUES ('0', '$cat_name')"; 51 $result = mysql_query($query) or die("Couldn't add category <b>$cat_name</b>"); 50 $wpdb->query("INSERT INTO $tablecategories (cat_ID,cat_name) VALUES ('0', '$cat_name')"); 52 51 53 52 header('Location: b2categories.php'); … … 69 68 if ($user_level < 3) 70 69 die ('Cheatin’ uh?'); 71 72 $query = "DELETE FROM $tablecategories WHERE cat_ID = $cat_ID"; 73 $result = mysql_query($query) or die("Couldn't delete category <b>$cat_name</b>".mysql_error()); 74 75 $query = "UPDATE $tableposts SET post_category='1' WHERE post_category='$cat_ID'"; 76 $result = mysql_query($query) or die("Couldn't reset category on posts where category was <b>$cat_name</b>"); 70 71 $wpdb->query("DELETE FROM $tablecategories WHERE cat_ID = $cat_ID"); 72 $wpdb->query("UPDATE $tableposts SET post_category='1' WHERE post_category='$cat_ID'"); 77 73 78 74 header('Location: b2categories.php'); … … 114 110 $cat_ID = addslashes($HTTP_POST_VARS["cat_ID"]); 115 111 116 $query = "UPDATE $tablecategories SET cat_name='$cat_name' WHERE cat_ID = $cat_ID"; 117 $result = mysql_query($query) or die("Couldn't edit category <b>$cat_name</b>: ".mysql_error()); 112 $wpdb->query("UPDATE $tablecategories SET cat_name='$cat_name' WHERE cat_ID = $cat_ID"); 118 113 119 114 header('Location: b2categories.php'); -
trunk/wp-admin/b2edit.showposts.php
r212 r282 149 149 if ($archive_mode == "monthly") { 150 150 echo "<select name=\"m\" style=\"width:120px;\">"; 151 $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC";152 151 $querycount++; 153 $arc_result= mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());154 while($arc_row = mysql_fetch_array($arc_result)) {152 $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC",ARRAY_A); 153 foreach ($arc_result as $arc_row) { 155 154 $arc_year = $arc_row["YEAR(post_date)"]; 156 155 $arc_month = $arc_row["MONTH(post_date)"]; … … 162 161 echo "<select name=\"d\" style=\"width:120px;\">"; 163 162 $archive_day_date_format = "Y/m/d"; 164 $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts ORDER BY post_date DESC";165 163 $querycount++; 166 $arc_result= mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());167 while($arc_row = mysql_fetch_array($arc_result)) {164 $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts ORDER BY post_date DESC", ARRAY_A); 165 foreach ($arc_result as $arc_row) { 168 166 $arc_year = $arc_row["YEAR(post_date)"]; 169 167 $arc_month = $arc_row["MONTH(post_date)"]; … … 181 179 $archive_week_end_date_format = "Y/m/d"; 182 180 $archive_week_separator = " - "; 183 $arc_sql="SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts ORDER BY post_date DESC";184 181 $querycount++; 185 $arc_result= mysql_query($arc_sql) or die($arc_sql."<br />".mysql_error());182 $arc_result=$wpdb->geT_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts ORDER BY post_date DESC", ARRAY_A); 186 183 $arc_w_last = ''; 187 while($arc_row = mysql_fetch_array($arc_result)) {184 foreach ($arc_result as $arc_row) { 188 185 $arc_year = $arc_row["YEAR(post_date)"]; 189 186 $arc_w = $arc_row["WEEK(post_date)"]; … … 202 199 echo '<input type="hidden" name="more" value="1" />'; 203 200 echo '<select name="p" style="width:120px;">'; 204 $requestarc = " SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC"; 205 $querycount++; 206 $resultarc = mysql_query($requestarc); 207 while($row=mysql_fetch_object($resultarc)) { 201 $querycount++; 202 $resultarc = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC"); 203 foreach ($resultarc as $row) { 208 204 if ($row->post_date != "0000-00-00 00:00:00") { 209 205 echo "<option value=\"".$row->ID."\">"; -
trunk/wp-admin/b2profile.php
r239 r282 97 97 $result = $wpdb->query($query); 98 98 if (!$result) { 99 die ("<strong>ERROR</strong>: couldn't update your profile... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !<br /><br />$query<br /><br />" .mysql_error());99 die ("<strong>ERROR</strong>: couldn't update your profile... please contact the <a href=\"mailto:$admin_email\">webmaster</a> !<br /><br />$query<br /><br />"); 100 100 } 101 101
Note: See TracChangeset
for help on using the changeset viewer.