Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16054
Modified Files:
serendipity_functions.inc.php
Log Message:
- Purely cosmetic changes to some SQL queries
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.421
retrieving revision 1.422
diff -u -d -r1.421 -r1.422
--- serendipity_functions.inc.php 13 Sep 2004 20:26:33 -0000 1.421
+++ serendipity_functions.inc.php 13 Sep 2004 20:40:39 -0000 1.422
@@ -546,7 +546,7 @@
function serendipity_fetchCategoryRange($categoryid) {
global $serendipity;
- $res = serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid='". (int)$categoryid ."'");
+ $res = serendipity_db_query("SELECT category_left, category_right FROM {$serendipity['dbPrefix']}category WHERE categoryid = '". (int)$categoryid ."'");
return array('category_left' => $res[0]['category_left'], 'category_right' => $res[0]['category_right']);
}
@@ -880,7 +880,7 @@
global $serendipity;
$right = $left + 1;
- $result = serendipity_db_query("SELECT categoryid FROM {$serendipity['dbPrefix']}category WHERE parentid='" . (int)$parent . "'");
+ $result = serendipity_db_query("SELECT categoryid FROM {$serendipity['dbPrefix']}category WHERE parentid = '" . (int)$parent . "'");
if ( is_array($result) ) {
foreach ( $result as $category ) {
$right = serendipity_rebuildCategoryTree($category['categoryid'], $right);
@@ -1473,7 +1473,7 @@
}
if (!empty($id)) {
- $and .= ' AND co.entry_id=' . (int)$id;
+ $and .= " AND co.entry_id = '" . (int)$id ."'";
}
if (!$showAll) {
@@ -1706,8 +1706,8 @@
FROM {$serendipity['dbPrefix']}comments c
LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)
LEFT JOIN {$serendipity['dbPrefix']}authors a ON (e.authorid = a.authorid)
- WHERE c.id = ". (int)$cid ."
- ". (($serendipity['serendipityUserlevel'] != USERLEVEL_ADMIN && $force !== true) ? 'AND e.authorid = '. $serendipity['authorId'] : '') ."
+ WHERE c.id = '". (int)$cid ."'
+ ". (($serendipity['serendipityUserlevel'] != USERLEVEL_ADMIN && $force !== true) ? "AND e.authorid = '". (int)$serendipity['authorId'] ."'" : '') ."
". (($force === true) ? "" : "AND status = 'pending'");
$rs = serendipity_db_query($sql, true);
@@ -1809,7 +1809,7 @@
$sql = "SELECT $pgsql_insert author, email, type
FROM {$serendipity['dbPrefix']}comments
- WHERE entry_id = ". (int)$entry_id ."
+ WHERE entry_id = '". (int)$entry_id ."'
AND email <> '$posterMail'
AND subscribed = 'true' $mysql_insert";
$subscribers = serendipity_db_query($sql);
@@ -1922,7 +1922,7 @@
{
global $serendipity;
- $query = "SELECT name,link FROM {$serendipity['dbPrefix']}references WHERE entry_id='" . (int)$id . "'";
+ $query = "SELECT name,link FROM {$serendipity['dbPrefix']}references WHERE entry_id = '" . (int)$id . "'";
return serendipity_db_query($query);
}
@@ -2001,7 +2001,7 @@
// extract author information
if (empty($entry['email'])) {
- $query = "select email from {$serendipity['dbPrefix']}authors where username='". serendipity_db_escape_string($entry['username']) ."'";
+ $query = "select email FROM {$serendipity['dbPrefix']}authors WHERE username = '". serendipity_db_escape_string($entry['username']) ."'";
$results = serendipity_db_query($query);
$entry['email'] = $results[0]['email'];
}
@@ -2498,8 +2498,9 @@
$locations[$i] = 'http' . (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $locations[$i];
}
- $query = "SELECT COUNT(id) FROM {$serendipity['dbPrefix']}references WHERE ";
- $query .= "entry_id=". (int)$tmpid ." AND link='" . serendipity_db_escape_string($locations[$i]) . "'";
+ $query = "SELECT COUNT(id) FROM {$serendipity['dbPrefix']}references
+ WHERE entry_id = '". (int)$tmpid ."'
+ AND link = '" . serendipity_db_escape_string($locations[$i]) . "'";
$row = serendipity_db_query($query, true, 'num');
if ($row[0] > 0) {
@@ -2657,7 +2658,7 @@
}
// Purge the daily/monthly entries so they can be rebuilt
- $result = serendipity_db_query("SELECT timestamp, authorid FROM {$serendipity['dbPrefix']}entries WHERE id=". (int)$id, true);
+ $result = serendipity_db_query("SELECT timestamp, authorid FROM {$serendipity['dbPrefix']}entries WHERE id = '". (int)$id ."'", true);
if ($serendipity['serendipityUserlevel'] < USERLEVEL_CHIEF && $result[1] != $serendipity['authorid']) {
// Only admins and chief users can delete entries which do not belong to the author
|