[geeklog-cvs] geeklog: Advanced Search and viewing, submitting Comments will n...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Jan 2 13:35:51 EST 2012


changeset 8468:804d0be33d0b
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/804d0be33d0b
user: Tom <websitemaster at cogeco.net>
date: Mon Jan 02 13:34:24 2012 -0500
description:
Advanced Search and viewing, submitting Comments will now take into account what topic they are in. The correct topic blocks will display.

diffstat:

 public_html/search.php |   3 +++
 system/lib-topic.php   |  36 +++++++++++++++++++++++++-----------
 2 files changed, 28 insertions(+), 11 deletions(-)

diffs (76 lines):

diff -r 2f849bb5954d -r 804d0be33d0b public_html/search.php
--- a/public_html/search.php	Mon Jan 02 13:32:09 2012 -0500
+++ b/public_html/search.php	Mon Jan 02 13:34:24 2012 -0500
@@ -36,6 +36,9 @@
 
 $searchObj = new Search();
 
+// Figure out topic to display
+TOPIC_getTopic('search');
+
 if (isset ($_GET['mode']) && ($_GET['mode'] == 'search')) {
     $display = COM_siteHeader('menu', $LANG09[11]);
     $display .= $searchObj->doSearch();
diff -r 2f849bb5954d -r 804d0be33d0b system/lib-topic.php
--- a/system/lib-topic.php	Mon Jan 02 13:32:09 2012 -0500
+++ b/system/lib-topic.php	Mon Jan 02 13:34:24 2012 -0500
@@ -1129,7 +1129,7 @@
 * @return   void
 *
 */
-function TOPIC_getTopic($type, $id)
+function TOPIC_getTopic($type, $id = '')
 {
     global $_TABLES, $topic;
     
@@ -1147,26 +1147,40 @@
     } else {
         $last_topic = $topic;
     }
-    
+
+    // ***********************************
     // Special Cases
-    If ($type == 'comment') {
+    if ($type == 'comment') {
         if ($id != '') {
             // Find comment objects topic
+            $sql = "SELECT type, sid 
+                FROM {$_TABLES['comments']}  
+                WHERE cid = '$id'";
+        
+            $result = DB_query($sql);
+            $nrows = DB_numRows($result);
+            if ($nrows > 0) {
+                $A = DB_fetchArray($result);
+                
+                // Found comment object so now reset type and id variables
+                $type = $A['type'];
+                $id = $A['sid'];
 
-            
-            
-            
-            
-            
-            
-            
+            } else {
+                // Could not find comment so set topic to nothing (all)
+                $topic = '';
+                $found = true;
+            }
         } else {
             // If no id then probably a submit form
             $topic = $last_topic;
             $found = true;
         }
+    } elseif ($type == 'search') {
+        $topic = $last_topic;
+        $found = true;
     }
-    
+    // ***********************************
     
     if (!$found) {
         if ($last_topic != '') {    



More information about the geeklog-cvs mailing list