From: <vb...@us...> - 2002-09-11 10:00:41
|
Update of /cvsroot/webnotes/webnotes/core In directory usw-pr-cvs1:/tmp/cvs-serv27294/core Modified Files: note_api.php Log Message: Fixed a problem with note_queue_count() where it used to count orphan notes. Although this case should be fixed elsewhere, it should be handled correctly if it exists. Index: note_api.php =================================================================== RCS file: /cvsroot/webnotes/webnotes/core/note_api.php,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- note_api.php 11 Sep 2002 09:49:54 -0000 1.12 +++ note_api.php 11 Sep 2002 10:00:38 -0000 1.13 @@ -10,11 +10,13 @@ ### -------------------- function note_queue_count() { - global $g_phpWN_note_table; + global $g_phpWN_note_table, $g_phpWN_page_table; + # the reason of including the page is to avoid counting orphan + # notes. $query = "SELECT COUNT(*) - FROM $g_phpWN_note_table - WHERE visible='0'"; + FROM $g_phpWN_note_table n, $g_phpWN_page_table p + WHERE visible='0' AND n.page_id = p.id"; $result = db_query( $query ); return db_result( $result, 0, 0 ); } @@ -37,7 +39,7 @@ INTO $g_phpWN_note_table ( id, page_id, email, ip, date_submitted, note, visible ) VALUES - ( null, '$c_page_id', '$c_email', '$c_remote_address', NOW(), '$c_note', $t_visible )"; + ( null, '$c_page_id', '$c_email', '$c_remote_address', NOW(), '$c_note', '$t_visible' )"; return db_query( $query ); } ### -------------------- @@ -234,4 +236,4 @@ } } ### -------------------- -?> \ No newline at end of file +?> |