Example #1
0
 public static function isLocalSQLite()
 {
     return OEDynUtils::isLocalWebServer();
 }
 function InitValues($manager)
 {
     // to be called after SetFromAssociativeArray etc.
     //echo 'HTMLInputs:';var_dump($this->Values);
     if (empty($this->Values)) {
         return;
     }
     $this->Values['CurrIterationRow'][0] = null;
     // (isset(OEDataContainer::$iCurrentRow)) ? OEDataContainer::$iCurrentRow : 0;
     // culture (ex DEFAULT, FR) and language code (ex EN, FR):
     $culture = strtoupper($manager->currLang);
     $this->Values['PageCulture'][0] = $culture;
     $isDefault = $culture === 'DEFAULT';
     $this->Values['PageLocalization'][0] = $isDefault ? '' : $culture;
     $this->Values['CaptchaOk'] = null;
     $this->Values['SecurPostTokenOk'] = null;
     $lang = $isDefault && isset($manager->JSData['DefCultureTrueCode']) ? $manager->JSData['DefCultureTrueCode'] : $culture;
     $this->Values['PageLanguage'][0] = $lang;
     $this->Values['CurrTimeStamp'][0] = time();
     // Site root:
     if (OEDynUtils::isLocalWebServer()) {
         // for local previs tests
         if (!isset($this->Values['SiteRootURL'])) {
             $this->Values['SiteRootURL'] = array();
         }
         $this->Values['SiteRootURL'][0] = 'http://localhost:8086/';
         //!!check and keep updated
     } else {
         if (!isset($this->Values['SiteRootURL'][0]) || empty($this->Values['SiteRootURL'][0])) {
             $this->Values['SiteRootURL'][0] = '';
             if (isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_URI']) && isset($_SERVER['HTTP_HOST'])) {
                 $scriptname = explode('/', $_SERVER['PHP_SELF']);
                 if (!empty($scriptname) && isset($this->Values['PathFromRoot'][0])) {
                     $scriptname = $scriptname[count($scriptname) - 1];
                     $scriptpath = str_replace($scriptname, '', $_SERVER['REQUEST_URI']);
                     $rootURL = $_SERVER['HTTP_HOST'] . $scriptpath;
                     //echo 'Page URL: '.$rootURL.'<br>';
                     $rootURL = substr($rootURL, 0, strlen($rootURL) - strlen($this->Values['PathFromRoot'][0]));
                     echo '<br> == Site URL auto-detect: ' . $rootURL . '<br>';
                     $this->Values['SiteRootURL'][0] = $rootURL;
                 }
             }
         }
     }
 }