[pLog-svn] r6130 - in plugins/branches/lifetype-1.2/closecomments: . class/security
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Wed Dec 26 14:55:29 EST 2007
Author: jondaley
Date: 2007-12-26 14:55:29 -0500 (Wed, 26 Dec 2007)
New Revision: 6130
Modified:
plugins/branches/lifetype-1.2/closecomments/class/security/closecomments.class.php
plugins/branches/lifetype-1.2/closecomments/pluginclosecomments.class.php
Log:
fixed http://bugs.lifetype.net/view.php?id=1427 where php5 is returning a reference and causing issues
Modified: plugins/branches/lifetype-1.2/closecomments/class/security/closecomments.class.php
===================================================================
--- plugins/branches/lifetype-1.2/closecomments/class/security/closecomments.class.php 2007-12-24 20:35:56 UTC (rev 6129)
+++ plugins/branches/lifetype-1.2/closecomments/class/security/closecomments.class.php 2007-12-26 19:55:29 UTC (rev 6130)
@@ -33,6 +33,13 @@
return $result;
}
+ // if this is already rejected, there is no reason to do anything here
+ if( $request->getValue( "op" ) == "AddComment" &&
+ $this->_pipelineRequest->getRejectedState() )
+ {
+ return new PipelineResult();
+ }
+
// otherwise let's proceed
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
$articles = new Articles();
@@ -51,7 +58,12 @@
return $result;
}
- $postDate = $article->getDateObject();
+ // getDateObject returns a reference in PHP5,
+ // so we need a copy to avoid changing the original
+ $sharedDate = $article->getDateObject();
+ $postDate = new Timestamp();
+ $postDate->copy($sharedDate);
+
$settings = $blogInfo->getSettings();
$period = $settings->getValue( "plugin_closecomments_period", DEFAULT_CLOSECOMMENTS_PERIOD );
$postDate->addSeconds( $period * 24 * 3600 );
@@ -60,7 +72,7 @@
//print("date+period = ".$postDate->getTimestamp()." - now = ".$now->getTimestamp()."<br/>");
if( $postDate->getTimestamp() < $now->getTimestamp()) {
- //print( "Closing comments!" );
+// print( "Closing comments!" );
lt_include( PLOG_CLASS_PATH."class/template/cachecontrol.class.php" );
if( $article->getCommentsEnabled()) {
$article->setCommentsEnabled( false );
Modified: plugins/branches/lifetype-1.2/closecomments/pluginclosecomments.class.php
===================================================================
--- plugins/branches/lifetype-1.2/closecomments/pluginclosecomments.class.php 2007-12-24 20:35:56 UTC (rev 6129)
+++ plugins/branches/lifetype-1.2/closecomments/pluginclosecomments.class.php 2007-12-26 19:55:29 UTC (rev 6130)
@@ -16,7 +16,7 @@
$this->id = "closecomments";
$this->author = "The LifeType Team";
- $this->version = "20070331";
+ $this->version = "20071226";
$this->desc = "Allows to automatically close comments for posts that are older than a configurable certain date";
// register our admin actions and menu entries
@@ -52,15 +52,17 @@
// get the post and check if we should close its comments, based on the current settings
$article = $params["article"];
- $postDate = $article->getDateObject();
+ // getDateObject returns a reference in PHP5,
+ // so we need a copy to avoid changing the original
+ $sharedDate = $article->getDateObject();
+ $postDate = new Timestamp();
+ $postDate->copy($sharedDate);
$period = $settings->getValue( "plugin_closecomments_period", DEFAULT_CLOSECOMMENTS_PERIOD );
$postDate->addSeconds( $period * 24 * 3600 );
$now = new Timestamp();
- //print("date+period = ".$postDate->getTimestamp()." - now = ".$now->getTimestamp()."<br/>");
-
if( $postDate->getTimestamp() < $now->getTimestamp()) {
- //print( "Closing comments!" );
+// print( "Closing comments!" );
lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
if( $article->getCommentsEnabled()) {
$article->setCommentsEnabled( false );
More information about the pLog-svn
mailing list