mirror of
https://github.com/mainwp/mainwp-child.git
synced 2025-09-12 00:00:42 +08:00
Second part of ssl fixes
This commit is contained in:
parent
3283eec336
commit
fef2de881b
3 changed files with 27 additions and 4 deletions
|
@ -2036,6 +2036,11 @@ class MainWP_Child {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Check SSL Requirement
|
||||||
|
if ( !MainWP_Helper::isSSLEnabled() && ( !defined( 'MAINWP_ALLOW_NOSSL_CONNECT' ) || !MAINWP_ALLOW_NOSSL_CONNECT ) ) {
|
||||||
|
MainWP_Helper::error( __( 'SSL is required on the child site to set up a secure connection.', 'mainwp-child' ) );
|
||||||
|
}
|
||||||
|
|
||||||
//Login
|
//Login
|
||||||
if ( isset( $_POST['user'] ) ) {
|
if ( isset( $_POST['user'] ) ) {
|
||||||
if ( ! $this->login( $_POST['user'] ) ) {
|
if ( ! $this->login( $_POST['user'] ) ) {
|
||||||
|
@ -2052,8 +2057,8 @@ class MainWP_Child {
|
||||||
MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] ); //Save the public key
|
MainWP_Helper::update_option( 'mainwp_child_server', $_POST['server'] ); //Save the public key
|
||||||
MainWP_Helper::update_option( 'mainwp_child_nonce', 0 ); //Save the nonce
|
MainWP_Helper::update_option( 'mainwp_child_nonce', 0 ); //Save the nonce
|
||||||
|
|
||||||
MainWP_Helper::update_option( 'mainwp_child_nossl', ( '-1' === $_POST['pubkey'] || ! function_exists( 'openssl_verify' ) ? 1 : 0 ), 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_nossl', ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::isSSLEnabled() ? 1 : 0 ), 'yes' );
|
||||||
$information['nossl'] = ( '-1' === $_POST['pubkey'] || ! function_exists( 'openssl_verify' ) ? 1 : 0 );
|
$information['nossl'] = ( '-1' === $_POST['pubkey'] || ! MainWP_Helper::isSSLEnabled() ? 1 : 0 );
|
||||||
$nossl_key = uniqid( '', true );
|
$nossl_key = uniqid( '', true );
|
||||||
MainWP_Helper::update_option( 'mainwp_child_nossl_key', $nossl_key, 'yes' );
|
MainWP_Helper::update_option( 'mainwp_child_nossl_key', $nossl_key, 'yes' );
|
||||||
$information['nosslkey'] = $nossl_key;
|
$information['nosslkey'] = $nossl_key;
|
||||||
|
@ -3211,7 +3216,17 @@ class MainWP_Child {
|
||||||
$information['version'] = self::$version;
|
$information['version'] = self::$version;
|
||||||
$information['wpversion'] = $wp_version;
|
$information['wpversion'] = $wp_version;
|
||||||
$information['siteurl'] = get_option( 'siteurl' );
|
$information['siteurl'] = get_option( 'siteurl' );
|
||||||
$information['nossl'] = ( '1' === get_option( 'mainwp_child_nossl' ) ? 1 : 0 );
|
|
||||||
|
//Try to switch to SSL if SSL is enabled in between!
|
||||||
|
$pubkey = get_option( 'mainwp_child_pubkey' );
|
||||||
|
$nossl = get_option( 'mainwp_child_nossl' );
|
||||||
|
if ( 1 == $nossl ) {
|
||||||
|
if ( isset($pubkey) && MainWP_Helper::isSSLEnabled() ) {
|
||||||
|
MainWP_Helper::update_option( 'mainwp_child_nossl', 0, 'yes' );
|
||||||
|
$nossl = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$information['nossl'] = ( 1 == $nossl ? 1 : 0 );
|
||||||
|
|
||||||
include_once( ABSPATH . '/wp-admin/includes/update.php' );
|
include_once( ABSPATH . '/wp-admin/includes/update.php' );
|
||||||
|
|
||||||
|
|
|
@ -1288,4 +1288,10 @@ class MainWP_Helper {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isSSLEnabled()
|
||||||
|
{
|
||||||
|
if ( defined( 'MAINWP_NOSSL' ) ) return !MAINWP_NOSSL;
|
||||||
|
return function_exists( 'openssl_verify' );
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
Author: MainWP
|
Author: MainWP
|
||||||
Author URI: https://mainwp.com
|
Author URI: https://mainwp.com
|
||||||
Text Domain: mainwp-child
|
Text Domain: mainwp-child
|
||||||
Version: 3.2.4
|
Version: 3.2.5-alpha
|
||||||
*/
|
*/
|
||||||
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isset( $_REQUEST['mainwpsignature'] ) && ( ! empty( $_REQUEST['mainwpsignature'] ) ) ) ) {
|
||||||
header( 'X-Frame-Options: ALLOWALL' );
|
header( 'X-Frame-Options: ALLOWALL' );
|
||||||
|
@ -15,6 +15,8 @@ if ( ( isset( $_REQUEST['heatmap'] ) && '1' === $_REQUEST['heatmap'] ) || ( isse
|
||||||
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
include_once( ABSPATH . 'wp-includes' . DIRECTORY_SEPARATOR . 'version.php' ); //Version information from wordpress
|
||||||
|
|
||||||
define( 'MAINWP_DEBUG', FALSE );
|
define( 'MAINWP_DEBUG', FALSE );
|
||||||
|
define( 'MAINWP_NOSSL', TRUE );
|
||||||
|
define( 'MAINWP_ALLOW_NOSSL_CONNECT', TRUE );
|
||||||
|
|
||||||
if ( ! defined( 'MAINWP_CHILD_FILE' ) ) {
|
if ( ! defined( 'MAINWP_CHILD_FILE' ) ) {
|
||||||
define( 'MAINWP_CHILD_FILE', __FILE__ );
|
define( 'MAINWP_CHILD_FILE', __FILE__ );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue