Add HTTPS support, fixes #1372
git-svn-id: https://develop.svn.wordpress.org/trunk@3041 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0aea367865
commit
4b6a074982
@ -6,7 +6,8 @@ if (!file_exists('../wp-config.php'))
|
|||||||
require_once('../wp-config.php');
|
require_once('../wp-config.php');
|
||||||
require_once('./upgrade-functions.php');
|
require_once('./upgrade-functions.php');
|
||||||
|
|
||||||
$guessurl = str_replace('/wp-admin/install.php?step=2', '', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
|
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||||
|
$guessurl = str_replace('/wp-admin/install.php?step=2', '', $schema . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) );
|
||||||
|
|
||||||
if (isset($_GET['step']))
|
if (isset($_GET['step']))
|
||||||
$step = $_GET['step'];
|
$step = $_GET['step'];
|
||||||
|
@ -150,7 +150,8 @@ CREATE TABLE $wpdb->usermeta (
|
|||||||
function populate_options() {
|
function populate_options() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$guessurl = preg_replace('|/wp-admin/.*|i', '', 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||||
|
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
||||||
add_option('siteurl', $guessurl, __('WordPress web address'));
|
add_option('siteurl', $guessurl, __('WordPress web address'));
|
||||||
add_option('blogname', __('My Weblog'), __('Blog title'));
|
add_option('blogname', __('My Weblog'), __('Blog title'));
|
||||||
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
|
add_option('blogdescription', __('Just another WordPress weblog'), __('Short tagline'));
|
||||||
|
@ -823,7 +823,7 @@ function make_url_footnote($content) {
|
|||||||
$link_url = $matches[2][$i];
|
$link_url = $matches[2][$i];
|
||||||
$link_text = $matches[4][$i];
|
$link_text = $matches[4][$i];
|
||||||
$content = str_replace($link_match, $link_text.' '.$link_number, $content);
|
$content = str_replace($link_match, $link_text.' '.$link_number, $content);
|
||||||
$link_url = (strtolower(substr($link_url,0,7)) != 'http://') ? get_settings('home') . $link_url : $link_url;
|
$link_url = ((strtolower(substr($link_url,0,7)) != 'http://')||(strtolower(substr($link_url,0,7)) != 'https://')) ? get_settings('home') . $link_url : $link_url;
|
||||||
$links_summary .= "\n".$link_number.' '.$link_url;
|
$links_summary .= "\n".$link_number.' '.$link_url;
|
||||||
}
|
}
|
||||||
$content = strip_tags($content);
|
$content = strip_tags($content);
|
||||||
|
@ -11,9 +11,10 @@ header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('cha
|
|||||||
if ( defined('RELOCATE') ) { // Move flag is set
|
if ( defined('RELOCATE') ) { // Move flag is set
|
||||||
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
|
if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
|
||||||
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
|
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
|
||||||
|
|
||||||
if ( dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') )
|
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||||
update_option('siteurl', dirname('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
|
if ( dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) != get_settings('siteurl') )
|
||||||
|
update_option('siteurl', dirname($schema . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']) );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($action) {
|
switch($action) {
|
||||||
|
@ -324,7 +324,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||||||
|
|
||||||
/* warning: here we make the assumption that the weblog's URI is on the same server */
|
/* warning: here we make the assumption that the weblog's URI is on the same server */
|
||||||
$filename = get_settings('home') . '/';
|
$filename = get_settings('home') . '/';
|
||||||
$filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
|
$filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
|
||||||
|
|
||||||
$f = fopen($filename, 'r');
|
$f = fopen($filename, 'r');
|
||||||
$content = fread($f, filesize($filename));
|
$content = fread($f, filesize($filename));
|
||||||
@ -359,7 +359,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||||||
|
|
||||||
/* warning: here we make the assumption that the weblog's URI is on the same server */
|
/* warning: here we make the assumption that the weblog's URI is on the same server */
|
||||||
$filename = get_settings('home') . '/';
|
$filename = get_settings('home') . '/';
|
||||||
$filename = preg_replace('#http://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
|
$filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
|
||||||
|
|
||||||
if ($f = fopen($filename, 'w+')) {
|
if ($f = fopen($filename, 'w+')) {
|
||||||
fwrite($f, $content);
|
fwrite($f, $content);
|
||||||
@ -1147,7 +1147,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
|||||||
$error_code = -1;
|
$error_code = -1;
|
||||||
|
|
||||||
// Check if the page linked to is in our site
|
// Check if the page linked to is in our site
|
||||||
$pos1 = strpos($pagelinkedto, str_replace('http://', '', str_replace('www.', '', get_settings('home'))));
|
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_settings('home')));
|
||||||
if( !$pos1 )
|
if( !$pos1 )
|
||||||
return new IXR_Error(0, 'Is there no link to us?');
|
return new IXR_Error(0, 'Is there no link to us?');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user