@@ -154,14 +154,14 @@ function action_handle_posts() {
154154
155155 if ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'new_cron ' === $ _POST ['crontrol_action ' ] ) ) {
156156 if ( ! current_user_can ( 'manage_options ' ) ) {
157- wp_die ( esc_html__ ( 'You are not allowed to add new cron events. ' , 'wp-crontrol ' ), 401 );
157+ wp_die ( esc_html__ ( 'You are not allowed to add new cron events. ' , 'wp-crontrol ' ), 403 );
158158 }
159159 check_admin_referer ( 'crontrol-new-cron ' );
160160
161161 $ cr = $ request ->init ( wp_unslash ( $ _POST ) );
162162
163163 if ( 'crontrol_cron_job ' === $ cr ->hookname ) {
164- wp_die ( esc_html__ ( 'You are not allowed to add new PHP cron events. ' , 'wp-crontrol ' ), 401 );
164+ wp_die ( esc_html__ ( 'You are not allowed to add new PHP cron events. ' , 'wp-crontrol ' ), 403 );
165165 }
166166 $ args = json_decode ( $ cr ->args , true );
167167
@@ -212,7 +212,7 @@ function action_handle_posts() {
212212
213213 } elseif ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'new_url_cron ' === $ _POST ['crontrol_action ' ] ) ) {
214214 if ( ! current_user_can ( 'manage_options ' ) ) {
215- wp_die ( esc_html__ ( 'You are not allowed to add new cron events. ' , 'wp-crontrol ' ), 401 );
215+ wp_die ( esc_html__ ( 'You are not allowed to add new cron events. ' , 'wp-crontrol ' ), 403 );
216216 }
217217 check_admin_referer ( 'crontrol-new-cron ' );
218218
@@ -270,7 +270,7 @@ function action_handle_posts() {
270270
271271 } elseif ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'new_php_cron ' === $ _POST ['crontrol_action ' ] ) ) {
272272 if ( ! current_user_can_manage_php_cron_events () ) {
273- wp_die ( esc_html__ ( 'You are not allowed to add new PHP cron events. ' , 'wp-crontrol ' ), 401 );
273+ wp_die ( esc_html__ ( 'You are not allowed to add new PHP cron events. ' , 'wp-crontrol ' ), 403 );
274274 }
275275 check_admin_referer ( 'crontrol-new-cron ' );
276276
@@ -328,15 +328,15 @@ function action_handle_posts() {
328328
329329 } elseif ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'edit_cron ' === $ _POST ['crontrol_action ' ] ) ) {
330330 if ( ! current_user_can ( 'manage_options ' ) ) {
331- wp_die ( esc_html__ ( 'You are not allowed to edit cron events. ' , 'wp-crontrol ' ), 401 );
331+ wp_die ( esc_html__ ( 'You are not allowed to edit cron events. ' , 'wp-crontrol ' ), 403 );
332332 }
333333
334334 $ cr = $ request ->init ( wp_unslash ( $ _POST ) );
335335
336336 check_admin_referer ( "crontrol-edit-cron_ {$ cr ->original_hookname }_ {$ cr ->original_sig }_ {$ cr ->original_next_run_utc }" );
337337
338338 if ( 'crontrol_cron_job ' === $ cr ->hookname && ! current_user_can_manage_php_cron_events () ) {
339- wp_die ( esc_html__ ( 'You are not allowed to edit PHP cron events. ' , 'wp-crontrol ' ), 401 );
339+ wp_die ( esc_html__ ( 'You are not allowed to edit PHP cron events. ' , 'wp-crontrol ' ), 403 );
340340 }
341341
342342 $ args = json_decode ( $ cr ->args , true );
@@ -420,7 +420,7 @@ function action_handle_posts() {
420420
421421 } elseif ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'edit_url_cron ' === $ _POST ['crontrol_action ' ] ) ) {
422422 if ( ! current_user_can ( 'manage_options ' ) ) {
423- wp_die ( esc_html__ ( 'You are not allowed to edit cron events. ' , 'wp-crontrol ' ), 401 );
423+ wp_die ( esc_html__ ( 'You are not allowed to edit cron events. ' , 'wp-crontrol ' ), 403 );
424424 }
425425
426426 $ cr = $ request ->init ( wp_unslash ( $ _POST ) );
@@ -511,7 +511,7 @@ function action_handle_posts() {
511511
512512 } elseif ( isset ( $ _POST ['crontrol_action ' ] ) && ( 'edit_php_cron ' === $ _POST ['crontrol_action ' ] ) ) {
513513 if ( ! current_user_can_manage_php_cron_events () ) {
514- wp_die ( esc_html__ ( 'You are not allowed to edit PHP cron events. ' , 'wp-crontrol ' ), 401 );
514+ wp_die ( esc_html__ ( 'You are not allowed to edit PHP cron events. ' , 'wp-crontrol ' ), 403 );
515515 }
516516
517517 $ cr = $ request ->init ( wp_unslash ( $ _POST ) );
@@ -601,7 +601,7 @@ function action_handle_posts() {
601601
602602 } elseif ( isset ( $ _POST ['crontrol_new_schedule ' ] ) ) {
603603 if ( ! current_user_can ( 'manage_options ' ) ) {
604- wp_die ( esc_html__ ( 'You are not allowed to add new cron schedules. ' , 'wp-crontrol ' ), 401 );
604+ wp_die ( esc_html__ ( 'You are not allowed to add new cron schedules. ' , 'wp-crontrol ' ), 403 );
605605 }
606606 check_admin_referer ( 'crontrol-new-schedule ' );
607607 $ name = sanitize_text_field ( wp_unslash ( $ _POST ['crontrol_schedule_internal_name ' ] ) );
@@ -619,7 +619,7 @@ function action_handle_posts() {
619619
620620 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'delete-schedule ' === $ _GET ['crontrol_action ' ] ) {
621621 if ( ! current_user_can ( 'manage_options ' ) ) {
622- wp_die ( esc_html__ ( 'You are not allowed to delete cron schedules. ' , 'wp-crontrol ' ), 401 );
622+ wp_die ( esc_html__ ( 'You are not allowed to delete cron schedules. ' , 'wp-crontrol ' ), 403 );
623623 }
624624 $ schedule = wp_unslash ( $ _GET ['crontrol_id ' ] );
625625 check_admin_referer ( "crontrol-delete-schedule_ {$ schedule }" );
@@ -634,7 +634,7 @@ function action_handle_posts() {
634634
635635 } elseif ( ( isset ( $ _POST ['action ' ] ) && 'crontrol_delete_crons ' === $ _POST ['action ' ] ) || ( isset ( $ _POST ['action2 ' ] ) && 'crontrol_delete_crons ' === $ _POST ['action2 ' ] ) ) {
636636 if ( ! current_user_can ( 'manage_options ' ) ) {
637- wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 401 );
637+ wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 403 );
638638 }
639639 check_admin_referer ( 'bulk-crontrol-events ' );
640640
@@ -677,7 +677,7 @@ function action_handle_posts() {
677677
678678 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'delete-cron ' === $ _GET ['crontrol_action ' ] ) {
679679 if ( ! current_user_can ( 'manage_options ' ) ) {
680- wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 401 );
680+ wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 403 );
681681 }
682682 $ hook = wp_unslash ( $ _GET ['crontrol_id ' ] );
683683 $ sig = wp_unslash ( $ _GET ['crontrol_sig ' ] );
@@ -686,7 +686,7 @@ function action_handle_posts() {
686686
687687 // PHP cron events can be deleted even if they're disallowed, as long as the user has permission.
688688 if ( 'crontrol_cron_job ' === $ hook && ! current_user_can ( 'edit_files ' ) ) {
689- wp_die ( esc_html__ ( 'You are not allowed to delete PHP cron events. ' , 'wp-crontrol ' ), 401 );
689+ wp_die ( esc_html__ ( 'You are not allowed to delete PHP cron events. ' , 'wp-crontrol ' ), 403 );
690690 }
691691
692692 $ redirect = array (
@@ -731,15 +731,15 @@ function action_handle_posts() {
731731
732732 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'delete-hook ' === $ _GET ['crontrol_action ' ] ) {
733733 if ( ! current_user_can ( 'manage_options ' ) ) {
734- wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 401 );
734+ wp_die ( esc_html__ ( 'You are not allowed to delete cron events. ' , 'wp-crontrol ' ), 403 );
735735 }
736736 $ hook = wp_unslash ( $ _GET ['crontrol_id ' ] );
737737 $ deleted = false ;
738738 check_admin_referer ( "crontrol-delete-hook_ {$ hook }" );
739739
740740 // Sanity check
741741 if ( 'crontrol_cron_job ' === $ hook ) {
742- wp_die ( esc_html__ ( 'You are not allowed to delete PHP cron events. ' , 'wp-crontrol ' ), 401 );
742+ wp_die ( esc_html__ ( 'You are not allowed to delete PHP cron events. ' , 'wp-crontrol ' ), 403 );
743743 }
744744
745745 $ deleted = wp_unschedule_hook ( $ hook , true );
@@ -779,15 +779,15 @@ function action_handle_posts() {
779779 }
780780 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'run-cron ' === $ _GET ['crontrol_action ' ] ) {
781781 if ( ! current_user_can ( 'manage_options ' ) ) {
782- wp_die ( esc_html__ ( 'You are not allowed to run cron events. ' , 'wp-crontrol ' ), 401 );
782+ wp_die ( esc_html__ ( 'You are not allowed to run cron events. ' , 'wp-crontrol ' ), 403 );
783783 }
784784 $ hook = wp_unslash ( $ _GET ['crontrol_id ' ] );
785785 $ sig = wp_unslash ( $ _GET ['crontrol_sig ' ] );
786786 check_admin_referer ( "crontrol-run-cron_ {$ hook }_ {$ sig }" );
787787
788788 // Don't need an `edit_files` check here because PHP cron events can always be run unless they're disabled.
789789 if ( ( 'crontrol_cron_job ' === $ hook ) && ! php_cron_events_enabled () ) {
790- wp_die ( esc_html__ ( 'You are not allowed to run cron events. ' , 'wp-crontrol ' ), 401 );
790+ wp_die ( esc_html__ ( 'You are not allowed to run cron events. ' , 'wp-crontrol ' ), 403 );
791791 }
792792
793793 $ ran = Event \run ( $ hook , $ sig );
@@ -819,13 +819,13 @@ function action_handle_posts() {
819819 exit ;
820820 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'pause-hook ' === $ _GET ['crontrol_action ' ] ) {
821821 if ( ! current_user_can ( 'manage_options ' ) ) {
822- wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 401 );
822+ wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 403 );
823823 }
824824
825825 $ hook = wp_unslash ( $ _GET ['crontrol_id ' ] );
826826
827827 if ( ( 'crontrol_cron_job ' === $ hook ) || ( 'crontrol_url_cron_job ' === $ hook ) ) {
828- wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 401 );
828+ wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 403 );
829829 }
830830
831831 check_admin_referer ( "crontrol-pause-hook_ {$ hook }" );
@@ -866,13 +866,13 @@ function action_handle_posts() {
866866 exit ;
867867 } elseif ( isset ( $ _GET ['crontrol_action ' ] ) && 'resume-hook ' === $ _GET ['crontrol_action ' ] ) {
868868 if ( ! current_user_can ( 'manage_options ' ) ) {
869- wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 401 );
869+ wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 403 );
870870 }
871871
872872 $ hook = wp_unslash ( $ _GET ['crontrol_id ' ] );
873873
874874 if ( 'crontrol_cron_job ' === $ hook ) {
875- wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 401 );
875+ wp_die ( esc_html__ ( 'You are not allowed to pause or resume cron events. ' , 'wp-crontrol ' ), 403 );
876876 }
877877
878878 check_admin_referer ( "crontrol-resume-hook_ {$ hook }" );
0 commit comments