mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Removed $querycount.
git-svn-id: http://svn.automattic.com/wordpress/trunk@570 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ed973decee
commit
41327030fd
@ -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 '<select name="post_category" style="width:'.$width.';" tabindex="2" id="category">';
|
||||
if ($postdata["Category"] != '') {
|
||||
$default = $postdata["Category"];
|
||||
}
|
||||
++$querycount;
|
||||
foreach($results as $post) {
|
||||
echo "<option value=\"".$post->cat_ID."\"";
|
||||
if ($post->cat_ID == $default)
|
||||
@ -1441,10 +1429,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
|
||||
a (boolean) false signals an error
|
||||
*/
|
||||
function wp_get_comment_status($comment_id) {
|
||||
global $wpdb, $querycount, $tablecomments;
|
||||
global $wpdb, $tablecomments;
|
||||
|
||||
$result = $wpdb->get_var("SELECT comment_approved FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
++$querycount;
|
||||
if ($result == NULL) {
|
||||
return "deleted";
|
||||
} else if ($result == "1") {
|
||||
@ -1457,16 +1444,13 @@ function wp_get_comment_status($comment_id) {
|
||||
}
|
||||
|
||||
function wp_notify_postauthor($comment_id, $comment_type) {
|
||||
global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers;
|
||||
global $wpdb, $tablecomments, $tableposts, $tableusers;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||
global $blogfilename, $blogname, $siteurl;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
++$querycount;
|
||||
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
++$querycount;
|
||||
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
|
||||
++$querycount;
|
||||
|
||||
if ('' == $user->user_email) return false; // If there's no email to send the comment to
|
||||
|
||||
@ -1517,20 +1501,16 @@ function wp_notify_postauthor($comment_id, $comment_type) {
|
||||
always returns true
|
||||
*/
|
||||
function wp_notify_moderator($comment_id) {
|
||||
global $wpdb, $querycount, $tablecomments, $tableposts, $tableusers;
|
||||
global $wpdb, $tablecomments, $tableposts, $tableusers;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||
global $blogfilename, $blogname, $siteurl;
|
||||
|
||||
$comment = $wpdb->get_row("SELECT * FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
++$querycount;
|
||||
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID='$comment->comment_post_ID' LIMIT 1");
|
||||
++$querycount;
|
||||
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE ID='$post->post_author' LIMIT 1");
|
||||
++$querycount;
|
||||
|
||||
$comment_author_domain = gethostbyaddr($comment->comment_author_IP);
|
||||
$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $tablecomments WHERE comment_approved = '0'");
|
||||
++$querycount;
|
||||
|
||||
$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";
|
||||
$notify_message .= "Author : $comment->comment_author (IP: $comment->comment_author_IP , $comment_author_domain)\r\n";
|
||||
|
@ -126,7 +126,7 @@ function get_archives_link($url, $text, $format = "html", $before = "", $after =
|
||||
|
||||
function get_archives($type='', $limit='', $format='html', $before = "", $after = "", $show_post_count = false) {
|
||||
global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week, $querycount;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
|
||||
|
||||
if ('' == $type) {
|
||||
$type = get_settings('archive_mode');
|
||||
@ -163,7 +163,6 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||
$now = date('Y-m-d H:i:s',(time() + ($time_difference * 3600)));
|
||||
|
||||
if ('monthly' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);
|
||||
if ($arcresults) {
|
||||
foreach ($arcresults as $arcresult) {
|
||||
@ -178,7 +177,6 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||
}
|
||||
}
|
||||
} elseif ('daily' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
|
||||
if ($arcresults) {
|
||||
foreach ($arcresults as $arcresult) {
|
||||
@ -192,7 +190,6 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||
if (!isset($start_of_week)) {
|
||||
$start_of_week = 1;
|
||||
}
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
|
||||
$arc_w_last = '';
|
||||
if ($arcresults) {
|
||||
@ -212,7 +209,6 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||
}
|
||||
}
|
||||
} elseif ('postbypost' == $type) {
|
||||
++$querycount;
|
||||
$arcresults = $wpdb->get_results("SELECT ID, post_date, post_title FROM $tableposts WHERE post_date < '$now' AND post_category > 0 AND post_status = 'publish' ORDER BY post_date DESC" . $limit);
|
||||
if ($arcresults) {
|
||||
foreach ($arcresults as $arcresult) {
|
||||
@ -232,12 +228,11 @@ function get_archives($type='', $limit='', $format='html', $before = "", $after
|
||||
}
|
||||
|
||||
function get_calendar($daylength = 1) {
|
||||
global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts, $querycount;
|
||||
global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts;
|
||||
|
||||
// Quick check. If we have no posts at all, abort!
|
||||
if (!$posts) {
|
||||
$gotsome = $wpdb->get_var("SELECT ID from $tableposts WHERE post_status = 'publish' AND post_category > 0 ORDER BY post_date DESC LIMIT 1");
|
||||
++$querycount;
|
||||
if (!$gotsome)
|
||||
return;
|
||||
}
|
||||
@ -254,7 +249,6 @@ function get_calendar($daylength = 1) {
|
||||
$thisyear = ''.intval(substr($m, 0, 4));
|
||||
$d = (($w - 1) * 7) + 6; //it seems MySQL's weeks disagree with PHP's
|
||||
$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('${thisyear}0101', INTERVAL $d DAY) ), '%m')");
|
||||
++$querycount;
|
||||
} elseif (!empty($m)) {
|
||||
$calendar = substr($m, 0, 6);
|
||||
$thisyear = ''.intval(substr($m, 0, 4));
|
||||
@ -277,7 +271,6 @@ function get_calendar($daylength = 1) {
|
||||
AND post_status = 'publish'
|
||||
ORDER BY post_date DESC
|
||||
LIMIT 1");
|
||||
++$querycount;
|
||||
$next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date ) AS year
|
||||
FROM $tableposts
|
||||
WHERE post_date > '$thisyear-$thismonth-01'
|
||||
@ -285,7 +278,6 @@ function get_calendar($daylength = 1) {
|
||||
AND post_status = 'publish'
|
||||
ORDER BY post_date ASC
|
||||
LIMIT 1");
|
||||
++$querycount;
|
||||
|
||||
echo '<table id="wp-calendar">
|
||||
<caption>' . $month[zeroise($thismonth, 2)] . ' ' . date('Y', $unixmonth) . '</caption>
|
||||
@ -333,7 +325,6 @@ function get_calendar($daylength = 1) {
|
||||
AND YEAR(post_date) = $thisyear
|
||||
AND post_status = 'publish'
|
||||
AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N);
|
||||
++$querycount;
|
||||
if ($dayswithposts) {
|
||||
foreach ($dayswithposts as $daywith) {
|
||||
$daywithpost[] = $daywith[0];
|
||||
@ -359,7 +350,6 @@ function get_calendar($daylength = 1) {
|
||||
."AND post_date < '".date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' "
|
||||
."AND post_status = 'publish'"
|
||||
);
|
||||
++$querycount;
|
||||
if ($ak_post_titles) {
|
||||
foreach ($ak_post_titles as $ak_post_title) {
|
||||
if (empty($ak_titles_for_day["$ak_post_title->dom"])) { // first one
|
||||
@ -410,7 +400,7 @@ function get_calendar($daylength = 1) {
|
||||
/***** Links *****/
|
||||
function get_permalink($id=false) {
|
||||
global $post, $wpdb, $tableposts;
|
||||
global $siteurl, $blogfilename, $querystring_start, $querystring_equal, $querycount;
|
||||
global $siteurl, $blogfilename, $querystring_start, $querystring_equal;
|
||||
|
||||
$rewritecode = array(
|
||||
'%year%',
|
||||
@ -434,7 +424,6 @@ function get_permalink($id=false) {
|
||||
}
|
||||
} else { // if an ID is given
|
||||
$idpost = $wpdb->get_row("SELECT post_date, post_name FROM $tableposts WHERE ID = $id");
|
||||
++$querycount;
|
||||
if ('' != get_settings('permalink_structure')) {
|
||||
$unixtime = strtotime($idpost->post_date);
|
||||
$rewritereplace = array(
|
||||
@ -1034,7 +1023,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
|
||||
|
||||
|
||||
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
|
||||
global $tableposts, $id, $post, $siteurl, $blogfilename, $querycount, $wpdb;
|
||||
global $tableposts, $id, $post, $siteurl, $blogfilename, $wpdb;
|
||||
global $p, $posts, $posts_per_page, $s, $single;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||
|
||||
@ -1059,7 +1048,6 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
|
||||
|
||||
$limitprev--;
|
||||
$lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");
|
||||
++$querycount;
|
||||
if ($lastpost) {
|
||||
$string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous;
|
||||
if ($title == 'yes') {
|
||||
@ -1073,7 +1061,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
|
||||
}
|
||||
|
||||
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
|
||||
global $tableposts, $p, $posts, $id, $post, $siteurl, $blogfilename, $querycount, $wpdb;
|
||||
global $tableposts, $p, $posts, $id, $post, $siteurl, $blogfilename, $wpdb;
|
||||
global $time_difference, $single;
|
||||
global $querystring_start, $querystring_equal, $querystring_separator;
|
||||
if(($p) || ($posts==1) || 1 == $single) {
|
||||
@ -1100,7 +1088,6 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
|
||||
$limitnext--;
|
||||
|
||||
$nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1");
|
||||
++$querycount;
|
||||
if ($nextpost) {
|
||||
$string = '<a href="'.get_permalink($nextpost->ID).'">'.$next;
|
||||
if ($title=='yes') {
|
||||
@ -1285,10 +1272,9 @@ function the_category_unicode() {
|
||||
|
||||
|
||||
function get_the_category_by_ID($cat_ID) {
|
||||
global $tablecategories, $querycount, $cache_categories, $use_cache, $wpdb;
|
||||
global $tablecategories, $cache_categories, $use_cache, $wpdb;
|
||||
if ((!$cache_categories[$cat_ID]) OR (!$use_cache)) {
|
||||
$cat_name = $wpdb->get_var("SELECT cat_name FROM $tablecategories WHERE cat_ID = '$cat_ID'");
|
||||
++$querycount;
|
||||
$cache_categories[$cat_ID] = $cat_name;
|
||||
} else {
|
||||
$cat_name = $cache_categories[$cat_ID];
|
||||
@ -1318,7 +1304,7 @@ function the_category_head($before='', $after='') {
|
||||
// out of the b2 loop
|
||||
function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc',
|
||||
$optiondates = 0, $optioncount = 0, $hide_empty = 1) {
|
||||
global $cat, $tablecategories, $tableposts, $querycount, $wpdb;
|
||||
global $cat, $tablecategories, $tableposts, $wpdb;
|
||||
$sort_column = 'cat_'.$sort_column;
|
||||
|
||||
$query = " SELECT cat_ID, cat_name,";
|
||||
@ -1333,7 +1319,6 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
|
||||
$query .= " ORDER BY $sort_column $sort_order, post_date DESC";
|
||||
|
||||
$categories = $wpdb->get_results($query);
|
||||
++$querycount;
|
||||
echo "<select name='cat' class='postform'>\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 = '<li>';
|
||||
@ -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;
|
||||
|
@ -103,7 +103,6 @@ default:
|
||||
</tr>
|
||||
<?php
|
||||
$users = $wpdb->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 "<tr>\n<!--".$user_data->user_login."-->\n";
|
||||
@ -139,7 +138,6 @@ default:
|
||||
|
||||
<?php
|
||||
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID");
|
||||
++$querycount;
|
||||
if ($users) {
|
||||
?>
|
||||
<div class="wrap">
|
||||
|
@ -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;
|
||||
|
@ -136,7 +136,6 @@ echo $comments_nav_bar;
|
||||
ORDER BY comment_date $commentorder
|
||||
LIMIT $commentstart, $commentend"
|
||||
);
|
||||
++$querycount;
|
||||
|
||||
// need to account for offet, etc.
|
||||
|
||||
|
@ -145,7 +145,6 @@ echo $posts_nav_bar;
|
||||
<option value="all">All Categories</option>
|
||||
<?php
|
||||
$categories = $wpdb->get_results("SELECT * FROM $tablecategories");
|
||||
$querycount++;
|
||||
$width = ($mode=="sidebar") ? "100%" : "170px";
|
||||
foreach ($categories as $category) {
|
||||
echo "<option value=\"".$category->cat_ID."\"";
|
||||
@ -164,7 +163,6 @@ echo $posts_nav_bar;
|
||||
|
||||
if ($archive_mode == "monthly") {
|
||||
echo "<select name=\"m\" style=\"width:120px;\">";
|
||||
$querycount++;
|
||||
$arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC",ARRAY_A);
|
||||
foreach ($arc_result as $arc_row) {
|
||||
$arc_year = $arc_row["YEAR(post_date)"];
|
||||
@ -176,7 +174,6 @@ echo $posts_nav_bar;
|
||||
} elseif ($archive_mode == "daily") {
|
||||
echo "<select name=\"d\" style=\"width:120px;\">";
|
||||
$archive_day_date_format = "Y/m/d";
|
||||
$querycount++;
|
||||
$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);
|
||||
foreach ($arc_result as $arc_row) {
|
||||
$arc_year = $arc_row["YEAR(post_date)"];
|
||||
@ -194,7 +191,6 @@ echo $posts_nav_bar;
|
||||
$archive_week_start_date_format = "Y/m/d";
|
||||
$archive_week_end_date_format = "Y/m/d";
|
||||
$archive_week_separator = " - ";
|
||||
$querycount++;
|
||||
$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);
|
||||
$arc_w_last = '';
|
||||
foreach ($arc_result as $arc_row) {
|
||||
@ -214,7 +210,6 @@ echo $posts_nav_bar;
|
||||
} elseif ($archive_mode == "postbypost") {
|
||||
echo '<input type="hidden" name="more" value="1" />';
|
||||
echo '<select name="p" style="width:120px;">';
|
||||
$querycount++;
|
||||
$resultarc = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC");
|
||||
foreach ($resultarc as $row) {
|
||||
if ($row->post_date != "0000-00-00 00:00:00") {
|
||||
@ -268,7 +263,6 @@ foreach ($posts as $post) { start_b2();
|
||||
if (($withcomments) or ($c)) {
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
|
||||
++$querycount;
|
||||
if ($comments) {
|
||||
?>
|
||||
|
||||
|
@ -139,7 +139,6 @@ if (!$got_links) {
|
||||
echo "<p>... may need to update it though. Looking for column link_updated...</p>\n";
|
||||
$query = "SELECT link_updated FROM $tablelinks LIMIT 1";
|
||||
$q = @mysql_query($query);
|
||||
++$querycount;
|
||||
if ($q != false) {
|
||||
if ($row = mysql_fetch_object($q)) {
|
||||
echo "<p>You have column link_updated. Good!</p>\n";
|
||||
@ -151,7 +150,6 @@ if (!$got_links) {
|
||||
}
|
||||
echo "<p>Looking for column link_rel...</p>\n";
|
||||
$query = "SELECT link_rel FROM $tablelinks LIMIT 1";
|
||||
++$querycount;
|
||||
$q = @mysql_query($query);
|
||||
if ($q != false) {
|
||||
if ($row = mysql_fetch_object($q)) {
|
||||
@ -168,7 +166,6 @@ if (!$got_links) {
|
||||
if ($got_links && $got_cats) {
|
||||
echo "<p>Looking for category 1...</p>\n";
|
||||
$sql = "SELECT * FROM $tablelinkcategories WHERE cat_id=1 ";
|
||||
++$querycount;
|
||||
$result = mysql_query($sql) or print ("Can't query '$tablelinkcategories'.<br />" . $sql . "<br />" . mysql_error());
|
||||
if ($result != false) {
|
||||
if ($row = mysql_fetch_object($result)) {
|
||||
|
@ -69,7 +69,6 @@ case "step1":
|
||||
$post_author = trim(addslashes($postinfo[1]));
|
||||
// we'll check the author is registered already
|
||||
$user = $wpdb->get_row("SELECT * FROM $tableusers WHERE user_login = '$post_author'");
|
||||
++$querycount;
|
||||
if (!$user) { // seems s/he's not, so let's register
|
||||
$user_ip = '127.0.0.1';
|
||||
$user_domain = 'localhost';
|
||||
@ -112,7 +111,6 @@ case "step1":
|
||||
}
|
||||
|
||||
$post_author_ID = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_login = '$post_author'");
|
||||
++$querycount;
|
||||
|
||||
$post_date = explode(' ', $post_date);
|
||||
$post_date_Ymd = explode('/', $post_date[0]);
|
||||
@ -136,7 +134,6 @@ case "step1":
|
||||
|
||||
// Quick-n-dirty check for dups:
|
||||
$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);
|
||||
++$querycount;
|
||||
if ($dupcheck[0]['ID']) {
|
||||
print "<br />\nSkipping duplicate post, ID = '" . $dupcheck[0]['ID'] . "'<br />\n";
|
||||
print "Timestamp: " . $post_date . "<br />\n";
|
||||
|
@ -139,7 +139,6 @@ textarea,input,select {
|
||||
// we'll check the author is registered, or if it's a deleted author
|
||||
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
|
||||
$result = mysql_query($sql);
|
||||
++$querycount;
|
||||
if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
|
||||
$user_ip="127.0.0.1";
|
||||
$user_domain="localhost";
|
||||
@ -160,7 +159,6 @@ textarea,input,select {
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM $tableusers WHERE user_login = '$post_author'";
|
||||
++$querycount;
|
||||
$result = mysql_query($sql);
|
||||
$myrow = mysql_fetch_array($result);
|
||||
$post_author_ID=$myrow[0];
|
||||
@ -197,7 +195,6 @@ textarea,input,select {
|
||||
die ("Error in posting... contact the <a href=\"mailto:$admin_email\">webmaster</a>");
|
||||
|
||||
$sql2 = "SELECT * FROM $tableposts WHERE 1=1 ORDER BY ID DESC LIMIT 1";
|
||||
++$querycount;
|
||||
$result2 = mysql_query($sql2);
|
||||
$myrow2 = mysql_fetch_array($result2);
|
||||
$post_ID=$myrow2[0];
|
||||
|
@ -80,12 +80,9 @@ $database = @mysql_select_db($tp_database_name);
|
||||
|
||||
// For now we're going to give everything the same author and same category
|
||||
$author = $wpdb->get_var("SELECT ID FROM $tableusers WHERE user_level = 10 LIMIT 1");
|
||||
++$querycount;
|
||||
$category = $wpdb->get_var("SELECT cat_ID FROM $tablecategories LIMIT 1");
|
||||
++$querycount;
|
||||
|
||||
$posts = mysql_query('SELECT * FROM textpattern', $connection);
|
||||
++$querycount;
|
||||
|
||||
while ($post = mysql_fetch_array($posts)) {
|
||||
// ID, AuthorID, LastMod, LastModID, Posted, Title, Body, Body_html, Abstract, Category1, Category2, Annotate, AnnotateInvite, Status, Listing1, Listing2, Section
|
||||
@ -111,12 +108,10 @@ while ($post = mysql_fetch_array($posts)) {
|
||||
|
||||
// Get wordpress post id
|
||||
$wp_post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
|
||||
++$querycount;
|
||||
|
||||
// Now let's insert comments if there are any for the TP post
|
||||
$tp_id = $post['ID'];
|
||||
$comments = mysql_query("SELECT * FROM txp_Discuss WHERE parentid = $tp_id");
|
||||
++$querycount;
|
||||
if ($comments) {
|
||||
while($comment = mysql_fetch_object($comments)) {
|
||||
// discussid, parentid, name, email, web, ip, posted, message
|
||||
|
@ -134,7 +134,6 @@ switch ($action) {
|
||||
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $tablelinkcategories WHERE cat_id=$cat_id");
|
||||
++$querycount;
|
||||
if ($row) {
|
||||
if ($row->list_limit == -1) {
|
||||
$row->list_limit = '';
|
||||
@ -325,7 +324,6 @@ switch ($action) {
|
||||
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
||||
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
||||
. " text_after_all, list_limit FROM $tablelinkcategories ORDER BY cat_id");
|
||||
++$querycount;
|
||||
foreach ($results as $row) {
|
||||
if ($row->list_limit == -1) {
|
||||
$row->list_limit = 'none';
|
||||
|
@ -33,10 +33,9 @@ $title = 'Manage Links';
|
||||
$this_file = 'linkmanager.php';
|
||||
|
||||
function category_dropdown($fieldname, $selected = 0) {
|
||||
global $wpdb, $querycount, $tablelinkcategories;
|
||||
global $wpdb, $tablelinkcategories;
|
||||
|
||||
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
||||
++$querycount;
|
||||
echo ' <select name="'.$fieldname.'" size="1">'."\n";
|
||||
foreach ($results as $row) {
|
||||
echo " <option value=\"".$row->cat_id."\"";
|
||||
@ -110,7 +109,6 @@ switch ($action) {
|
||||
}
|
||||
$all_links = join(',', $linkcheck);
|
||||
$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)");
|
||||
++$querycount;
|
||||
foreach ($results as $row) {
|
||||
if (!get_settings('links_use_adminlevels') || ($user_level >= $row->user_level)) { // ok to proceed
|
||||
$ids_to_change[] = $row->link_id;
|
||||
@ -140,7 +138,6 @@ switch ($action) {
|
||||
}
|
||||
$all_links = join(',', $linkcheck);
|
||||
$results = $wpdb->get_results("SELECT link_id, link_visible FROM $tablelinks WHERE link_id in ($all_links)");
|
||||
++$querycount;
|
||||
foreach ($results as $row) {
|
||||
if ($row->link_visible == 'Y') { // ok to proceed
|
||||
$ids_to_turnoff[] = $row->link_id;
|
||||
@ -307,7 +304,6 @@ switch ($action) {
|
||||
$row = $wpdb->get_row("SELECT link_url, link_name, link_image, link_target, link_description, link_visible, link_category AS cat_id, link_rating, link_rel, link_notes " .
|
||||
" FROM $tablelinks " .
|
||||
" WHERE link_id = $link_id");
|
||||
++$querycount;
|
||||
|
||||
if ($row) {
|
||||
$link_url = stripslashes($row->link_url);
|
||||
@ -502,7 +498,6 @@ function checkAll(form)
|
||||
<td>
|
||||
<?php
|
||||
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
||||
++$querycount;
|
||||
echo " <select name=\"cat_id\">\n";
|
||||
echo " <option value=\"All\"";
|
||||
if ($cat_id == 'All')
|
||||
@ -565,7 +560,6 @@ function checkAll(form)
|
||||
FROM $tablelinks
|
||||
LEFT JOIN $tablelinkcategories ON $tablelinks.link_category = $tablelinkcategories.cat_id
|
||||
LEFT JOIN $tableusers ON $tableusers.ID = $tablelinks.link_owner ";
|
||||
++$querycount;
|
||||
|
||||
if (isset($cat_id) && ($cat_id != 'All')) {
|
||||
$sql .= " WHERE link_category = $cat_id ";
|
||||
@ -636,7 +630,6 @@ LINKS;
|
||||
<input type="submit" name="action2" value="Assign" /> ownership <?php echo gethelp_link($this_file,'assign_ownership');?> to:
|
||||
<?php
|
||||
$results = $wpdb->get_results("SELECT ID, user_login FROM $tableusers WHERE user_level > 0 ORDER BY ID");
|
||||
++$querycount;
|
||||
echo " <select name=\"newowner\" size=\"1\">\n";
|
||||
foreach ($results as $row) {
|
||||
echo " <option value=\"".$row->ID."\"";
|
||||
|
@ -73,7 +73,6 @@ switch ($step) {
|
||||
Category: <?php echo gethelp_link($this_file,'link_category');?><select name="cat_id">
|
||||
<?php
|
||||
$categories = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $tablelinkcategories ORDER BY cat_id");
|
||||
++$querycount;
|
||||
foreach ($categories as $category) {
|
||||
?>
|
||||
<option value="<?php echo $category->cat_id; ?>"><?php echo $category->cat_id.': '.$category->cat_name; ?></option>
|
||||
|
@ -50,7 +50,6 @@ SELECT;
|
||||
."FROM $tableoptionvalues "
|
||||
."WHERE option_id = $option_result->option_id "
|
||||
."ORDER BY optionvalue_seq");
|
||||
++$querycount;
|
||||
if ($select) {
|
||||
foreach($select as $option) {
|
||||
$ret .= '<option value="'.$option->optionvalue.'"';
|
||||
@ -68,7 +67,6 @@ SELECT;
|
||||
case 7: // SQL select
|
||||
// first get the sql to run
|
||||
$sql = $wpdb->get_var("SELECT optionvalue FROM $tableoptionvalues WHERE option_id = $option_result->option_id");
|
||||
++$querycount;
|
||||
if (!$sql) {
|
||||
return $option_result->option_name . $editable;
|
||||
}
|
||||
|
@ -145,7 +145,6 @@ echo $posts_nav_bar;
|
||||
<option value="all">All Categories</option>
|
||||
<?php
|
||||
$categories = $wpdb->get_results("SELECT * FROM $tablecategories");
|
||||
$querycount++;
|
||||
$width = ($mode=="sidebar") ? "100%" : "170px";
|
||||
foreach ($categories as $category) {
|
||||
echo "<option value=\"".$category->cat_ID."\"";
|
||||
@ -164,7 +163,6 @@ echo $posts_nav_bar;
|
||||
|
||||
if ($archive_mode == "monthly") {
|
||||
echo "<select name=\"m\" style=\"width:120px;\">";
|
||||
$querycount++;
|
||||
$arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC",ARRAY_A);
|
||||
foreach ($arc_result as $arc_row) {
|
||||
$arc_year = $arc_row["YEAR(post_date)"];
|
||||
@ -176,7 +174,6 @@ echo $posts_nav_bar;
|
||||
} elseif ($archive_mode == "daily") {
|
||||
echo "<select name=\"d\" style=\"width:120px;\">";
|
||||
$archive_day_date_format = "Y/m/d";
|
||||
$querycount++;
|
||||
$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);
|
||||
foreach ($arc_result as $arc_row) {
|
||||
$arc_year = $arc_row["YEAR(post_date)"];
|
||||
@ -194,7 +191,6 @@ echo $posts_nav_bar;
|
||||
$archive_week_start_date_format = "Y/m/d";
|
||||
$archive_week_end_date_format = "Y/m/d";
|
||||
$archive_week_separator = " - ";
|
||||
$querycount++;
|
||||
$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);
|
||||
$arc_w_last = '';
|
||||
foreach ($arc_result as $arc_row) {
|
||||
@ -214,7 +210,6 @@ echo $posts_nav_bar;
|
||||
} elseif ($archive_mode == "postbypost") {
|
||||
echo '<input type="hidden" name="more" value="1" />';
|
||||
echo '<select name="p" style="width:120px;">';
|
||||
$querycount++;
|
||||
$resultarc = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC");
|
||||
foreach ($resultarc as $row) {
|
||||
if ($row->post_date != "0000-00-00 00:00:00") {
|
||||
@ -271,7 +266,6 @@ echo $posts_nav_bar;
|
||||
if (($withcomments) or ($c)) {
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
|
||||
++$querycount;
|
||||
if ($comments) {
|
||||
?>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user