[geeklog-hg] geeklog: Always grab Static page id from the database when displ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Sep 23 21:44:14 EDT 2013


changeset 9311:6b84f53d771e
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/6b84f53d771e
user: Tom <websitemaster at cogeco.net>
date: Mon Sep 23 21:42:40 2013 -0400
description:
Always grab Static page id from the database when displaying a staticpage since some comparisons are case sensitive in php and the cache files while staticpage ids are not.

diffstat:

 plugins/staticpages/functions.inc    |  4 +++-
 plugins/staticpages/services.inc.php |  7 ++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r bd87752c99e6 -r 6b84f53d771e plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Mon Sep 23 21:12:14 2013 -0400
+++ b/plugins/staticpages/functions.inc	Mon Sep 23 21:42:40 2013 -0400
@@ -664,7 +664,9 @@
     $svc_msg = array();
 
     if (PLG_invokeService('staticpages', 'get', $args, $retval, $svc_msg) == PLG_RET_OK) {
-
+        //// Grab page id from database since some comparisons are case sensitive and staticpage ids are not.
+        $page = DB_getItem($_TABLES['staticpage'], 'sp_id', "sp_id = '$page' ");
+        
         if ($mode == 'print') {
             $retval = SP_printPage($page, $retval);
         } elseif ($mode =='autotag') {
diff -r bd87752c99e6 -r 6b84f53d771e plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Mon Sep 23 21:12:14 2013 -0400
+++ b/plugins/staticpages/services.inc.php	Mon Sep 23 21:42:40 2013 -0400
@@ -719,14 +719,14 @@
         $topic_perms .= " GROUP BY sp_id";        
         
         $sql = array();
-        $sql['mysql'] = "SELECT sp_title,sp_page_title,sp_content,sp_hits,created,modified,sp_format,"
+        $sql['mysql'] = "SELECT sp_id,sp_title,sp_page_title,sp_content,sp_hits,created,modified,sp_format,"
                       . "commentcode,meta_description,meta_keywords,template_flag,template_id,draft_flag,"
                       . "owner_id,group_id,perm_owner,perm_group,"
                       . "perm_members,perm_anon,sp_help,sp_php,sp_inblock,cache_time "
                       . "FROM {$_TABLES['staticpage']}, {$_TABLES['topic_assignments']} ta "
                       . "WHERE (sp_id = '$page')" . $perms
                       . " AND ta.type = 'staticpages' AND ta.id = sp_id " . $topic_perms;
-        $sql['mssql'] = "SELECT sp_title,sp_page_title,"
+        $sql['mssql'] = "SELECT sp_id,sp_title,sp_page_title,"
                       . "CAST(sp_content AS text) AS sp_content,sp_hits,"
                       . "created,modified,sp_format,commentcode,"
                       . "CAST(meta_description AS text) AS meta_description,"
@@ -736,7 +736,7 @@
                       . "FROM {$_TABLES['staticpage']}, {$_TABLES['topic_assignments']} ta WHERE (sp_id = '$page')"
                       . $perms
                       . " AND ta.type = 'staticpages' AND ta.id = sp_id " . $topic_perms;
-        $sql['pgsql'] = "SELECT sp_title,sp_page_title,sp_content,sp_hits,"
+        $sql['pgsql'] = "SELECT sp_id,sp_title,sp_page_title,sp_content,sp_hits,"
                       . "created,modified,sp_format,"
                       . "commentcode,meta_description,meta_keywords,template_flag,template_id,draft_flag,"
                       . "owner_id,group_id,perm_owner,perm_group,"
@@ -753,6 +753,7 @@
 
         if (!($error)) {
             $output = DB_fetchArray($result, false);
+            $page = $output['sp_id']; // reset page id so case mimics id perfectly since this affects the cache file and canonical link
 
             // WE ASSUME $output doesn't have any confidential fields
             // Generate output now (omly if not grabing a template since template is combined with variables first and then generated)



More information about the geeklog-cvs mailing list