@@ 19-38 (lines=20) @@ | ||
16 | */ |
|
17 | function wordpoints_ajax_points_hooks_order() { |
|
18 | ||
19 | if ( check_ajax_referer( 'save-network-wordpoints-points-hooks', 'savehooks', false ) ) { |
|
20 | ||
21 | if ( ! current_user_can( 'manage_network_wordpoints_points_hooks' ) ) { |
|
22 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
23 | } |
|
24 | ||
25 | // Saving network hooks order, turn on network mode. |
|
26 | WordPoints_Points_Hooks::set_network_mode( true ); |
|
27 | ||
28 | } elseif ( check_ajax_referer( 'save-wordpoints-points-hooks', 'savehooks', false ) ) { |
|
29 | ||
30 | if ( ! current_user_can( 'manage_options' ) ) { |
|
31 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
32 | } |
|
33 | ||
34 | } else { |
|
35 | ||
36 | // CSRF attack (or, more probably, the user left the browser open too long). |
|
37 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
38 | } |
|
39 | ||
40 | // Save hooks order for all points types. |
|
41 | if ( ! isset( $_POST['points_types'] ) || ! is_array( $_POST['points_types'] ) ) { |
|
@@ 86-105 (lines=20) @@ | ||
83 | */ |
|
84 | function wordpoints_ajax_save_points_hook() { |
|
85 | ||
86 | if ( check_ajax_referer( 'save-network-wordpoints-points-hooks', 'savehooks', false ) ) { |
|
87 | ||
88 | if ( ! current_user_can( 'manage_network_wordpoints_points_hooks' ) ) { |
|
89 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
90 | } |
|
91 | ||
92 | // Saving network hooks, turn on network mode. |
|
93 | WordPoints_Points_Hooks::set_network_mode( true ); |
|
94 | ||
95 | } elseif ( check_ajax_referer( 'save-wordpoints-points-hooks', 'savehooks', false ) ) { |
|
96 | ||
97 | if ( ! current_user_can( 'manage_options' ) ) { |
|
98 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
99 | } |
|
100 | ||
101 | } else { |
|
102 | ||
103 | // CSRF attack (or, more probably the user left the browser open too long). |
|
104 | wp_die( -1, '', array( 'response' => 403 ) ); |
|
105 | } |
|
106 | ||
107 | $error = __( 'An error has occurred. Please reload the page and try again.', 'wordpoints' ); |
|
108 |