Example #1
0
 private function createPluginsOrThemesView($template, $themesOnly)
 {
     Piwik::checkUserHasSuperUserAccess();
     $view = $this->configureView('@CorePluginsAdmin/' . $template);
     $view->updateNonce = Nonce::getNonce(MarketplaceController::UPDATE_NONCE);
     $view->activateNonce = Nonce::getNonce(static::ACTIVATE_NONCE);
     $view->uninstallNonce = Nonce::getNonce(static::UNINSTALL_NONCE);
     $view->deactivateNonce = Nonce::getNonce(static::DEACTIVATE_NONCE);
     $view->pluginsInfo = $this->getPluginsInfo($themesOnly);
     $users = Request::processRequest('UsersManager.getUsers');
     $view->otherUsersCount = count($users) - 1;
     $view->themeEnabled = $this->pluginManager->getThemeEnabled()->getPluginName();
     $view->pluginNamesHavingSettings = array_keys($this->settingsProvider->getAllSystemSettings());
     $view->isMarketplaceEnabled = Marketplace::isMarketplaceEnabled();
     $view->isPluginsAdminEnabled = CorePluginsAdmin::isPluginsAdminEnabled();
     $view->pluginsHavingUpdate = array();
     $view->marketplacePluginNames = array();
     if (Marketplace::isMarketplaceEnabled() && $this->marketplacePlugins) {
         try {
             $view->marketplacePluginNames = $this->marketplacePlugins->getAvailablePluginNames($themesOnly);
             $view->pluginsHavingUpdate = $this->marketplacePlugins->getPluginsHavingUpdate();
         } catch (Exception $e) {
             // curl exec connection error (ie. server not connected to internet)
         }
     }
     return $view;
 }
Example #2
0
 public function newVersionAvailable()
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->checkNewVersionIsAvailableOrDie();
     $newVersion = $this->updater->getLatestVersion();
     $view = new View('@CoreUpdater/newVersionAvailable');
     $this->addCustomLogoInfo($view);
     $this->setBasicVariablesView($view);
     $view->piwik_version = Version::VERSION;
     $view->piwik_new_version = $newVersion;
     $incompatiblePlugins = $this->getIncompatiblePlugins($newVersion);
     $marketplacePlugins = array();
     try {
         if (!empty($incompatiblePlugins) && $this->marketplacePlugins) {
             $marketplacePlugins = $this->marketplacePlugins->getAllAvailablePluginNames();
         }
     } catch (\Exception $e) {
     }
     $view->marketplacePlugins = $marketplacePlugins;
     $view->incompatiblePlugins = $incompatiblePlugins;
     $view->piwik_latest_version_url = $this->updater->getArchiveUrl($newVersion);
     $view->can_auto_update = Filechecks::canAutoUpdate();
     $view->makeWritableCommands = Filechecks::getAutoUpdateMakeWritableMessage();
     return $view->render();
 }
Example #3
0
 private function createUpdateOrInstallView($template, $nonceName)
 {
     Piwik::checkUserHasSuperUserAccess();
     $this->dieIfPluginsAdminIsDisabled();
     $this->displayWarningIfConfigFileNotWritable();
     $pluginName = $this->getPluginNameIfNonceValid($nonceName);
     $view = new View('@Marketplace/' . $template);
     $this->setBasicVariablesView($view);
     $view->errorMessage = '';
     $view->plugin = array('name' => $pluginName);
     try {
         $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
     } catch (\Exception $e) {
         $notification = new Notification($e->getMessage());
         $notification->context = Notification::CONTEXT_ERROR;
         $notification->type = Notification::TYPE_PERSISTENT;
         $notification->flags = Notification::FLAG_CLEAR;
         Notification\Manager::notify('CorePluginsAdmin_InstallPlugin', $notification);
         Url::redirectToReferrer();
         return;
     }
     $view->plugin = $this->plugins->getPluginInfo($pluginName);
     return $view;
 }