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'] = 'themes';
     $app = false;
     $messages = array();
     $applications = installerHelper::getApps($messages, $update_counter, $filter);
     $search = array();
     $search['slug'] = $app_id = waRequest::get('slug');
     $search['vendor'] = waRequest::get('vendor', 'webasyst');
     $themes = wa()->getThemes($search['slug']);
     if (array_filter($search, 'strlen') && ($app = installerHelper::search($applications, $search))) {
         foreach ($app['extras']['themes'] as $id => $info) {
             if (!isset($themes[$id])) {
                 $themes[$id] = new waTheme($id, $search['slug'], true);
                 $themes[$id]['name'] = $info['name'];
                 $themes[$id]['description'] = $info['description'];
             }
             if (!empty($info['payware'])) {
                 $themes[$id]['payware'] = $info['payware'];
             }
             if (!empty($info['img'])) {
                 $themes[$id]['cover'] = $info['img'];
             }
         }
         $this->view->assign('themes', $themes);
         $this->view->assign('messages', $messages);
         $this->view->assign('app_id', $app_id);
         $this->view->assign('app', $app);
         $this->view->assign('slug', $search['slug']);
         $this->view->assign('vendor', $search['vendor']);
     }
 }
 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()
 {
     $extended = false;
     $this->view->assign('action', 'update');
     $this->view->assign('error', false);
     $messages = installerMessage::getInstance()->handle(waRequest::get('msg'));
     $filter = array();
     $filter['enabled'] = true;
     if ($this->module) {
         $filter['extras'] = $this->module;
     }
     $applications = installerHelper::getApps($messages, $this->update_counter, $filter);
     $app = false;
     try {
         $subject = waRequest::get('subject');
         if (empty($subject)) {
             $storage = wa()->getStorage();
             $search = array();
             $extras = preg_replace('/s$/', '', $this->module);
             $slug_id = "installer_select_{$extras}";
             $vendor_id = "installer_select_{$extras}_vendor";
             $search['slug'] = waRequest::get('slug', $storage->read($slug_id));
             $search['vendor'] = waRequest::get('vendor', $storage->read($vendor_id));
             if ((!$this->redirect || array_filter($search, 'strlen')) && ($app = installerHelper::search($applications, $search))) {
                 $storage->write($slug_id, $search['slug'] = $app['slug']);
                 $storage->write($vendor_id, $search['vendor'] = $app['vendor']);
             } else {
                 reset($applications);
                 if ($app = current($applications)) {
                     $this->redirect(array('module' => $this->module, 'slug' => $app['slug'], 'vendor' => $app['vendor']));
                 }
             }
             $this->view->assign('slug', $search['slug']);
             $this->view->assign('vendor', $search['vendor']);
             $this->view->assign('selected_app', $app);
         }
     } catch (Exception $ex) {
         $messages[] = array('text' => $ex->getMessage(), 'result' => 'fail');
     }
     installerHelper::checkUpdates($messages);
     $model = new waAppSettingsModel();
     $this->view->assign('update_counter', $model->get($this->getApp(), 'update_counter'));
     $this->view->assign('messages', $messages);
     $this->view->assign('apps', $applications);
     $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);
     }
 }