$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; } //=============================== //WP-CONFIG: wp-config //=============================== $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', " . '\'' . DupUtil::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/");
//WP-CONFIG: wp-config //=============================== $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', " . '\'' . DupUtil::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);";