[geeklog-cvs] geeklog: Fixed bug if you changed the staticpage id and it was a...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Sep 18 14:06:34 EDT 2010


changeset 7976:62d83c93f503
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/62d83c93f503
user: Tom <websitemaster at cogeco.net>
date: Sat Sep 18 14:04:38 2010 -0400
description:
Fixed bug if you changed the staticpage id and it was a template. Other pages that used the template where not updated with the new template id

diffstat:

 plugins/staticpages/services.inc.php |  12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diffs (29 lines):

diff -r f5141a9d84e2 -r 62d83c93f503 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Fri Sep 17 09:52:21 2010 -0400
+++ b/plugins/staticpages/services.inc.php	Sat Sep 18 14:04:38 2010 -0400
@@ -400,6 +400,12 @@
             $meta_description = "";
             $meta_keywords = "";
         } else {
+            // See if it was a template before, if so and option changed, remove use from other pages
+            if (DB_getItem($_TABLES['staticpage'], 'template_flag', "sp_id = '$sp_old_id'") == 1) {
+                $sql = "UPDATE {$_TABLES['staticpage']} SET template_id = '' WHERE template_id = '$sp_old_id'";
+                $result = DB_query($sql);
+            }            
+            
             if ($template_id != '') {
                 // If using a template, make sure php disabled
                 $sp_php = 0;
@@ -457,6 +463,12 @@
                         ."'$sp_inblock','$postmode'");
 
         if ($delete_old_page && !empty ($sp_old_id)) {
+            // If a template and the id changed, update any staticpages that use it
+            if ($template_flag == 1) {
+                $sql = "UPDATE {$_TABLES['staticpage']} SET template_id = '$sp_id' WHERE template_id = '$sp_old_id'";
+                $result = DB_query($sql);            
+            }
+            
             DB_delete($_TABLES['staticpage'], 'sp_id', $sp_old_id);
         }
 



More information about the geeklog-cvs mailing list