Ticket #16166: 16166.2.diff

File 16166.2.diff, 9.4 KB (added by nacin, 2 years ago)

Untested.

Line 
1Index: wp-admin/users.php
2===================================================================
3--- wp-admin/users.php  (revision 17316)
4+++ wp-admin/users.php  (working copy)
5@@ -49,7 +49,7 @@
6        check_admin_referer('bulk-users');
7 
8        if ( empty($_REQUEST['users']) ) {
9-               wp_redirect($redirect);
10+               $wp_list_table->redirect( $redirect );
11                exit();
12        }
13 
14@@ -78,7 +78,7 @@
15                $user->set_role($_REQUEST['new_role']);
16        }
17 
18-       wp_redirect(add_query_arg('update', $update, $redirect));
19+       $wp_list_table->redirect(add_query_arg('update', $update, $redirect));
20        exit();
21 
22 break;
23@@ -137,7 +137,7 @@
24        check_admin_referer('bulk-users');
25 
26        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
27-               wp_redirect($redirect);
28+               $wp_list_table->redirect($redirect);
29                exit();
30        }
31 
32@@ -232,7 +232,7 @@
33        check_admin_referer('bulk-users');
34 
35        if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
36-               wp_redirect($redirect);
37+               $wp_list_table->redirect($redirect);
38                exit();
39        }
40 
41Index: wp-admin/edit-comments.php
42===================================================================
43--- wp-admin/edit-comments.php  (revision 17316)
44+++ wp-admin/edit-comments.php  (working copy)
45@@ -37,7 +37,6 @@
46        $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0;
47 
48        $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() );
49-       $redirect_to = $wp_list_table->add_query_args( $redirect_to );
50 
51        foreach ( $comment_ids as $comment_id ) { // Check the permissions on each
52                if ( !current_user_can( 'edit_comment', $comment_id ) )
53@@ -92,7 +91,7 @@
54        if ( $trashed || $spammed )
55                $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to );
56 
57-       wp_redirect( $redirect_to );
58+       $wp_list_table->redirect( $redirect_to );
59        exit;
60 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
61         wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
62Index: wp-admin/includes/class-wp-list-table.php
63===================================================================
64--- wp-admin/includes/class-wp-list-table.php   (revision 17316)
65+++ wp-admin/includes/class-wp-list-table.php   (working copy)
66@@ -631,15 +631,14 @@
67 
68                return array( $current_orderby, $current_order );
69        }
70-       
71-       function add_query_args( $location ) {
72+
73+       function redirect( $location ) {
74                $pagenum = $this->get_pagenum();
75                list( $current_orderby, $current_order ) = $this->get_order_info();
76                $location = add_query_arg( 'paged', $pagenum, $location );
77                if ( $current_orderby )
78                        $location = add_query_arg( array( 'orderby' => $current_orderby, 'order' => $current_order ), $location );
79-
80-               return $location;
81+               wp_redirect( $location );
82        }
83 
84        /**
85Index: wp-admin/edit-tags.php
86===================================================================
87--- wp-admin/edit-tags.php      (revision 17316)
88+++ wp-admin/edit-tags.php      (working copy)
89@@ -78,9 +78,8 @@
90 
91        wp_delete_term( $tag_ID, $taxonomy );
92 
93-       $location = $wp_list_table->add_query_args( $location );
94        $location = add_query_arg( 'message', 2, $location );
95-       wp_redirect( $location );
96+       $wp_list_table->redirect( $location );
97        exit;
98 
99 break;
100@@ -105,8 +104,7 @@
101        }
102 
103        $location = add_query_arg( 'message', 6, $location );
104-       $location = $wp_list_table->add_query_args( $location );
105-       wp_redirect( $location );
106+       $wp_list_table->redirect( $location );
107        exit;
108 
109 break;
110Index: wp-admin/upload.php
111===================================================================
112--- wp-admin/upload.php (revision 17316)
113+++ wp-admin/upload.php (working copy)
114@@ -84,9 +84,8 @@
115                                                $location = $referer;
116                                }
117 
118-                               $location = $wp_list_table->add_query_args( $location );
119                                $location = add_query_arg( array( 'attached' => $attached ) , $location );
120-                               wp_redirect( $location );
121+                               $wp_list_table->redirect( $location );
122                                exit;
123                        }
124                        break;
125@@ -122,8 +121,7 @@
126                        break;
127        }
128 
129-       $location = $wp_list_table->add_query_args( $location );
130-       wp_redirect( $location );
131+       $wp_list_table->redirect( $location );
132        exit;
133 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
134         wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), stripslashes( $_SERVER['REQUEST_URI'] ) ) );
135Index: wp-admin/network/edit.php
136===================================================================
137--- wp-admin/network/edit.php   (revision 17316)
138+++ wp-admin/network/edit.php   (working copy)
139@@ -223,9 +223,9 @@
140                                }
141                        }
142 
143-                       wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
144+                       $wp_list_table->redirect( add_query_arg( array( 'updated' => 'true', 'action' => $blogfunction ), wp_get_referer() ) );
145                } else {
146-                       wp_redirect( network_admin_url( 'sites.php' ) );
147+                       $wp_list_table->redirect( network_admin_url( 'sites.php' ) );
148                }
149                exit();
150        break;
151@@ -425,9 +425,9 @@
152                                }
153                        }
154 
155-                       wp_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
156+                       $wp_list_table->redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) );
157                } else {
158-                       wp_redirect( network_admin_url( 'users.php' ) );
159+                       $wp_list_table->redirect( network_admin_url( 'users.php' ) );
160                }
161                exit();
162        break;
163Index: wp-admin/network/themes.php
164===================================================================
165--- wp-admin/network/themes.php (revision 17316)
166+++ wp-admin/network/themes.php (working copy)
167@@ -40,40 +40,40 @@
168                        check_admin_referer('enable-theme_' . $_GET['theme']);
169                        $allowed_themes[ $_GET['theme'] ] = true;
170                        update_site_option( 'allowedthemes', $allowed_themes );
171-                       wp_redirect( add_query_arg( 'enabled', '1', $referer ) );
172+                       $wp_list_table->redirect( add_query_arg( 'enabled', '1', $referer ) );
173                        exit;
174                        break;
175                case 'disable':
176                        check_admin_referer('disable-theme_' . $_GET['theme']);
177                        unset( $allowed_themes[ $_GET['theme'] ] );
178                        update_site_option( 'allowedthemes', $allowed_themes );
179-                       wp_redirect( add_query_arg( 'disabled', '1', $referer ) );
180+                       $wp_list_table->redirect( add_query_arg( 'disabled', '1', $referer ) );
181                        exit;
182                        break;
183                case 'enable-selected':
184                        check_admin_referer('bulk-themes');
185                        $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
186                        if ( empty($themes) ) {
187-                               wp_redirect( add_query_arg( 'error', 'none', $referer ) );
188+                               $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) );
189                                exit;
190                        }
191                        foreach( (array) $themes as $theme )
192                                $allowed_themes[ $theme ] = true;
193                        update_site_option( 'allowedthemes', $allowed_themes );
194-                       wp_redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
195+                       $wp_list_table->redirect( add_query_arg( 'enabled', count( $themes ), $referer ) );
196                        exit;
197                        break;
198                case 'disable-selected':
199                        check_admin_referer('bulk-themes');
200                        $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
201                        if ( empty($themes) ) {
202-                               wp_redirect( add_query_arg( 'error', 'none', $referer ) );
203+                               $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) );
204                                exit;
205                        }
206                        foreach( (array) $themes as $theme )
207                                unset( $allowed_themes[ $theme ] );
208                        update_site_option( 'allowedthemes', $allowed_themes );
209-                       wp_redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );
210+                       $wp_list_table->redirect( add_query_arg( 'disabled', count( $themes ), $referer ) );
211                        exit;
212                        break;
213                case 'delete-selected':
214@@ -89,7 +89,7 @@
215                                unset( $themes[ get_option( 'stylesheet' ) ] );
216 
217                        if ( empty( $themes ) ) {
218-                               wp_redirect( add_query_arg( 'error', 'none', $referer ) );
219+                               $wp_list_table->redirect( add_query_arg( 'error', 'none', $referer ) );
220                                exit;
221                        }
222 
223@@ -104,9 +104,9 @@
224                                        $theme_info[ $theme ] = $data;
225                                }
226                        }
227-                       
228+
229                        if ( empty( $themes ) ) {
230-                               wp_redirect( add_query_arg( 'error', 'main', $referer ) );
231+                               $wp_list_table->redirect( add_query_arg( 'error', 'main', $referer ) );
232                                exit;
233                        }
234 
235Index: wp-admin/edit.php
236===================================================================
237--- wp-admin/edit.php   (revision 17316)
238+++ wp-admin/edit.php   (working copy)
239@@ -41,7 +41,6 @@
240        check_admin_referer('bulk-posts');
241 
242        $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
243-       $sendback = $wp_list_table->add_query_args( $sendback );
244        if ( strpos($sendback, 'post.php') !== false )
245                $sendback = admin_url($post_new_file);
246 
247@@ -123,7 +122,7 @@
248 
249        $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status',  'post', 'bulk_edit', 'post_view'), $sendback );
250 
251-       wp_redirect($sendback);
252+       $wp_list_table->redirect( $sendback );
253        exit();
254 } elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
255         wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
256Index: wp-admin/link-manager.php
257===================================================================
258--- wp-admin/link-manager.php   (revision 17316)
259+++ wp-admin/link-manager.php   (working copy)
260@@ -27,7 +27,7 @@
261                        wp_delete_link( $link_id );
262                }
263 
264-               wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) );
265+               $wp_list_table->redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) );
266                exit;
267        }
268 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {