[geeklog-cvs] geeklog: Made sure topic list is passed as category for web serv...

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


changeset 8464:af0c814010a8
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/af0c814010a8
user: Tom <websitemaster at cogeco.net>
date: Fri Dec 30 09:57:00 2011 -0500
description:
Made sure topic list is passed as category for web services.

diffstat:

 plugins/staticpages/functions.inc    |   2 +-
 plugins/staticpages/services.inc.php |   2 +
 public_html/backend/geeklog.rss      |  36 ++++++++++++++
 public_html/comment.php              |   6 ++
 public_html/lib-common.php           |   4 +-
 system/lib-topic.php                 |  87 ++++++++++++++++++++++-------------
 6 files changed, 102 insertions(+), 35 deletions(-)

diffs (220 lines):

diff -r 7746d9dd395b -r af0c814010a8 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sat Dec 24 09:30:00 2011 -0500
+++ b/plugins/staticpages/functions.inc	Fri Dec 30 09:57:00 2011 -0500
@@ -110,8 +110,8 @@
         } else {
             $topic_sql = " AND (ta.tid = '" . TOPIC_ALL_OPTION . "')";
         }
-        $topic_sql .= COM_getTopicSQL('AND', 0, 'ta');
     }
+    $topic_sql .= COM_getTopicSQL('AND', 0, 'ta');
 
     $sql = "SELECT sp.sp_id, sp.sp_label 
         FROM {$_TABLES['staticpage']} sp, {$_TABLES['topic_assignments']} ta   
diff -r 7746d9dd395b -r af0c814010a8 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Sat Dec 24 09:30:00 2011 -0500
+++ b/plugins/staticpages/services.inc.php	Fri Dec 30 09:57:00 2011 -0500
@@ -794,6 +794,7 @@
             $output['title']        = $output['sp_title'];
             $output['page_title']   = $output['sp_page_title'];
             //$output['category']     = array($output['sp_tid']);
+            $output['category']     = TOPIC_getTopicIdsForObject('staticpages', $page);
             $output['content']      = $output['sp_content'];
             $output['content_type'] = 'html';
 
@@ -855,6 +856,7 @@
                 $output_item['title']        = $output_item['sp_title'];
                 $output_item['page_title']   = $output_item['sp_page_title'];
                 //$output_item['category']     = array($output_item['sp_tid']);
+                $output_item['category']     = TOPIC_getTopicIdsForObject('staticpages', $page);
                 $output_item['content']      = $output_item['sp_content'];
                 $output_item['content_type'] = 'html';
 
diff -r 7746d9dd395b -r af0c814010a8 public_html/backend/geeklog.rss
--- a/public_html/backend/geeklog.rss	Sat Dec 24 09:30:00 2011 -0500
+++ b/public_html/backend/geeklog.rss	Fri Dec 30 09:57:00 2011 -0500
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+
+<rss version="2.0" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
+<channel>
+<title>Geeklog Site</title>
+<link>http://192.168.1.201</link>
+<description>Another Nifty Geeklog Site</description>
+<managingEditor>admin at 192.168.1.201</managingEditor>
+<webMaster>admin at 192.168.1.201</webMaster>
+<copyright>Copyright 2011 Geeklog Site</copyright>
+<generator>Geeklog</generator>
+<pubDate>Sat, 24 Dec 2011 09:01:19 -0500</pubDate>
+<language>en-gb</language>
+<atom:link href="http://192.168.1.201/backend/geeklog.rss" rel="self" type="application/rss+xml" />
+<item>
+<title>Ha</title>
+<link>http://192.168.1.201/article.php?story=Ha</link>
+<guid isPermaLink="true">http://192.168.1.201/article.php?story=Ha</guid>
+<pubDate>Fri, 23 Dec 2011 15:30:59 -0500</pubDate>
+<comments>http://192.168.1.201/article.php?story=Ha#comments</comments>
+<dc:subject>Ha</dc:subject>
+<description>Ha Sto ...</description>
+<trackback:ping>http://192.168.1.201/trackback.php?id=Ha</trackback:ping>
+</item>
+<item>
+<title>Welcome to Geeklog!</title>
+<link>http://192.168.1.201/article.php?story=welcome</link>
+<guid isPermaLink="true">http://192.168.1.201/article.php?story=welcome</guid>
+<pubDate>Fri, 23 Dec 2011 15:28:51 -0500</pubDate>
+<comments>http://192.168.1.201/article.php?story=welcome#comments</comments>
+<dc:subject>Geeklog</dc:subject>
+<description><p>Welcome and let me be the first to congratulate you on installing Geeklog. Please take the time to read everything in the <a href="docs/english/index.html">docs directory</a>. Geeklog now has enhanced, user-based security.  You should thoroughly understand how these work before you run a production Geeklog Site.</p>
<p>To log into your new Geeklog site, please use this account:</p>
<p>Username: <b>Admin</b><br />
Password: <b>password</b></p><p><b>And don't forget to <a href="usersettings.php">change your password</a> after logging in!</b> ...</p></description>
+<trackback:ping>http://192.168.1.201/trackback.php?id=welcome</trackback:ping>
+</item>
+</channel>
+</rss>
diff -r 7746d9dd395b -r af0c814010a8 public_html/comment.php
--- a/public_html/comment.php	Sat Dec 24 09:30:00 2011 -0500
+++ b/public_html/comment.php	Fri Dec 30 09:57:00 2011 -0500
@@ -391,6 +391,12 @@
     $formtype = COM_applyFilter ($_REQUEST['formtype']);
 }
 
+// Get comment id, may not be there...will handle in function
+$cid = ''; 
+if (isset ($_REQUEST['cid'])) {
+    $cid = COM_applyFilter ($_REQUEST['cid']);
+}
+TOPIC_getTopic('comment', $cid);
 
 switch ($mode) {
 case $LANG03[28]: // Preview Changes (for edit)
diff -r 7746d9dd395b -r af0c814010a8 public_html/lib-common.php
--- a/public_html/lib-common.php	Sat Dec 24 09:30:00 2011 -0500
+++ b/public_html/lib-common.php	Fri Dec 30 09:57:00 2011 -0500
@@ -34,8 +34,8 @@
 // +---------------------------------------------------------------------------+
 
 // Prevent PHP from reporting uninitialized variables
-error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR);
-
+//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_USER_ERROR);
+error_reporting(E_ALL);
 /**
 * This is the common library for Geeklog.  Through our code, you will see
 * functions with the COM_ prefix (e.g. COM_siteHeader()).  Any such functions
diff -r 7746d9dd395b -r af0c814010a8 system/lib-topic.php
--- a/system/lib-topic.php	Sat Dec 24 09:30:00 2011 -0500
+++ b/system/lib-topic.php	Fri Dec 30 09:57:00 2011 -0500
@@ -976,7 +976,7 @@
 }
 
 /**
-* Retrieve default topic from selection
+* Retrieve topics from selection or retrieve topics for object from db
 *
 * @param    string          $type   Type of object to find topic access about. If 'topic' then will check post array for topic selection control 
 * @param    string/array    $id     ID of block or topic to check if block topic access
@@ -1134,6 +1134,7 @@
     global $_TABLES, $topic;
     
     $find_another = false;
+    $found = false;
     
     // Double check
     $topic = COM_applyFilter($topic);
@@ -1147,41 +1148,63 @@
         $last_topic = $topic;
     }
     
-    if ($last_topic != '') {    
-        // see if object belongs to topic
-        $sql = "SELECT ta.* 
-            FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta 
-            WHERE t.tid = ta.tid  
-            AND ta.type = '$type' AND ta.id = '$id' AND ta.tid = '$last_topic' 
-            " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't');
+    // Special Cases
+    If ($type == 'comment') {
+        if ($id != '') {
+            // Find comment objects topic
+
+            
+            
+            
+            
+            
+            
+            
+        } else {
+            // If no id then probably a submit form
+            $topic = $last_topic;
+            $found = true;
+        }
+    }
     
-        $result = DB_query($sql);
-        $nrows = DB_numRows($result);
-        if ($nrows > 0) {
-            $topic = $last_topic;
+    
+    if (!$found) {
+        if ($last_topic != '') {    
+            // see if object belongs to topic
+            $sql = "SELECT ta.* 
+                FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta 
+                WHERE t.tid = ta.tid  
+                AND ta.type = '$type' AND ta.id = '$id' AND ta.tid = '$last_topic' 
+                " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't');
+        
+            $result = DB_query($sql);
+            $nrows = DB_numRows($result);
+            if ($nrows > 0) {
+                $topic = $last_topic;
+            } else {
+                $find_another = true;
+            }
         } else {
             $find_another = true;
         }
-    } else {
-        $find_another = true;
-    }
-    
-    if ($find_another) {
-        // Find another topic to set, most likely default
-        $sql = "SELECT ta.* 
-            FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta 
-            WHERE t.tid = ta.tid  
-            AND ta.type = '$type' AND ta.id = '$id' 
-            " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "
-            ORDER by ta.tdefault DESC";
-    
-        $result = DB_query($sql);
-        $nrows = DB_numRows($result);
-        if ($nrows > 0) {
-            $A = DB_fetchArray($result);
-            $topic = $A['tid'];
-        } else {
-            $topic = '';
+        
+        if ($find_another) {
+            // Find another topic to set, most likely default
+            $sql = "SELECT ta.* 
+                FROM {$_TABLES['topics']} t, {$_TABLES['topic_assignments']} ta 
+                WHERE t.tid = ta.tid  
+                AND ta.type = '$type' AND ta.id = '$id' 
+                " . COM_getLangSQL('tid', 'AND', 't') . COM_getPermSQL('AND', 0, 2, 't') . "
+                ORDER by ta.tdefault DESC";
+        
+            $result = DB_query($sql);
+            $nrows = DB_numRows($result);
+            if ($nrows > 0) {
+                $A = DB_fetchArray($result);
+                $topic = $A['tid'];
+            } else {
+                $topic = '';
+            }
         }
     }
 }



More information about the geeklog-cvs mailing list