Exemple #1
0
 /**
  * Clears all caches in all available places
  */
 public function clearAllCaches()
 {
     // Save usage for stats
     Usage::getInstance()->add(__CLASS__, __FUNCTION__);
     if (FileCache::itWorks()) {
         $this->getFileCacher()->deleteAll();
     }
     if (MemcachedCache::itWorks()) {
         $this->getMemcachedCacher()->deleteAll();
     }
     if (MemcacheCache::itWorks()) {
         $this->getMemcacheCacher()->deleteAll();
     }
     if (FakeCache::itWorks()) {
         $this->getFakeCacher()->deleteAll();
     }
 }
Exemple #2
0
 private function parseUrl()
 {
     // Some pages do not have menu header nor items
     $this->no_menu = isset($_GET['nomenu']);
     /* Get P and P_DO - these are module and action shortcuts */
     if (!isset($_GET['p'])) {
         $_GET['p'] = 'home';
     }
     if (!isset($_GET['do'])) {
         $_GET['do'] = '_default';
     }
     // Render log=in form if if user is not auth-ed
     if (!Users::getInstance()->isLogged()) {
         $_GET['p'] = 'guest';
         $this->no_menu = true;
     }
     if (!defined('P')) {
         define('P', $_GET['p']);
     }
     if (!defined('P_DO')) {
         define('P_DO', $_GET['do']);
     }
     // Parse URL
     $path = [];
     if (!($url = parse_url(SELF)) || !isset($url['path'])) {
         die('URL can not be parsed');
     }
     // Generate real path
     foreach (explode('/', $url['path']) as $pa) {
         if ($pa) {
             $path[] = $pa;
         }
     }
     // For non-rewrite hostings remove last file name
     if (end($path) === 'index.php') {
         array_pop($path);
     }
     if ($this->no_menu) {
         Menu::getInstance()->disableMenu();
     }
     // Log CMS usage
     Usage::getInstance()->add(P, P_DO);
     // Rewite $_GET in case constans defined not from params
     $_GET['p'] = P;
     $_GET['do'] = P_DO;
     $this->p = P;
     $this->p_do = P_DO;
 }