@@ 41-52 (lines=12) @@ | ||
38 | $error = true; |
|
39 | ||
40 | // Allow no content for MANUAL rules (as they may not exist just yet). |
|
41 | if ( current_user_can( 'manage_options' ) && empty( $_POST['critcssfile'] ) ) { |
|
42 | $content = ''; |
|
43 | $error = false; |
|
44 | } elseif ( current_user_can( 'manage_options' ) && $this->critcss_check_filename( $_POST['critcssfile'] ) ) { |
|
45 | // Or check user permissios and filename. |
|
46 | // Set file path and obtain its content. |
|
47 | $critcssfile = AO_CCSS_DIR . strip_tags( $_POST['critcssfile'] ); |
|
48 | if ( file_exists( $critcssfile ) ) { |
|
49 | $content = file_get_contents( $critcssfile ); |
|
50 | $error = false; |
|
51 | } |
|
52 | } |
|
53 | ||
54 | // Prepare response. |
|
55 | if ( $error ) { |
|
@@ 133-143 (lines=11) @@ | ||
130 | $status = false; |
|
131 | ||
132 | // Allow no file for MANUAL rules (as they may not exist just yet). |
|
133 | if ( current_user_can( 'manage_options' ) && empty( $_POST['critcssfile'] ) ) { |
|
134 | $error = false; |
|
135 | } elseif ( current_user_can( 'manage_options' ) && $this->critcss_check_filename( $_POST['critcssfile'] ) ) { |
|
136 | // Or check user permissios and filename |
|
137 | // Set file path and delete it. |
|
138 | $critcssfile = AO_CCSS_DIR . strip_tags( $_POST['critcssfile'] ); |
|
139 | if ( file_exists( $critcssfile ) ) { |
|
140 | $status = unlink( $critcssfile ); |
|
141 | $error = false; |
|
142 | } |
|
143 | } |
|
144 | ||
145 | // Prepare response. |
|
146 | if ( $error ) { |