| @@ -108,9 +108,9 @@ | ||
| 108 | 108 | $exclude_keys = array( 'page', 'websiteid', 'location', '_opennonce', '_opennonce', 'openUrl', 'filedl', 'dirdl', 'closeWindow' ); |
| 109 | 109 | |
| 110 | 110 | if ( isset( $_GET['openUrl'] ) && 'yes' === $_GET['openUrl'] ) { |
| 111 | 111 | |
| 112 | - $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true ); | |
| 112 | + $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true, array( 'verify_signature' => true ) ); | |
| 113 | 113 | $postdata['open_location'] = $location; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. |
| 114 | 114 | ?> |
| 115 | 115 | <div class="ui segment" style="padding: 25rem"> |
| 116 | 116 | <div class="ui active dimmer"> |
| @@ -116,9 +116,9 @@ | ||
| 116 | 116 | <div class="ui active dimmer"> |
| 117 | 117 | <div class="ui massive double text loader"><?php esc_html_e( 'Redirecting...', 'mainwp' ); ?></div> |
| 118 | 118 | </div> |
| 119 | 119 | <?php |
| 120 | - $url = ( isset( $website->url ) && '' !== $website->url ? $website->url : $website->siteurl ); | |
| 120 | + $url = MainWP_Site_Url_Corrector::browser_target_url( $website ); | |
| 121 | 121 | $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); |
| 122 | 122 | ?> |
| 123 | 123 | <form method="POST" action="<?php echo esc_url( $url ); ?>" id="redirectForm"> <?php // phpcs:ignore -- NOSONAR - dublicate id ok. ?> |
| 124 | 124 | <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |
| @@ -180,13 +180,22 @@ | ||
| 180 | 180 | * |
| 181 | 181 | * @uses \MainWP\Dashboard\MainWP_Connect::get_get_data_authed() |
| 182 | 182 | */ |
| 183 | 183 | private static function open_site( $website, $location, $params = array() ) { |
| 184 | + if ( ! is_array( $params ) ) { | |
| 185 | + $params = array(); | |
| 186 | + } | |
| 187 | + | |
| 188 | + $action_url = ''; | |
| 184 | 189 | if ( MainWP_Demo_Handle::get_instance()->is_demo_website( $website ) ) { |
| 185 | - $action = $website->url . 'wp-admin.html'; | |
| 190 | + $action_url = $website->url . 'wp-admin.html'; | |
| 186 | 191 | } else { |
| 187 | - $action = MainWP_Connect::get_get_data_authed( $website, ( null === $location || '' === $location ) ? 'index.php' : $location, 'where', false, $params ); | |
| 192 | + if ( ! isset( $params['verify_signature'] ) ) { | |
| 193 | + $params['verify_signature'] = true; // enable for open site. | |
| 194 | + } | |
| 195 | + $action_url = MainWP_Connect::get_get_data_authed( $website, ( null === $location || '' === $location ) ? 'index.php' : $location, 'where', false, $params, MainWP_Site_Url_Corrector::browser_target_url( $website ) ); | |
| 188 | 196 | } |
| 197 | + | |
| 189 | 198 | $open_download = ! empty( $params['filedl'] ) ? true : false; |
| 190 | 199 | $close_window = ! empty( $_GET['closeWindow'] ) ? true : false; //phpcs:ignore -- ok. |
| 191 | 200 | |
| 192 | 201 | /** |
| @@ -195,10 +204,12 @@ | ||
| 195 | 204 | * Fire before go to wp admin child site. |
| 196 | 205 | * |
| 197 | 206 | * @since 5.5 |
| 198 | 207 | */ |
| 199 | - do_action( 'mainwp_site_go_to_wpadmin', $website, $location, $params ); | |
| 208 | + do_action( 'mainwp_site_go_to_wpadmin', $website, $location, $params, $action_url ); | |
| 200 | 209 | |
| 210 | + MainWP_Logger::instance()->debug_for_website( $website, 'open site', 'action [' . $action_url . ']' ); | |
| 211 | + | |
| 201 | 212 | ?> |
| 202 | 213 | <div class="ui segment"> |
| 203 | 214 | <div class="ui active page dimmer <?php echo $open_download || $close_window ? 'open-site-close-window' : ''; ?>" style="margin: 0 !important;"> |
| 204 | 215 | <?php |
| @@ -212,9 +223,9 @@ | ||
| 212 | 223 | <?php |
| 213 | 224 | } |
| 214 | 225 | ?> |
| 215 | 226 | </div> |
| 216 | - <form method="POST" action="<?php echo $action; // phpcs:ignore WordPress.Security.EscapeOutput ?>" id="redirectForm"> | |
| 227 | + <form method="POST" action="<?php echo $action_url; // phpcs:ignore WordPress.Security.EscapeOutput ?>" id="redirectForm"> | |
| 217 | 228 | <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |
| 218 | 229 | </form> |
| 219 | 230 | </div> |
| 220 | 231 | <?php |
| @@ -269,12 +280,12 @@ | ||
| 269 | 280 | <div class="ui massive double text loader"><?php esc_html_e( 'Redirecting...', 'mainwp' ); ?></div> |
| 270 | 281 | </div> |
| 271 | 282 | <?php |
| 272 | 283 | |
| 273 | - $url = ( isset( $website->url ) && '' !== $website->url ? $website->url : $website->siteurl ); | |
| 284 | + $url = MainWP_Site_Url_Corrector::browser_target_url( $website ); | |
| 274 | 285 | $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); |
| 275 | 286 | |
| 276 | - $postdata = MainWP_Connect::get_get_data_authed( $website, $file, 'f', true ); | |
| 287 | + $postdata = MainWP_Connect::get_get_data_authed( $website, $file, 'f', true, array( 'verify_signature' => true ) ); | |
| 277 | 288 | $postdata['size'] = $size; |
| 278 | 289 | ?> |
| 279 | 290 | <form method="POST" action="<?php echo esc_url( $url ); ?>" id="redirectForm"> |
| 280 | 291 | <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |
| @@ -317,12 +328,12 @@ | ||
| 317 | 328 | <div class="ui massive double text loader"><?php esc_html_e( 'Redirecting...', 'mainwp' ); ?></div> |
| 318 | 329 | </div> |
| 319 | 330 | <?php |
| 320 | 331 | |
| 321 | - $url = ( isset( $website->url ) && '' !== $website->url ? $website->url : $website->siteurl ); | |
| 332 | + $url = MainWP_Site_Url_Corrector::browser_target_url( $website ); | |
| 322 | 333 | $url .= ( '/' !== substr( $url, - 1 ) ? '/' : '' ); |
| 323 | 334 | |
| 324 | - $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true ); | |
| 335 | + $postdata = MainWP_Connect::get_get_data_authed( $website, 'index.php', 'where', true, array( 'verify_signature' => true ) ); | |
| 325 | 336 | $postdata['open_location'] = $open_location; // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions -- base64_encode used for http encoding compatible. |
| 326 | 337 | ?> |
| 327 | 338 | <form method="POST" action="<?php echo esc_url( $url ); ?>" id="redirectForm"> |
| 328 | 339 | <?php MainWP_UI::generate_wp_nonce( 'mainwp-admin-nonce' ); ?> |