function perform()
 {
     // fetch the data
     $this->_ip1 = $this->_request->getValue("ip1");
     $this->_ip2 = $this->_request->getValue("ip2");
     $this->_ip3 = $this->_request->getValue("ip3");
     $this->_ip4 = $this->_request->getValue("ip4");
     $this->_hostIp = $this->_ip1 . "." . $this->_ip2 . "." . $this->_ip3 . "." . $this->_ip4;
     $this->_mask = $this->_request->getValue("mask");
     $this->_blockType = $this->_request->getValue("blockType");
     $this->_reason = $this->_request->getValue("reason");
     // create the dao object and add the info to the db
     $blockedHosts = new BlockedHosts();
     $t = new Timestamp();
     $blockedHost = new BlockedHost($this->_hostIp, $this->_mask, $this->_reason, $t->getTimestamp(), GLOBALLY_BLOCKED_HOST, $this->_blockType, BLOCK_BLACKLIST);
     $this->notifyEvent(EVENT_PRE_BLOCK_HOST_ADD, array("host" => &$blockedHost));
     $result = $blockedHosts->add($blockedHost);
     // and give some feedback to the user
     if (!$result) {
         $this->_view = new AdminNewBlockedHostView($this->_blogInfo);
         $this->_view->setErrorMessage($this->_locale->tr("error_adding_blocked_host"));
         $this->setCommonData();
         return false;
     }
     $this->notifyEvent(EVENT_POST_BLOCK_HOST_ADD, array("host" => &$blockedHost));
     $this->_view = new AdminBlockedHostsView($this->_blogInfo);
     $this->_view->setSuccessMessage($this->_locale->tr("blocked_host_updated_ok"));
     $this->setCommonData();
     // clear the cache
     CacheControl::resetBlogCache($this->_blogInfo->getId());
     return true;
 }
 /**
  * Carries out the specified action
  */
 function perform()
 {
     // if we're blocking a single host, then the mask should be
     // as long as 32 bits
     $blockedHosts = new BlockedHosts();
     $t = new Timestamp();
     $blockedHost = new BlockedHost($this->_host, 32, "Host blocked from posting", $t->getTimestamp(), $this->_blogInfo->getId(), BLOCK_COMMENT_POSTING, BLOCK_BLACKLIST);
     $result = $blockedHosts->add($blockedHost);
     // if there was an error, let the user know about it...
     if (!$result) {
         $this->_view = new AdminErrorView($this->_blogInfo);
         $this->_view->setMessage("There was an error adding this host to the list of blocked hosts.");
         $this->setCommonData();
         return false;
     }
     $this->_view = new AdminMessageView($this->_blogInfo);
     $this->_view->setMessage("Host " . $this->_host . " blocked from posting comments successfully.");
     $this->setCommonData();
     // better to return true if everything fine
     return true;
 }