[geeklog-hg] geeklog: If topic does not exist then error message is displayed...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Mar 23 13:24:48 EDT 2013


changeset 9008:a6f243804067
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/a6f243804067
user: Tom <websitemaster at cogeco.net>
date: Sat Mar 23 13:24:48 2013 -0400
description:
If topic does not exist then error message is displayed (eventually to be a 404 error)

diffstat:

 public_html/index.php |  51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diffs (61 lines):

diff -r ae90c1448a9a -r a6f243804067 public_html/index.php
--- a/public_html/index.php	Sat Mar 23 13:23:38 2013 -0400
+++ b/public_html/index.php	Sat Mar 23 13:24:48 2013 -0400
@@ -83,6 +83,57 @@
     }
 }
 
+// See if user has access to view topic else display message.
+// This check has already been done in lib-common so re check to figure out if 
+// message needs to be displayed.
+if (isset($_GET['topic'])) {
+    $topic_check = COM_applyFilter($_GET['topic']);
+} elseif (isset($_POST['topic'])) {
+    $topic_check = COM_applyFilter($_POST['topic']);
+}
+if ($topic_check != '') {
+    if ($topic_check != DB_getItem($_TABLES['topics'], 'tid', "tid = '$topic_check' " . COM_getPermSQL('AND'))) {
+        // This will eventually be a 404 error. Copied code from below this time
+        // just to keep the same user exerience        
+        $display = '';
+        if (!isset ($_CONF['hide_no_news_msg']) ||
+                ($_CONF['hide_no_news_msg'] == 0)) {
+            $display .= COM_startBlock ($LANG05[1], '',
+                        COM_getBlockTemplate ('_msg_block', 'header')) . $LANG05[2];
+            if (!empty ($topic_check)) {
+                $topicname = DB_getItem ($_TABLES['topics'], 'topic',
+                                         "tid = '$topic_check'");
+                $display .= sprintf ($LANG05[3], $topicname);
+            }
+            $display .= COM_endBlock (COM_getBlockTemplate ('_msg_block', 'footer'));
+        }
+    
+        $display .= PLG_showCenterblock (3, $page, $topic_check); // bottom blocks
+        
+        $header = '';
+        
+        if ($topic)
+        {
+            // Meta Tags
+            if ($_CONF['meta_tags'] > 0) {
+                $result = DB_query ("SELECT meta_description, meta_keywords FROM {$_TABLES['topics']} WHERE tid = '{$topic}'");
+                $A = DB_fetchArray ($result);
+        
+                $meta_description = stripslashes($A['meta_description']);
+                $meta_keywords = stripslashes($A['meta_keywords']);
+                $header .= COM_createMetaTags($meta_description, $meta_keywords);
+            }
+        }
+        
+        $display = COM_createHTMLDocument($display, array('breadcrumbs' => $breadcrumbs, 'headercode' => $header, 'rightblock' => true));
+        
+        // Output page
+        COM_output($display);
+        exit();    
+    }
+}
+
+
 $newstories = false;
 $displayall = false;
 if (isset ($_GET['display'])) {



More information about the geeklog-cvs mailing list