Example #1
0
 public static function checkDomain()
 {
     $theDomain = $_SERVER['HTTP_HOST'];
     if (isset($_COOKIE['changed_domain'])) {
         $oldDomain = $_COOKIE['changed_domain'];
         if ($oldDomain == $theDomain) {
             return false;
         }
     }
     $filePath = ROOT_PATH . 'application/caches/domain/' . $theDomain . '.cache';
     if (!file_exists($filePath)) {
         return false;
     }
     $loadData = unserialize(file_get_contents($filePath));
     if (is_array($loadData)) {
         if (isset($loadData['prefix'])) {
             Database::setPrefix($loadData['prefix']);
             $prefixAll = isset($loadData['prefixall']) ? $loadData['prefixall'] : 'no';
             Cookie::make('prefixall', $prefixAll, 1440 * 7);
         }
         if (isset($loadData['theme'])) {
             $theme = $loadData['theme'];
             if (!file_exists(THEMES_PATH . $theme . '/index.php')) {
                 return false;
             }
             System::setTheme($theme, 'yes');
             Cookie::make('changed_domain', $theDomain, 1440 * 7);
         }
     }
 }