PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 6.0.6
Taskbuilder – Project Management & Task Management Tool With Kanban Board v6.0.6
6.0.6 6.0.5 6.0.2 6.0.3 6.0.4 6.0.1 6.0.0 5.0.8 5.0.9 4.0.9 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 All 58 releases
← All changes | includes/admin/projects/open_project/wppm_submit_project_comment.php +49 -49 5.0.46.0.6 View file →
@@ -1,49 +1,49 @@
1 -<?php
2 -if ( ! defined( 'ABSPATH' ) ) {
3 - exit; // Exit if accessed directly
4 -}
5 -global $wpdb,$wppmfunction,$current_user;
6 -if ( check_ajax_referer( 'wppm_submit_proj_comment', '_ajax_nonce', false ) != 1 ) {
7 - wp_send_json_error( 'Unauthorised request!', 401 );
8 -}
9 -$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ;
10 -if(!$wppmfunction->has_project_permission('add_proj_comment',$proj_id)){
11 - wp_send_json_error( 'Unauthorised request!', 403 );
12 -}
13 -$cu_id = $current_user->ID;
14 -$project_data = $wppmfunction->get_project($proj_id);
15 -if (empty($project_data)) {
16 - wp_send_json_error( 'Project not found', 404 );
17 -}
18 -$comment = !empty($_POST['comment_body']) ? wp_kses_post($_POST['comment_body']) : '' ;
19 -$allowed_tags = array( 'br' => array(), 'abbr' => array('title' => array(),), 'p' => array(), 'strong' => array(), 'a' => array('href' => array(), 'title' => array(), 'rel'=> array(), 'target'=> 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(),));
20 -$comment_body = wp_kses($comment,$allowed_tags);
21 -$attachments = !empty($_POST['wppm_proj_comment_attachment']) ? $wppmfunction->sanitize_array($_POST['wppm_proj_comment_attachment']) : [];
22 -$attachment_ids = implode(",",$attachments);
23 -if($comment_body=="" && $attachment_ids=="") exit;
24 -if(!empty($attachments)){
25 - $project_auth_code = $wppmfunction->get_project_meta($proj_id,'project_auth_code',true);
26 - if(empty($project_auth_code)){
27 - $auth_code = $wppmfunction->getRandomString(10);
28 - $wppmfunction->add_project_meta($proj_id,'project_auth_code',$auth_code);
29 - }
30 -}
31 -$vals = array('is_active' => 1);
32 -foreach($attachments as $attach){
33 - $attach = esc_sql($attach);
34 - $wpdb->update($wpdb->prefix.'wppm_attachments', $vals, array('id'=>"$attach"));
35 -}
36 -$args=array(
37 - 'proj_id'=> $proj_id,
38 - 'body'=>$comment_body,
39 - 'attachment_ids'=>$attachment_ids,
40 - 'create_time'=>current_time('mysql', 1),
41 - 'created_by'=>$cu_id
42 -);
43 -$args = apply_filters( 'wppm_submit_proj_comment_args', $args );
44 -$comment_id = $wppmfunction->wppm_submit_proj_comment($args);
45 -$proj_log_values = array('proj_id'=>esc_sql($proj_id),'comment_id'=>esc_sql($comment_id),'comment_type'=>'comment');
46 -$wpdb->insert($wpdb->prefix . 'wppm_project_comment_meta',$proj_log_values);
47 -
48 -do_action('wppm_after_submit_proj_comment', $proj_id,$comment_id);
49 -
1 +<?php
2 +if ( ! defined( 'ABSPATH' ) ) {
3 + exit; // Exit if accessed directly
4 +}
5 +global $wpdb,$wppmfunction,$current_user;
6 +if ( check_ajax_referer( 'wppm_submit_proj_comment', '_ajax_nonce', false ) != 1 ) {
7 + wp_send_json_error( 'Unauthorised request!', 401 );
8 +}
9 +$proj_id = isset($_POST['proj_id']) ? absint(sanitize_text_field(wp_unslash($_POST['proj_id']))) : '' ;
10 +if(!$wppmfunction->has_project_permission('add_proj_comment',$proj_id)){
11 + wp_send_json_error( 'Unauthorised request!', 403 );
12 +}
13 +$cu_id = $current_user->ID;
14 +$project_data = $wppmfunction->get_project($proj_id);
15 +if (empty($project_data)) {
16 + wp_send_json_error( 'Project not found', 404 );
17 +}
18 +$comment = !empty($_POST['comment_body']) ? wp_kses_post($_POST['comment_body']) : '' ;
19 +$allowed_tags = array( 'br' => array(), 'abbr' => array('title' => array(),), 'p' => array(), 'strong' => array(), 'a' => array('href' => array(), 'title' => array(), 'rel'=> array(), 'target'=> 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(),));
20 +$comment_body = wp_kses($comment,$allowed_tags);
21 +$attachments = !empty($_POST['wppm_proj_comment_attachment']) ? $wppmfunction->sanitize_array($_POST['wppm_proj_comment_attachment']) : [];
22 +$attachment_ids = implode(",",$attachments);
23 +if($comment_body=="" && $attachment_ids=="") exit;
24 +if(!empty($attachments)){
25 + $project_auth_code = $wppmfunction->get_project_meta($proj_id,'project_auth_code',true);
26 + if(empty($project_auth_code)){
27 + $auth_code = $wppmfunction->getRandomString(10);
28 + $wppmfunction->add_project_meta($proj_id,'project_auth_code',$auth_code);
29 + }
30 +}
31 +$vals = array('is_active' => 1);
32 +foreach($attachments as $attach){
33 + $attach = esc_sql($attach);
34 + $wpdb->update($wpdb->prefix.'wppm_attachments', $vals, array('id'=>"$attach"));
35 +}
36 +$args=array(
37 + 'proj_id'=> $proj_id,
38 + 'body'=>$comment_body,
39 + 'attachment_ids'=>$attachment_ids,
40 + 'create_time'=>current_time('mysql', 1),
41 + 'created_by'=>$cu_id
42 +);
43 +$args = apply_filters( 'wppm_submit_proj_comment_args', $args );
44 +$comment_id = $wppmfunction->wppm_submit_proj_comment($args);
45 +$proj_log_values = array('proj_id'=>esc_sql($proj_id),'comment_id'=>esc_sql($comment_id),'comment_type'=>'comment');
46 +$wpdb->insert($wpdb->prefix . 'wppm_project_comment_meta',$proj_log_values);
47 +
48 +do_action('wppm_after_submit_proj_comment', $proj_id,$comment_id);
49 +