[geeklog-cvs] geeklog: Prevent overwriting existing links when changing the li...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Oct 3 16:39:04 EDT 2008


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/10585aeefd17
changeset: 6418:10585aeefd17
user:      Dirk Haun <dirk at haun-online.de>
date:      Fri Oct 03 22:38:53 2008 +0200
description:
Prevent overwriting existing links when changing the link ID

diffstat:

2 files changed, 18 insertions(+), 4 deletions(-)
public_html/admin/plugins/links/index.php |   18 ++++++++++++++----
public_html/docs/history                  |    4 ++++

diffs (44 lines):

diff -r acd44b7538e0 -r 10585aeefd17 public_html/admin/plugins/links/index.php
--- a/public_html/admin/plugins/links/index.php	Fri Oct 03 22:15:16 2008 +0200
+++ b/public_html/admin/plugins/links/index.php	Fri Oct 03 22:38:53 2008 +0200
@@ -273,12 +273,22 @@
         $perm_anon = 2;
     }
 
-    $lid = COM_sanitizeID ($lid);
-    if (empty ($lid)) {
-        if (empty ($old_lid)) {
-            $lid = COM_makeSid ();
+    $lid = COM_sanitizeID($old_lid);
+    $old_lid = COM_sanitizeID($old_lid);
+    if (empty($lid)) {
+        if (empty($old_lid)) {
+            $lid = COM_makeSid();
         } else {
             $lid = $old_lid;
+        }
+    }
+
+    // check for link id change
+    if (!empty($old_lid) && ($lid != $old_lid)) {
+        // check if new lid is already in use
+        if (DB_count($_TABLES['links'], 'lid', $lid) > 0) {
+            // TBD: abort, display editor with all content intact again
+            $lid = $old_lid; // for now ...
         }
     }
 
diff -r acd44b7538e0 -r 10585aeefd17 public_html/docs/history
--- a/public_html/docs/history	Fri Oct 03 22:15:16 2008 +0200
+++ b/public_html/docs/history	Fri Oct 03 22:38:53 2008 +0200
@@ -21,6 +21,10 @@
 
 - Updated Polish language files, provided by Robert Stadnik
 - Updated Slovenian language file for the Links plugin, provided by gape
+
+Links plugin
+------------
+- Prevent overwriting existing links when changing the link ID [Dirk]
 
 Polls plugin
 ------------



More information about the geeklog-cvs mailing list