@@ -710,7 +710,11 @@ public function merge_or_fetch_data() {
710710 * making PT fully backward compatible with the older bookmarklet.
711711 */
712712 if ( empty ( $ _POST ) && ! empty ( $ data ['u ' ] ) ) {
713- $ data = $ this ->source_data_fetch_fallback ( $ data ['u ' ], $ data );
713+ if ( isset ( $ _GET ['_wpnonce ' ] ) && wp_verify_nonce ( $ _GET ['_wpnonce ' ], 'scan-site ' ) ) {
714+ $ data = $ this ->source_data_fetch_fallback ( $ data ['u ' ], $ data );
715+ } else {
716+ $ data ['errors ' ] = 'missing nonce ' ;
717+ }
714718 } else {
715719 foreach ( array ( '_images ' , '_embeds ' ) as $ type ) {
716720 if ( empty ( $ _POST [ $ type ] ) ) {
@@ -1250,7 +1254,7 @@ public function html() {
12501254 $ site_data = array (
12511255 'v ' => ! empty ( $ data ['v ' ] ) ? $ data ['v ' ] : '' ,
12521256 'u ' => ! empty ( $ data ['u ' ] ) ? $ data ['u ' ] : '' ,
1253- 'hasData ' => ! empty ( $ data ),
1257+ 'hasData ' => ! empty ( $ data ) && ! isset ( $ data [ ' errors ' ] ) ,
12541258 );
12551259
12561260 if ( ! empty ( $ images ) ) {
@@ -1382,8 +1386,9 @@ public function html() {
13821386 <div id="scanbar" class="scan">
13831387 <form method="GET">
13841388 <label for="url-scan" class="screen-reader-text"><?php _e ( 'Scan site for content ' ); ?> </label>
1385- <input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e ( 'Enter a URL to scan ' ) ?> " />
1389+ <input type="url" name="u" id="url-scan" class="scan-url" value="<?php echo esc_attr ( $ site_data [ ' u ' ] ) ?> " placeholder="<?php esc_attr_e ( 'Enter a URL to scan ' ) ?> " />
13861390 <input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e ( 'Scan ' ) ?> " />
1391+ <?php wp_nonce_field ( 'scan-site ' ); ?>
13871392 </form>
13881393 </div>
13891394
0 commit comments