Press This: Verify intent before fetching in-page resources using Press This.
Props vortfu git-svn-id: https://develop.svn.wordpress.org/trunk@40195 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ec30770c50
commit
d5b9305fa3
|
@ -718,7 +718,11 @@ class WP_Press_This {
|
||||||
* making PT fully backward compatible with the older bookmarklet.
|
* making PT fully backward compatible with the older bookmarklet.
|
||||||
*/
|
*/
|
||||||
if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
|
if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
|
||||||
|
if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
|
||||||
$data = $this->source_data_fetch_fallback( $data['u'], $data );
|
$data = $this->source_data_fetch_fallback( $data['u'], $data );
|
||||||
|
} else {
|
||||||
|
$data['errors'] = 'missing nonce';
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ( array( '_images', '_embeds' ) as $type ) {
|
foreach ( array( '_images', '_embeds' ) as $type ) {
|
||||||
if ( empty( $_POST[ $type ] ) ) {
|
if ( empty( $_POST[ $type ] ) ) {
|
||||||
|
@ -1235,7 +1239,7 @@ class WP_Press_This {
|
||||||
$site_data = array(
|
$site_data = array(
|
||||||
'v' => ! empty( $data['v'] ) ? $data['v'] : '',
|
'v' => ! empty( $data['v'] ) ? $data['v'] : '',
|
||||||
'u' => ! empty( $data['u'] ) ? $data['u'] : '',
|
'u' => ! empty( $data['u'] ) ? $data['u'] : '',
|
||||||
'hasData' => ! empty( $data ),
|
'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( ! empty( $images ) ) {
|
if ( ! empty( $images ) ) {
|
||||||
|
@ -1367,8 +1371,9 @@ class WP_Press_This {
|
||||||
<div id="scanbar" class="scan">
|
<div id="scanbar" class="scan">
|
||||||
<form method="GET">
|
<form method="GET">
|
||||||
<label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
|
<label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
|
||||||
<input type="url" name="u" id="url-scan" class="scan-url" value="" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
|
<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' ) ?>" />
|
||||||
<input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
|
<input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
|
||||||
|
<?php wp_nonce_field( 'scan-site' ); ?>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue