Example #1
0
 /**
  * This function is called if action is forbidden in demo mode
  *
  * @return void
  */
 protected function forbidInDemoMode()
 {
     $message = $this->getForbidInDemoModeMessage();
     if ($message) {
         \XLite\Core\TopMessage::addWarning($message);
     }
     $url = $this->getForbidInDemoModeRedirectURL();
     if ($url) {
         \Includes\Utils\Operator::redirect($url);
     }
 }
Example #2
0
 /**
  * Initialization
  *
  * @return void
  */
 public static function initialize()
 {
     if (static::isDropCacheRequested()) {
         // Drop classes cache
         \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators();
         // Redirect to avoid loop
         \Includes\Utils\Operator::redirect(\XLite::getAdminScript() . '?target=main');
     } elseif (static::isSafeModeRequested() && !static::isSafeModeStarted()) {
         $restorePoint = null;
         if (static::isRestoreDateSet()) {
             $restorePoint = \Includes\Utils\ModulesManager::getRestorePoint(static::getRestoreDate());
         }
         if (static::isSoftwareResetEnabled()) {
             if (!($restorePoint != null ^ static::isRestoreDateSet())) {
                 // Put safe mode indicator
                 \Includes\Utils\FileManager::write(static::getIndicatorFileName(), static::getIndicatorFileContent());
                 // Clean cache indicators to force cache generation
                 \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators();
             } else {
                 $date = \DateTime::createFromFormat(\Includes\Utils\ModulesManager::RESTORE_DATE_FORMAT, static::getRestoreDate());
                 \Includes\Decorator\Utils\PersistentInfo::set('restoreFailed', $date->getTimestamp());
             }
         }
         // Redirect to avoid loop
         \Includes\Utils\Operator::redirect(\XLite::getAdminScript() . '?target=main');
     }
 }
Example #3
0
File: Main.php Project: kingsj/core
 /**
  * Forbid action processing
  *
  * @param string $message Action message OPTIONAL
  * @param string $url     Redirect URL OPTIONAL
  *
  * @return void
  */
 public static function doForbidAction($message = null, $url = null)
 {
     self::doForbidOperation($message);
     \Includes\Utils\Operator::redirect($url ?: \XLite\Core\Converter::buildURL(\XLite\Core\Request::getInstance()->target));
 }
Example #4
0
 /**
  * Initialization
  *
  * @return void
  */
 public static function initialize()
 {
     if (static::isSafeModeRequested() && !static::isSafeModeStarted()) {
         if (static::isSoftwareResetEnabled()) {
             // Put safe mode indicator
             \Includes\Utils\FileManager::write(static::getIndicatorFileName(), static::getIndicatorFileContent());
             // Clean cache indicators to force cache generation
             \Includes\Decorator\Utils\CacheManager::cleanupCacheIndicators();
         }
         // Redirect to avoid loop
         \Includes\Utils\Operator::redirect('admin.php?target=main');
     }
 }