[geeklog-cvs] geeklog: Fixed story preview losing the story when the sid alrea...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Jan 12 04:22:44 EST 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/aa686f7bdc05
changeset: 6673:aa686f7bdc05
user:      Dirk Haun <dirk at haun-online.de>
date:      Sat Jan 10 19:10:20 2009 +0100
description:
Fixed story preview losing the story when the sid already existed (bug #0000789). Reason: Duplicate values for different errors - re-numbered STORY_xxx errors.

diffstat:

3 files changed, 22 insertions(+), 19 deletions(-)
public_html/admin/story.php    |    8 +++-----
public_html/docs/history       |    2 ++
system/classes/story.class.php |   31 +++++++++++++++++--------------

diffs (138 lines):

diff -r 1dbd8d39fbd2 -r aa686f7bdc05 public_html/admin/story.php
--- a/public_html/admin/story.php	Sat Jan 10 15:51:48 2009 +0100
+++ b/public_html/admin/story.php	Sat Jan 10 19:10:20 2009 +0100
@@ -8,7 +8,7 @@
 // |                                                                           |
 // | Geeklog story administration page.                                        |
 // +---------------------------------------------------------------------------+
-// | Copyright (C) 2000-2008 by the following authors:                         |
+// | Copyright (C) 2000-2009 by the following authors:                         |
 // |                                                                           |
 // | Authors: Tony Bibbs        - tony AT tonybibbs DOT com                    |
 // |          Mark Limburg      - mlimburg AT users DOT sourceforge DOT net    |
@@ -31,8 +31,6 @@
 // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
 // |                                                                           |
 // +---------------------------------------------------------------------------+
-//
-// $Id: story.php,v 1.270 2008/09/13 07:26:43 mjervis Exp $
 
 /**
 * This is the Geeklog story administration page.
@@ -297,7 +295,7 @@
             return COM_refresh( $_CONF['site_admin_url'] . '/story.php' );
         }
     } elseif( $result == STORY_DUPLICATE_SID) {
-        $display .= COM_errorLog ($LANG24[24], 2);
+        $display .= COM_showMessageText($LANG24[24]);
     }
 
     // Load HTML templates
@@ -344,7 +342,7 @@
         if ($advanced_editormode AND $previewContent != '' ) {
             $story_templates->set_var('preview_content', $previewContent);
         } elseif ($previewContent != '') {
-            $display = COM_startBlock ($LANG24[26], '',
+            $display .= COM_startBlock ($LANG24[26], '',
                             COM_getBlockTemplate ('_admin_block', 'header'));
             $display .= $previewContent;
             $display .= COM_endBlock (COM_getBlockTemplate ('_admin_block', 'footer'));
diff -r 1dbd8d39fbd2 -r aa686f7bdc05 public_html/docs/history
--- a/public_html/docs/history	Sat Jan 10 15:51:48 2009 +0100
+++ b/public_html/docs/history	Sat Jan 10 19:10:20 2009 +0100
@@ -63,6 +63,8 @@
 Jan ??, 2009 (1.5.2)
 ------------
 
+- Fixed story preview losing the story when the sid already existed (bug
+  #0000789) [Dirk]
 - Fixed wrong use of str_replace in STORY_extractLinks (bug #0000794) [Dirk]
 - Added "Send Pings" to the Story Options block (if enabled and allowed for the
   current user) [Dirk]
diff -r 1dbd8d39fbd2 -r aa686f7bdc05 system/classes/story.class.php
--- a/system/classes/story.class.php	Sat Jan 10 15:51:48 2009 +0100
+++ b/system/classes/story.class.php	Sat Jan 10 19:10:20 2009 +0100
@@ -8,7 +8,7 @@
 // |                                                                           |
 // | Geeklog Story Abstraction.                                                |
 // +---------------------------------------------------------------------------+
-// | Copyright (C) 2006-2008 by the following authors:                         |
+// | Copyright (C) 2006-2009 by the following authors:                         |
 // |                                                                           |
 // | Authors: Michael Jervis, mike AT fuckingbrit DOT com                      |
 // +---------------------------------------------------------------------------+
@@ -28,8 +28,6 @@
 // | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
 // |                                                                           |
 // +---------------------------------------------------------------------------+
-//
-// $Id: story.class.php,v 1.36 2008/08/16 18:07:09 dhaun Exp $
 
 /**
  * This file provides a class to represent a story, or article. It provides a
@@ -53,26 +51,28 @@
  * Constants for stories:
  * Loading from database:
  */
+define('STORY_LOADED_OK', 1);
+
 define('STORY_INVALID_SID', -1);
-
 define('STORY_PERMISSION_DENIED', -2);
 define('STORY_EDIT_DENIED', -3);
-define('STORY_LOADED_OK', 1);
+
 /**
  * Constants for Stories:
  * Saving to database
  */
-define('STORY_SAVED', 1);
-define('STORY_SAVED_SUBMISSION', 2);
+define('STORY_SAVED', 2);
+define('STORY_SAVED_SUBMISSION', 3);
+
 /**
  * Constants for Stories:
  * Loading from request.
  */
-define('STORY_DUPLICATE_SID', -1);
-define('STORY_EXISTING_NO_EDIT_PERMISSION', -2);
-define('STORY_NO_ACCESS_PARAMS', -3);
-define('STORY_EMPTY_REQUIRED_FIELDS', -4);
-define('STORY_NO_ACCESS_TOPIC', -5);
+define('STORY_DUPLICATE_SID', -4);
+define('STORY_EXISTING_NO_EDIT_PERMISSION', -5);
+define('STORY_NO_ACCESS_PARAMS', -6);
+define('STORY_EMPTY_REQUIRED_FIELDS', -7);
+define('STORY_NO_ACCESS_TOPIC', -8);
 
 /**
   * Constants for our magic loader
@@ -688,6 +688,8 @@
          * /public_html/admin/story.php
          */
 
+        $retval = STORY_LOADED_OK; // default to success
+
         /* Load the trivial stuff: */
         $this->_loadBasics($array);
 
@@ -702,7 +704,8 @@
         if ($result && (DB_numRows($result) > 0)) {
             /* Sid exists! Is it our article? */
             if ($this->_sid != $this->_originalSid) {
-                return STORY_DUPLICATE_SID;
+                // for story preview: don't abort
+                $retval = STORY_DUPLICATE_SID;
             }
 
             $article = DB_fetchArray($result);
@@ -752,7 +755,7 @@
 
         $this->_sanitizeData();
 
-        return STORY_LOADED_OK;
+        return $retval;
     }
 
     /**



More information about the geeklog-cvs mailing list