Skip to content

Commit

Permalink
Fixes #721 Prevent PHP errors (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrisrp authored Sep 13, 2023
1 parent 01437ae commit f462e8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions inc/classes/class-imagify-files-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public function prepare_items() {
$file_ids = array();
$where = '';

$sent_orderby = htmlspecialchars( wp_unslash( $_GET['orderby'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$sent_order = htmlspecialchars( wp_unslash( $_GET['order'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$sent_orderby = isset( $_GET['orderby'] ) ? htmlspecialchars( wp_unslash( $_GET['orderby'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$sent_order = isset( $_GET['order'] ) ? htmlspecialchars( wp_unslash( $_GET['order'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$folder_filter = self::get_folder_filter();
$status_filter = self::get_status_filter();

Expand Down Expand Up @@ -1031,7 +1031,7 @@ public static function get_status_filter() {
'unoptimized' => 1,
'errors' => 1,
);
$filter = trim( htmlspecialchars( wp_unslash( $_GET['status-filter'] ) ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$filter = isset( $_GET['status-filter'] ) ? trim( htmlspecialchars( wp_unslash( $_GET['status-filter'] ) ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended
$filter = isset( $values[ $filter ] ) ? $filter : '';

return $filter;
Expand Down
4 changes: 4 additions & 0 deletions inc/classes/class-imagify-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ public function get_form_action() {
* @return bool
*/
public function is_form_submit() {
if ( ! isset( $_POST['option_page'], $_POST['action'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing
return false;
}

return htmlspecialchars( wp_unslash( $_POST['option_page'] ) ) === $this->settings_group && htmlspecialchars( wp_unslash( $_POST['action'] ) ) === 'update'; // phpcs:ignore WordPress.Security.NonceVerification.Missing
}

Expand Down

0 comments on commit f462e8b

Please sign in to comment.