Exemple #1
0
 /**
  * @see	\wcf\system\SingletonFactory::init()
  */
 protected function init()
 {
     if (isset($_SERVER['HTTP_HOST'])) {
         foreach (ApplicationHandler::getInstance()->getApplications() as $application) {
             if ($application->domainName == $_SERVER['HTTP_HOST']) {
                 $this->inRescueMode = false;
                 break;
             }
         }
         // check if WCF is running as standalone
         if ($this->inRescueMode() && PACKAGE_ID == 1) {
             if (ApplicationHandler::getInstance()->getWCF()->domainName == $_SERVER['HTTP_HOST']) {
                 $this->inRescueMode = false;
             }
         }
     } else {
         // when using cli, no rescue mode is provided
         $this->inRescueMode = false;
     }
     if (class_exists('wcf\\system\\WCFACP', false)) {
         $this->isACPRequest = true;
     }
     if (PACKAGE_ID) {
         $this->controllers = ControllerCacheBuilder::getInstance()->getData(array('environment' => $this->isACPRequest ? 'admin' : 'user'));
         if (!URL_LEGACY_MODE && URL_CONTROLLER_REPLACEMENT) {
             $controllerAliases = explode("\n", URL_CONTROLLER_REPLACEMENT);
             for ($i = 0, $length = count($controllerAliases); $i < $length; $i++) {
                 $tmp = explode('=', $controllerAliases[$i]);
                 $this->controllerAliases[$tmp[0]] = $tmp[1];
             }
         }
     }
 }
 /**
  * Returns true if given controller name is known to the system, used to
  * prevent aliases colliding with existing ones.
  * 
  * @param	string		$controller
  * @return	boolean
  */
 protected function isKnownController($controller)
 {
     if ($this->controllers === null) {
         $this->controllers = ControllerCacheBuilder::getInstance()->getData(array('environment' => 'user'));
     }
     $controller = str_replace('-', '', $controller);
     foreach ($this->controllers as $types) {
         foreach ($types as $controllers) {
             if (isset($controllers[$controller])) {
                 return true;
             }
         }
     }
     return false;
 }