Skip to content

Commit

Permalink
FILTER_SANITIZE_FULL_SPECIAL_CHARS as replacement for FILTER_SANITIZE…
Browse files Browse the repository at this point in the history
…_STRING (#210)
  • Loading branch information
lloc authored Jan 29, 2025
1 parent 2c04c1b commit a614e5b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
26 changes: 13 additions & 13 deletions wp-multi-network/includes/classes/class-wp-ms-networks-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public function route_pages() {
wp_die( esc_html__( 'You do not have permission to access this page.', 'wp-multi-network' ) );
}

$action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_STRING );
$action = filter_input( INPUT_GET, 'action', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$action = sanitize_key( $action );

switch ( $action ) {
Expand All @@ -264,9 +264,9 @@ public function route_pages() {

// View the list of networks, with bulk action handling.
case 'all_networks':
$doaction = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING );
$doaction = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( empty( $doaction ) || '-1' === $doaction ) {
$doaction = filter_input( INPUT_POST, 'action2', FILTER_SANITIZE_STRING );
$doaction = filter_input( INPUT_POST, 'action2', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
}
$doaction = sanitize_key( $doaction );

Expand Down Expand Up @@ -300,7 +300,7 @@ public function route_save_handlers() {
return;
}

$action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_STRING );
$action = filter_input( INPUT_POST, 'action', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( empty( $action ) ) {
$alternative_actions = array( 'delete', 'delete_multiple', 'move' );
foreach ( $alternative_actions as $alternative_action ) {
Expand Down Expand Up @@ -434,7 +434,7 @@ private function page_all_networks() {
$all_networks_url = $this->admin_url( array( 'action' => 'all_networks' ) );
$search_url = $this->admin_url( array( 'action' => 'domains' ) );

$search_text = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING );
$search_text = filter_input( INPUT_POST, 's', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
?>

<div class="wrap">
Expand Down Expand Up @@ -524,7 +524,7 @@ private function page_move_site() {

<hr class="wp-header-end">

<form method="post" action="<?php echo esc_attr( filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_STRING ) ); ?>">
<form method="post" action="<?php echo esc_attr( filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) ); ?>">
<div id="poststuff">
<div id="post-body" class="metabox-holder columns-2">
<div id="postbox-container-1" class="postbox-container">
Expand Down Expand Up @@ -864,10 +864,10 @@ private function handle_add_network() {
}

// Sanitize values.
$network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) );
$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) );
$network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) );
$site_name = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_STRING ) );
$network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
$network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
$site_name = wp_unslash( filter_input( INPUT_POST, 'new_site', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );

// Additional formatting.
$network_title = wp_strip_all_tags( $network_title );
Expand Down Expand Up @@ -952,9 +952,9 @@ private function handle_update_network() {
}

// Sanitize values.
$network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_STRING ) );
$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_STRING ) );
$network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_STRING ) );
$network_title = wp_unslash( filter_input( INPUT_POST, 'title', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
$network_domain = wp_unslash( filter_input( INPUT_POST, 'domain', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );
$network_path = wp_unslash( filter_input( INPUT_POST, 'path', FILTER_SANITIZE_FULL_SPECIAL_CHARS ) );

// Additional formatting.
$network_title = sanitize_text_field( $network_title );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public function prepare_items() {
$per_page = $this->get_items_per_page( 'networks_per_page' );
$pagenum = $this->get_pagenum();

$order_by = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_STRING );
$order_by = filter_input( INPUT_GET, 'orderby', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$order_by = ! empty( $order_by ) ? sanitize_key( $order_by ) : '';
$order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_STRING );
$order = filter_input( INPUT_GET, 'order', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
$order = ! empty( $order ) ? strtoupper( $order ) : 'ASC';
$search = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
$search = filter_input( INPUT_GET, 's', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
if ( ! $search ) {
$search = filter_input( INPUT_POST, 's', FILTER_SANITIZE_STRING );
$search = filter_input( INPUT_POST, 's', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
}

$search = stripslashes( trim( $search ) );
Expand Down

0 comments on commit a614e5b

Please sign in to comment.