PluginProbe
Taskbuilder – Project Management & Task Management Tool With Kanban Board / 3.0.0
Taskbuilder – Project Management & Task Management Tool With Kanban Board v3.0.0
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 1.0.6 All 57 releases
taskbuilder / includes / admin / projects / open_project / wppm_submit_project_comment.php

wppm_submit_project_comment.php in Taskbuilder – Project Management & Task Management Tool With Kanban Board 3.0.0, at includes/admin/projects/open_project/wppm_submit_project_comment.php

39 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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']) ? sanitize_text_field($_POST['proj_id']) : '' ;
10 $comment = isset($_POST['comment_body']) ? ($_POST['comment_body']) : '' ;
11 $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(),));
12 $comment_body = wp_kses(htmlspecialchars_decode($comment, ENT_QUOTES),$allowed_tags);
13 if($comment_body=="") exit;
14 $attachments = !empty($_POST['wppm_proj_comment_attachment']) ? $wppmfunction->sanitize_array($_POST['wppm_proj_comment_attachment']) : [];
15 $attachment_ids = implode(",",$attachments);
16 if(!empty($attachments)){
17 $project_auth_code = $wppmfunction->get_project_meta($proj_id,'project_auth_code',true);
18 if(empty($project_auth_code)){
19 $auth_code = $wppmfunction->getRandomString(10);
20 $wppmfunction->add_project_meta($proj_id,'project_auth_code',$auth_code);
21 }
22 }
23 $vals = array('is_active' => 1);
24 foreach($attachments as $attach){
25 $wpdb->update($wpdb->prefix.'wppm_attachments', $vals, array('id'=>$attach));
26 }
27 $args=array(
28 'proj_id'=> $proj_id,
29 'body'=>$comment_body,
30 'attachment_ids'=>$attachment_ids,
31 'create_time'=>current_time('mysql', 1),
32 'created_by'=>$current_user->ID
33 );
34 $args = apply_filters( 'wppm_submit_proj_comment_args', $args );
35 $comment_id = $wppmfunction->wppm_submit_proj_comment($args);
36
37 do_action('wppm_after_submit_proj_comment', $proj_id,$comment_id);
38
39