[CodeFactor] Apply fixes to commit 4d8a9c5

[ci skip] [skip ci]
This commit is contained in:
codefactor-io 2020-05-13 17:58:07 +00:00
parent 4d8a9c5762
commit a353e91bd5
7 changed files with 59 additions and 63 deletions

View file

@ -41,7 +41,6 @@ class MainWP_Child_Stats {
/**
*
* Show stats without login - only allowed while no account is added yet.
*
*/
public function get_site_stats_no_auth( $information = array() ) {
if ( get_option( 'mainwp_child_pubkey' ) ) {

View file

@ -808,8 +808,9 @@ class MainWP_Child {
}
// if auth connect are not valid then exit or return.
if ( ! MainWP_Connect::instance()->parse_init_auth() )
if ( ! MainWP_Connect::instance()->parse_init_auth() ) {
return;
}
$auth = MainWP_Connect::instance()->auth( isset( $_POST['mainwpsignature'] ) ? $_POST['mainwpsignature'] : '', isset( $_POST['function'] ) ? $_POST['function'] : '', isset( $_POST['nonce'] ) ? $_POST['nonce'] : '', isset( $_POST['nossl'] ) ? $_POST['nossl'] : 0 );

View file

@ -191,7 +191,7 @@ class MainWP_Connect {
$username = rawurldecode( $_REQUEST['user'] );
if ( isset( $_REQUEST['alt_user'] ) && ! empty( $_REQUEST['alt_user'] ) ) {
$alter_login_required = MainWP_Connect::instance()->check_login_as( $_REQUEST['alt_user'] );
$alter_login_required = self::instance()->check_login_as( $_REQUEST['alt_user'] );
if ( $alter_login_required ) {
$username = rawurldecode( $_REQUEST['alt_user'] );
}
@ -214,7 +214,7 @@ class MainWP_Connect {
$file = $_REQUEST['fdl'];
}
$auth = MainWP_Connect::instance()->auth( $signature, rawurldecode( ( isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : $file ) ), isset( $_REQUEST['nonce'] ) ? $_REQUEST['nonce'] : '', isset( $_REQUEST['nossl'] ) ? $_REQUEST['nossl'] : 0 );
$auth = self::instance()->auth( $signature, rawurldecode( ( isset( $_REQUEST['where'] ) ? $_REQUEST['where'] : $file ) ), isset( $_REQUEST['nonce'] ) ? $_REQUEST['nonce'] : '', isset( $_REQUEST['nossl'] ) ? $_REQUEST['nossl'] : 0 );
if ( ! $auth ) {
return;
@ -376,8 +376,6 @@ class MainWP_Connect {
* Check to support login by alternative admin.
* Return false will login by connected admin user.
* Return true will try to login as alternative user.
*
*
*/
public function check_login_as( $alter_login ) {

View file

@ -179,9 +179,10 @@ class MainWP_Helper {
// to fix issue re-create new attachment.
if ( $check_file_existed ) {
$result = self::check_media_file_existed( $upload_dir, $filename, $temporary_file, $local_img_path, $local_img_url );
if ( ! empty( $result ) )
if ( ! empty( $result ) ) {
return $result;
}
}
// file exists, do not overwrite, generate unique file name.
// this may causing of issue incorrect source of image in post content.
@ -194,7 +195,6 @@ class MainWP_Helper {
if ( $moved ) {
return self::insert_attachment_media( $img_data, $img_url, $parent_id, $local_img_path, $local_img_url );
}
}
if ( file_exists( $temporary_file ) ) {

View file

@ -58,7 +58,6 @@ class MainWP_Utility {
/**
*
* To support maintenance alert
*
*/
public function maintenance_alert() {
if ( ! is_404() ) {
@ -165,7 +164,6 @@ class MainWP_Utility {
/**
*
* To support upload backup files.
*
*/
public function upload_file( $file, $offset = 0 ) {
$dirs = MainWP_Helper::get_mainwp_dir( 'backup' );