Example #1
0
 /**
  * Sets up correct application name
  */
 protected function determinateApplicationName()
 {
     if (empty($this->sApplicationName)) {
         $this->sApplicationName = $this->oConfig->getValue('default_application');
         if ($this->oConfig->hasValue('applications')) {
             $aApplications = $this->oConfig->getValue('applications');
             // Check domains
             foreach ($aApplications as $sName => $aApp) {
                 if (!empty($aApp['domain']) && $_SERVER['SERVER_NAME'] == $aApp['domain']) {
                     $this->sApplicationName = $sName;
                     return;
                     // Domain is most important - if found we do not check rest od the url
                 }
             }
             $aUrlParts = explode('/', $this->getCurrentPath());
             if (!empty($aUrlParts[1])) {
                 foreach ($aApplications as $sName => $aApp) {
                     if (!empty($aApp['url_path']) && $aUrlParts[1] == $aApp['url_path']) {
                         $this->sApplicationName = $sName;
                         $this->sAppUrl = substr('http://' . $_SERVER['HTTP_HOST'] . URLROOT, 0, -1) . '/' . $aApp['url_path'];
                         $this->bUrlContainsAppName = true;
                         break;
                     }
                 }
                 // foreach
             }
             // if
         }
         // if
     }
     // if
 }