Skip to content
Permalink
1 contributor

Users who have contributed to this file

<?php
/*
Copyright 2011-16 lifeinthegrid.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
SOURCE CONTRIBUTORS:
Gaurav Aggarwal
David Coveney of Interconnect IT Ltd
https://github.com/interconnectit/Search-Replace-DB/
*/
if (file_exists('dtoken.php')) {
//This is most likely inside the snapshot folder.
//DOWNLOAD ONLY: (Only enable download from within the snapshot directory)
if (isset($_GET['get']) && isset($_GET['file'])) {
//Clean the input, strip out anything not alpha-numeric or "_.", so restricts
//only downloading files in same folder, and removes risk of allowing directory
//separators in other charsets (vulnerability in older IIS servers), also
//strips out anything that might cause it to use an alternate stream since
//that would require :// near the front.
$filename = preg_replace('/[^a-zA-Z0-9_.]*/','',$_GET['file']);
if (strlen($filename) && file_exists($filename) && (strstr($filename, '_installer.php'))) {
//Attempt to push the file to the browser
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=installer.php');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($filename));
//FIXME: We should consider removing all error supression like this
//as it makes troubleshooting a wild goose chase for times that the
//script failes on such a line. The same can and should be accomplished
//at the server level by turning off displaying errors in PHP.
@ob_clean();
@flush();
if (@readfile($filename) == false) {
$data = file_get_contents($filename);
if ($data == false) {
die("Unable to read installer file. The server currently has readfile and file_get_contents disabled on this server. Please contact your server admin to remove this restriction");
} else {
print $data;
}
}
} else {
header("HTTP/1.1 404 Not Found", true, 404);
header("Status: 404 Not Found");
}
}
//Prevent Access from rovers or direct browsing in snapshop directory, or when
//requesting to download a file, should not go past this point.
exit;
}
?>
<?php if (false) : ?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Error: PHP is not running</title>
</head>
<body>
<h2>Error: PHP is not running</h2>
<p>Duplicator requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p>
</body>
</html>
<?php endif; ?>
<?php
/* ==============================================================================================
ADVANCED FEATURES - Allows admins to perform aditional logic on the import.
$GLOBALS['REPLACE_LIST']
Add additional search and replace items to step 2 for the serialize engine.
Place directly below $GLOBALS['REPLACE_LIST'] variable below your items
EXAMPLE:
array_push($GLOBALS['REPLACE_LIST'], array('search' => 'https://oldurl/', 'replace' => 'https://newurl/'));
array_push($GLOBALS['REPLACE_LIST'], array('search' => 'ftps://oldurl/', 'replace' => 'ftps://newurl/'));
================================================================================================= */
//COMPARE VALUES
$GLOBALS['FW_CREATED'] = '2016-10-19 07:03:08';
$GLOBALS['FW_VERSION_DUP'] = '1.1.18';
$GLOBALS['FW_VERSION_WP'] = '4.6.1';
$GLOBALS['FW_VERSION_DB'] = '10.1.18';
$GLOBALS['FW_VERSION_PHP'] = '5.6.26';
$GLOBALS['FW_VERSION_OS'] = 'Linux';
//GENERAL
$GLOBALS['FW_TABLEPREFIX'] = 'wp_';
$GLOBALS['FW_URL_OLD'] = 'http://localhost:8080';
$GLOBALS['FW_URL_NEW'] = '';
$GLOBALS['FW_PACKAGE_NAME'] = '20161019_holzwerk_58071aac6fda65351161019070308_archive.zip';
$GLOBALS['FW_PACKAGE_NOTES'] = '';
$GLOBALS['FW_SECURE_NAME'] = '20161019_holzwerk_58071aac6fda65351161019070308';
$GLOBALS['FW_DBHOST'] = '';
$GLOBALS['FW_DBHOST'] = empty($GLOBALS['FW_DBHOST']) ? 'localhost' : $GLOBALS['FW_DBHOST'];
$GLOBALS['FW_DBPORT'] = '';
$GLOBALS['FW_DBPORT'] = empty($GLOBALS['FW_DBPORT']) ? 3306 : $GLOBALS['FW_DBPORT'];
$GLOBALS['FW_DBNAME'] = '';
$GLOBALS['FW_DBUSER'] = '';
$GLOBALS['FW_DBPASS'] = '';
$GLOBALS['FW_SSL_ADMIN'] = 0;
$GLOBALS['FW_SSL_LOGIN'] = 0;
$GLOBALS['FW_CACHE_WP'] = 0;
$GLOBALS['FW_CACHE_PATH'] = 0;
$GLOBALS['FW_BLOGNAME'] = 'Holzwerk';
$GLOBALS['FW_WPROOT'] = '/var/www/html/';
$GLOBALS['FW_DUPLICATOR_VERSION'] = '1.1.18';
$GLOBALS['FW_OPTS_DELETE'] = json_decode('["duplicator_ui_view_state","duplicator_package_active","duplicator_settings"]', true);
//DATABASE SETUP: all time in seconds
$GLOBALS['DB_MAX_TIME'] = 5000;
$GLOBALS['DB_MAX_PACKETS'] = 268435456;
ini_set('mysql.connect_timeout', '5000');
//PHP SETUP: all time in seconds
ini_set('memory_limit', '2048M');
ini_set("max_execution_time", '5000');
ini_set("max_input_time", '5000');
ini_set('default_socket_timeout', '5000');
@set_time_limit(0);
$GLOBALS['DBCHARSET_DEFAULT'] = 'utf8';
$GLOBALS['DBCOLLATE_DEFAULT'] = 'utf8_general_ci';
//UPDATE TABLE SETTINGS
$GLOBALS['REPLACE_LIST'] = array();
/* ================================================================================================
END ADVANCED FEATURES: Do not edit below here.
=================================================================================================== */
//CONSTANTS
define("DUPLICATOR_INIT", 1);
define("DUPLICATOR_SSDIR_NAME", 'wp-snapshots'); //This should match DUPLICATOR_SSDIR_NAME in duplicator.php
//SHARED POST PARMS
$_POST['action_step'] = isset($_POST['action_step']) ? $_POST['action_step'] : "1";
/* Host has several combinations :
localhost | localhost:55 | localhost: | http://localhost | http://localhost:55 */
$_POST['dbhost'] = isset($_POST['dbhost']) ? trim($_POST['dbhost']) : null;
$_POST['dbport'] = isset($_POST['dbport']) ? trim($_POST['dbport']) : 3306;
$_POST['dbuser'] = isset($_POST['dbuser']) ? trim($_POST['dbuser']) : null;
$_POST['dbpass'] = isset($_POST['dbpass']) ? trim($_POST['dbpass']) : null;
$_POST['dbname'] = isset($_POST['dbname']) ? trim($_POST['dbname']) : null;
$_POST['dbcharset'] = isset($_POST['dbcharset']) ? trim($_POST['dbcharset']) : $GLOBALS['DBCHARSET_DEFAULT'];
$_POST['dbcollate'] = isset($_POST['dbcollate']) ? trim($_POST['dbcollate']) : $GLOBALS['DBCOLLATE_DEFAULT'];
//GLOBALS
$GLOBALS["SQL_FILE_NAME"] = "installer-data.sql";
$GLOBALS["LOG_FILE_NAME"] = "installer-log.txt";
$GLOBALS['SEPERATOR1'] = str_repeat("********", 10);
$GLOBALS['LOGGING'] = isset($_POST['logging']) ? $_POST['logging'] : 1;
$GLOBALS['CURRENT_ROOT_PATH'] = dirname(__FILE__);
$GLOBALS['CHOWN_ROOT_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}", 0755);
$GLOBALS['CHOWN_LOG_PATH'] = @chmod("{$GLOBALS['CURRENT_ROOT_PATH']}/{$GLOBALS['LOG_FILE_NAME']}", 0644);
$GLOBALS['URL_SSL'] = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') ? true : false;
$GLOBALS['URL_PATH'] = ($GLOBALS['URL_SSL']) ? "https://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}" : "http://{$_SERVER['SERVER_NAME']}{$_SERVER['REQUEST_URI']}";
//Restart log if user starts from step 1
if ($_POST['action_step'] == 1) {
$GLOBALS['LOG_FILE_HANDLE'] = @fopen($GLOBALS['LOG_FILE_NAME'], "w+");
} else {
$GLOBALS['LOG_FILE_HANDLE'] = @fopen($GLOBALS['LOG_FILE_NAME'], "a+");
}
?>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
define('ERR_CONFIG_FOUND', 'A wp-config.php already exists in this location. This error prevents users from accidentally overwriting the wrong directories contents. You have two options: <ul><li>Empty this root directory except for the package and installer and try again.</li><li>Delete just the wp-config.php file and try again. This will over-write all other files in the directory.</li></ul>');
define('ERR_ZIPNOTFOUND', 'The packaged zip file was not found. Be sure the zip package is in the same directory as the installer file and as the correct permissions. If you are trying to reinstall a package you can copy the package from the "' . DUPLICATOR_SSDIR_NAME . '" directory back up to your root which is the same location as your installer.php file.');
define('ERR_ZIPOPEN', 'Failed to open zip archive file. Please be sure the archive is completely downloaded before running the installer. Try to extract the archive manually to make sure the file is not corrupted.');
define('ERR_ZIPEXTRACTION', 'Errors extracting zip file. Portions or part of the zip archive did not extract correctly. Try to extract the archive manually with a client side program like unzip/win-zip/winrar to make sure the file is not corrupted. If the file extracts correctly then there is an invalid file or directory that PHP is unable to extract. This can happen if your moving from one operating system to another where certain naming conventions work on one environment and not another. <br/><br/> Workarounds: <br/> 1. Create a new package and be sure to exclude any directories that have invalid names or files in them. This warning will be displayed on the scan results under "Invalid Names". <br/> 2. Manually extract the zip file with a client side program. Then under advanced options in step 1 of the installer check the "Manual package extraction" option and perform the install.');
define('ERR_ZIPMANUAL', 'When choosing manual package extraction, the contents of the package must already be extracted and the wp-config.php and database.sql files must be present in the same directory as the installer.php for the process to continue. Please manually extract the package into the current directory before continuing in manual extraction mode. Also validate that the wp-config.php and database.sql files are present.');
define('ERR_MAKELOG', 'PHP is having issues writing to the log file <b>' . DUPX_Util::set_safe_path($GLOBALS['CURRENT_ROOT_PATH']) . '\installer-log.txt .</b> In order for the Duplicator to proceed validate your owner/group and permission settings for PHP on this path. Try temporarily setting you permissions to 777 to see if the issue gets resolved. If you are on a shared hosting environment please contact your hosting company and tell them you are getting errors writing files to the path above when using PHP.');
define('ERR_ZIPARCHIVE', 'In order to extract the archive.zip file the PHP ZipArchive module must be installed. Please read the FAQ for more details. You can still install this package but you will need to check the Manual package extraction checkbox found in the Advanced Options. Please read the online user guide for details in performing a manual package extraction.');
define('ERR_MYSQLI_SUPPORT', 'In order to complete an install the mysqli extension for PHP is required. If you are on a hosted server please contact your host and request that mysqli be enabled. For more information visit: http://php.net/manual/en/mysqli.installation.php');
define('ERR_DBCONNECT', 'DATABASE CONNECTION FAILED!<br/>');
define('ERR_DBCONNECT_CREATE', 'DATABASE CREATION FAILURE!<br/> Unable to create database "%s". Check to make sure the user has "Create" privileges. Some hosts will restrict creation of a database only through the cpanel. Try creating the database manually to proceed with installation. If the database already exists then check the radio button labeled "Connect and Remove All Data" which will remove all existing tables.');
define('ERR_DBTRYCLEAN', 'DATABASE CREATION FAILURE!<br/> Unable to remove all tables from database "%s".<br/> Please remove all tables from this database and try the installation again.');
define('ERR_DBCREATE', 'The database "%s" does not exists.<br/> Change mode to create in order to create a new database.');
define('ERR_DBEMPTY', 'The database "%s" has "%s" tables. The Duplicator only works with an EMPTY database. Enable the action "Connect and Remove All Data" radio button to remove all tables and or create a new database. Some hosting providers do not allow table removal from scripts. In this case you will need to login to your hosting providers control panel and remove the tables manually. Please contact your hosting provider for further details. Always backup all your data before proceeding!');
define('ERR_TESTDB_UTF8', 'UTF8 Characters were detected as part of the database connection string. If your connection fails be sure to update the MySQL my.ini configuration file setting to support UTF8 characters by enabling this option [character_set_server=utf8] and restarting the database server.');
define('ERR_TESTDB_VERSION', 'In order to avoid database incompatibility issues make sure the database versions between the build and installer servers are as close as possible. If the package was created on a newer database version than where it is being installed then you might run into issues.<br/><br/> It is best to make sure the server where the installer is running has the same or higher version number than where it was built. If the major and minor version are the same or close for example [5.7 to 5.6], then the migration should work without issues. A version pair of [5.7 to 5.1] is more likely to cause issues unless you have a very simple setup. If the versions are too far apart work with your hosting provider to upgrade the MySQL engine on this server.');
/** * *****************************************************
* DUPX_Log
* Class used to log information */
class DUPX_Log {
/** METHOD: LOG
* Used to write debug info to the text log file
* @param string $msg Any text data
* @param int $loglevel Log level
*/
static public function Info($msg, $logging = 1) {
if ($logging <= $GLOBALS["LOGGING"]) {
@fwrite($GLOBALS["LOG_FILE_HANDLE"], "{$msg}\n");
}
}
static public function Error($errorMessage) {
if ($logging <= $GLOBALS["LOGGING"]) {
$breaks = array("<br />","<br>","<br/>");
$msg = str_ireplace($breaks, "\r\n", $errorMessage);
@fwrite($GLOBALS["LOG_FILE_HANDLE"], "\nINSTALLER ERROR:\n{$msg}\n");
@fclose($GLOBALS["LOG_FILE_HANDLE"]);
}
die("<div class='dup-ui-error'><b style='color:#B80000;'>INSTALL ERROR!</b><br/>{$errorMessage}</div><br/>");
}
}
?>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
/** * *****************************************************
* Various Static Utility methods for working with the installer */
class DUPX_Util
{
/**
* Get current microtime as a float. Can be used for simple profiling.
*/
static public function get_microtime() {
return microtime(true);
}
/**
* Return a string with the elapsed time.
* Order of $end and $start can be switched.
*/
static public function elapsed_time($end, $start) {
return sprintf("%.4f sec.", abs($end - $start));
}
/**
* @param string $string Thing that needs escaping
* @param bool $echo Do we echo or return?
* @return string Escaped string.
*/
static public function esc_html_attr($string = '', $echo = false) {
$output = htmlentities($string, ENT_QUOTES, 'UTF-8');
if ($echo)
echo $output;
else
return $output;
}
/**
* Count the tables in a given database
* @param string $_POST['dbname'] Database to count tables in
*/
static public function dbtable_count($conn, $dbname) {
$res = mysqli_query($conn, "SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = '{$dbname}' ");
$row = mysqli_fetch_row($res);
return is_null($row) ? 0 : $row[0];
}
/**
* Returns the table count
* @param string $conn A valid link resource
* @param string $table_name A valid table name
*/
static public function table_row_count($conn, $table_name) {
$total = mysqli_query($conn, "SELECT COUNT(*) FROM `$table_name`");
if ($total) {
$total = @mysqli_fetch_array($total);
return $total[0];
} else {
return 0;
}
}
/**
* Adds a slash to the end of a path
* @param string $path A path
*/
static public function add_slash($path) {
$last_char = substr($path, strlen($path) - 1, 1);
if ($last_char != '/') {
$path .= '/';
}
return $path;
}
/**
* Makes path safe for any OS
* Paths should ALWAYS READ be "/"
* uni: /home/path/file.xt
* win: D:/home/path/file.txt
* @param string $path The path to make safe
*/
static public function set_safe_path($path) {
return str_replace("\\", "/", $path);
}
static public function unset_safe_path($path) {
return str_replace("/", "\\", $path);
}
/**
* PHP_SAPI for fcgi requires a data flush of at least 256
* bytes every 40 seconds or else it forces a script hault
*/
static public function fcgi_flush() {
echo(str_repeat(' ', 256));
@flush();
}
/**
* A safe method used to copy larger files
* @param string $source The path to the file being copied
* @param string $destination The path to the file being made
*/
static public function copy_file($source, $destination) {
$sp = fopen($source, 'r');
$op = fopen($destination, 'w');
while (!feof($sp)) {
$buffer = fread($sp, 512); // use a buffer of 512 bytes
fwrite($op, $buffer);
}
// close handles
fclose($op);
fclose($sp);
}
/**
* Finds a string in a file and returns true if found
* @param array $list A list of strings to search for
* @param string $haystack The string to search in
*/
static public function string_has_value($list, $file) {
foreach ($list as $var) {
if (strstr($file, $var) !== false) {
return true;
}
}
return false;
}
/** METHOD: get_active_plugins
* Returns the active plugins for a package
* @param conn $dbh A database connection handle
* @return array $list A list of active plugins
*/
static public function get_active_plugins($dbh) {
$query = @mysqli_query($dbh, "SELECT option_value FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE option_name = 'active_plugins' ");
if ($query) {
$row = @mysqli_fetch_array($query);
$all_plugins = unserialize($row[0]);
if (is_array($all_plugins)) {
return $all_plugins;
}
}
return array();
}
/**
* Returns the tables for a database
* @param conn $dbh A database connection handle
* @return array $list A list of all table names
*/
static public function get_database_tables($dbh) {
$query = @mysqli_query($dbh, 'SHOW TABLES');
if ($query) {
while ($table = @mysqli_fetch_array($query)) {
$all_tables[] = $table[0];
}
if (isset($all_tables) && is_array($all_tables)) {
return $all_tables;
}
}
return array();
}
/**
* MySQL connection support for sock
* @param same as mysqli_connect
* @return database connection handle
*/
static public function db_connect( $host, $username, $password, $dbname = '', $port = null ) {
//sock connections
if ( 'sock' === substr( $host, -4 ) )
{
$url_parts = parse_url( $host );
$dbh = @mysqli_connect( 'localhost', $username, $password, $dbname, null, $url_parts['path'] );
}
else
{
$dbh = @mysqli_connect( $host, $username, $password, $dbname, $port );
}
return $dbh;
}
/**
* MySQL database version number
* @param conn $dbh Database connection handle
* @return false|string false on failure, version number on success
*/
static public function mysql_version($dbh) {
if (function_exists('mysqli_get_server_info')) {
return preg_replace('/[^0-9.].*/', '', mysqli_get_server_info($dbh));
} else {
return 0;
}
}
/**
* MySQL server variable
* @param conn $dbh Database connection handle
* @return string the server variable to query for
*/
static public function mysql_variable_value($dbh, $variable) {
$result = @mysqli_query($dbh, "SHOW VARIABLES LIKE '{$variable}'");
$row = @mysqli_fetch_array($result);
@mysqli_free_result($result);
return isset($row[1]) ? $row[1] : null;
}
/**
* Determine if a MySQL database supports a particular feature
* @param conn $dbh Database connection handle
* @param string $feature the feature to check for
* @return bool
*/
static public function mysql_has_ability($dbh, $feature) {
$version = self::mysql_version($dbh);
switch (strtolower($feature)) {
case 'collation' :
case 'group_concat' :
case 'subqueries' :
return version_compare($version, '4.1', '>=');
case 'set_charset' :
return version_compare($version, '5.0.7', '>=');
};
return false;
}
/**
* Sets the MySQL connection's character set.
* @param resource $dbh The resource given by mysqli_connect
* @param string $charset The character set (optional)
* @param string $collate The collation (optional)
*/
static public function mysql_set_charset($dbh, $charset = null, $collate = null) {
$charset = (!isset($charset) ) ? $GLOBALS['DBCHARSET_DEFAULT'] : $charset;
$collate = (!isset($collate) ) ? $GLOBALS['DBCOLLATE_DEFAULT'] : $collate;
if (self::mysql_has_ability($dbh, 'collation') && !empty($charset)) {
if (function_exists('mysqli_set_charset') && self::mysql_has_ability($dbh, 'set_charset')) {
return mysqli_set_charset($dbh, $charset);
} else {
$sql = " SET NAMES {$charset}";
if (!empty($collate))
$sql .= " COLLATE {$collate}";
return mysqli_query($dbh, $sql);
}
}
}
/**
* Display human readable byte sizes
* @param string $size The size in bytes
*/
static public function readable_bytesize($size) {
try {
$units = array('B', 'KB', 'MB', 'GB', 'TB');
for ($i = 0; $size >= 1024 && $i < 4; $i++)
$size /= 1024;
return round($size, 2) . $units[$i];
} catch (Exception $e) {
return "n/a";
}
}
/**
* The characters that are special in the replacement value of preg_replace are not the
* same characters that are special in the pattern
* @param string $str The string to replace on
*/
static public function preg_replacement_quote($str) {
return preg_replace('/(\$|\\\\)(?=\d)/', '\\\\\1', $str);
}
/**
* Check to see if the internet is accessable
* NOTE: fsocketopen on windows doesn't seem to honor $timeout setting.
*
* @param string $url A url e.g without prefix "ajax.googleapis.com"
* @param string $port A valid port number
* @return bool
*/
public static function is_url_active($url, $port, $timeout=5)
{
if (function_exists('fsockopen'))
{
@ini_set("default_socket_timeout", 5);
$port = isset($port) && is_integer($port) ? $port : 80;
$connected = @fsockopen($url, $port, $errno, $errstr, $timeout); //website and port
if ($connected){
@fclose($connected);
return true;
}
return false;
} else {
return false;
}
}
/**
* Returns an array of zip files found in the current directory
* @return array of zip files
*/
static public function get_zip_files() {
$files = array();
foreach (glob("*.zip") as $name) {
if (file_exists($name)) {
$files[] = $name;
}
}
if (count($files) > 0) {
return $files;
}
//FALL BACK: Windows XP has bug with glob,
//add secondary check for PHP lameness
if ($dh = opendir('.'))
{
while (false !== ($name = readdir($dh))) {
$ext = substr($name, strrpos($name, '.') + 1);
if(in_array($ext, array("zip"))) {
$files[] = $name;
}
}
closedir($dh);
}
return $files;
}
/**
* Does a string have non ascii characters
*/
public static function is_non_ascii($string)
{
return preg_match('/[^\x20-\x7f]/', $string);
}
}
?>
<?php
// Exit if accessed directly
if (!defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$_baseURL}");
exit;
}
/**
* Class used to update and edit web server configuration files
* for both Apache and IIS files .htaccess and web.config */
class DUPX_WPConfig
{
/**
* Updates the web server config files in Step 1 */
public static function UpdateStep1()
{
$root_path = DUPX_Util::set_safe_path($GLOBALS['CURRENT_ROOT_PATH']);
$wpconfig = @file_get_contents('wp-config.php', true);
$patterns = array(
"/'DB_NAME',\s*'.*?'/",
"/'DB_USER',\s*'.*?'/",
"/'DB_PASSWORD',\s*'.*?'/",
"/'DB_HOST',\s*'.*?'/");
$db_host = ($_POST['dbport'] == 3306) ? $_POST['dbhost'] : "{$_POST['dbhost']}:{$_POST['dbport']}";
$replace = array(
"'DB_NAME', " . '\'' . $_POST['dbname'] . '\'',
"'DB_USER', " . '\'' . $_POST['dbuser'] . '\'',
"'DB_PASSWORD', " . '\'' . DUPX_Util::preg_replacement_quote($_POST['dbpass']) . '\'',
"'DB_HOST', " . '\'' . $db_host . '\'');
//SSL CHECKS
if ($_POST['ssl_admin']) {
if (! strstr($wpconfig, 'FORCE_SSL_ADMIN')) {
$wpconfig = $wpconfig . PHP_EOL . "define('FORCE_SSL_ADMIN', true);";
}
} else {
array_push($patterns, "/'FORCE_SSL_ADMIN',\s*true/");
array_push($replace, "'FORCE_SSL_ADMIN', false");
}
if ($_POST['ssl_login']) {
if (! strstr($wpconfig, 'FORCE_SSL_LOGIN')) {
$wpconfig = $wpconfig . PHP_EOL . "define('FORCE_SSL_LOGIN', true);";
}
} else {
array_push($patterns, "/'FORCE_SSL_LOGIN',\s*true/");
array_push($replace, "'FORCE_SSL_LOGIN', false");
}
//CACHE CHECKS
if ($_POST['cache_wp']) {
if (! strstr($wpconfig, 'WP_CACHE')) {
$wpconfig = $wpconfig . PHP_EOL . "define('WP_CACHE', true);";
}
} else {
array_push($patterns, "/'WP_CACHE',\s*true/");
array_push($replace, "'WP_CACHE', false");
}
if (! $_POST['cache_path']) {
array_push($patterns, "/'WPCACHEHOME',\s*'.*?'/");
array_push($replace, "'WPCACHEHOME', ''");
}
if (! is_writable("{$root_path}/wp-config.php") )
{
if (file_exists("{$root_path}/wp-config.php"))
{
chmod("{$root_path}/wp-config.php", 0644)
? DUPX_Log::Info('File Permission Update: wp-config.php set to 0644')
: DUPX_Log::Info('WARNING: Unable to update file permissions and write to wp-config.php. Please visit the online FAQ for setting file permissions and work with your hosting provider or server administrator to enable this installer.php script to write to the wp-config.php file.');
} else {
DUPX_Log::Info('WARNING: Unable to locate wp-config.php file. Be sure the file is present in your archive.');
}
}
$wpconfig = preg_replace($patterns, $replace, $wpconfig);
file_put_contents('wp-config.php', $wpconfig);
$wpconfig = null;
}
/**
* Updates the web server config files in Step 2 */
public static function UpdateStep2()
{
//Placeholder step 2 logic
}
}
?>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
/** * *****************************************************
* Class used to update and edit web server configuration files */
class DUPX_ServerConfig {
/**
* Clear .htaccess and web.config files and backup
*/
static public function Reset() {
DUPX_Log::Info("\nWEB SERVER CONFIGURATION FILE RESET:");
//Apache
@copy('.htaccess', '.htaccess.orig');
@unlink('.htaccess');
//IIS
@copy('web.config', 'web.config.orig');
@unlink('web.config');
//.user.ini - For WordFence
@copy('.user.ini', '.user.ini.orig');
@unlink('.user.ini');
DUPX_Log::Info("- Backup of .htaccess/web.config made to .orig");
DUPX_Log::Info("- Reset of .htaccess/web.config files");
$tmp_htaccess = '# RESET FOR DUPLICATOR INSTALLER USEAGE';
file_put_contents('.htaccess', $tmp_htaccess);
@chmod('.htaccess', 0644);
}
/** METHOD: ResetHTACCESS
* Resets the .htaccess file
*/
static public function Setup() {
if (! isset($_POST['url_new'])) {
return;
}
DUPX_Log::Info("\nWEB SERVER CONFIGURATION FILE BASIC SETUP:");
$currdata = parse_url($_POST['url_old']);
$newdata = parse_url($_POST['url_new']);
$currpath = DUPX_Util::add_slash(isset($currdata['path']) ? $currdata['path'] : "");
$newpath = DUPX_Util::add_slash(isset($newdata['path']) ? $newdata['path'] : "");
$tmp_htaccess = <<<HTACCESS
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase {$newpath}
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . {$newpath}index.php [L]
</IfModule>
# END WordPress
HTACCESS;
file_put_contents('.htaccess', $tmp_htaccess);
@chmod('.htaccess', 0644);
DUPX_Log::Info("created basic .htaccess file. If using IIS web.config this process will need to be done manually.");
}
}
?>
<?php
// Exit if accessed directly
if (!defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: {$_baseURL}");
exit;
}
/** * *****************************************************
* CLASS::DUPX_UpdateEngine
* Walks every table in db that then walks every row and column replacing searches with replaces
* large tables are split into 50k row blocks to save on memory. */
class DUPX_UpdateEngine
{
/**
* LOG ERRORS
*/
public static function log_errors($report)
{
if (!empty($report['errsql'])) {
DUPX_Log::Info("====================================");
DUPX_Log::Info("DATA-REPLACE ERRORS (MySQL)");
foreach ($report['errsql'] as $error) {
DUPX_Log::Info($error);
}
DUPX_Log::Info("");
}
if (!empty($report['errser'])) {
DUPX_Log::Info("====================================");
DUPX_Log::Info("DATA-REPLACE ERRORS (Serialization):");
foreach ($report['errser'] as $error) {
DUPX_Log::Info($error);
}
DUPX_Log::Info("");
}
if (!empty($report['errkey'])) {
DUPX_Log::Info("====================================");
DUPX_Log::Info("DATA-REPLACE ERRORS (Key):");
DUPX_Log::Info('Use SQL: SELECT @row := @row + 1 as row, t.* FROM some_table t, (SELECT @row := 0) r');
foreach ($report['errkey'] as $error) {
DUPX_Log::Info($error);
}
}
}
/**
* LOG STATS
*/
public static function log_stats($report)
{
if (!empty($report) && is_array($report))
{
$stats = "--------------------------------------\n";
$srchnum = 0;
foreach ($GLOBALS['REPLACE_LIST'] as $item)
{
$srchnum++;
$stats .= sprintf("Search{$srchnum}:\t'%s' \nChange{$srchnum}:\t'%s' \n", $item['search'], $item['replace']);
}
$stats .= sprintf("SCANNED:\tTables:%d \t|\t Rows:%d \t|\t Cells:%d \n", $report['scan_tables'], $report['scan_rows'], $report['scan_cells']);
$stats .= sprintf("UPDATED:\tTables:%d \t|\t Rows:%d \t|\t Cells:%d \n", $report['updt_tables'], $report['updt_rows'], $report['updt_cells']);
$stats .= sprintf("ERRORS:\t\t%d \nRUNTIME:\t%f sec", $report['err_all'], $report['time']);
DUPX_Log::Info($stats);
}
}
/**
* Returns only the text type columns of a table ignoring all numeric types
*/
public static function getTextColumns($conn, $table)
{
$type_where = "type NOT LIKE 'tinyint%' AND ";
$type_where .= "type NOT LIKE 'smallint%' AND ";
$type_where .= "type NOT LIKE 'mediumint%' AND ";
$type_where .= "type NOT LIKE 'int%' AND ";
$type_where .= "type NOT LIKE 'bigint%' AND ";
$type_where .= "type NOT LIKE 'float%' AND ";
$type_where .= "type NOT LIKE 'double%' AND ";
$type_where .= "type NOT LIKE 'decimal%' AND ";
$type_where .= "type NOT LIKE 'numeric%' AND ";
$type_where .= "type NOT LIKE 'date%' AND ";
$type_where .= "type NOT LIKE 'time%' AND ";
$type_where .= "type NOT LIKE 'year%' ";
$result = mysqli_query($conn, "SHOW COLUMNS FROM `{$table}` WHERE {$type_where}");
if (!$result) {
return null;
}
$fields = array();
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$fields[] = $row['Field'];
}
}
//Return Primary which is needed for index lookup
//$result = mysqli_query($conn, "SHOW INDEX FROM `{$table}` WHERE KEY_NAME LIKE '%PRIMARY%'"); 1.1.15 updated
$result = mysqli_query($conn, "SHOW INDEX FROM `{$table}`");
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$fields[] = $row['Column_name'];
}
}
return (count($fields) > 0) ? $fields : null;
}
/**
* LOAD
* Begins the processing for replace logic
* @param mysql $conn The db connection object
* @param array $list Key value pair of 'search' and 'replace' arrays
* @param array $tables The tables we want to look at
* @param array $fullsearch Search every column reguardless of its data type
* @return array Collection of information gathered during the run.
*/
public static function load($conn, $list = array(), $tables = array(), $fullsearch = false)
{
$report = array(
'scan_tables' => 0,
'scan_rows' => 0,
'scan_cells' => 0,
'updt_tables' => 0,
'updt_rows' => 0,
'updt_cells' => 0,
'errsql' => array(),
'errser' => array(),
'errkey' => array(),
'errsql_sum' => 0,
'errser_sum' => 0,
'errkey_sum' => 0,
'time' => '',
'err_all' => 0
);
$walk_function = create_function('&$str', '$str = "`$str`";');
$profile_start = DUPX_Util::get_microtime();
if (is_array($tables) && !empty($tables)) {
foreach ($tables as $table)
{
$report['scan_tables']++;
$columns = array();
// Get a list of columns in this table
$fields = mysqli_query($conn, 'DESCRIBE ' . $table);
while ($column = mysqli_fetch_array($fields)) {
$columns[$column['Field']] = $column['Key'] == 'PRI' ? true : false;
}
// Count the number of rows we have in the table if large we'll split into blocks
$row_count = mysqli_query($conn, "SELECT COUNT(*) FROM `{$table}`");
$rows_result = mysqli_fetch_array($row_count);
@mysqli_free_result($row_count);
$row_count = $rows_result[0];
if ($row_count == 0) {
DUPX_Log::Info("{$table}^ ({$row_count})");
continue;
}
$page_size = 25000;
$offset = ($page_size + 1);
$pages = ceil($row_count / $page_size);
// Grab the columns of the table. Only grab text based columns because
// they are the only data types that should allow any type of search/replace logic
$colList = '*';
$colMsg = '*';
if (! $fullsearch)
{
$colList = self::getTextColumns($conn, $table);
if ($colList != null && is_array($colList)) {
array_walk($colList, $walk_function);
$colList = implode(',', $colList);
}
$colMsg = (empty($colList)) ? '*' : '~';
}
if (empty($colList))
{
DUPX_Log::Info("{$table}^ ({$row_count})");
continue;
}
else
{
DUPX_Log::Info("{$table}{$colMsg} ({$row_count})");
}
//Paged Records
for ($page = 0; $page < $pages; $page++)
{
$current_row = 0;
$start = $page * $page_size;
$end = $start + $page_size;
$sql = sprintf("SELECT {$colList} FROM `%s` LIMIT %d, %d", $table, $start, $offset);
$data = mysqli_query($conn, $sql);
if (!$data)
$report['errsql'][] = mysqli_error($conn);
$scan_count = ($row_count < $end) ? $row_count : $end;
DUPX_Log::Info("\tScan => {$start} of {$scan_count}", 2);
//Loops every row
while ($row = mysqli_fetch_array($data))
{
$report['scan_rows']++;
$current_row++;
$upd_col = array();
$upd_sql = array();
$where_sql = array();
$upd = false;
$serial_err = 0;
//Loops every cell
foreach ($columns as $column => $primary_key)
{
$report['scan_cells']++;
$edited_data = $data_to_fix = $row[$column];
$base64coverted = false;
$txt_found = false;
//Only replacing string values
if (!empty($row[$column]) && !is_numeric($row[$column]))
{
//Base 64 detection
if (base64_decode($row[$column], true))
{
$decoded = base64_decode($row[$column], true);
if (self::is_serialized($decoded))
{
$edited_data = $decoded;
$base64coverted = true;
}
}
//Skip table cell if match not found
foreach ($list as $item)
{
if (strpos($edited_data, $item['search']) !== false) {
$txt_found = true;
break;
}
}
if (! $txt_found) {
continue;
}
//Replace logic - level 1: simple check on any string or serlized strings
foreach ($list as $item) {
$edited_data = self::recursive_unserialize_replace($item['search'], $item['replace'], $edited_data);
}
//Replace logic - level 2: repair serilized strings that have become broken
$serial_check = self::fix_serial_string($edited_data);
if ($serial_check['fixed'])
{
$edited_data = $serial_check['data'];
}
elseif ($serial_check['tried'] && !$serial_check['fixed'])
{
$serial_err++;
}
}
//Change was made
if ($edited_data != $data_to_fix || $serial_err > 0)
{
$report['updt_cells']++;
//Base 64 encode
if ($base64coverted) {
$edited_data = base64_encode($edited_data);
}
$upd_col[] = $column;
$upd_sql[] = $column . ' = "' . mysqli_real_escape_string($conn, $edited_data) . '"';
$upd = true;
}
if ($primary_key) {
$where_sql[] = $column . ' = "' . mysqli_real_escape_string($conn, $data_to_fix) . '"';
}
}
//PERFORM ROW UPDATE
if ($upd && !empty($where_sql))
{
$sql = "UPDATE `{$table}` SET " . implode(', ', $upd_sql) . ' WHERE ' . implode(' AND ', array_filter($where_sql));
$result = mysqli_query($conn, $sql) or $report['errsql'][] = mysqli_error($conn);
//DEBUG ONLY:
DUPX_Log::Info("\t{$sql}\n", 3);
if ($result) {
if ($serial_err > 0) {
$report['errser'][] = "SELECT " . implode(', ', $upd_col) . " FROM `{$table}` WHERE " . implode(' AND ', array_filter($where_sql)) . ';';
}
$report['updt_rows']++;
}
} elseif ($upd) {
$report['errkey'][] = sprintf("Row [%s] on Table [%s] requires a manual update.", $current_row, $table);
}
}
DUPX_Util::fcgi_flush();
@mysqli_free_result($data);
}
if ($upd) {
$report['updt_tables']++;
}
}
}
$profile_end = DUPX_Util::get_microtime();
$report['time'] = DUPX_Util::elapsed_time($profile_end, $profile_start);
$report['errsql_sum'] = empty($report['errsql']) ? 0 : count($report['errsql']);
$report['errser_sum'] = empty($report['errser']) ? 0 : count($report['errser']);
$report['errkey_sum'] = empty($report['errkey']) ? 0 : count($report['errkey']);
$report['err_all'] = $report['errsql_sum'] + $report['errser_sum'] + $report['errkey_sum'];
return $report;
}
/**
* Take a serialised array and unserialise it replacing elements and
* unserialising any subordinate arrays and performing the replace.
* @param string $from String we're looking to replace.
* @param string $to What we want it to be replaced with
* @param array $data Used to pass any subordinate arrays back to in.
* @param bool $serialised Does the array passed via $data need serialising.
* @return array The original array with all elements replaced as needed.
*/
public static function recursive_unserialize_replace($from = '', $to = '', $data = '', $serialised = false)
{
// some unseriliased data cannot be re-serialised eg. SimpleXMLElements
try
{
if (is_string($data) && ($unserialized = @unserialize($data)) !== false)
{
$data = self::recursive_unserialize_replace($from, $to, $unserialized, true);
}
elseif (is_array($data))
{
$_tmp = array();
foreach ($data as $key => $value)
{
$_tmp[$key] = self::recursive_unserialize_replace($from, $to, $value, false);
}
$data = $_tmp;
unset($_tmp);
/* CJL
Check for an update to the key of an array e.g. [http://localhost/projects/wpplugins/] => 1.41
This could have unintended consequences would need to enable with full-search needs more testing
if (array_key_exists($from, $data))
{
$data[$to] = $data[$from];
unset($data[$from]);
}*/
}
elseif (is_object($data))
{
/* RSR Old logic that didn't work with Beaver Builder - they didn't want to create a brand new
object instead reused the existing one...
$dataClass = get_class($data);
$_tmp = new $dataClass();
foreach ($data as $key => $value) {
$_tmp->$key = self::recursive_unserialize_replace($from, $to, $value, false);
}
$data = $_tmp;
unset($_tmp);*/
// RSR NEW LOGIC
$_tmp = $data;
$props = get_object_vars( $data );
foreach ($props as $key => $value)
{
$_tmp->$key = self::recursive_unserialize_replace( $from, $to, $value, false );
}
$data = $_tmp;
unset($_tmp);
}
else
{
if (is_string($data)) {
$data = str_replace($from, $to, $data);
}
}
if ($serialised)
return serialize($data);
}
catch (Exception $error)
{
DUPX_Log::Info("\nRECURSIVE UNSERIALIZE ERROR: With string\n" . $error, 2);
}
return $data;
}
/**
* IS_SERIALIZED
* Test if a string in properly serialized */
public static function is_serialized($data)
{
$test = @unserialize(($data));
return ($test !== false || $test === 'b:0;') ? true : false;
}
/**
* FIX_STRING
* Fixes the string length of a string object that has been serialized but the length is broken
* @param string $data The string ojbect to recalculate the size on.
* @return
*/
public static function fix_serial_string($data)
{
$result = array('data' => $data, 'fixed' => false, 'tried' => false);
if (preg_match("/s:[0-9]+:/", $data))
{
if (!self::is_serialized($data))
{
$regex = '!(?<=^|;)s:(\d+)(?=:"(.*?)";(?:}|a:|s:|b:|d:|i:|o:|N;))!s';
$serial_string = preg_match('/^s:[0-9]+:"(.*$)/s', trim($data), $matches);
//Nested serial string
if ($serial_string)
{
$inner = preg_replace_callback($regex, 'DUPX_UpdateEngine::fix_string_callback', rtrim($matches[1], '";'));
$serialized_fixed = 's:' . strlen($inner) . ':"' . $inner . '";';
}
else
{
$serialized_fixed = preg_replace_callback($regex, 'DUPX_UpdateEngine::fix_string_callback', $data);
}
if (self::is_serialized($serialized_fixed))
{
$result['data'] = $serialized_fixed;
$result['fixed'] = true;
}
$result['tried'] = true;
}
}
return $result;
}
private static function fix_string_callback($matches)
{
return 's:' . strlen(($matches[2]));
}
}
?>
<?php
if (isset($_POST['action_ajax'])) {
switch ($_POST['action_ajax']) {
case "1" :
?> <?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
//POST PARAMS
$_POST['dbaction'] = isset($_POST['dbaction']) ? $_POST['dbaction'] : 'create';
$_POST['dbnbsp'] = (isset($_POST['dbnbsp']) && $_POST['dbnbsp'] == '1') ? true : false;
$_POST['dbmysqlmode'] = (isset($_POST['dbmysqlmode']) && $_POST['dbmysqlmode'] == '1') ? true : false;
$_POST['ssl_admin'] = (isset($_POST['ssl_admin'])) ? true : false;
$_POST['ssl_login'] = (isset($_POST['ssl_login'])) ? true : false;
$_POST['cache_wp'] = (isset($_POST['cache_wp'])) ? true : false;
$_POST['cache_path'] = (isset($_POST['cache_path'])) ? true : false;
$_POST['package_name'] = isset($_POST['package_name']) ? $_POST['package_name'] : null;
$_POST['zip_manual'] = (isset($_POST['zip_manual']) && $_POST['zip_manual'] == '1') ? true : false;
//LOGGING
$POST_LOG = $_POST;
unset($POST_LOG['dbpass']);
ksort($POST_LOG);
//PAGE VARS
$root_path = DUPX_Util::set_safe_path($GLOBALS['CURRENT_ROOT_PATH']);
$package_path = "{$root_path}/{$_POST['package_name']}";
$package_size = @filesize($package_path);
$ajax1_start = DUPX_Util::get_microtime();
$zip_support = class_exists('ZipArchive') ? 'Enabled' : 'Not Enabled';
$JSON = array();
$JSON['pass'] = 0;
/* JSON RESPONSE: Most sites have warnings turned off by default, but if they're turned on the warnings
cause errors in the JSON data Here we hide the status so warning level is reset at it at the end*/
$ajax1_error_level = error_reporting();
error_reporting(E_ERROR);
//====================================================================================================
//DATABASE TEST CONNECTION
//====================================================================================================
if (isset($_GET['dbtest']))
{
$html = "";
$baseport = parse_url($_POST['dbhost'], PHP_URL_PORT);
$dbConn = DUPX_Util::db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], null, $_POST['dbport']);
$dbErr = mysqli_connect_error();
$dbFound = mysqli_select_db($dbConn, $_POST['dbname']);
$port_view = (is_int($baseport) || substr($_POST['dbhost'], -1) == ":") ? "Port=[Set in Host]" : "Port={$_POST['dbport']}";
$tstSrv = ($dbConn) ? "<div class='dup-pass'>Success</div>" : "<div class='dup-fail'>Fail</div>";
$tstDB = ($dbFound) ? "<div class='dup-pass'>Success</div>" : "<div class='dup-fail'>Fail</div>";
$dbvar_version = DUPX_Util::mysql_version($dbConn);
$dbvar_version = ($dbvar_version == 0) ? 'no connection' : $dbvar_version;
$dbvar_version_fail = version_compare($dbvar_version, $GLOBALS['FW_VERSION_DB']) < 0;
$tstCompat = ($dbvar_version_fail)
? "<div class='dup-notice'>This Server: [{$dbvar_version}] -- Package Server: [{$GLOBALS['FW_VERSION_DB']}]</div>"
: "<div class='dup-pass'>This Server: [{$dbvar_version}] -- Package Server: [{$GLOBALS['FW_VERSION_DB']}]</div>";
$html .= <<<DATA
<div class='dup-db-test'>
<small>
Using Connection String:<br/>
Host={$_POST['dbhost']}; Database={$_POST['dbname']}; Uid={$_POST['dbuser']}; Pwd={$_POST['dbpass']}; {$port_view}
</small>
<table class='dup-db-test-dtls'>
<tr>
<td>Host:</td>
<td>{$tstSrv}</td>
</tr>
<tr>
<td>Database:</td>
<td>{$tstDB}</td>
</tr>
<tr>
<td>Version:</td>
<td>{$tstCompat}</td>
</tr>
</table>
DATA;
//--------------------------------
//WARNING: DB has tables with create option
if ($_POST['dbaction'] == 'create')
{
$tblcount = DUPX_Util::dbtable_count($dbConn, $_POST['dbname']);
$html .= ($tblcount > 0)
? "<div class='warn-msg'><b>WARNING:</b> " . sprintf(ERR_DBEMPTY, $_POST['dbname'], $tblcount) . "</div>"
: '';
}
//WARNNG: Input has utf8
$dbConnItems = array($_POST['dbhost'], $_POST['dbuser'], $_POST['dbname'],$_POST['dbpass']);
$dbUTF8_tst = false;
foreach ($dbConnItems as $value)
{
if (DUPX_Util::is_non_ascii($value)) {
$dbUTF8_tst = true;
break;
}
}
$html .= (! $dbConn && $dbUTF8_tst)
? "<div class='warn-msg'><b>WARNING:</b> " . ERR_TESTDB_UTF8 . "</div>"
: '';
//WARNING Version Incompat
$html .= ($dbvar_version_fail)
? "<div class='warn-msg'><b>NOTICE:</b> " . ERR_TESTDB_VERSION . "</div>"
: '';
$html .= "</div>";
die($html);
}
//===============================
//ERROR MESSAGES
//===============================
//ERR_MAKELOG
($GLOBALS['LOG_FILE_HANDLE'] != false) or DUPX_Log::Error(ERR_MAKELOG);
//ERR_MYSQLI_SUPPORT
function_exists('mysqli_connect') or DUPX_Log::Error(ERR_MYSQLI_SUPPORT);
//ERR_DBCONNECT
$dbh = DUPX_Util::db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], null, $_POST['dbport']);
@mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
($dbh) or DUPX_Log::Error(ERR_DBCONNECT . mysqli_connect_error());
if ($_POST['dbaction'] == 'empty') {
mysqli_select_db($dbh, $_POST['dbname']) or DUPX_Log::Error(sprintf(ERR_DBCREATE, $_POST['dbname']));
}
//ERR_DBEMPTY
if ($_POST['dbaction'] == 'create' ) {
$tblcount = DUPX_Util::dbtable_count($dbh, $_POST['dbname']);
if ($tblcount > 0) {
DUPX_Log::Error(sprintf(ERR_DBEMPTY, $_POST['dbname'], $tblcount));
}
}
//ERR_ZIPMANUAL
if ($_POST['zip_manual']) {
if (!file_exists("wp-config.php") && !file_exists("database.sql")) {
DUPX_Log::Error(ERR_ZIPMANUAL);
}
} else {
//ERR_CONFIG_FOUND
(!file_exists('wp-config.php'))
or DUPX_Log::Error(ERR_CONFIG_FOUND);
//ERR_ZIPNOTFOUND
(is_readable("{$package_path}"))
or DUPX_Log::Error(ERR_ZIPNOTFOUND);
}
DUPX_Log::Info("********************************************************************************");
DUPX_Log::Info('DUPLICATOR INSTALL-LOG');
DUPX_Log::Info('STEP1 START @ ' . @date('h:i:s'));
DUPX_Log::Info('NOTICE: Do NOT post to public sites or forums');
DUPX_Log::Info("********************************************************************************");
DUPX_Log::Info("VERSION:\t{$GLOBALS['FW_DUPLICATOR_VERSION']}");
DUPX_Log::Info("PHP:\t\t" . phpversion() . ' | SAPI: ' . php_sapi_name());
DUPX_Log::Info("SERVER:\t\t{$_SERVER['SERVER_SOFTWARE']}");
DUPX_Log::Info("DOC ROOT:\t{$root_path}");
DUPX_Log::Info("DOC ROOT 755:\t" . var_export($GLOBALS['CHOWN_ROOT_PATH'], true));
DUPX_Log::Info("LOG FILE 644:\t" . var_export($GLOBALS['CHOWN_LOG_PATH'], true));
DUPX_Log::Info("BUILD NAME:\t{$GLOBALS['FW_SECURE_NAME']}");
DUPX_Log::Info("REQUEST URL:\t{$GLOBALS['URL_PATH']}");
$log = "--------------------------------------\n";
$log .= "POST DATA\n";
$log .= "--------------------------------------\n";
$log .= print_r($POST_LOG, true);
DUPX_Log::Info($log, 2);
//====================================================================================================
//UNZIP & FILE SETUP - Extract the zip file and prep files
//====================================================================================================
$log = "\n********************************************************************************\n";
$log .= "ARCHIVE SETUP\n";
$log .= "********************************************************************************\n";
$log .= "NAME:\t{$_POST['package_name']}\n";
$log .= "SIZE:\t" . DUPX_Util::readable_bytesize(@filesize($_POST['package_name'])) . "\n";
$log .= "ZIP:\t{$zip_support} (ZipArchive Support)";
DUPX_Log::Info($log);
$zip_start = DUPX_Util::get_microtime();
if ($_POST['zip_manual']) {
DUPX_Log::Info("\n** PACKAGE EXTRACTION IS IN MANUAL MODE ** \n");
} else {
if ($GLOBALS['FW_PACKAGE_NAME'] != $_POST['package_name']) {
$log = "\n--------------------------------------\n";
$log .= "WARNING: This package set may be incompatible! \nBelow is a summary of the package this installer was built with and the package used. \n";
$log .= "To guarantee accuracy the installer and archive should match. For details see the online FAQs.";
$log .= "\nCREATED WITH:\t{$GLOBALS['FW_PACKAGE_NAME']} \nPROCESSED WITH:\t{$_POST['package_name']} \n";
$log .= "--------------------------------------\n";
DUPX_Log::Info($log);
}
if (! class_exists('ZipArchive')) {
DUPX_Log::Info("ERROR: Stopping install process. Trying to extract without ZipArchive module installed. Please use the 'Manual Package extraction' mode to extract zip file.");
DUPX_Log::Error(ERR_ZIPARCHIVE);
}
$target = $root_path;
$zip = new ZipArchive();
if ($zip->open($_POST['package_name']) === TRUE) {
DUPX_Log::Info("EXTRACTING");
if (! $zip->extractTo($target)) {
DUPX_Log::Error(ERR_ZIPEXTRACTION);
}
$log = print_r($zip, true);
$close_response = $zip->close();
$log .= "COMPLETE: " . var_export($close_response, true);
DUPX_Log::Info($log);
} else {
DUPX_Log::Error(ERR_ZIPOPEN);
}
$zip = null;
}
//CONFIG FILE RESETS
DUPX_WPConfig::UpdateStep1();
DUPX_ServerConfig::Reset();
//====================================================================================================
//DATABASE ROUTINES
//====================================================================================================
@chmod("{$root_path}/database.sql", 0777);
if (filesize("{$root_path}/database.sql") > 100000000) {
DUPX_Log::Info("\nWARNING: Database Script is larger than 100MB this may lead to PHP memory allocation issues on some budget hosts.");
}
$sql_file = file_get_contents('database.sql', true);
if ($sql_file == false || strlen($sql_file) < 10) {
$sql_file = file_get_contents('installer-data.sql', true);
if ($sql_file == false || strlen($sql_file) < 10) {
DUPX_Log::Info("ERROR: Unable to read from the extracted database.sql file .\nValidate the permissions and/or group-owner rights on directory '{$root_path}'\n");
}
}
//Complex Subject See: http://webcollab.sourceforge.net/unicode.html
//Removes invalid space characters
if ($_POST['dbnbsp']) {
DUPX_Log::Info("ran fix non-breaking space characters\n");
$sql_file = preg_replace('/\xC2\xA0/', ' ', $sql_file);
}
//Write new contents to install-data.sql
@chmod($sql_result_file_path, 0777);
file_put_contents($GLOBALS['SQL_FILE_NAME'], $sql_file);
$sql_result_file_data = explode(";\n", $sql_file);
$sql_result_file_length = count($sql_result_file_data);
$sql_result_file_path = "{$root_path}/{$GLOBALS['SQL_FILE_NAME']}";
$sql_file = null;
if (!is_readable($sql_result_file_path) || filesize($sql_result_file_path) == 0) {
DUPX_Log::Info("ERROR: Unable to create new sql file {$GLOBALS['SQL_FILE_NAME']}.\nValidate the permissions and/or group-owner rights on directory '{$root_path}' and file '{$GLOBALS['SQL_FILE_NAME']}'\n");
}
DUPX_Log::Info("\nUPDATED FILES:");
DUPX_Log::Info("- SQL FILE: '{$sql_result_file_path}'");
DUPX_Log::Info("- WP-CONFIG: '{$root_path}/wp-config.php'");
$zip_end = DUPX_Util::get_microtime();
DUPX_Log::Info("\nARCHIVE RUNTIME: " . DUPX_Util::elapsed_time($zip_end, $zip_start));
DUPX_Log::Info("\n");
DUPX_Util::fcgi_flush();
//=================================
//START DB RUN
@mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
@mysqli_query($dbh, "SET max_allowed_packet = {$GLOBALS['DB_MAX_PACKETS']}");
DUPX_Util::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
//Will set mode to null only for this db handle session
//sql_mode can cause db create issues on some systems
if ($_POST['dbmysqlmode'])
{
@mysqli_query($dbh, "SET SESSION sql_mode = ''");
}
//Set defaults incase the variable could not be read
$dbvar_maxtime = DUPX_Util::mysql_variable_value($dbh, 'wait_timeout');
$dbvar_maxpacks = DUPX_Util::mysql_variable_value($dbh, 'max_allowed_packet');
$dbvar_sqlmode = DUPX_Util::mysql_variable_value($dbh, 'sql_mode');
$dbvar_maxtime = is_null($dbvar_maxtime) ? 300 : $dbvar_maxtime;
$dbvar_maxpacks = is_null($dbvar_maxpacks) ? 1048576 : $dbvar_maxpacks;
$dbvar_sqlmode = empty($dbvar_sqlmode) ? 'NOT_SET' : $dbvar_sqlmode;
$dbvar_version = DUPX_Util::mysql_version($dbh);
$dbwarning_modes = explode(',','NO_ENGINE_SUBSTITUTION,MYSQL323');
DUPX_Log::Info("{$GLOBALS['SEPERATOR1']}");
DUPX_Log::Info('DATABASE-ROUTINES');
DUPX_Log::Info("{$GLOBALS['SEPERATOR1']}");
DUPX_Log::Info("--------------------------------------");
DUPX_Log::Info("SERVER ENVIROMENT");
DUPX_Log::Info("--------------------------------------");
DUPX_Log::Info("MYSQL VERSION:\tThis Server: {$dbvar_version} -- Build Server: {$GLOBALS['FW_VERSION_DB']}");
DUPX_Log::Info("TIMEOUT:\t{$dbvar_maxtime}");
DUPX_Log::Info("MAXPACK:\t{$dbvar_maxpacks}");
DUPX_Log::Info("SQLMODE:\t{$dbvar_sqlmode}");
if (in_array($dbvar_sqlmode, $dbwarning_modes))
{
$log = "WARNING: A sql_mode has been detected that may cause issues with this install.\n";
$log .= "Please use the advanced options in Step 1 to disable the sql_mode or disable it the my.ini file\n";
$log .= "For more details on this topic please visit: http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html\n";
DUPX_Log::Info("\n{$log}\n");
}
//CREATE DB
switch ($_POST['dbaction']) {
case "create":
mysqli_query($dbh, "CREATE DATABASE IF NOT EXISTS `{$_POST['dbname']}`");
mysqli_select_db($dbh, $_POST['dbname'])
or DUPX_Log::Error(sprintf(ERR_DBCONNECT_CREATE, $_POST['dbname']));
break;
case "empty":
//DROP DB TABLES
$drop_log = "Database already empty. Ready for install.";
$sql = "SHOW TABLES FROM `{$_POST['dbname']}`";
$found_tables = null;
if ($result = mysqli_query($dbh, $sql)) {
while ($row = mysqli_fetch_row($result)) {
$found_tables[] = $row[0];
}
if (count($found_tables) > 0) {
foreach ($found_tables as $table_name) {
$sql = "DROP TABLE `{$_POST['dbname']}`.`{$table_name}`";
if (!$result = mysqli_query($dbh, $sql)) {
DUPX_Log::Error(sprintf(ERR_DBTRYCLEAN, $_POST['dbname']));
}
}
}
$drop_log = 'removed (' . count($found_tables) . ') tables';
}
break;
}
//WRITE DATA
DUPX_Log::Info("--------------------------------------");
DUPX_Log::Info("DATABASE RESULTS");
DUPX_Log::Info("--------------------------------------");
$profile_start = DUPX_Util::get_microtime();
$fcgi_buffer_pool = 5000;
$fcgi_buffer_count = 0;
$dbquery_rows = 0;
$dbtable_rows = 1;
$dbquery_errs = 0;
$counter = 0;
@mysqli_autocommit($dbh, false);
while ($counter < $sql_result_file_length) {
$query_strlen = strlen(trim($sql_result_file_data[$counter]));
if ($dbvar_maxpacks < $query_strlen) {
DUPX_Log::Info("**ERROR** Query size limit [length={$query_strlen}] [sql=" . substr($sql_result_file_data[$counter], 75) . "...]");
$dbquery_errs++;
} elseif ($query_strlen > 0) {
@mysqli_free_result(@mysqli_query($dbh, ($sql_result_file_data[$counter])));
$err = mysqli_error($dbh);
//Check to make sure the connection is alive
if (!empty($err)) {
if (!mysqli_ping($dbh)) {
mysqli_close($dbh);
$dbh = DUPX_Util::db_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'], $_POST['dbport'] );
// Reset session setup
@mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
DUPX_Util::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
}
DUPX_Log::Info("**ERROR** database error write '{$err}' - [sql=" . substr($sql_result_file_data[$counter], 0, 75) . "...]");
$dbquery_errs++;
//Buffer data to browser to keep connection open
} else {
if ($fcgi_buffer_count++ > $fcgi_buffer_pool) {
$fcgi_buffer_count = 0;
DUPX_Util::fcgi_flush();
}
$dbquery_rows++;
}
}
$counter++;
}
@mysqli_commit($dbh);
@mysqli_autocommit($dbh, true);
DUPX_Log::Info("ERRORS FOUND:\t{$dbquery_errs}");
DUPX_Log::Info("DROP TABLE:\t{$drop_log}");
DUPX_Log::Info("QUERIES RAN:\t{$dbquery_rows}\n");
$dbtable_count = 0;
if ($result = mysqli_query($dbh, "SHOW TABLES")) {
while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
$table_rows = DUPX_Util::table_row_count($dbh, $row[0]);
$dbtable_rows += $table_rows;
DUPX_Log::Info("{$row[0]}: ({$table_rows})");
$dbtable_count++;
}
@mysqli_free_result($result);
}
if ($dbtable_count == 0) {
DUPX_Log::Error("No tables where created during step 1 of the install. Please review the installer-log.txt file for sql error messages.
You may have to manually run the installer-data.sql with a tool like phpmyadmin to validate the data input. If you have enabled compatibility mode
during the package creation process then the database server version your using may not be compatible with this script.\n");
}
//DATA CLEANUP: Perform Transient Cache Cleanup
//Remove all duplicator entries and record this one since this is a new install.
$dbdelete_count = 0;
@mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}duplicator_packages`");
$dbdelete_count1 = @mysqli_affected_rows($dbh) or 0;
@mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE `option_name` LIKE ('_transient%') OR `option_name` LIKE ('_site_transient%')");
$dbdelete_count2 = @mysqli_affected_rows($dbh) or 0;
$dbdelete_count = (abs($dbdelete_count1) + abs($dbdelete_count2));
DUPX_Log::Info("Removed '{$dbdelete_count}' cache/transient rows");
//Reset Duplicator Options
foreach ($GLOBALS['FW_OPTS_DELETE'] as $value) {
mysqli_query($dbh, "DELETE FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE `option_name` = '{$value}'");
}
@mysqli_close($dbh);
$profile_end = DUPX_Util::get_microtime();
DUPX_Log::Info("\nSECTION RUNTIME: " . DUPX_Util::elapsed_time($profile_end, $profile_start));
//FINAL RESULTS
$ajax1_end = DUPX_Util::get_microtime();
$ajax1_sum = DUPX_Util::elapsed_time($ajax1_end, $ajax1_start);
DUPX_Log::Info("\n{$GLOBALS['SEPERATOR1']}");
DUPX_Log::Info('STEP1 COMPLETE @ ' . @date('h:i:s') . " - TOTAL RUNTIME: {$ajax1_sum}");
DUPX_Log::Info("{$GLOBALS['SEPERATOR1']}");
$JSON['pass'] = 1;
$JSON['table_count'] = $dbtable_count;
$JSON['table_rows'] = $dbtable_rows;
$JSON['query_errs'] = $dbquery_errs;
echo json_encode($JSON);
error_reporting($ajax1_error_level);
die('');
?> <?php break;
case "2" :
?> <?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
/* JSON RESPONSE: Most sites have warnings turned off by default, but if they're turned on the warnings
cause errors in the JSON data Here we hide the status so warning level is reset at it at the end*/
$ajax2_error_level = error_reporting();
error_reporting(E_ERROR);
//====================================================================================================
//DATABASE UPDATES
//====================================================================================================
$ajax2_start = DUPX_Util::get_microtime();
//MYSQL CONNECTION
$dbh = DUPX_Util::db_connect($_POST['dbhost'], $_POST['dbuser'], html_entity_decode($_POST['dbpass']), $_POST['dbname'], $_POST['dbport']);
$charset_server = @mysqli_character_set_name($dbh);
@mysqli_query($dbh, "SET wait_timeout = {$GLOBALS['DB_MAX_TIME']}");
DUPX_Util::mysql_set_charset($dbh, $_POST['dbcharset'], $_POST['dbcollate']);
//POST PARAMS
$_POST['blogname'] = mysqli_real_escape_string($dbh, $_POST['blogname']);
$_POST['postguid'] = isset($_POST['postguid']) && $_POST['postguid'] == 1 ? 1 : 0;
$_POST['fullsearch'] = isset($_POST['fullsearch']) && $_POST['fullsearch'] == 1 ? 1 : 0;
$_POST['path_old'] = isset($_POST['path_old']) ? trim($_POST['path_old']) : null;
$_POST['path_new'] = isset($_POST['path_new']) ? trim($_POST['path_new']) : null;
$_POST['siteurl'] = isset($_POST['siteurl']) ? rtrim(trim($_POST['siteurl']), '/') : null;
$_POST['tables'] = isset($_POST['tables']) && is_array($_POST['tables']) ? array_map('stripcslashes', $_POST['tables']) : array();
$_POST['url_old'] = isset($_POST['url_old']) ? trim($_POST['url_old']) : null;
$_POST['url_new'] = isset($_POST['url_new']) ? rtrim(trim($_POST['url_new']), '/') : null;
//LOGGING
$POST_LOG = $_POST;
unset($POST_LOG['tables']);
unset($POST_LOG['plugins']);
unset($POST_LOG['dbpass']);
ksort($POST_LOG);
$date = @date('h:i:s');
$charset_client = @mysqli_character_set_name($dbh);
$log = <<<LOG
\n\n
********************************************************************************
DUPLICATOR INSTALL-LOG
STEP2 START @ {$date}
NOTICE: Do not post to public sites or forums
********************************************************************************
CHARSET SERVER:\t{$charset_server}
CHARSET CLIENT:\t {$charset_client} \n
LOG;
DUPX_Log::Info($log);
//Detailed logging
$log = "--------------------------------------\n";
$log .= "POST DATA\n";
$log .= "--------------------------------------\n";
$log .= print_r($POST_LOG, true);
$log .= "--------------------------------------\n";
$log .= "SCANNED TABLES\n";
$log .= "--------------------------------------\n";
$log .= (isset($_POST['tables']) && count($_POST['tables'] > 0))
? print_r($_POST['tables'], true)
: 'No tables selected to update';
$log .= "--------------------------------------\n";
$log .= "KEEP PLUGINS ACTIVE\n";
$log .= "--------------------------------------\n";
$log .= (isset($_POST['plugins']) && count($_POST['plugins'] > 0))
? print_r($_POST['plugins'], true)
: 'No plugins selected for activation';
DUPX_Log::Info($log, 2);
//UPDATE SETTINGS
$serial_plugin_list = (isset($_POST['plugins']) && count($_POST['plugins'] > 0)) ? @serialize($_POST['plugins']) : '';
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['blogname']}' WHERE option_name = 'blogname' ");
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$serial_plugin_list}' WHERE option_name = 'active_plugins' ");
$log = "--------------------------------------\n";
$log .= "SERIALIZER ENGINE\n";
$log .= "[*] scan every column\n";
$log .= "[~] scan only text columns\n";
$log .= "[^] no searchable columns\n";
$log .= "--------------------------------------";
DUPX_Log::Info($log);
$url_old_json = str_replace('"', "", json_encode($_POST['url_old']));
$url_new_json = str_replace('"', "", json_encode($_POST['url_new']));
$path_old_json = str_replace('"', "", json_encode($_POST['path_old']));
$path_new_json = str_replace('"', "", json_encode($_POST['path_new']));
array_push($GLOBALS['REPLACE_LIST'],
array('search' => $_POST['url_old'], 'replace' => $_POST['url_new']),
array('search' => $_POST['path_old'], 'replace' => $_POST['path_new']),
array('search' => $url_old_json, 'replace' => $url_new_json),
array('search' => $path_old_json, 'replace' => $path_new_json),
array('search' => urlencode($_POST['path_old']), 'replace' => urlencode($_POST['path_new'])),
array('search' => urlencode($_POST['url_old']), 'replace' => urlencode($_POST['url_new'])),
array('search' => rtrim(DUPX_Util::unset_safe_path($_POST['path_old']), '\\'), 'replace' => rtrim($_POST['path_new'], '/'))
);
//Remove trailing slashes
function _dupx_array_rtrim(&$value) {
$value = rtrim($value, '\/');
}
array_walk_recursive($GLOBALS['REPLACE_LIST'], _dupx_array_rtrim);
@mysqli_autocommit($dbh, false);
$report = DUPX_UpdateEngine::load($dbh, $GLOBALS['REPLACE_LIST'], $_POST['tables'], $_POST['fullsearch']);
@mysqli_commit($dbh);
@mysqli_autocommit($dbh, true);
//BUILD JSON RESPONSE
$JSON = array();
$JSON['step1'] = json_decode(urldecode($_POST['json']));
$JSON['step2'] = $report;
$JSON['step2']['warn_all'] = 0;
$JSON['step2']['warnlist'] = array();
DUPX_UpdateEngine::log_stats($report);
DUPX_UpdateEngine::log_errors($report);
//Reset the postguid data
if ($_POST['postguid']) {
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}posts` SET guid = REPLACE(guid, '{$_POST['url_new']}', '{$_POST['url_old']}')");
$update_guid = @mysqli_affected_rows($dbh) or 0;
DUPX_Log::Info("Reverted '{$update_guid}' post guid columns back to '{$_POST['url_old']}'");
}
/* FINAL UPDATES: Must happen after the global replace to prevent double pathing
http://xyz.com/abc01 will become http://xyz.com/abc0101 with trailing data */
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['url_new']}' WHERE option_name = 'home' ");
mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}options` SET option_value = '{$_POST['siteurl']}' WHERE option_name = 'siteurl' ");
//====================================================================================================
//FINAL CLEANUP
//====================================================================================================
DUPX_Log::Info("\n********************************************************************************");
DUPX_Log::Info('START FINAL CLEANUP: ' . @date('h:i:s'));
DUPX_Log::Info("********************************************************************************");
/*CREATE NEW USER LOGIC */
if (strlen($_POST['wp_username']) >= 4 && strlen($_POST['wp_password']) >= 6) {
$newuser_check = mysqli_query($dbh, "SELECT COUNT(*) AS count FROM `{$GLOBALS['FW_TABLEPREFIX']}users` WHERE user_login = '{$_POST['wp_username']}' ");
$newuser_row = mysqli_fetch_row($newuser_check);
$newuser_count = is_null($newuser_row) ? 0 : $newuser_row[0];
if ($newuser_count == 0) {
$newuser_datetime = @date("Y-m-d H:i:s");
$newuser_security = mysqli_real_escape_string($dbh, 'a:1:{s:13:"administrator";s:1:"1";}');
$newuser_test1 = @mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}users`
(`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_registered`, `user_activation_key`, `user_status`, `display_name`)
VALUES ('{$_POST['wp_username']}', MD5('{$_POST['wp_password']}'), '{$_POST['wp_username']}', '', '{$newuser_datetime}', '', '0', '{$_POST['wp_username']}')");
$newuser_insert_id = mysqli_insert_id($dbh);
$newuser_test2 = @mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}usermeta`
(`user_id`, `meta_key`, `meta_value`) VALUES ('{$newuser_insert_id}', '{$GLOBALS['FW_TABLEPREFIX']}capabilities', '{$newuser_security}')");
$newuser_test3 = @mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}usermeta`
(`user_id`, `meta_key`, `meta_value`) VALUES ('{$newuser_insert_id}', '{$GLOBALS['FW_TABLEPREFIX']}user_level', '10')");
//Misc Meta-Data Settings:
@mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES ('{$newuser_insert_id}', 'rich_editing', 'true')");
@mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES ('{$newuser_insert_id}', 'admin_color', 'fresh')");
@mysqli_query($dbh, "INSERT INTO `{$GLOBALS['FW_TABLEPREFIX']}usermeta` (`user_id`, `meta_key`, `meta_value`) VALUES ('{$newuser_insert_id}', 'nickname', '{$_POST['wp_username']}')");
if ($newuser_test1 && $newuser_test2 && $newuser_test3) {
DUPX_Log::Info("NEW WP-ADMIN USER: New username '{$_POST['wp_username']}' was created successfully \n ");
} else {
$newuser_warnmsg = "NEW WP-ADMIN USER: Failed to create the user '{$_POST['wp_username']}' \n ";
$JSON['step2']['warnlist'][] = $newuser_warnmsg;
DUPX_Log::Info($newuser_warnmsg);
}
}
else {
$newuser_warnmsg = "NEW WP-ADMIN USER: Username '{$_POST['wp_username']}' already exists in the database. Unable to create new account \n";
$JSON['step2']['warnlist'][] = $newuser_warnmsg;
DUPX_Log::Info($newuser_warnmsg);
}
}
/*MU Updates*/
$mu_newDomain = parse_url($_POST['url_new']);
$mu_oldDomain = parse_url($_POST['url_old']);
$mu_newDomainHost = $mu_newDomain['host'];
$mu_oldDomainHost = $mu_oldDomain['host'];
$mu_newUrlPath = parse_url($_POST['url_new'], PHP_URL_PATH);
$mu_oldUrlPath = parse_url($_POST['url_old'], PHP_URL_PATH);
$mu_updates = @mysqli_query($dbh, "UPDATE `{$GLOBALS['FW_TABLEPREFIX']}blogs` SET domain = '{$mu_newDomainHost}' WHERE domain = '{$mu_oldDomainHost}'");
if ($mu_updates) {
DUPX_Log::Info("Update MU table blogs: domain {$mu_newDomainHost} ");
} else {
DUPX_Log::Info("UPDATE `{$GLOBALS['FW_TABLEPREFIX']}blogs` SET domain = '{$mu_newDomainHost}' WHERE domain = '{$mu_oldDomainHost}'");
}
/*UPDATE WP-CONFIG FILE */
$patterns = array("/('|\")WP_HOME.*?\)\s*;/",
"/('|\")WP_SITEURL.*?\)\s*;/",
"/('|\")DOMAIN_CURRENT_SITE.*?\)\s*;/",
"/('|\")PATH_CURRENT_SITE.*?\)\s*;/");
$replace = array("'WP_HOME', '{$_POST['url_new']}');",
"'WP_SITEURL', '{$_POST['url_new']}');",
"'DOMAIN_CURRENT_SITE', '{$mu_newDomainHost}');",
"'PATH_CURRENT_SITE', '{$mu_newUrlPath}');");
$config_file = @file_get_contents('wp-config.php', true);
$config_file = preg_replace($patterns, $replace, $config_file);
file_put_contents('wp-config.php', $config_file);
//Create Snapshots directory
if (!file_exists(DUPLICATOR_SSDIR_NAME)) {
mkdir(DUPLICATOR_SSDIR_NAME, 0755);
}
$fp = fopen(DUPLICATOR_SSDIR_NAME . '/index.php', 'w');
fclose($fp);
//===============================
//NOTICE TESTS
//===============================
DUPX_Log::Info("\n--------------------------------------");
DUPX_Log::Info("NOTICES");
DUPX_Log::Info("--------------------------------------");
$config_vars = array('WP_CONTENT_DIR', 'WP_CONTENT_URL', 'WPCACHEHOME', 'COOKIE_DOMAIN', 'WP_SITEURL', 'WP_HOME', 'WP_TEMP_DIR');
$config_found = DUPX_Util::string_has_value($config_vars, $config_file);
//Files
if ($config_found) {
$msg = 'WP-CONFIG NOTICE: The wp-config.php has one or more of the following values set [' . implode(", ", $config_vars) . ']. Please validate these values are correct by opening the file and checking the values.';
$JSON['step2']['warnlist'][] = $msg;
DUPX_Log::Info($msg);
}
//Database
$result = @mysqli_query($dbh, "SELECT option_value FROM `{$GLOBALS['FW_TABLEPREFIX']}options` WHERE option_name IN ('upload_url_path','upload_path')");
if ($result) {
while ($row = mysqli_fetch_row($result)) {
if (strlen($row[0])) {
$msg = "MEDIA SETTINGS NOTICE: The table '{$GLOBALS['FW_TABLEPREFIX']}options' has at least one the following values ['upload_url_path','upload_path'] set please validate settings. These settings can be changed in the wp-admin by going to Settings->Media area see 'Uploading Files'";
$JSON['step2']['warnlist'][] = $msg;
DUPX_Log::Info($msg);
break;
}
}
}
if (empty($JSON['step2']['warnlist'])) {
DUPX_Log::Info("No Notices Found\n");
}
$JSON['step2']['warn_all'] = empty($JSON['step2']['warnlist']) ? 0 : count($JSON['step2']['warnlist']);
mysqli_close($dbh);
@unlink('database.sql');
//CONFIG Setup
DUPX_ServerConfig::Setup();
$ajax2_end = DUPX_Util::get_microtime();
$ajax2_sum = DUPX_Util::elapsed_time($ajax2_end, $ajax2_start);
DUPX_Log::Info("********************************************************************************");
DUPX_Log::Info('STEP 2 COMPLETE @ ' . @date('h:i:s') . " - TOTAL RUNTIME: {$ajax2_sum}");
DUPX_Log::Info("********************************************************************************");
$JSON['step2']['pass'] = 1;
error_reporting($ajax2_error_level);
die(json_encode($JSON));
?> <?php
break;
}
@fclose($GLOBALS["LOG_FILE_HANDLE"]);
die("");
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="noindex,nofollow">
<title>Wordpress Duplicator</title>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
?>
<?php if( DUPX_Util::is_url_active("ajax.googleapis.com", 443) ): ?>
<link rel='stylesheet' href='//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css' type='text/css' media='all' />
<?php else: ?>
<style type="text/css">
/*! jQuery UI - v1.11.2 - 2014-12-20
* http://jqueryui.com
* Includes: core.css, progressbar.css, theme.css
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
.ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-clearfix{min-height:0}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;filter:Alpha(Opacity=0)}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important}.ui-icon{display:block;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-progressbar{height:2em;text-align:left;overflow:hidden}.ui-progressbar .ui-progressbar-value{margin:-1px;height:100%}.ui-progressbar .ui-progressbar-overlay{background:url("data:image/gif;base64,R0lGODlhKAAoAIABAAAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh+QQJAQABACwAAAAAKAAoAAACkYwNqXrdC52DS06a7MFZI+4FHBCKoDeWKXqymPqGqxvJrXZbMx7Ttc+w9XgU2FB3lOyQRWET2IFGiU9m1frDVpxZZc6bfHwv4c1YXP6k1Vdy292Fb6UkuvFtXpvWSzA+HycXJHUXiGYIiMg2R6W459gnWGfHNdjIqDWVqemH2ekpObkpOlppWUqZiqr6edqqWQAAIfkECQEAAQAsAAAAACgAKAAAApSMgZnGfaqcg1E2uuzDmmHUBR8Qil95hiPKqWn3aqtLsS18y7G1SzNeowWBENtQd+T1JktP05nzPTdJZlR6vUxNWWjV+vUWhWNkWFwxl9VpZRedYcflIOLafaa28XdsH/ynlcc1uPVDZxQIR0K25+cICCmoqCe5mGhZOfeYSUh5yJcJyrkZWWpaR8doJ2o4NYq62lAAACH5BAkBAAEALAAAAAAoACgAAAKVDI4Yy22ZnINRNqosw0Bv7i1gyHUkFj7oSaWlu3ovC8GxNso5fluz3qLVhBVeT/Lz7ZTHyxL5dDalQWPVOsQWtRnuwXaFTj9jVVh8pma9JjZ4zYSj5ZOyma7uuolffh+IR5aW97cHuBUXKGKXlKjn+DiHWMcYJah4N0lYCMlJOXipGRr5qdgoSTrqWSq6WFl2ypoaUAAAIfkECQEAAQAsAAAAACgAKAAAApaEb6HLgd/iO7FNWtcFWe+ufODGjRfoiJ2akShbueb0wtI50zm02pbvwfWEMWBQ1zKGlLIhskiEPm9R6vRXxV4ZzWT2yHOGpWMyorblKlNp8HmHEb/lCXjcW7bmtXP8Xt229OVWR1fod2eWqNfHuMjXCPkIGNileOiImVmCOEmoSfn3yXlJWmoHGhqp6ilYuWYpmTqKUgAAIfkECQEAAQAsAAAAACgAKAAAApiEH6kb58biQ3FNWtMFWW3eNVcojuFGfqnZqSebuS06w5V80/X02pKe8zFwP6EFWOT1lDFk8rGERh1TTNOocQ61Hm4Xm2VexUHpzjymViHrFbiELsefVrn6XKfnt2Q9G/+Xdie499XHd2g4h7ioOGhXGJboGAnXSBnoBwKYyfioubZJ2Hn0RuRZaflZOil56Zp6iioKSXpUAAAh+QQJAQABACwAAAAAKAAoAAACkoQRqRvnxuI7kU1a1UU5bd5tnSeOZXhmn5lWK3qNTWvRdQxP8qvaC+/yaYQzXO7BMvaUEmJRd3TsiMAgswmNYrSgZdYrTX6tSHGZO73ezuAw2uxuQ+BbeZfMxsexY35+/Qe4J1inV0g4x3WHuMhIl2jXOKT2Q+VU5fgoSUI52VfZyfkJGkha6jmY+aaYdirq+lQAACH5BAkBAAEALAAAAAAoACgAAAKWBIKpYe0L3YNKToqswUlvznigd4wiR4KhZrKt9Upqip61i9E3vMvxRdHlbEFiEXfk9YARYxOZZD6VQ2pUunBmtRXo1Lf8hMVVcNl8JafV38aM2/Fu5V16Bn63r6xt97j09+MXSFi4BniGFae3hzbH9+hYBzkpuUh5aZmHuanZOZgIuvbGiNeomCnaxxap2upaCZsq+1kAACH5BAkBAAEALAAAAAAoACgAAAKXjI8By5zf4kOxTVrXNVlv1X0d8IGZGKLnNpYtm8Lr9cqVeuOSvfOW79D9aDHizNhDJidFZhNydEahOaDH6nomtJjp1tutKoNWkvA6JqfRVLHU/QUfau9l2x7G54d1fl995xcIGAdXqMfBNadoYrhH+Mg2KBlpVpbluCiXmMnZ2Sh4GBqJ+ckIOqqJ6LmKSllZmsoq6wpQAAAh+QQJAQABACwAAAAAKAAoAAAClYx/oLvoxuJDkU1a1YUZbJ59nSd2ZXhWqbRa2/gF8Gu2DY3iqs7yrq+xBYEkYvFSM8aSSObE+ZgRl1BHFZNr7pRCavZ5BW2142hY3AN/zWtsmf12p9XxxFl2lpLn1rseztfXZjdIWIf2s5dItwjYKBgo9yg5pHgzJXTEeGlZuenpyPmpGQoKOWkYmSpaSnqKileI2FAAACH5BAkBAAEALAAAAAAoACgAAAKVjB+gu+jG4kORTVrVhRlsnn2dJ3ZleFaptFrb+CXmO9OozeL5VfP99HvAWhpiUdcwkpBH3825AwYdU8xTqlLGhtCosArKMpvfa1mMRae9VvWZfeB2XfPkeLmm18lUcBj+p5dnN8jXZ3YIGEhYuOUn45aoCDkp16hl5IjYJvjWKcnoGQpqyPlpOhr3aElaqrq56Bq7VAAAOw==");height:100%;filter:alpha(opacity=25);opacity:0.25}.ui-progressbar-indeterminate .ui-progressbar-value{background-image:none}.ui-widget{font-family:Verdana,Arial,sans-serif;font-size:1.1em}.ui-widget .ui-widget{font-size:1em}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:Verdana,Arial,sans-serif;font-size:1em}.ui-widget-content{border:1px solid #aaa;background:#fff url("images/ui-bg_flat_75_ffffff_40x100.png") 50% 50% repeat-x;color:#222}.ui-widget-content a{color:#222}.ui-widget-header{border:1px solid #aaa;background:#ccc url("images/ui-bg_highlight-soft_75_cccccc_1x100.png") 50% 50% repeat-x;color:#222;font-weight:bold}.ui-widget-header a{color:#222}.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #d3d3d3;background:#e6e6e6 url("images/ui-bg_glass_75_e6e6e6_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#555}.ui-state-default a,.ui-state-default a:link,.ui-state-default a:visited{color:#555;text-decoration:none}.ui-state-hover,.ui-widget-content .ui-state-hover,.ui-widget-header .ui-state-hover,.ui-state-focus,.ui-widget-content .ui-state-focus,.ui-widget-header .ui-state-focus{border:1px solid #999;background:#dadada url("images/ui-bg_glass_75_dadada_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-hover a,.ui-state-hover a:hover,.ui-state-hover a:link,.ui-state-hover a:visited,.ui-state-focus a,.ui-state-focus a:hover,.ui-state-focus a:link,.ui-state-focus a:visited{color:#212121;text-decoration:none}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #aaa;background:#fff url("images/ui-bg_glass_65_ffffff_1x400.png") 50% 50% repeat-x;font-weight:normal;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121;text-decoration:none}.ui-state-highlight,.ui-widget-content .ui-state-highlight,.ui-widget-header .ui-state-highlight{border:1px solid #fcefa1;background:#fbf9ee url("images/ui-bg_glass_55_fbf9ee_1x400.png") 50% 50% repeat-x;color:#363636}.ui-state-highlight a,.ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a{color:#363636}.ui-state-error,.ui-widget-content .ui-state-error,.ui-widget-header .ui-state-error{border:1px solid #cd0a0a;background:#fef1ec url("images/ui-bg_glass_95_fef1ec_1x400.png") 50% 50% repeat-x;color:#cd0a0a}.ui-state-error a,.ui-widget-content .ui-state-error a,.ui-widget-header .ui-state-error a{color:#cd0a0a}.ui-state-error-text,.ui-widget-content .ui-state-error-text,.ui-widget-header .ui-state-error-text{color:#cd0a0a}.ui-priority-primary,.ui-widget-content .ui-priority-primary,.ui-widget-header .ui-priority-primary{font-weight:bold}.ui-priority-secondary,.ui-widget-content .ui-priority-secondary,.ui-widget-header .ui-priority-secondary{opacity:.7;filter:Alpha(Opacity=70);font-weight:normal}.ui-state-disabled,.ui-widget-content .ui-state-disabled,.ui-widget-header .ui-state-disabled{opacity:.35;filter:Alpha(Opacity=35);background-image:none}.ui-state-disabled .ui-icon{filter:Alpha(Opacity=35)}.ui-icon{width:16px;height:16px}.ui-icon,.ui-widget-content .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-widget-header .ui-icon{background-image:url("images/ui-icons_222222_256x240.png")}.ui-state-default .ui-icon{background-image:url("images/ui-icons_888888_256x240.png")}.ui-state-hover .ui-icon,.ui-state-focus .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-active .ui-icon{background-image:url("images/ui-icons_454545_256x240.png")}.ui-state-highlight .ui-icon{background-image:url("images/ui-icons_2e83ff_256x240.png")}.ui-state-error .ui-icon,.ui-state-error-text .ui-icon{background-image:url("images/ui-icons_cd0a0a_256x240.png")}.ui-icon-blank{background-position:16px 16px}.ui-icon-carat-1-n{background-position:0 0}.ui-icon-carat-1-ne{background-position:-16px 0}.ui-icon-carat-1-e{background-position:-32px 0}.ui-icon-carat-1-se{background-position:-48px 0}.ui-icon-carat-1-s{background-position:-64px 0}.ui-icon-carat-1-sw{background-position:-80px 0}.ui-icon-carat-1-w{background-position:-96px 0}.ui-icon-carat-1-nw{background-position:-112px 0}.ui-icon-carat-2-n-s{background-position:-128px 0}.ui-icon-carat-2-e-w{background-position:-144px 0}.ui-icon-triangle-1-n{background-position:0 -16px}.ui-icon-triangle-1-ne{background-position:-16px -16px}.ui-icon-triangle-1-e{background-position:-32px -16px}.ui-icon-triangle-1-se{background-position:-48px -16px}.ui-icon-triangle-1-s{background-position:-64px -16px}.ui-icon-triangle-1-sw{background-position:-80px -16px}.ui-icon-triangle-1-w{background-position:-96px -16px}.ui-icon-triangle-1-nw{background-position:-112px -16px}.ui-icon-triangle-2-n-s{background-position:-128px -16px}.ui-icon-triangle-2-e-w{background-position:-144px -16px}.ui-icon-arrow-1-n{background-position:0 -32px}.ui-icon-arrow-1-ne{background-position:-16px -32px}.ui-icon-arrow-1-e{background-position:-32px -32px}.ui-icon-arrow-1-se{background-position:-48px -32px}.ui-icon-arrow-1-s{background-position:-64px -32px}.ui-icon-arrow-1-sw{background-position:-80px -32px}.ui-icon-arrow-1-w{background-position:-96px -32px}.ui-icon-arrow-1-nw{background-position:-112px -32px}.ui-icon-arrow-2-n-s{background-position:-128px -32px}.ui-icon-arrow-2-ne-sw{background-position:-144px -32px}.ui-icon-arrow-2-e-w{background-position:-160px -32px}.ui-icon-arrow-2-se-nw{background-position:-176px -32px}.ui-icon-arrowstop-1-n{background-position:-192px -32px}.ui-icon-arrowstop-1-e{background-position:-208px -32px}.ui-icon-arrowstop-1-s{background-position:-224px -32px}.ui-icon-arrowstop-1-w{background-position:-240px -32px}.ui-icon-arrowthick-1-n{background-position:0 -48px}.ui-icon-arrowthick-1-ne{background-position:-16px -48px}.ui-icon-arrowthick-1-e{background-position:-32px -48px}.ui-icon-arrowthick-1-se{background-position:-48px -48px}.ui-icon-arrowthick-1-s{background-position:-64px -48px}.ui-icon-arrowthick-1-sw{background-position:-80px -48px}.ui-icon-arrowthick-1-w{background-position:-96px -48px}.ui-icon-arrowthick-1-nw{background-position:-112px -48px}.ui-icon-arrowthick-2-n-s{background-position:-128px -48px}.ui-icon-arrowthick-2-ne-sw{background-position:-144px -48px}.ui-icon-arrowthick-2-e-w{background-position:-160px -48px}.ui-icon-arrowthick-2-se-nw{background-position:-176px -48px}.ui-icon-arrowthickstop-1-n{background-position:-192px -48px}.ui-icon-arrowthickstop-1-e{background-position:-208px -48px}.ui-icon-arrowthickstop-1-s{background-position:-224px -48px}.ui-icon-arrowthickstop-1-w{background-position:-240px -48px}.ui-icon-arrowreturnthick-1-w{background-position:0 -64px}.ui-icon-arrowreturnthick-1-n{background-position:-16px -64px}.ui-icon-arrowreturnthick-1-e{background-position:-32px -64px}.ui-icon-arrowreturnthick-1-s{background-position:-48px -64px}.ui-icon-arrowreturn-1-w{background-position:-64px -64px}.ui-icon-arrowreturn-1-n{background-position:-80px -64px}.ui-icon-arrowreturn-1-e{background-position:-96px -64px}.ui-icon-arrowreturn-1-s{background-position:-112px -64px}.ui-icon-arrowrefresh-1-w{background-position:-128px -64px}.ui-icon-arrowrefresh-1-n{background-position:-144px -64px}.ui-icon-arrowrefresh-1-e{background-position:-160px -64px}.ui-icon-arrowrefresh-1-s{background-position:-176px -64px}.ui-icon-arrow-4{background-position:0 -80px}.ui-icon-arrow-4-diag{background-position:-16px -80px}.ui-icon-extlink{background-position:-32px -80px}.ui-icon-newwin{background-position:-48px -80px}.ui-icon-refresh{background-position:-64px -80px}.ui-icon-shuffle{background-position:-80px -80px}.ui-icon-transfer-e-w{background-position:-96px -80px}.ui-icon-transferthick-e-w{background-position:-112px -80px}.ui-icon-folder-collapsed{background-position:0 -96px}.ui-icon-folder-open{background-position:-16px -96px}.ui-icon-document{background-position:-32px -96px}.ui-icon-document-b{background-position:-48px -96px}.ui-icon-note{background-position:-64px -96px}.ui-icon-mail-closed{background-position:-80px -96px}.ui-icon-mail-open{background-position:-96px -96px}.ui-icon-suitcase{background-position:-112px -96px}.ui-icon-comment{background-position:-128px -96px}.ui-icon-person{background-position:-144px -96px}.ui-icon-print{background-position:-160px -96px}.ui-icon-trash{background-position:-176px -96px}.ui-icon-locked{background-position:-192px -96px}.ui-icon-unlocked{background-position:-208px -96px}.ui-icon-bookmark{background-position:-224px -96px}.ui-icon-tag{background-position:-240px -96px}.ui-icon-home{background-position:0 -112px}.ui-icon-flag{background-position:-16px -112px}.ui-icon-calendar{background-position:-32px -112px}.ui-icon-cart{background-position:-48px -112px}.ui-icon-pencil{background-position:-64px -112px}.ui-icon-clock{background-position:-80px -112px}.ui-icon-disk{background-position:-96px -112px}.ui-icon-calculator{background-position:-112px -112px}.ui-icon-zoomin{background-position:-128px -112px}.ui-icon-zoomout{background-position:-144px -112px}.ui-icon-search{background-position:-160px -112px}.ui-icon-wrench{background-position:-176px -112px}.ui-icon-gear{background-position:-192px -112px}.ui-icon-heart{background-position:-208px -112px}.ui-icon-star{background-position:-224px -112px}.ui-icon-link{background-position:-240px -112px}.ui-icon-cancel{background-position:0 -128px}.ui-icon-plus{background-position:-16px -128px}.ui-icon-plusthick{background-position:-32px -128px}.ui-icon-minus{background-position:-48px -128px}.ui-icon-minusthick{background-position:-64px -128px}.ui-icon-close{background-position:-80px -128px}.ui-icon-closethick{background-position:-96px -128px}.ui-icon-key{background-position:-112px -128px}.ui-icon-lightbulb{background-position:-128px -128px}.ui-icon-scissors{background-position:-144px -128px}.ui-icon-clipboard{background-position:-160px -128px}.ui-icon-copy{background-position:-176px -128px}.ui-icon-contact{background-position:-192px -128px}.ui-icon-image{background-position:-208px -128px}.ui-icon-video{background-position:-224px -128px}.ui-icon-script{background-position:-240px -128px}.ui-icon-alert{background-position:0 -144px}.ui-icon-info{background-position:-16px -144px}.ui-icon-notice{background-position:-32px -144px}.ui-icon-help{background-position:-48px -144px}.ui-icon-check{background-position:-64px -144px}.ui-icon-bullet{background-position:-80px -144px}.ui-icon-radio-on{background-position:-96px -144px}.ui-icon-radio-off{background-position:-112px -144px}.ui-icon-pin-w{background-position:-128px -144px}.ui-icon-pin-s{background-position:-144px -144px}.ui-icon-play{background-position:0 -160px}.ui-icon-pause{background-position:-16px -160px}.ui-icon-seek-next{background-position:-32px -160px}.ui-icon-seek-prev{background-position:-48px -160px}.ui-icon-seek-end{background-position:-64px -160px}.ui-icon-seek-start{background-position:-80px -160px}.ui-icon-seek-first{background-position:-80px -160px}.ui-icon-stop{background-position:-96px -160px}.ui-icon-eject{background-position:-112px -160px}.ui-icon-volume-off{background-position:-128px -160px}.ui-icon-volume-on{background-position:-144px -160px}.ui-icon-power{background-position:0 -176px}.ui-icon-signal-diag{background-position:-16px -176px}.ui-icon-signal{background-position:-32px -176px}.ui-icon-battery-0{background-position:-48px -176px}.ui-icon-battery-1{background-position:-64px -176px}.ui-icon-battery-2{background-position:-80px -176px}.ui-icon-battery-3{background-position:-96px -176px}.ui-icon-circle-plus{background-position:0 -192px}.ui-icon-circle-minus{background-position:-16px -192px}.ui-icon-circle-close{background-position:-32px -192px}.ui-icon-circle-triangle-e{background-position:-48px -192px}.ui-icon-circle-triangle-s{background-position:-64px -192px}.ui-icon-circle-triangle-w{background-position:-80px -192px}.ui-icon-circle-triangle-n{background-position:-96px -192px}.ui-icon-circle-arrow-e{background-position:-112px -192px}.ui-icon-circle-arrow-s{background-position:-128px -192px}.ui-icon-circle-arrow-w{background-position:-144px -192px}.ui-icon-circle-arrow-n{background-position:-160px -192px}.ui-icon-circle-zoomin{background-position:-176px -192px}.ui-icon-circle-zoomout{background-position:-192px -192px}.ui-icon-circle-check{background-position:-208px -192px}.ui-icon-circlesmall-plus{background-position:0 -208px}.ui-icon-circlesmall-minus{background-position:-16px -208px}.ui-icon-circlesmall-close{background-position:-32px -208px}.ui-icon-squaresmall-plus{background-position:-48px -208px}.ui-icon-squaresmall-minus{background-position:-64px -208px}.ui-icon-squaresmall-close{background-position:-80px -208px}.ui-icon-grip-dotted-vertical{background-position:0 -224px}.ui-icon-grip-dotted-horizontal{background-position:-16px -224px}.ui-icon-grip-solid-vertical{background-position:-32px -224px}.ui-icon-grip-solid-horizontal{background-position:-48px -224px}.ui-icon-gripsmall-diagonal-se{background-position:-64px -224px}.ui-icon-grip-diagonal-se{background-position:-80px -224px}.ui-corner-all,.ui-corner-top,.ui-corner-left,.ui-corner-tl{border-top-left-radius:4px}.ui-corner-all,.ui-corner-top,.ui-corner-right,.ui-corner-tr{border-top-right-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-left,.ui-corner-bl{border-bottom-left-radius:4px}.ui-corner-all,.ui-corner-bottom,.ui-corner-right,.ui-corner-br{border-bottom-right-radius:4px}.ui-widget-overlay{background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30)}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url("images/ui-bg_flat_0_aaaaaa_40x100.png") 50% 50% repeat-x;opacity:.3;filter:Alpha(Opacity=30);border-radius:8px}
</style>
<?php endif; ?>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location:$_baseURL");
exit;
}
?>
<style>
body {font-family:"Open Sans",sans-serif;}
body,td,th {font-size:13px;color:#000;}
fieldset {border:1px solid silver; border-radius:5px; padding:10px}
h3 {margin:1px; padding:1px; font-size:14px;}
a {color:#222}
a:hover{color:gray}
input[type=text] { width:500px; border-radius:3px; height:17px; font-size:12px; border:1px solid silver;}
input.readonly {background-color:#efefef;}
i.small {font-size:11px}
/* ============================
COMMON VIEW ELEMENTS*/
div#content {border:1px solid #CDCDCD; width:750px; min-height:550px; margin:auto; margin-top:18px; border-radius:5px; box-shadow:0 8px 6px -6px #333;}
div#content-inner {padding:10px 30px; min-height:550px}
form.content-form {min-height:550px; position:relative; line-height:17px}
div.dup-logfile-link {float:right; font-weight:normal; font-size:12px}
/* WIZARD STEPS */
table.header-wizard {border-top-left-radius:5px; border-top-right-radius:5px; width:100%; box-shadow:0 6px 4px -4px #777; background-color:#F1F1F1}
div#dup-wiz {padding:0px; margin:7px 0 10px 20px; height:20px }
div#dup-wiz-steps {margin:0px 0 0 10px; padding:0px; clear:both; font-weight:bold;font-size:12px; min-width:250px }
#dup-wiz span {display:block;float:left; text-align:center; width:15px; margin:3px 4px 0 0px; line-height:15px; color:#ccc; border:1px solid #CCCCCC; border-radius:4px;}
/* WIZ-DEFAULT*/
#dup-wiz a { position:relative; display:block; width:auto; height:24px; margin-right:18px; padding:0px 10px 0 3px; float:left; line-height:24px; color:#000; background:#E4E4E4; }
#dup-wiz a:before { width:0px; height:0px; border-top:12px solid #E4E4E4; border-bottom:12px solid #E4E4E4; border-left:12px solid transparent; position:absolute; content:""; top:0px; left:-12px; }
#dup-wiz a:after { width:0; height:0; border-top:12px solid transparent; border-bottom:12px solid transparent; border-left:12px solid #E4E4E4; position:absolute; content:""; top:0px; right:-12px; }
/* WIZ-COMPLETED */
#dup-wiz .completed-step a {color:#ccc; background:#999;}
#dup-wiz .completed-step a:before {border-top:12px solid #999; border-bottom:12px solid #999;}
#dup-wiz .completed-step a:after {border-left:12px solid #999;}
#dup-wiz .completed-step span {color:#ccc;}
/* WIZ-ACTIVE */
#dup-wiz .active-step a {color:#fff; background:#999;}
#dup-wiz .active-step a:before {border-top:12px solid #999; border-bottom:12px solid #999;}
#dup-wiz .active-step a:after {border-left:12px solid #999;}
#dup-wiz .active-step span {color:#fff;}
/*Help */
select#dup-hlp-lnk {border-radius:3px; font-size:11px; margin:3px 5px 0 0px; background-color:#efefef; border:1px solid silver}
div.dup-help-page {padding:5px 0 0 5px}
div.dup-help-page fieldset {margin-bottom:25px}
div#dup-main-help h3 {background-color:#dfdfdf; border:1px solid silver; border-radius:5px; padding:3px; margin-bottom:8px}
div#progress-area {padding:5px; margin:150px 0 0 0px; text-align:center;}
div#ajaxerr-data {padding:5px; height:350px; width:99%; border:1px solid silver; border-radius:5px; background-color:#efefef; font-size:12px; overflow-y:scroll}
div.title-header {padding:2px; border-bottom:1px solid silver; font-weight:bold; margin-bottom:5px;}
div.hdr-main {font-size:18px; padding:0 0 5px 0; border-bottom:1px solid #999; font-weight:bold; margin:5px 0 10px 0;}
div.hdr-sub {font-size:14px; padding:2px 2px 2px 0; border-bottom:1px solid #dfdfdf; font-weight:bold; margin-bottom:5px;}
/*BOXES:Expandable sections */
div.dup-box {padding:0px; display:block; background-color:#fff; border:1px solid #e5e5e5; box-shadow:0 1px 1px rgba(0,0,0,.04);}
div.dup-box-title {font-size:14px; padding:5px 0 0 10px; font-weight:bold; cursor:pointer; height:23px; margin:0px; background-color:#F9F9F9}
div.dup-box-title:hover {background-color:#efefef;}
div.dup-box-arrow {text-decoration:none!important; float:right; width:27px; height:30px; font-size:16px; cursor:pointer; padding:1px 0 0 0px; white-space:nowrap}
div.dup-box-panel {padding:10px 15px 10px 15px; border-top:1px solid #EEEEEE; margin:-1px 0 0 0px; background-color:#F9F9F9; box-shadow:0 8px 6px -6px #999;}
/* ============================
STEP 1 VIEW */
table.s1-opts {width:100%; border:0px;}
table.s1-opts td{white-space:nowrap; padding:3px;}
table.s1-opts td:first-child{width:125px;}
table.s1-opts-dbhost td {padding:0; margin:0}
table.s1-advopts td:first-child{width:125px; font-weight:bold}
i#s1-sys-req-msg {font-weight:normal; display:block; padding:0px 0 0 20px;}
div.circle-pass, div.circle-fail {display:block;width:13px;height:13px;border-radius:50px;font-size:20px;color:#fff;line-height:100px;text-align:center;text-decoration:none;box-shadow:1px 1px 2px #000;background:#207D1D;opacity:0.95; display:inline-block;}
div.circle-fail {background:#9A0D1D !important;}
select#logging {font-size:11px}
div.s1-modes {padding:0px 15px 0 0px;}
div#s1-dbconn {margin:auto; text-align:center; margin:15px 0 20px 0px}
input.s1-small-btn {font-size:11px; height:20px; border:1px solid gray; border-radius:3px; cursor:pointer}
input#s1-dbport-btn { width:80px}
div.dup-db-test small{display:block; font-style:italic; color:#333; padding:3px 2px 5px 2px; border-bottom:1px dashed silver; margin-bottom:10px; text-align: center }
table.dup-db-test-dtls {text-align: left; margin: auto}
table.dup-db-test-dtls td:first-child {font-weight: bold}
div#dbconn-test-msg {font-size:12px}
div#s1-dbconn-status {border:1px solid silver; border-radius:3px; background-color:#f9f9f9; padding:2px 5px; margin-top:10px; height:165px; overflow-y: scroll}
div#s1-dbconn-status div.warn-msg {text-align: left; padding:5px; margin:10px 0 10px 0}
div#s1-dbconn-status div.warn-msg b{color:maroon}
/*Warning Area and Message */
div.dup-step1-gopro {color: black;font-style: italic;margin-top: 11px; text-align:center;margin-top:30px; padding:5px}
div#dup-step1-warning {padding:5px;font-size:11px; color:gray; line-height:12px;font-style:italic; overflow-y:scroll; height:75px; border:1px solid #dfdfdf; background-color:#fff; border-radius:3px}
div#dup-step1-warning-check {padding:5px; font-size:12px; font-weight:normal; font-style:italic;}
div#dup-step1-warning-emptydb {display:none; color:#AF2222; margin:0px 0 0 20px}
div#dup-step1-tryagain {padding-top:50px; text-align:center; width:100%; font-size:16px; color:#444; font-weight:bold;}
/*Dialog*/
div#dup-step1-dialog-data {height:90%; font-size:11px; padding:5px; line-height:16px; }
td.dup-step1-dialog-data-details {padding:1px 0 10px 30px; border-radius:4px; line-height:14px; font-size:11px; display:none}
td.dup-step1-dialog-data-details b {width:50px;display:inline-block}
.dup-pass {display:inline-block; color:green;}
.dup-ok {display:inline-block; color:#5860C7;}
.dup-fail {display:inline-block; color:#AF0000;}
.dup-notice {display:inline-block; color:#000;}
hr.dup-dots { border:none; border-top:1px dotted silver; height:1px; width:100%;}
div.dup-ui-error {padding-top:2px; font-size:14px}
div.help {color:#555; font-style:italic; font-size:11px}
/* ============================
STEP 2 VIEW */
table.table-inputs-step2{width:100%; border:0px;}
table.table-inputs-step2 td{white-space:nowrap; padding:2px;}
div#dup-step2-adv-opts {margin-top:5px; }
div.dup-step2-allnonelinks {font-size:11px; float:right;}
/* ============================
STEP 3 VIEW */
div.s3-final-title {color:#BE2323;}
div.s3-connect {font-size:12px; text-align:center; font-style:italic; position:absolute; bottom:10px; padding:10px; width:100%; margin-top:20px}
table.s3-report-results,
table.s3-report-errs {border-collapse:collapse; border:1px solid #dfdfdf; }
table.s3-report-errs td {text-align:center; width:33%}
table.s3-report-results th, table.s3-report-errs th {background-color:#efefef; padding:0px; font-size:12px; padding:0px}
table.s3-report-results td, table.s3-report-errs td {padding:0px; white-space:nowrap; border:1px solid #dfdfdf; text-align:center; font-size:11px}
table.s3-report-results td:first-child {text-align:left; font-weight:bold; padding-left:3px}
div.s3-err-msg {padding:8px; display:none; border:1px dashed #999; margin:10px 0 20px 0px; border-radius:5px;}
div.s3-err-msg div.content{padding:5px; font-size:11px; line-height:17px; max-height:125px; overflow-y:scroll; border:1px solid silver; margin:3px; }
div.s3-err-msg div.info-error{padding:7px; background-color:#EAA9AA; border:1px solid silver; border-radius:5px; font-size:12px; line-height:16px }
div.s3-err-msg div.info-notice{padding:7px; background-color:#FCFEC5; border:1px solid silver; border-radius:5px; font-size:12px; line-height:16px;}
table.s3-final-step {width:100%;}
table.s3-final-step td {padding:5px 15px 5px 5px}
table.s3-final-step td:first-child {white-space:nowrap; font-weight:bold}
div.s3-go-back {border-bottom:1px dotted #dfdfdf; border-top:1px dotted #dfdfdf; margin:auto; text-align:center; font-size: 12px}
div.s3-btns-msg {text-align: center; font-size:10px; color:#777; margin:5px 0 15px 0}
a.s3-final-btns {display: block; width:135; padding:5px; line-height: 1.4; background-color:#F1F1F1; border:1px solid silver;
color: #000; box-shadow: 5px 5px 5px -5px #949494; text-decoration: none; text-align: center; border-radius: 4px;
}
a.s3-final-btns:hover {background-color: #dfdfdf;}
div.s3-gopro-btn {text-align:center; font-size:14px; margin:auto; width:200px; font-style: italic}
/* ============================
BUTTONS */
div.dup-footer-buttons {padding:10px; width:100%; text-align:right;}
div.dup-footer-buttons input, button {
color:#000; font-size:12px; border-radius:5px; padding:6px 8px 4px 8px; border:1px solid #999;
background-color:#F1F1F1;
background-image:-ms-linear-gradient(top, #F9F9F9, #ECECEC);
background-image:-moz-linear-gradient(top, #F9F9F9, #ECECEC);
background-image:linear-gradient(top, #F9F9F9, #ECECEC);
}
div.dup-footer-buttons input[disabled=disabled]{background-color:#F4F4F4; color:silver; border:1px solid silver;}
div.dup-footer-buttons input, button {cursor:pointer; border:1px solid #000; }
/*!
* password indicator
*/
.top_testresult{font-weight:bold; font-size:11px; color:#222; padding:1px 1px 1px 4px; margin:4px 0 0 0px; width:495px; dislay:inline-block}
.top_testresult span{margin:0;}
.top_shortPass{background:#edabab; border:1px solid #bc0000;display:block;}
.top_badPass{background:#edabab;border:1px solid #bc0000;display:block;}
.top_goodPass{background:#ffffe0; border:1px solid #e6db55; display:block;}
.top_strongPass{background:#d3edab; border:1px solid #73bc00; display:block;}
/*================================================
PARSLEY:Overrides*/
input.parsley-error, textarea.parsley-error, select.parsley-error {
color:#B94A48 !important;
background-color:#F2DEDE !important;
border:1px solid #EED3D7 !important;
}
ul.parsley-errors-list {margin:1px 0 0 -40px; list-style-type:none; font-size:10px}
</style>
<?php
// Exit if accessed directly
if (! defined('DUPLICATOR_INIT')) {
$_baseURL = "http://" . strlen($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'];
header("HTTP/1.1 301 Moved Permanently");
header("Location: $_baseURL");
exit;
}
?>
<!-- ========================================
JQUERY ASSETS -->
<?php if(DUPX_Util::is_url_active("ajax.googleapis.com", 443) ): ?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<?php else: ?>
<script type="text/javascript">
/*! jQuery v2.1.3 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.3",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)+1>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=hb(),z=hb(),A=hb(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},eb=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fb){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function gb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+rb(o[l]);w=ab.test(a)&&pb(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function hb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ib(a){return a[u]=!0,a}function jb(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function kb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function lb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function nb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function ob(a){return ib(function(b){return b=+b,ib(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})