コード例 #1
0
 /**
  * Execute a single Action. The Action's <method>Action::onInit</method> will be called,
  * then its <class>AccessController</class> will be queried if the action can be executed,
  * and, if allowed, its <method>Action::process</method> will be called. If the action cannot
  * be executed in the current environment, then an <class>AccessDeniedException</class>
  * will be thrown
  * @param  Action $action  the action to execute
  * @throws  AccessDeniedException  if the action cannot be executed
  */
 static function process(Action $action) {
   $action->onInit();
   $ac = $action->getAccessController();
   if(is_null($ac) || ($ac->isAccessible())) {
     $action->process();
   } else {
     throw new AccessDeniedException('Action access controller (' . get_class($ac) . ') forbids this action', 0, $action);
   }
 }
コード例 #2
0
ファイル: Pull.php プロジェクト: exside/teleport
 public function process()
 {
     parent::process();
     if (!$this->overwriteTarget && file_exists($this->target)) {
         throw new ActionException($this, "{$this->target} exists; use --overwriteTarget to Pull anyway");
     }
     try {
         $pulled = copy($this->source, $this->target);
         if (!$pulled) {
             throw new ActionException($this, "copy failed");
         }
         $this->request->log("Successfully pulled {$this->source} to {$this->target}");
     } catch (\Exception $e) {
         throw new ActionException($this, "Error pulling {$this->source} to {$this->target}", $e);
     }
 }
コード例 #3
0
ファイル: Profile.php プロジェクト: exside/teleport
 /**
  * Process this action.
  *
  * @throws \Teleport\Action\ActionException If an error is encountered processing this Action.
  * @return void
  */
 public function process()
 {
     parent::process();
     try {
         if (!array_key_exists('config_key', $this->request->args())) {
             $this->config_key = 'config';
         }
         if (!array_key_exists('code', $this->request->args())) {
             $this->code = str_replace(array('-', '.'), array('_', '_'), $this->name);
         }
         $profile = new \stdClass();
         $profile->properties = new \stdClass();
         $profile->properties->modx = new \stdClass();
         $profile->properties->modx->core_path = $this->core_path;
         $profile->properties->modx->config_key = $this->config_key;
         $this->getMODX($profile);
         $profile = array('name' => $this->name, 'code' => $this->code, 'properties' => array('modx' => array('core_path' => $this->core_path, 'config_key' => $this->config_key, 'context_mgr_path' => $this->modx->getOption('manager_path', null, MODX_MANAGER_PATH), 'context_mgr_url' => $this->modx->getOption('manager_url', null, MODX_MANAGER_URL), 'context_connectors_path' => $this->modx->getOption('connectors_path', null, MODX_CONNECTORS_PATH), 'context_connectors_url' => $this->modx->getOption('connectors_url', null, MODX_CONNECTORS_URL), 'context_web_path' => $this->modx->getOption('base_path', null, MODX_BASE_PATH), 'context_web_url' => $this->modx->getOption('base_url', null, MODX_BASE_URL))));
         $profileFilename = TELEPORT_BASE_PATH . 'profile' . DIRECTORY_SEPARATOR . $this->code . '.profile.json';
         $written = $this->modx->getCacheManager()->writeFile($profileFilename, $this->modx->toJSON($profile));
         if ($written === false) {
             throw new ActionException($this, "Error writing profile {$profileFilename}");
         }
         $this->request->log("Successfully wrote profile to {$profileFilename}");
         if ($this->target && $this->push) {
             if (!$this->push($profileFilename, $this->target)) {
                 throw new ActionException($this, "Error pushing profile {$profileFilename} to {$this->target}");
             }
             $this->request->log("Successfully pushed profile {$profileFilename} to {$this->target}");
             $this->request->log("{$this->target}", false);
         } else {
             $this->request->log("{$profileFilename}", false);
         }
     } catch (\Exception $e) {
         throw new ActionException($this, "Error generating profile: " . $e->getMessage(), $e);
     }
 }
コード例 #4
0
ファイル: bootstrap.php プロジェクト: RobertoMalatesta/neard
define('APP_TITLE', 'Neard');
define('APP_GITHUB_HOME', 'https://github.com/crazy-max/neard');
define('APP_GITHUB_ISSUES', 'https://github.com/crazy-max/neard/issues');
define('APP_AUTHOR_NAME', 'Cr@zy');
define('APP_AUTHOR_EMAIL', '*****@*****.**');
define('HOSTS_FILE', 'C:\\Windows\\System32\\drivers\\etc\\hosts');
define('CURRENT_APACHE_PORT', 80);
define('CURRENT_APACHE_SSL_PORT', 443);
define('CURRENT_APACHE_VERSION', '2.2.22');
define('CURRENT_PHP_VERSION', '5.3.13');
define('CURRENT_MYSQL_PORT', 3306);
define('CURRENT_MYSQL_VERSION', '5.5.24');
define('CURRENT_MARIADB_PORT', 3307);
define('CURRENT_MARIADB_VERSION', '5.5.34');
define('CURRENT_NODEJS_VERSION', '0.10.22');
define('CURRENT_FILEZILLA_PORT', 21);
define('CURRENT_FILEZILLA_SSL_PORT', 990);
define('CURRENT_FILEZILLA_VERSION', '0.9.46');
define('RETURN_TAB', '	');
// Bootstrap
require_once dirname(__FILE__) . '/classes/class.bootstrap.php';
$neardBs = new Bootstrap(dirname(__FILE__));
$neardBs->register();
// Process action
$neardAction = new Action();
$neardAction->process();
// Stop loading
if ($neardBs->isBootstrap()) {
    Util::stopLoading();
}