[geeklog-cvs] geeklog: adjust comments lib to work with pgsql
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Tue Jan 26 15:53:55 EST 2010
changeset 7648:8c3760c8583d
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/8c3760c8583d
user: stan <yankees26an at gmail.com>
date: Sun Aug 16 19:45:53 2009 -0400
description:
adjust comments lib to work with pgsql
diffstat:
system/lib-comment.php | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (49 lines):
diff -r d61bef61c0f5 -r 8c3760c8583d system/lib-comment.php
--- a/system/lib-comment.php Sun Aug 16 19:45:20 2009 -0400
+++ b/system/lib-comment.php Sun Aug 16 19:45:53 2009 -0400
@@ -1140,16 +1140,18 @@
. "AND sid = '$sid'");
list($rht, $indent) = DB_fetchArray($result);
if ( !DB_error() ) {
+ $rht2=$rht+=1;
+ $indent+=1;
DB_query("UPDATE {$_TABLES['comments']} SET lft = lft + 2 "
. "WHERE sid = '$sid' AND type = '$type' AND lft >= $rht");
DB_query("UPDATE {$_TABLES['comments']} SET rht = rht + 2 "
. "WHERE sid = '$sid' AND type = '$type' AND rht >= $rht");
if (isset($name)) {
DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress,name',
- "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht+1,$indent+1,'$type','{$_SERVER['REMOTE_ADDR']}','$name'");
+ "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht2,$indent,'$type','{$_SERVER['REMOTE_ADDR']}','$name'");
} else {
DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
- "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht+1,$indent+1,'$type','{$_SERVER['REMOTE_ADDR']}'");
+ "'$sid',$uid,'$comment',now(),'$title',$pid,$rht,$rht2,$indent,'$type','{$_SERVER['REMOTE_ADDR']}'");
}
} else { //replying to non-existent comment or comment in wrong article
@@ -1158,20 +1160,22 @@
$ret = 4; // Cannot return here, tables locked!
}
} else {
+ $rht2=$rht+=1;
+ $rht3=$rht+2;
$rht = DB_getItem($_TABLES['comments'], 'MAX(rht)', "sid = '$sid'");
if ( DB_error() ) {
$rht = 0;
}
if (isset($name)) {
DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress,name',
- "'$sid',$uid,'$comment',now(),'$title',$pid,$rht+1,$rht+2,0,'$type','{$_SERVER['REMOTE_ADDR']}','$name'");
+ "'$sid',$uid,'$comment',now(),'$title',$pid,$rht2,$rht3,0,'$type','{$_SERVER['REMOTE_ADDR']}','$name'");
} else {
$rht = DB_getItem($_TABLES['comments'], 'MAX(rht)', "sid = '$sid'");
if ( DB_error() ) {
$rht = 0;
}
DB_save ($_TABLES['comments'], 'sid,uid,comment,date,title,pid,lft,rht,indent,type,ipaddress',
- "'$sid',$uid,'$comment',now(),'$title',$pid,$rht+1,$rht+2,0,'$type','{$_SERVER['REMOTE_ADDR']}'");
+ "'$sid',$uid,'$comment',now(),'$title',$pid,$rht2,$rht3,0,'$type','{$_SERVER['REMOTE_ADDR']}'");
}
}
More information about the geeklog-cvs
mailing list