⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admindeleteblogaction.class.php

📁 一个用PHP编写的
💻 PHP
字号:
<?php	lt_include( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );    lt_include( PLOG_CLASS_PATH."class/view/admin/adminsiteblogslistview.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );    lt_include( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );    lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );    /**     * \ingroup Action     * @private     *	 * it does not delete blogs from the system but simply set them to disabled	 */	class AdminDeleteBlogAction extends AdminAction	{		var $_op;		var $_blogIds;    	function AdminDeleteBlogAction( $actionInfo, $request )        {        	$this->AdminAction( $actionInfo, $request );			// set up the data validation stuff        	$this->_op = $actionInfo->getActionParamValue();        	if( $this->_op == "deleteBlogs" )        		$this->registerFieldvalidator( "blogIds", new ArrayValidator());        	else        		$this->registerFieldValidator( "blogId", new IntegerValidator());        	$view = new AdminSiteBlogsListView( $this->_blogInfo );        	$view->setErrorMessage( $this->_locale->tr("error_no_blogs_selected"));        	$this->setValidationErrorView( $view );			$this->requireAdminPermission( "update_site_blog" );        }        function perform()        {        	if( $this->_op == "deleteBlog" ) {        		$this->_blogIds = Array();        		$blogId = $this->_request->getValue( "blogId" );        		$this->_blogIds[] = $blogId;        	}        	else        		$this->_blogIds = $this->_request->getValue( "blogIds" );        	$this->_disableBlogs();        }        //        function disableBlog( $blogIn		/**		 * @private		 */        function _disableBlogs()        {        	// get the default blog id        	$config =& Config::getConfig();            $defaultBlogId = $config->getValue( "default_blog_id" );        	$errorMessage = "";        	$successMessage = "";        	$totalOk = 0;            $blogs = new Blogs();        	foreach( $this->_blogIds as $blogId ) {            	// get some info about the blog before deleting it                $blogInfo = $blogs->getBlogInfo( $blogId );				if( !$blogInfo ) {					$errorMessage .= $this->_locale->pr("error_deleting_blog2", $blogId)."<br/>";				}				else {					$this->notifyEvent( EVENT_PRE_BLOG_DELETE, Array( "blog" => &$blogInfo ));					// make sure we're not deleting the default one!					if( $defaultBlogId == $blogId ) {						$errorMessage .= $this->_locale->pr("error_blog_is_default_blog", $blogInfo->getBlog())."<br />";					}					else {					   // disable the blog					    $blogInfo->setStatus( BLOG_STATUS_DISABLED );						if( $blogs->updateBlog( $blogInfo )) {							$totalOk++;													if( $totalOk < 2 )								$successMessage = $this->_locale->pr("blog_deleted_ok", $blogInfo->getBlog());							else								$successMessage = $this->_locale->pr( "blogs_deleted_ok", $totalOk );														$this->notifyEvent( EVENT_POST_BLOG_DELETE, Array( "blog" => &$blogInfo ));						}						else							$errorMessage .= $this->_locale->pr("error_deleting_blog", $blogInfo->getBlog())."<br/>";					}				}			}            $this->_view = new AdminSiteBlogsListView( $this->_blogInfo );            if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );            if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );            $this->setCommonData();            return true;        }    }?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -