← All changes
|
includes/admin/tasks/open_task/wppm_edit_task_status.php
+8
-6
1.0.2
→
6.0.7
View file →
| @@ -2,10 +2,11 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | exit; // Exit if accessed directly |
| 4 | 4 | } |
| 5 | 5 | global $wpdb,$wppmfunction,$current_user; |
| 6 | -$task_id = isset($_POST['task_id']) ? intval(sanitize_text_field($_POST['task_id'])) : '' ; | |
| 7 | -$proj_id = isset($_POST['proj_id']) ? intval(sanitize_text_field($_POST['proj_id'])) : '' ; | |
| 6 | +$task_id = isset($_POST['task_id']) ? absint(sanitize_text_field(wp_unslash($_POST['task_id']))) : '' ; | |
| 7 | +$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ; | |
| 8 | +$current_project_id = isset($_POST['project_id']) ? absint(sanitize_text_field(wp_unslash($_POST['project_id']))) : '' ; | |
| 8 | 9 | if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_status',$task_id))) {exit;} |
| 9 | 10 | $task_data = $wppmfunction->get_task($task_id); |
| 10 | 11 | $statuses = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}wppm_task_statuses"); |
| 11 | 12 | $status_id = $task_data['status']; |
| @@ -27,9 +28,10 @@ | ||
| 27 | 28 | </select> |
| 28 | 29 | </div> |
| 29 | 30 | <?php do_action('wppm_after_edit_change_task_status',$task_id);?> |
| 30 | 31 | <input type="hidden" name="action" value="wppm_set_change_task_status" /> |
| 31 | - <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo htmlentities(esc_attr($task_id)) ?>" /> | |
| 32 | + <input type="hidden" name="_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppm_set_change_task_status' ) ); ?>"> | |
| 33 | + <input type="hidden" id="wppm_task_id" name="task_id" value="<?php echo (esc_attr($task_id)) ?>" /> | |
| 32 | 34 | |
| 33 | 35 | |
| 34 | 36 | </form> |
| 35 | 37 | <?php |
| @@ -36,10 +38,10 @@ | ||
| 36 | 38 | $body = ob_get_clean(); |
| 37 | 39 | |
| 38 | 40 | ob_start(); |
| 39 | 41 | ?> |
| 40 | -<button type="button" class="btn wppm_popup_close" onclick="wppm_modal_close();"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 41 | -<button type="button" class="btn wppm_popup_action" onclick="wppm_set_change_task_status(<?php echo htmlentities(esc_attr($task_id))?>,<?php echo esc_attr($proj_id) ?> );"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 42 | +<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_close':'wppm_task_popup_close'?>" onclick="<?php echo ($proj_id!="0")?'wppm_modal_close();':'wppm_task_modal_close();'?>"><?php echo esc_html_e('Close','taskbuilder');?></button> | |
| 43 | +<button type="button" class="btn <?php echo ($proj_id!="0")?'wppm_popup_action':'wppm_task_popup_action'?>" onclick="wppm_set_change_task_status(<?php echo (esc_js($task_id))?>,<?php echo esc_js($proj_id) ?>,<?php echo esc_js($current_project_id) ?>);"><?php echo esc_html_e('Save','taskbuilder');?></button> | |
| 42 | 44 | <?php |
| 43 | 45 | $footer = ob_get_clean(); |
| 44 | 46 | |
| 45 | 47 | $output = array( |
| @@ -46,5 +48,5 @@ | ||
| 46 | 48 | 'body' => $body, |
| 47 | 49 | 'footer' => $footer |
| 48 | 50 | ); |
| 49 | 51 | |
| 50 | -echo json_encode($output); | |
| 52 | +echo wp_json_encode($output); | |