[geeklog-cvs] geeklog: Added What's New Block comment support for Staticpages

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Tue Mar 9 19:08:50 EST 2010


changeset 7772:0c97fecbe5b8
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/0c97fecbe5b8
user: Tom <websitemaster at cogeco.net>
date: Tue Mar 09 18:52:56 2010 -0500
description:
Added What's New Block comment support for Staticpages
Fixed date search bug with staticpage

diffstat:

 plugins/staticpages/functions.inc |  31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diffs (62 lines):

diff -r ca1ffd39bb66 -r 0c97fecbe5b8 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Tue Mar 09 18:50:14 2010 -0500
+++ b/plugins/staticpages/functions.inc	Tue Mar 09 18:52:56 2010 -0500
@@ -796,7 +796,7 @@
     $search_c = new SearchCriteria('comments', array($LANG_STATIC['staticpages'],$LANG09[66]));
 
     $columns = array('title' => 'c.title', 'comment');
-    $sql .= $search_c->getDateRangeSQL('AND', 'c_date', $datestart, $dateend);
+    $sql .= $search_c->getDateRangeSQL('AND', 'c.date', $datestart, $dateend);
     list($sql, $ftsql) = $search_c->buildSearchSQL($keyType, $query, $columns, $sql);
 
     $search_c->setSQL($sql);
@@ -1477,7 +1477,7 @@
         $retval = array($LANG_STATIC['pages'],
                         COM_formatTimeString($LANG_WHATSNEW['new_last'],
                                              $_SP_CONF['newstaticpagesinterval'])
-                       );
+                            );
     }
 
     return $retval;
@@ -1494,7 +1494,6 @@
     global $_CONF, $_TABLES, $_SP_CONF, $LANG_STATIC;
 
     $retval = '';
-    
     if ($_SP_CONF['hidenewstaticpages'] == 'modified') {
         $datecolumn = 'modified';
     } else {
@@ -1557,6 +1556,32 @@
 }
 
 /**
+* Return new Static Page comments for the What's New block
+*
+* @return   array list of new staticpage comments (dups, type, title, sid, lastdate)
+*
+*/
+function plugin_getwhatsnewcomment_staticpages()
+{
+    global $_CONF, $_TABLES;
+
+    // Comments
+    $sql['mysql'] = "SELECT DISTINCT COUNT(*) AS dups, type, title, sid, max(date) AS lastdate FROM {$_TABLES['comments']}, {$_TABLES['staticpage']} sp"
+        . " WHERE (sp.sp_id = sid) AND (sp.draft_flag = 0)" . COM_getPermSQL('AND', 0, 2, 'sp')
+        . " AND (date >= (DATE_SUB(NOW(), INTERVAL {$_CONF['newcommentsinterval']} SECOND))) GROUP BY sid,type, title, sid ORDER BY 5 DESC LIMIT 15";
+  
+    $result = DB_query($sql);
+    $nrows = DB_numRows($result);
+    if ($nrows > 0) {
+        for ($x = 0; $x < $nrows; $x++) {
+            $A[] = DB_fetchArray($result);    
+        }
+        
+        return $A;
+    }
+}
+
+/**
 * Return information for a static page
 *
 * @param    string  $sp_id      static page ID or '*'



More information about the geeklog-cvs mailing list