diff --git a/wp-quick-install/index.php b/wp-quick-install/index.php
index 89a0a9f..ff628f6 100755
--- a/wp-quick-install/index.php
+++ b/wp-quick-install/index.php
@@ -41,6 +41,18 @@
$data = json_encode( parse_ini_file( 'data.ini' ) );
}
+function curl_file_get_contents($URL)
+{
+ $c = curl_init();
+ curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($c, CURLOPT_URL, $URL);
+ $contents = curl_exec($c);
+ curl_close($c);
+
+ if ($contents) return $contents;
+ else return FALSE;
+}
+
// We add ../ to directory
$directory = ! empty( $_POST['directory'] ) ? '../' . $_POST['directory'] . '/' : '../';
@@ -80,14 +92,15 @@
$language = substr( $_POST['language'], 0, 6 );
// Get WordPress data
- $wp = json_decode( file_get_contents( WP_API_CORE . $language ) )->offers[0];
+ $wp = json_decode( curl_file_get_contents( WP_API_CORE . $language ) )->offers[0];
+ $wp->download = str_replace('http:', 'https:', $wp->download); // Prevent http result: 301 - Moved permanently
/*--------------------------*/
/* We download the latest version of WordPress
/*--------------------------*/
if ( ! file_exists( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip' ) ) {
- file_put_contents( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip', file_get_contents( $wp->download ) );
+ file_put_contents( WPQI_CACHE_CORE_PATH . 'wordpress-' . $wp->version . '-' . $language . '.zip', curl_file_get_contents( $wp->download ) );
}
break;
@@ -98,7 +111,7 @@
$language = substr( $_POST['language'], 0, 6 );
// Get WordPress data
- $wp = json_decode( file_get_contents( WP_API_CORE . $language ) )->offers[0];
+ $wp = json_decode( curl_file_get_contents( WP_API_CORE . $language ) )->offers[0];
/*--------------------------*/
/* We create the website folder with the files and the WordPress folder
@@ -151,7 +164,7 @@
$config_file = file( $directory . 'wp-config-sample.php' );
// Managing the security keys
- $secret_keys = explode( "\n", file_get_contents( 'https://api.wordpress.org/secret-key/1.1/salt/' ) );
+ $secret_keys = explode( "\n", curl_file_get_contents( 'https://api.wordpress.org/secret-key/1.1/salt/' ) );
foreach ( $secret_keys as $k => $v ) {
$secret_keys[$k] = substr( $v, 28, 64 );
@@ -482,7 +495,7 @@
foreach ( $plugins as $plugin ) {
// We retrieve the plugin XML file to get the link to downlad it
- $plugin_repo = file_get_contents( "http://api.wordpress.org/plugins/info/1.0/$plugin.json" );
+ $plugin_repo = curl_file_get_contents( "http://api.wordpress.org/plugins/info/1.0/$plugin.json" );
if ( $plugin_repo && $plugin = json_decode( $plugin_repo ) ) {
@@ -490,7 +503,7 @@
if ( ! file_exists( $plugin_path ) ) {
// We download the lastest version
- if ( $download_link = file_get_contents( $plugin->download_link ) ) {
+ if ( $download_link = curl_file_get_contents( $plugin->download_link ) ) {
file_put_contents( $plugin_path, $download_link );
} }
@@ -665,7 +678,7 @@
translations;
+ $languages = json_decode( curl_file_get_contents( 'http://api.wordpress.org/translations/core/1.0/?version=4.0' ) )->translations;
foreach ( $languages as $language ) {
echo '';