Missing querycount
git-svn-id: http://svn.automattic.com/wordpress/trunk@558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1c5322e065
commit
3e120068f9
|
@ -478,7 +478,7 @@ function get_usernumposts($userid) {
|
|||
// examine a url (supposedly from this blog) and try to
|
||||
// determine the post ID it represents.
|
||||
function url_to_postid($url = '') {
|
||||
global $wpdb, $tableposts, $siteurl;
|
||||
global $wpdb, $querycount, $tableposts, $siteurl;
|
||||
|
||||
// Take a link like 'http://example.com/blog/something'
|
||||
// and extract just the '/something':
|
||||
|
@ -536,7 +536,8 @@ function url_to_postid($url = '') {
|
|||
if ($postname) $where .= " AND post_name = '" . $wpdb->escape($postname) . "' ";
|
||||
|
||||
// Run the query to get the post ID:
|
||||
return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
|
||||
++$querycount;
|
||||
return intval($wpdb->get_var("SELECT ID FROM $tableposts WHERE 1 = 1 " . $where));
|
||||
}
|
||||
|
||||
|
||||
|
@ -681,6 +682,7 @@ function dropdown_categories($blog_ID=1, $default=1) {
|
|||
if ($postdata["Category"] != '') {
|
||||
$default = $postdata["Category"];
|
||||
}
|
||||
++$querycount;
|
||||
foreach($results as $post) {
|
||||
echo "<option value=\"".$post->cat_ID."\"";
|
||||
if ($post->cat_ID == $default)
|
||||
|
@ -1439,28 +1441,32 @@ function wp_set_comment_status($comment_id, $comment_status) {
|
|||
a (boolean) false signals an error
|
||||
*/
|
||||
function wp_get_comment_status($comment_id) {
|
||||
global $wpdb, $tablecomments;
|
||||
global $wpdb, $querycount, $tablecomments;
|
||||
|
||||
$result = $wpdb->get_var("SELECT comment_approved FROM $tablecomments WHERE comment_ID='$comment_id' LIMIT 1");
|
||||
++$querycount;
|
||||
if ($result == NULL) {
|
||||
return "deleted";
|
||||
return "deleted";
|
||||
} else if ($result == "1") {
|
||||
return "approved";
|
||||
return "approved";
|
||||
} else if ($result == "0") {
|
||||
return "unapproved";
|
||||
return "unapproved";
|
||||
} else {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function wp_notify_postauthor($comment_id, $comment_type) {
|
||||
global $wpdb, $tablecomments, $tableposts, $tableusers;
|
||||
global $wpdb, $querycount, $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
|
||||
|
||||
|
@ -1511,16 +1517,20 @@ function wp_notify_postauthor($comment_id, $comment_type) {
|
|||
always returns true
|
||||
*/
|
||||
function wp_notify_moderator($comment_id) {
|
||||
global $wpdb, $tablecomments, $tableposts, $tableusers;
|
||||
global $wpdb, $querycount, $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";
|
||||
|
|
|
@ -232,11 +232,12 @@ 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;
|
||||
global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $weekday, $tableposts, $posts, $querycount;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
@ -253,6 +254,7 @@ 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));
|
||||
|
@ -275,6 +277,7 @@ 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'
|
||||
|
@ -282,6 +285,7 @@ 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>
|
||||
|
@ -329,7 +333,7 @@ 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];
|
||||
|
@ -355,6 +359,7 @@ 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
|
||||
|
@ -405,7 +410,8 @@ function get_calendar($daylength = 1) {
|
|||
/***** Links *****/
|
||||
function get_permalink($id=false) {
|
||||
global $post, $wpdb, $tableposts;
|
||||
global $siteurl, $blogfilename, $querystring_start, $querystring_equal;
|
||||
global $siteurl, $blogfilename, $querystring_start, $querystring_equal, $querycount;
|
||||
|
||||
$rewritecode = array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
|
@ -427,6 +433,7 @@ 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(
|
||||
|
@ -1350,7 +1357,7 @@ 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>';
|
||||
|
@ -1359,7 +1366,6 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
echo $before . "No categories" . $after . "\n";
|
||||
return;
|
||||
}
|
||||
++$querycount;
|
||||
if (intval($optionall) == 1) {
|
||||
$all = apply_filters('list_cats', $all);
|
||||
$link = "<a href=\"".$file.$querystring_start.'cat'.$querystring_equal.'all">'.$all."</a>";
|
||||
|
@ -1405,11 +1411,12 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde
|
|||
|
||||
function comments_number($zero='No Comments', $one='1 Comment', $more='% Comments', $include_unapproved = false) {
|
||||
global $id, $comment, $tablecomments, $querycount, $wpdb;
|
||||
$query = "SELECT COUNT(*) FROM $tablecomments WHERE comment_post_ID = '$id'";
|
||||
$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) {
|
||||
|
@ -1438,9 +1445,10 @@ 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, $tablecomments, $HTTP_COOKIE_VARS, $cookiehash;
|
||||
global $id, $b2commentspopupfile, $b2commentsjavascript, $post, $wpdb, $querycount, $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;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
$comment_author_url = trim($HTTP_COOKIE_VARS["comment_author_url_".$cookiehash]);
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
|
||||
++$querycount;
|
||||
?>
|
||||
|
||||
<!-- You can start editing here. -->
|
||||
|
|
|
@ -39,7 +39,7 @@ $user_ip = $HTTP_SERVER_VARS['REMOTE_ADDR'];
|
|||
$user_domain = gethostbyaddr($user_ip);
|
||||
|
||||
$commentstatus = $wpdb->get_var("SELECT comment_status FROM $tableposts WHERE ID = $comment_post_ID");
|
||||
|
||||
++$querycount;
|
||||
if ('closed' == $commentstatus)
|
||||
die('Sorry, comments are closed for this item.');
|
||||
|
||||
|
@ -68,6 +68,7 @@ $url = addslashes($url);
|
|||
|
||||
/* Flood-protection */
|
||||
$lasttime = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_author_IP = '$user_ip' ORDER BY comment_date DESC LIMIT 1");
|
||||
++$querycount;
|
||||
$ok = true;
|
||||
if (!empty($lasttime)) {
|
||||
$time_lastcomment= mysql2date('U', $lasttime);
|
||||
|
@ -100,6 +101,7 @@ if ($ok) { // if there was no comment from this IP in the last 10 seconds
|
|||
");
|
||||
|
||||
$comment_ID = $wpdb->get_var('SELECT last_insert_id()');
|
||||
++$querycount;
|
||||
|
||||
if (($moderation_notify) && (!$approved)) {
|
||||
wp_notify_moderator($comment_ID);
|
||||
|
|
|
@ -30,7 +30,9 @@ foreach ($posts as $post) { start_b2();
|
|||
<?php
|
||||
// this line is WordPress' motor, do not delete it.
|
||||
$comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id AND comment_approved = '1' ORDER BY comment_date");
|
||||
++$querycount;
|
||||
$commentstatus = $wpdb->get_row("SELECT comment_status, post_password FROM $tableposts WHERE ID = $id");
|
||||
++$querycount;
|
||||
if (!empty($commentstatus->post_password) && $HTTP_COOKIE_VARS['wp-postpass_'.$cookiehash] != $commentstatus->post_password) { // and it doesn't match the cookie
|
||||
echo(get_the_password_form());
|
||||
} else { ?>
|
||||
|
|
|
@ -86,9 +86,11 @@ case 'login':
|
|||
$pass_is_md5 = 1;
|
||||
$password = substr($password, 4, strlen($password));
|
||||
$query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND MD5(user_pass) = '$password'";
|
||||
++$querycount;
|
||||
} else {
|
||||
$pass_is_md5 = 0;
|
||||
$query = "SELECT ID, user_login, user_pass FROM $tableusers WHERE user_login = '$user_login' AND user_pass = '$password'";
|
||||
++$querycount;
|
||||
}
|
||||
$login = $wpdb->get_row($query);
|
||||
|
||||
|
|
|
@ -204,6 +204,7 @@ for ($iCount=1; $iCount<=$Count; $iCount++) {
|
|||
|
||||
$sql = "SELECT ID, user_level FROM $tableusers WHERE user_login='$user_login' AND user_pass='$user_pass' ORDER BY ID DESC LIMIT 1";
|
||||
$result = $wpdb->get_row($sql);
|
||||
++$querycount;
|
||||
|
||||
if (!$result) {
|
||||
echo '<p><b>Wrong login or password.</b></p></div>';
|
||||
|
|
|
@ -80,7 +80,8 @@ case 'register':
|
|||
|
||||
/* checking the login isn't already used by another user */
|
||||
$result = $wpdb->get_results("SELECT user_login FROM $tableusers WHERE user_login = '$user_login'");
|
||||
if (count($result) >= 1) {
|
||||
++$querycount;
|
||||
if (count($result) >= 1) {
|
||||
die ('<strong>ERROR</strong>: This login is already registered, please choose another one.');
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u
|
|||
trackback_response(1, 'Sorry, this weblog does not allow you to trackback its posts.');
|
||||
|
||||
$pingstatus = $wpdb->get_var("SELECT ping_status FROM $tableposts WHERE ID = $tb_id");
|
||||
++$querycount;
|
||||
|
||||
if ('closed' == $pingstatus)
|
||||
trackback_response(1, 'Sorry, trackbacks are closed for this item.');
|
||||
|
@ -86,6 +87,7 @@ if ((strlen(''.$tb_id)) && (empty($HTTP_GET_VARS['__mode'])) && (strlen(''.$tb_u
|
|||
die ("There is an error with the database, it can't store your comment...<br />Please contact the <a href='mailto:$admin_email'>webmaster</a>.");
|
||||
} else {
|
||||
$comment_ID = $wpdb->get_var('SELECT last_insert_id()');
|
||||
++$querycount;
|
||||
if ($comments_notify)
|
||||
wp_notify_postauthor($comment_ID, 'trackback');
|
||||
trackback_response(0);
|
||||
|
|
|
@ -304,7 +304,7 @@ if ($preview) {
|
|||
// error_log("$request");
|
||||
// echo $request;
|
||||
$posts = $wpdb->get_results($request);
|
||||
|
||||
++$querycount;
|
||||
if (1 == count($posts)) {
|
||||
if ($p || $name) {
|
||||
$more = 1;
|
||||
|
|
|
@ -103,6 +103,7 @@ 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";
|
||||
|
@ -138,6 +139,7 @@ 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;
|
||||
global $tableusers, $wpdb, $querycount;
|
||||
|
||||
if (!empty($HTTP_COOKIE_VARS["wordpressuser_".$cookiehash])) {
|
||||
$user_login = $HTTP_COOKIE_VARS["wordpressuser_".$cookiehash];
|
||||
|
@ -20,6 +20,7 @@ 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,6 +136,7 @@ echo $comments_nav_bar;
|
|||
ORDER BY comment_date $commentorder
|
||||
LIMIT $commentstart, $commentend"
|
||||
);
|
||||
++$querycount;
|
||||
|
||||
// need to account for offet, etc.
|
||||
|
||||
|
|
|
@ -268,6 +268,7 @@ 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,6 +139,7 @@ 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";
|
||||
|
@ -150,6 +151,7 @@ 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)) {
|
||||
|
@ -166,6 +168,7 @@ 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,6 +69,7 @@ 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';
|
||||
|
@ -111,6 +112,7 @@ 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]);
|
||||
|
@ -134,6 +136,7 @@ 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,6 +139,7 @@ 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";
|
||||
|
@ -159,6 +160,7 @@ 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];
|
||||
|
@ -195,6 +197,7 @@ 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,9 +80,12 @@ $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
|
||||
|
@ -108,10 +111,12 @@ 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,6 +134,7 @@ 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 = '';
|
||||
|
@ -324,11 +325,12 @@ 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");
|
||||
foreach ($results as $row) {
|
||||
if ($row->list_limit == -1) {
|
||||
$row->list_limit = 'none';
|
||||
}
|
||||
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||
++$querycount;
|
||||
foreach ($results as $row) {
|
||||
if ($row->list_limit == -1) {
|
||||
$row->list_limit = 'none';
|
||||
}
|
||||
$style = ($i % 2) ? ' class="alternate"' : '';
|
||||
?>
|
||||
<tr valign="middle" <?php echo $style ?>>
|
||||
<td style="border-bottom: 1px dotted #9C9A9C;"><?php echo $row->cat_id?></td>
|
||||
|
|
|
@ -33,9 +33,10 @@ $title = 'Manage Links';
|
|||
$this_file = 'linkmanager.php';
|
||||
|
||||
function category_dropdown($fieldname, $selected = 0) {
|
||||
global $wpdb, $tablelinkcategories;
|
||||
global $wpdb, $querycount, $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."\"";
|
||||
|
@ -109,6 +110,7 @@ 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;
|
||||
|
@ -138,6 +140,7 @@ 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;
|
||||
|
@ -304,6 +307,7 @@ 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);
|
||||
|
@ -498,6 +502,7 @@ 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')
|
||||
|
@ -560,6 +565,7 @@ 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 ";
|
||||
|
@ -630,6 +636,7 @@ 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,6 +73,7 @@ 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,6 +50,7 @@ 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.'"';
|
||||
|
@ -67,6 +68,7 @@ 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;
|
||||
}
|
||||
|
|
|
@ -271,6 +271,7 @@ 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) {
|
||||
?>
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ foreach ($posts as $post) { start_b2();
|
|||
AND post_date < '".date("Y-m-d H:i:s")."'
|
||||
ORDER BY comment_date
|
||||
LIMIT $posts_per_rss");
|
||||
++$querycount;
|
||||
}
|
||||
else { // if no post id passed in, we'll just ue the last 10 comments.
|
||||
$comments = $wpdb->get_results("SELECT comment_ID,
|
||||
|
@ -78,6 +79,7 @@ foreach ($posts as $post) { start_b2();
|
|||
AND post_date < '".date("Y-m-d H:i:s")."'
|
||||
ORDER BY comment_date DESC
|
||||
LIMIT $posts_per_rss");
|
||||
++$querycount;
|
||||
}
|
||||
// this line is WordPress' motor, do not delete it.
|
||||
if ($comments) {
|
||||
|
|
|
@ -11,7 +11,7 @@ include('blog.header.php');
|
|||
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||
|
||||
$maxdate = $wpdb->get_var($sql);
|
||||
|
||||
++$querycount;
|
||||
$unixtime = strtotime($maxdate);
|
||||
|
||||
// format timestamp for Last-Modified header
|
||||
|
|
|
@ -11,7 +11,7 @@ include('blog.header.php');
|
|||
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||
|
||||
$maxdate = $wpdb->get_var($sql);
|
||||
|
||||
++$querycount;
|
||||
$unixtime = strtotime($maxdate);
|
||||
|
||||
// format timestamp for Last-Modified header
|
||||
|
|
|
@ -11,6 +11,7 @@ include('blog.header.php');
|
|||
$sql = "SELECT max(post_date) FROM $tableposts";
|
||||
|
||||
$maxdate = $wpdb->get_var($sql);
|
||||
++$querycount;
|
||||
|
||||
$unixtime = strtotime($maxdate);
|
||||
|
||||
|
|
Loading…
Reference in New Issue