public function execute()
 {
     $filter = array();
     $filter['enabled'] = true;
     $filter['extras'] = 'themes';
     $options = array('installed' => true);
     $applications = installerHelper::getInstaller()->getApps($options, $filter);
     $search = array();
     $search['slug'] = waRequest::get('slug');
     $search['vendor'] = waRequest::get('vendor', 'webasyst');
     $search['vendor'] = waRequest::get('theme_vendor', 'webasyst');
     if (!empty($search['slug'])) {
         $options = array('action' => true, 'requirements' => true, 'inherited' => array_keys($applications));
         if ($theme = installerHelper::getInstaller()->getItemInfo('*/themes/' . $search['slug'], $options)) {
             $theme['app'] = preg_replace('@/.+$@', '', $theme['slug']);
         }
         $this->view->assign('identity_hash', installerHelper::getHash());
         $this->view->assign('promo_id', installerHelper::getPromoId());
         $this->view->assign('domain', installerHelper::getDomain());
         $this->view->assign('theme', $theme);
         $this->view->assign('query', waRequest::get('query', '', waRequest::TYPE_STRING_TRIM) . '/');
     } else {
         throw new waException(_w('Theme not found'), 404);
     }
 }
 public function execute()
 {
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     $counter = array('total' => 0, 'applicable' => 0, 'payware' => 0);
     $items = array();
     try {
         $items = installerHelper::getUpdates();
         $counter = installerHelper::getUpdatesCounter(null);
         if (isset($items['installer'])) {
             $items['installer']['name'] = _w('Webasyst Framework');
         }
     } catch (Exception $ex) {
         $messages[] = array('text' => $ex->getMessage(), 'result' => 'fail');
     }
     installerHelper::checkUpdates($messages);
     if (!waRequest::get('_')) {
         $this->setLayout(new installerBackendLayout());
         if ($messages) {
             $this->getLayout()->assign('messages', $messages);
         }
         $this->getLayout()->assign('update_counter', $counter['total']);
         $this->getLayout()->assign('no_ajax', true);
     } else {
         $this->view->assign('messages', $messages);
     }
     $this->view->assign('error', false);
     $this->view->assign('update_counter', $counter['total']);
     $this->view->assign('update_counter_applicable', $counter['applicable']);
     $this->view->assign('items', $items);
     $this->view->assign('domain', installerHelper::getDomain());
     $this->view->assign('title', _w('Updates'));
 }
 public function execute()
 {
     $filter = array();
     $filter['enabled'] = true;
     $filter['extras'] = 'plugins';
     $options = array('installed' => true);
     $search = array();
     $search['slug'] = preg_replace('@^(wa-plugins/)?([^/]+)/.+$@', '$1$2', waRequest::get('slug'));
     if (strpos($search['slug'], 'wa-plugins/') === 0) {
         $options['system'] = true;
     }
     $applications = installerHelper::getInstaller()->getApps($options, $filter);
     $plugin_search = array();
     $plugin_search['id'] = preg_replace('@^.+/@', '', waRequest::get('slug'));
     if (array_filter($search, 'strlen') && ($app = installerHelper::search($applications, $search))) {
         $plugin_search['slug'] = $search['slug'] . "/plugins/" . $plugin_search['id'];
         $options = array('action' => true, 'requirements' => true);
         $plugin = installerHelper::getInstaller()->getItemInfo($plugin_search['slug'], $options);
         if (!$plugin) {
             $options['local'] = true;
             $plugin = installerHelper::getInstaller()->getItemInfo($plugin_search['slug'], $options);
         }
         if ($plugin) {
             $plugin['app'] = preg_replace('@^(wa-plugins/)?([^/]+)/.+$@', '$1$2', $plugin['slug']);
             $plugin['slug'] = preg_replace('@^wa-plugins/([^/]+)/plugins/(.+)$@', 'wa-plugins/$1/$2', $plugin['slug']);
         }
         $this->view->assign('identity_hash', installerHelper::getHash());
         $this->view->assign('promo_id', installerHelper::getPromoId());
         $this->view->assign('domain', installerHelper::getDomain());
         $this->view->assign('plugin', $plugin);
         $this->view->assign('query', waRequest::get('query', '', waRequest::TYPE_STRING_TRIM) . '/');
     } else {
         throw new waException(_w('Plugin not found'), 404);
     }
 }
 public function execute()
 {
     if (!waRequest::get('_')) {
         $this->setLayout(new installerBackendLayout());
     }
     $this->view->assign('action', 'update');
     $this->view->assign('error', false);
     try {
         $slug = waRequest::get('slug');
         $options = array('vendor' => waRequest::get('vendor', '', waRequest::TYPE_STRING_TRIM), 'edition' => waRequest::get('edition', '', waRequest::TYPE_STRING_TRIM), 'action' => true, 'requirements' => true);
         $this->view->assign('app', $app = installerHelper::getInstaller()->getItemInfo($slug, $options));
         $this->view->assign('title', sprintf(_w('Application "%s"'), $app['name']));
     } catch (Exception $ex) {
         $this->view->assign('error', $ex->getMessage());
     }
     $this->view->assign('identity_hash', installerHelper::getHash());
     $this->view->assign('promo_id', installerHelper::getPromoId());
     $this->view->assign('domain', installerHelper::getDomain());
     if (!empty($app['is_premium']) && $app['theme'] == 'premium') {
         $this->setTemplate(preg_replace('@(\\.html)$@', 'Premium$1', $this->getTemplate()));
     }
 }