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()
 {
     $extended = false;
     $this->view->assign('action', 'update');
     $update_counter = 0;
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     $this->view->assign('error', false);
     $app = null;
     try {
         $app_list = installerHelper::getApps($messages, $update_counter);
         $slug = waRequest::get('slug');
         $vendor = waRequest::get('vendor');
         $edition = waRequest::get('edition');
         foreach ($app_list as $info) {
             if ($info['slug'] == $slug && $info['vendor'] == $vendor && $info['edition'] == $edition) {
                 $app = $info;
                 break;
             }
         }
         if (!$app) {
             throw new waException(_w('Application not found'));
         }
     } catch (Exception $ex) {
         $msg = installerMessage::getInstance()->raiseMessage($ex->getMessage(), installerMessage::R_FAIL);
         $this->redirect(array('module' => 'apps', 'msg' => $msg));
     }
     $this->view->assign('identity_hash', installerHelper::getHash());
     $this->view->assign('messages', $messages);
     $this->view->assign('update_counter', $update_counter);
     $this->view->assign('app', $app);
     $this->view->assign('title', sprintf(_w('Application "%s"'), $app['name']));
 }
 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()
 {
     $this->view->assign('action', 'update');
     $counter = array('total' => 0, 'applicable' => 0, 'payware' => 0);
     $app_list = array();
     $this->view->assign('error', false);
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     try {
         $app_list = installerHelper::getApps($messages, $counter);
         foreach ($app_list as &$info) {
             if ($info['slug'] == 'installer') {
                 $info['name'] = _w('Webasyst Framework');
                 break;
             }
         }
         unset($info);
         $plugin_list = installerHelper::getSystemPlugins($messages, $counter);
     } catch (Exception $ex) {
         $messages[] = array('text' => $ex->getMessage(), 'result' => 'fail');
     }
     installerHelper::checkUpdates($messages);
     $this->view->assign('messages', $messages);
     //$this->view->assign('install_counter', $model->get($this->getApp(), 'install_counter'));
     $this->getConfig()->setCount($counter['total'] ? $counter['total'] : null);
     $this->view->assign('update_counter', $counter['total']);
     $this->view->assign('update_counter_applicable', $counter['applicable']);
     $this->view->assign('apps', $app_list);
     $this->view->assign('plugins', $plugin_list);
     $this->view->assign('identity_hash', installerHelper::getHash());
     $this->view->assign('title', _w('Updates'));
 }
 public function execute()
 {
     $extended = false;
     $this->view->assign('action', 'update');
     $this->view->assign('error', false);
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     $update_counter = null;
     $this->view->assign('apps', installerHelper::getApps($messages, $update_counter));
     installerHelper::checkUpdates($messages);
     $this->view->assign('identity_hash', installerHelper::getHash());
     $this->view->assign('messages', $messages);
     $model = new waAppSettingsModel();
     $this->view->assign('update_counter', $model->get($this->getApp(), 'update_counter'));
     $this->view->assign('extended', $extended);
     $this->view->assign('title', _w('Installer'));
 }
 public function execute()
 {
     $filter = array();
     $filter['enabled'] = true;
     $filter['extras'] = 'themes';
     $app = false;
     $messages = array();
     $applications = installerHelper::getApps($messages, $update_counter = null, $filter);
     $search = array();
     $search['slug'] = waRequest::get('slug');
     $search['vendor'] = waRequest::get('vendor', 'webasyst');
     $theme_search = array();
     $theme_search['slug'] = waRequest::get('theme_slug');
     $theme_search['vendor'] = waRequest::get('theme_vendor', 'webasyst');
     if (array_filter($search, 'strlen') && ($app = installerHelper::search($applications, $search))) {
         $theme = new waTheme($theme_search['slug'], $search['slug'], true);
         $theme_search['slug'] = $search['slug'] . "/themes/" . $theme_search['slug'];
         if ($info = installerHelper::search($app['extras']['themes'], $theme_search)) {
             if (!$theme['path']) {
                 $theme['name'] = $info['name'];
                 $theme['description'] = $info['description'];
                 $theme['vendor'] = $info['vendor'];
                 $theme['install_info'] = $info;
             } else {
                 $theme['updates_info'] = $info;
             }
             if (!empty($info['payware'])) {
                 $theme['payware'] = $info['payware'];
             }
             if (!empty($info['img'])) {
                 $theme['cover'] = $info['img'];
             }
         }
         $this->view->assign('identity_hash', installerHelper::getHash());
         $this->view->assign('theme', $theme);
         $this->view->assign('messages', $messages);
     } else {
         throw new waException(_w('Theme 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()));
     }
 }