/** * Carries out the specified action */ 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->_ip = $this->_ip1 . "." . $this->_ip2 . "." . $this->_ip3 . "." . $this->_ip4; $this->_mask = $this->_request->getValue("mask"); $this->_type = $this->_request->getValue("blockType"); $this->_reason = $this->_request->getValue("reason"); $blockedHosts = new BlockedHosts(); $blockedHost = $blockedHosts->getBlockedHost($this->_hostId, $this->_blogInfo->getId()); // check if the info about the blocked host is correct if (!$blockedHost) { $this->_view = new AdminBlogBlockedHostsView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_fetching_blocked_host")); $this->setCommonData(); return false; } // set the new information $blockedHost->setHost($this->_ip); $blockedHost->setReason($this->_reason); $blockedHost->setType($this->_type); $blockedHost->setMask($this->_mask); $this->notifyEvent(EVENT_PRE_BLOCK_HOST_UPDATE, array("host" => &$blockedHost)); if (!$blockedHosts->update($blockedHost)) { $this->_view = new AdminBlogBlockedHostsView($this->_blogInfo); $this->_view->setErrorMessage($this->_locale->tr("error_updating_blocked_host")); $this->setCommonData(); return false; } $this->notifyEvent(EVENT_POST_BLOCK_HOST_UPDATE, array("host" => &$blockedHost)); $this->_view = new AdminBlogBlockedHostsView($this->_blogInfo); $this->_view->setSuccessMessage($this->_locale->tr("blocked_host_updated_ok")); $this->setCommonData(); // clear the cache CacheControl::resetBlogCache($this->_blogInfo->getId()); return true; }