function perform()
 {
     // fetch the data
     $this->_filteredContentRule = $this->_request->getValue("filteredContent");
     $this->_reason = $this->_request->getValue("reason");
     // create the dao object and add the info to the db
     $filteredContents = new FilteredContents();
     $content = $filteredContents->getBlogFilteredContent($this->_contentId, 0);
     // check if we could find the information, or give up otherwise...
     if (!$content) {
         $this->_view = new AdminFilteredContentView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_fetching_filtered_content"));
         $this->setCommonData();
         return false;
     }
     $content->setRegExp($this->_filteredContentRule);
     $content->setReason($this->_reason);
     $this->notifyEvent(EVENT_PRE_FILTERED_CONTENT_UPDATE, array("content" => &$content));
     $result = $filteredContents->updateFilteredContent($content);
     // and give some feedback to the user
     if (!$result) {
         $this->_view = new AdminFilteredContentView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_updating_blocked_content"));
         $this->setCommonData();
         return false;
     }
     $this->notifyEvent(EVENT_POST_FILTERED_CONTENT_UPDATE, array("content" => &$content));
     $this->_view = new AdminFilteredContentView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->tr("blocked_content_updated_ok"));
     $this->setCommonData();
     // clear the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     return true;
 }
 function render()
 {
     $blogSettings = $this->_blogInfo->getSettings();
     $pluginEnabled = $blogSettings->getValue("plugin_contentfilter_enabled");
     $contents = new FilteredContents();
     $filteredContent = $contents->getBlogFilteredContent($this->_contentId, $this->_blogInfo->getId());
     $this->setValue("pluginEnabled", $pluginEnabled);
     $this->setValue("filteredcontent", $filteredContent);
     if (!$pluginEnabled) {
         $locale = $this->_blogInfo->getLocale();
         $text = $locale->tr("error_contentfilter_not_enabled");
         $this->setErrorMessage($text);
     }
     parent::render();
 }
 function perform()
 {
     // fetch the data
     $this->_contentId = $this->_request->getValue("contentId");
     // fetch the filtered content that we're going to edit
     $contents = new FilteredContents();
     $filteredContent = $contents->getBlogFilteredContent($this->_contentId, 0);
     if (!$filteredContent) {
         $this->_view = new AdminFilteredContentView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_fetching_filtered_content"));
         $this->setCommonData();
         return false;
     }
     $this->_view = new AdminEditFilteredContentView($this->_blogInfo, $this->_contentId);
     $this->setCommonData();
     return true;
 }
 function _deleteFilteredContents()
 {
     // get the content that has been filtered by this blog
     $filteredContents = new FilteredContents();
     // loop through the array of things to remove
     $errorMessage = "";
     $successMessage = "";
     $numOk = 0;
     foreach ($this->_deleteFilteredContents as $filteredContentId) {
         // fetch the content
         $filteredContent = $filteredContents->getBlogFilteredContent($filteredContentId, 0);
         $this->notifyEvent(EVENT_PRE_FILTERED_CONTENT_DELETE, array("content" => &$filteredContent));
         // first remove it
         if (!$filteredContents->removeBlogFilteredContent($filteredContentId, $filteredContent->getBlogId())) {
             $errorMessage .= $this->_locale->pr("error_deleting_content", $filteredContent->getRegExp(false)) . "<br/>";
         } else {
             $numOk++;
             if ($numOk > 1) {
                 $successMessage = $this->_locale->pr("contents_deleted_ok", $numOk);
             } else {
                 $successMessage = $this->_locale->pr("content_deleted_ok", $filteredContent->getRegExp(false));
             }
             $this->notifyEvent(EVENT_POST_FILTERED_CONTENT_DELETE, array("content" => &$filteredContent));
         }
     }
     $this->_view = new AdminFilteredContentView($this->_blogInfo);
     if ($errorMessage != "") {
         $this->_view->setErrorMessage($errorMessage);
     }
     if ($successMessage != "") {
         $this->_view->setSuccessMessage($successMessage);
     }
     $this->setCommonData();
     // clear the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     // better to return true if everything fine
     return true;
 }