[geeklog-cvs] geeklog: Use a more efficient implementation of Story::hasConten...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sun Apr 12 11:39:25 EDT 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/4978619d27c6
changeset: 6927:4978619d27c6
user:      Dirk Haun <dirk at haun-online.de>
date:      Sun Apr 12 15:21:52 2009 +0200
description:
Use a more efficient implementation of Story::hasContent (bug #0000858, patch provided by Maciej Cupial)

diffstat:

2 files changed, 18 insertions(+), 4 deletions(-)
public_html/docs/history       |    2 ++
system/classes/story.class.php |   20 ++++++++++++++++----

diffs (49 lines):

diff -r f794788d8253 -r 4978619d27c6 public_html/docs/history
--- a/public_html/docs/history	Sun Apr 12 12:34:06 2009 +0200
+++ b/public_html/docs/history	Sun Apr 12 15:21:52 2009 +0200
@@ -11,6 +11,8 @@
 + Comment moderation and editable comments, by Jared Wenerd
 
 Other changes:
+- Use a more efficient implementation of Story::hasContent (bug #0000858, patch
+  provided by Maciej Cupial)
 - Make sure formerly optional config items can be disabled (bug #0000846) [Dirk]
 - Re-introduced function get_SPX_Ver in the install script, which is still
   needed when upgrading from old Geeklog releases (reported by Sheila) [Dirk]
diff -r f794788d8253 -r 4978619d27c6 system/classes/story.class.php
--- a/system/classes/story.class.php	Sun Apr 12 12:34:06 2009 +0200
+++ b/system/classes/story.class.php	Sun Apr 12 15:21:52 2009 +0200
@@ -344,9 +344,17 @@
      */
     function hasContent()
     {
-        $test = $this->_title . $this->_introtext . $this->_bodytext;
-        $test = trim($test);
-        return ($test != '');
+        if (trim($this->_title) != '') {
+            return true;
+        }
+        if (trim($this->_introtext) != '') {
+            return true;
+        }
+        if (trim($this->_bodytext) != '') {
+            return true;
+        }
+
+        return false;
     }
 
     /**
@@ -386,7 +394,11 @@
         } else {
             $this->_expire = '0';
         }
-        $this->_comment_expire = $story['cmt_expire_unix'];
+        if (!empty($story['cmt_expire_unix'])) {
+            $this->_comment_expire = $story['cmt_expire_unix'];
+        } else {
+            $this->_comment_expire = '0';
+        }
 
         // Store the original SID
         $this->_originalSid = $this->_sid;



More information about the geeklog-cvs mailing list