[pLog-svn] r752 - plog/trunk/class/action/admin
oscar at devel.plogworld.net
oscar at devel.plogworld.net
Tue Jan 18 15:37:04 GMT 2005
Author: oscar
Date: 2005-01-18 15:37:04 +0000 (Tue, 18 Jan 2005)
New Revision: 752
Added:
plog/trunk/class/action/admin/admincleanupaction.class.php
Log:
forgot to add this class from the previous commit :)
Added: plog/trunk/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admincleanupaction.class.php 2005-01-18 15:36:40 UTC (rev 751)
+++ plog/trunk/class/action/admin/admincleanupaction.class.php 2005-01-18 15:37:04 UTC (rev 752)
@@ -0,0 +1,74 @@
+<?php
+
+ /**
+ * @package admin
+ */
+
+
+ include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/view/admin/admintemplatedview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+ include_once( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
+
+ /**
+ * Action that shows a form to change the settings of the current blog.
+ */
+ class AdminCleanupAction extends SiteAdminAction
+ {
+ var $_message;
+ var $_op;
+
+ function AdminCleanupAction( $actionInfo, $request )
+ {
+ $this->SiteAdminAction( $actionInfo, $request );
+
+ $this->_op = $actionInfo->getActionParamValue();
+ $this->_message = "";
+ }
+
+ /**
+ * cleans up posts. Returns true if successful or false otherwise
+ */
+ function cleanupPosts()
+ {
+ $articles = new Articles();
+ $articles->purgePosts();
+
+ $this->_message = $this->_locale->tr("posts_purged_ok");
+
+ return true;
+ }
+
+ /**
+ * cleans up spam comments. Returns true if successful or false otheriwse
+ */
+ function cleanupComments()
+ {
+ $comments = new ArticleComments();
+ $comments->purgeSpamComments();
+
+ $this->_message = $this->_locale->tr("spam_comments_purged_ok");
+
+ return true;
+ }
+
+ function perform()
+ {
+ // decide what we're going to do...
+ if( $this->_op == "cleanupSpam" ) {
+ $result = $this->cleanupComments();
+ }
+ elseif( $this->_op == "cleanupPosts" ) {
+ $result = $this->cleanupPosts();
+ }
+
+ // create the view and see if there was a success message
+ $this->_view = new AdminTemplatedView( $this->_blogInfo, "cleanup" );
+ if( $result )
+ $this->_view->setSuccessMessage( $this->_message );
+
+ $this->setCommonData();
+
+ return true;
+ }
+ }
\ No newline at end of file
More information about the pLog-svn
mailing list