| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
global $wpdb,$wppmfunction,$current_user; |
| 6 |
$task_id = isset($_POST['task_id']) ? intval(sanitize_text_field($_POST['task_id'])) : '' ; |
| 7 |
if (!(($current_user->ID && $current_user->has_cap('manage_options')) || $wppmfunction->has_permission('change_task_details',$task_id))) {exit;} |
| 8 |
$task_data = $wppmfunction->get_task($task_id); |
| 9 |
$task_label = isset($_POST['wppm_edit_task_label']) ? sanitize_text_field($_POST['wppm_edit_task_label']) : "" ; |
| 10 |
$project_label = isset($_POST['wppm_edit_project_label']) ? sanitize_text_field($_POST['wppm_edit_project_label']) : "" ; |
| 11 |
$task_start_date = isset($_POST['wppm_edit_task_start_date']) ? sanitize_text_field($_POST['wppm_edit_task_start_date']) : "" ; |
| 12 |
$task_end_date = isset($_POST['wppm_edit_task_end_date']) ? sanitize_text_field($_POST['wppm_edit_task_end_date']) : "" ; |
| 13 |
$task_priority = isset($_POST['wppm_edit_task_priority']) ? intval(sanitize_text_field($_POST['wppm_edit_task_priority'])) : "" ; |
| 14 |
$allowedtags = array( 'br' => array(), 'abbr' => array('title' => array(),), 'p' => array(), 'strong' => array(), 'a' => array('href' => array(), 'title' => array(),'target'=> array(), 'rel'=>array()),'em' =>array(),'span' =>array(), 'blockquote'=>array('cite' => array(),),'div' => array('class' => array(),'title' => array(),'style' => array(),),'ul'=>array(),'li'=>array(),'ol'=>array(),'img' => array( 'alt'=> array(),'class' => array(),'height' => array(),'src'=> array(),'width'=> array(),)); |
| 15 |
$task_description = isset($_POST['wppm_edit_task_description']) ? wp_kses(htmlspecialchars_decode($_POST['wppm_edit_task_description'], ENT_QUOTES),$allowedtags) : "" ; |
| 16 |
|
| 17 |
if($task_label && $task_label != $task_data['task_name'] ){ |
| 18 |
$wppmfunction->change_task_label( $task_id, $task_label); |
| 19 |
} |
| 20 |
|
| 21 |
if($project_label && $project_label != $task_data['project'] ){ |
| 22 |
$wppmfunction->change_task_project_label( $task_id, $project_label); |
| 23 |
} |
| 24 |
|
| 25 |
if($task_start_date && $task_start_date != $task_data['start_date'] ){ |
| 26 |
$wppmfunction->change_start_date( $task_id, $task_start_date); |
| 27 |
} |
| 28 |
|
| 29 |
if($task_end_date && $task_end_date != $task_data['end_date'] ){ |
| 30 |
$wppmfunction->change_end_date( $task_id, $task_end_date); |
| 31 |
} |
| 32 |
|
| 33 |
if( $task_priority && $task_priority != $task_data['priority']){ |
| 34 |
$wppmfunction->change_priority( $task_id, $task_priority); |
| 35 |
} |
| 36 |
|
| 37 |
if( $task_description && $task_description != $task_data['description']){ |
| 38 |
$wppmfunction->change_description( $task_id, $task_description); |
| 39 |
} |
| 40 |
|
| 41 |
do_action('wppm_after_change_task_details',$task_id,$task_data['project']); |