/** * Sends cookies. * * @return void */ private function sendCookies() { if (!$this->getResponse()->getCookies()->isEmpty()) { // get default path $defaultPath = EnvironmentUtil::getSitePath(); // get default domain (prepend dot (.) to make cookie available at sub-domains) $defaultDomain = sprintf('.%s', EnvironmentUtil::getSiteUrl()->getHost()); // set all the cookies /** @var \Ableron\Lib\Http\HttpCookie $cookie */ foreach ($this->getResponse()->getCookies() as $cookie) { // make sure cookie path is at least the site path if ($cookie->getPath() === '/') { $cookie->setPath($defaultPath); } // make sure domain is set (do not set localhost as domain as this causes cookies not to be set in Opera/Chrome/IE) if ($cookie->getDomain() === '' && $defaultDomain !== '.localhost') { $cookie->setDomain($defaultDomain); } // set cookie setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpirationTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly()); } } }
/** * Adjusts the apache configuration file (.htaccess). * * @return void */ private function adjustApacheConfigurationFile() { // set htaccess.txt path $htaccessFile = ABLERON_ROOT_DIR . '/htaccess.txt'; // set rewrite base file_put_contents($htaccessFile, str_replace('{{rewriteBase}}', EnvironmentUtil::getSitePath(), file_get_contents($htaccessFile))); // rename htaccess.txt to .htaccess rename($htaccessFile, ABLERON_ROOT_DIR . '/.htaccess'); }