/** * Test Get and Set the site Status * * @return void * * @covers \Rcm\Entity\Site */ public function testGetAndSetStatus() { $status = 'A'; $this->site->setStatus($status); $actual = $this->site->getStatus(); $this->assertEquals($status, $actual); }
/** * Test Get and Set the site Status * * @return void * * @covers \Rcm\Entity\Site */ public function testGetAndSetStatus() { $status = Site::STATUS_ACTIVE; $this->site->setStatus($status); $actual = $this->site->getStatus(); $this->assertEquals($status, $actual); }
/** * Check the domain is a known domain for the CMS. If not the primary, it will * redirect the user to the primary domain. Useful for multiple domain sites. * * @param MvcEvent $event Zend MVC Event * * @return null|Response */ public function checkDomain(MvcEvent $event) { /** @var \Zend\Http\PhpEnvironment\Request $request */ $request = $event->getRequest(); $serverParam = $request->getServer(); $currentDomain = $serverParam->get('HTTP_HOST'); if (empty($currentDomain)) { // We are on CLI return null; } if (!$this->currentSite->getSiteId() || $this->currentSite->getStatus() != 'A') { if (empty($this->config['Rcm']['defaultDomain']) || $this->config['Rcm']['defaultDomain'] == $this->currentSite->getDomain()->getDomainName()) { $response = new Response(); $response->setStatusCode(404); $event->stopPropagation(true); return $response; } $response = new Response(); $response->setStatusCode(302); $response->getHeaders()->addHeaderLine('Location', '//' . $this->config['Rcm']['defaultDomain']); $event->stopPropagation(true); return $response; } $primaryCheck = $this->currentSite->getDomain()->getPrimary(); /** * If the IP is not a domain and is not the primary, redirect to primary */ if (!$this->ipValidator->isValid($currentDomain) && !empty($primaryCheck) && $primaryCheck->getDomainName() != $currentDomain) { $response = new Response(); $response->setStatusCode(302); $response->getHeaders()->addHeaderLine('Location', '//' . $primaryCheck->getDomainName()); $event->stopPropagation(true); return $response; } return null; }