[geeklog-cvs] geeklog: Update the topic id in static pages when it changes

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Mar 27 13:34:25 EDT 2010


changeset 7847:b75f38deef74
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/b75f38deef74
user: Dirk Haun <dirk at haun-online.de>
date: Sat Mar 27 17:48:50 2010 +0100
description:
Update the topic id in static pages when it changes

diffstat:

 plugins/staticpages/functions.inc |  20 ++++++++++++++++++++
 public_html/admin/topic.php       |   7 ++++++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diffs (52 lines):

diff -r c03516c87845 -r b75f38deef74 plugins/staticpages/functions.inc
--- a/plugins/staticpages/functions.inc	Sat Mar 27 16:13:34 2010 +0100
+++ b/plugins/staticpages/functions.inc	Sat Mar 27 17:48:50 2010 +0100
@@ -1795,4 +1795,24 @@
     return $tmp;
 }
 
+/**
+* Callback function when an item was saved
+*
+* @param    string  $id     (unused) ID of item being saved
+* @param    string  $type   type of item ('article', 'staticpages', ...)
+* @param    string  $old_id (unused) previous ID of item, if != $id
+* @return   void
+* @see      PLG_itemSaved
+*
+*/
+function plugin_itemsaved_staticpages($id, $type, $old_id)
+{
+    global $_TABLES;
+
+    // we're really only interested in Topic ID changes
+    if (($type == 'topic') && !empty($old_id) && ($id != $old_id)) {
+        DB_change($_TABLES['staticpage'], 'sp_tid', $id, 'sp_tid', $old_id);
+    }
+}
+
 ?>
diff -r c03516c87845 -r b75f38deef74 public_html/admin/topic.php
--- a/public_html/admin/topic.php	Sat Mar 27 16:13:34 2010 +0100
+++ b/public_html/admin/topic.php	Sat Mar 27 17:48:50 2010 +0100
@@ -2,7 +2,7 @@
 
 /* Reminder: always indent with 4 spaces (no tabs). */
 // +---------------------------------------------------------------------------+
-// | Geeklog 1.6                                                               |
+// | Geeklog 1.7                                                               |
 // +---------------------------------------------------------------------------+
 // | topic.php                                                                 |
 // |                                                                           |
@@ -412,6 +412,11 @@
 
         DB_save($_TABLES['topics'],'tid, topic, imageurl, meta_description, meta_keywords, sortnum, limitnews, is_default, archive_flag, owner_id, group_id, perm_owner, perm_group, perm_members, perm_anon',"'$tid', '$topic', '$imageurl', '$meta_description', '$meta_keywords','$sortnum','$limitnews',$is_default,'$is_archive',$owner_id,$group_id,$perm_owner,$perm_group,$perm_members,$perm_anon");
 
+        if ($old_tid != $tid) {
+            PLG_itemSaved($tid, 'topic', $old_tid);
+        } else {
+            PLG_itemSaved($tid, 'topic');
+        }
         // update feed(s) and Older Stories block
         COM_rdfUpToDateCheck('article', $tid);
         COM_olderStuff();



More information about the geeklog-cvs mailing list