Skip to content

Commit

Permalink
Security and nonce checks
Browse files Browse the repository at this point in the history
- Added check for stream user cap required
- Added nonce check to update routine
  • Loading branch information
Chris Olbekson committed Apr 5, 2014
1 parent 10d8ffb commit 4dcb552
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions includes/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ public static function prompt_update() {
?>
<div class="error">
<form method="post" action="<?php echo esc_url( remove_query_arg( 'wp_stream_update', wp_get_referer() ) ) ?>">
<?php wp_nonce_field( 'wp_stream_update_db' ) ?>
<input type="hidden" name="wp_stream_update" value="update_and_continue"/>
<p><strong><?php esc_html_e( 'Stream Database Update Required', 'stream' ) ?></strong></p>
<p><?php esc_html_e( 'Before we send you on your way, we have to update your database to the newest version.', 'stream' ) ?></p>
Expand All @@ -128,6 +129,7 @@ public static function prompt_update() {
*
*/
public static function prompt_update_status() {
check_admin_referer( 'wp_stream_update_db' );
$success_db = self::update( self::$db_version, self::$current );

if ( $success_db && self::$current === $success_db ) {
Expand Down Expand Up @@ -155,6 +157,9 @@ public static function prompt_update_status() {
* @return void
*/
public static function update_notice_hook() {
if ( ! current_user_can( WP_Stream_Admin::VIEW_CAP ) ) {
return;
}
if ( ! isset( $_REQUEST['wp_stream_update'] ) ) {
self::prompt_update();
} elseif ( 'user_action_required' === $_REQUEST['wp_stream_update' ] ) {
Expand Down

0 comments on commit 4dcb552

Please sign in to comment.