get_website_by_id( $id ); if ( ! MainWP_System_Utility::can_edit_website( $website ) ) { exit(); } $location = ''; if ( isset( $_GET['location'] ) ) { $location = base64_decode( wp_unslash( $_GET['location'] ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_decode used for HTTP compatible char. } $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : ''; $query = wp_parse_url( $request_uri, PHP_URL_QUERY ); $add_params = array(); if ( $query ) { parse_str( $query, $add_params ); } $exclude_keys = array( 'page', 'websiteid', 'location', '_opennonce', '_opennonce', 'openUrl', 'filedl', 'dirdl', 'closeWindow' ); if ( isset( $_GET['openUrl'] ) && 'yes' === $_GET['openUrl'] ) { $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true ); $postdata['open_location'] = $location; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. ?>
url ) && '' !== $website->url ? $website->url : $website->siteurl ); $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); ?>
$value ) { echo ''; } if ( is_array( $add_params ) ) { foreach ( $add_params as $name => $value ) { if ( in_array( $name, $exclude_keys, true ) ) { continue; } echo ''; } } ?>
$value ) { if ( in_array( $name, $exclude_keys, true ) ) { continue; } $allow_params[ $name ] = $value; } } $allow_vars = array( 'filedl', 'dirdl', ); $allow_vars = apply_filters( 'mainwp_open_site_allow_vars', $allow_vars ); if ( is_array( $allow_vars ) ) { foreach ( $allow_vars as $var ) { if ( is_string( $var ) && isset( $_GET[ $var ] ) ) { $allow_params[ $var ] = $_GET[ $var ]; // phpcs:ignore -- ok. } } } static::open_site( $website, $location, $allow_params ); } // phpcs:enable } /** * This method opens the requested Child Site Admin. * * @param mixed $website Website ID. * @param mixed $location Website Location. * @param array $params others params. * * @uses \MainWP\Dashboard\MainWP_Connect::get_get_data_authed() */ private static function open_site( $website, $location, $params = array() ) { if ( MainWP_Demo_Handle::get_instance()->is_demo_website( $website ) ) { $action = $website->url . 'wp-admin.html'; } else { $action = MainWP_Connect::get_get_data_authed( $website, ( null === $location || '' === $location ) ? 'index.php' : $location, 'where', false, $params ); } $open_download = ! empty( $params['filedl'] ) ? true : false; $close_window = ! empty( $_GET['closeWindow'] ) ? true : false; //phpcs:ignore -- ok. /** * Action: mainwp_site_go_to_wpadmin * * Fire before go to wp admin child site. * * @since 5.5 */ do_action( 'mainwp_site_go_to_wpadmin', $website, $location, $params ); ?>
get_website_by_id( $id ); if ( ! MainWP_System_Utility::can_edit_website( $website ) ) { exit(); } $file = ''; if ( isset( $_GET['f'] ) ) { $file = base64_decode( esc_html( wp_unslash( $_GET['f'] ) ) ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. } $site = isset( $_GET['size'] ) ? esc_html( wp_unslash( $_GET['size'] ) ) : ''; // phpcs:enable static::open_site_restore( $website, $file, $site ); } /** * This opens the site restore. * * @param mixed $website Website ID. * @param mixed $file Restore File. * @param mixed $size Post data size. * * @uses \MainWP\Dashboard\MainWP_Connect::get_get_data_authed() */ public static function open_site_restore( $website, $file, $size ) { ?>
url ) && '' !== $website->url ? $website->url : $website->siteurl ); $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); $postdata = MainWP_Connect::get_get_data_authed( $website, $file, 'f', true ); $postdata['size'] = $size; ?>
$value ) { echo ''; } ?>
url ) && '' !== $website->url ? $website->url : $website->siteurl ); $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true ); $postdata['open_location'] = $open_location; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. ?>
$value ) { echo ''; } ?>
id; } else { return ''; } $open_url = ''; if ( MainWP_Demo_Handle::get_instance()->is_demo_website( $site_id ) ) { $open_url = MainWP_Demo_Handle::get_instance()->get_open_site_demo_url( $site_id ); } else { $open_url = self::get_open_site_admin_link( $site_id ); if ( ! empty( $location ) ) { $open_url .= '&location=' . $location; } } if ( $echo_out ) { echo $open_url; //phpcs:ignore WordPress.Security.EscapeOutput } return $open_url; } }