[pLog-svn] r6062 - in plugins/branches/lifetype-1.2/editcomments: . class/action locale

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Mon Nov 19 23:07:47 EST 2007


Author: jondaley
Date: 2007-11-19 23:07:47 -0500 (Mon, 19 Nov 2007)
New Revision: 6062

Modified:
   plugins/branches/lifetype-1.2/editcomments/class/action/admineditcommentaction.class.php
   plugins/branches/lifetype-1.2/editcomments/class/action/adminedittrackbackaction.class.php
   plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatecommentaction.class.php
   plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatetrackbackaction.class.php
   plugins/branches/lifetype-1.2/editcomments/locale/locale_en_UK.php
   plugins/branches/lifetype-1.2/editcomments/plugineditcomments.class.php
Log:
added permission checks to editing of comments and trackbacks.  fixes http://bugs.lifetype.net/view.php?id=1418

Modified: plugins/branches/lifetype-1.2/editcomments/class/action/admineditcommentaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/class/action/admineditcommentaction.class.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/class/action/admineditcommentaction.class.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -10,6 +10,7 @@
 	
 		function AdminEditCommentAction( $actionInfo, $request ){
 			$this->AdminAction( $actionInfo, $request );
+            $this->requirePermission( "view_comments" );
 		}
 		
 		function perform(){

Modified: plugins/branches/lifetype-1.2/editcomments/class/action/adminedittrackbackaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/class/action/adminedittrackbackaction.class.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/class/action/adminedittrackbackaction.class.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -10,6 +10,7 @@
 	
 		function AdminEditTrackbackAction( $actionInfo, $request ){
 			$this->AdminAction( $actionInfo, $request );
+            $this->requirePermission( "view_trackbacks" );
 		}
 		
 		function perform(){

Modified: plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatecommentaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatecommentaction.class.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatecommentaction.class.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -27,6 +27,7 @@
     
     function AdminUpdateCommentAction($actionInfo, $request){
         $this->AdminAction($actionInfo, $request);
+        $this->requirePermission( "update_comment" );
 
         $this->_op = $actionInfo->getActionParamValue();
         if($this->_request->getValue("cancel")){
@@ -38,8 +39,6 @@
         $this->_articleId = $this->_request->getValue( "articleId" );
 
         if($this->_op == "updateComment"){
-            $view = new AdminEditCommentView($this->_blogInfo);
-
             $this->registerFieldValidator("commentId", new IntegerValidator());
             $this->registerFieldValidator("commentText", new StringValidator());
             $this->registerFieldValidator("authorName", new StringValidator());
@@ -51,7 +50,10 @@
             $this->registerField("commentDateTime");
             $this->registerField("commentIp");
             
-            $view->setErrorMessage( $this->_locale->tr("invalid_data"));
+            $this->_commentId = $this->_request->getValue("commentId");
+            $view = new AdminEditCommentView($this->_blogInfo, $this->_commentId);
+
+            $view->setErrorMessage( $this->_locale->tr("pluginEditCommentsInvalidData"));
             $this->setValidationErrorView( $view );
             $this->_fetchFields();
         }
@@ -60,7 +62,6 @@
 
     function _fetchFields(){
         lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-        $this->_commentId = $this->_request->getValue("commentId");
             // TODO, be able to change parent?  drop down list?
             //$this->_parentId  = $this->_request->getValue( "parentId" );
             //if( $this->_parentId == null || $this->_parentId == "" )

Modified: plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatetrackbackaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatetrackbackaction.class.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/class/action/adminupdatetrackbackaction.class.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -27,6 +27,7 @@
     
     function AdminUpdateTrackbackAction($actionInfo, $request){
         $this->AdminAction($actionInfo, $request);
+        $this->requirePermission( "update_trackback" );
 
         $this->_op = $actionInfo->getActionParamValue();
         if($this->_request->getValue("cancel")){

Modified: plugins/branches/lifetype-1.2/editcomments/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/locale/locale_en_UK.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/locale/locale_en_UK.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -9,4 +9,5 @@
 $messages["pluginEditCommentsFailed"] = "Comment editing failed.";
 $messages["pluginEditTrackbacksFailed"] = "Trackback editing failed.";
 $messages["pluginEditCommentsDateFormat"] = "dd/mm/yyyy hh:mm:ss";
+$messages["pluginEditCommentsInvalidData"] = "Invalid data submitted!";
 ?>
\ No newline at end of file

Modified: plugins/branches/lifetype-1.2/editcomments/plugineditcomments.class.php
===================================================================
--- plugins/branches/lifetype-1.2/editcomments/plugineditcomments.class.php	2007-11-20 04:06:54 UTC (rev 6061)
+++ plugins/branches/lifetype-1.2/editcomments/plugineditcomments.class.php	2007-11-20 04:07:47 UTC (rev 6062)
@@ -7,10 +7,10 @@
 			$this->PluginBase($source);
 
 			$this->id = "editcomments";
-			$this->desc = "Allows blog owner to edit comment text";
+			$this->desc = "Allows editing of comments for users with the 'update existing comments' permission.";
 			$this->author = "Jon Daley";
 			$this->locales = Array( "en_UK" );
-            $this->version = "20070511";
+            $this->version = "20071119";
             
 			if($source == "admin")
                 $this->initAdmin();
@@ -64,7 +64,6 @@
                         $match[0], $result);
                 }
                 
-
                 if($res){
                         // regenerate the block, adding the new markup
                     $artId = $result[1];
@@ -75,9 +74,6 @@
                         // and now replace the old block with the new one in the global $content variable
                     $content = str_replace( $match[0], $newStr, $content );
                 }
-                else{
-                    print "couldn't find id";
-                }
             }
             
             $params["content"] = $content;



More information about the pLog-svn mailing list