| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; // Exit if accessed directly |
| 5 |
} |
| 6 |
|
| 7 |
global $current_user, $wpscfunction; |
| 8 |
if (!($current_user->ID && $current_user->has_cap('wpsc_agent'))) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
$ticket_id = isset($_POST['ticket_id']) ? sanitize_text_field($_POST['ticket_id']) : 0 ; |
| 13 |
$thread_id = isset($_POST['thread_id']) ? sanitize_text_field($_POST['thread_id']) : 0 ; |
| 14 |
|
| 15 |
$source = isset($_POST['source']) ? sanitize_text_field($_POST['source']) : 'thread' ; |
| 16 |
$raised_email = $wpscfunction->get_ticket_fields($ticket_id,'customer_email'); |
| 17 |
|
| 18 |
$user = get_user_by('email', $raised_email); |
| 19 |
$thread_type = get_post_meta( $thread_id, 'thread_type', true); |
| 20 |
|
| 21 |
$ip_address = get_post_meta($thread_id, 'ip_address', true); |
| 22 |
$ip_address = $ip_address ? $ip_address : __('Not Found','supportcandy'); |
| 23 |
|
| 24 |
$os = get_post_meta($thread_id,'os',true); |
| 25 |
$os = $os ? $os : __('Not Found','supportcandy'); |
| 26 |
|
| 27 |
$browser = get_post_meta($thread_id,'browser',true); |
| 28 |
$browser = $browser ? $browser : __('Not Found','supportcandy'); |
| 29 |
|
| 30 |
$reply_source = get_post_meta( $thread_id, 'reply_source',true); |
| 31 |
$reply_type = ''; |
| 32 |
if ($reply_source == 'browser'){ |
| 33 |
$reply_type = "Browser"; |
| 34 |
} |
| 35 |
$reply_type = apply_filters( 'wpsc_ticket_thread_reply_source',$reply_type, $reply_source,$thread_id,$ticket_id ); |
| 36 |
$reply_type = $reply_type ? $reply_type : __('Not Found','supportcandy'); |
| 37 |
|
| 38 |
$wpsc_appearance_modal_window = get_option('wpsc_modal_window'); |
| 39 |
|
| 40 |
$agent_created = $wpscfunction->get_ticket_fields($ticket_id,'agent_created'); |
| 41 |
$agent_created = $agent_created ? __('Yes','supportcandy') : __('No','supportcandy'); |
| 42 |
|
| 43 |
ob_start(); |
| 44 |
?> |
| 45 |
<div id="wpsc_raised_extra_info"> |
| 46 |
<table class="table table-hover"> |
| 47 |
<tr> |
| 48 |
<td style="width:200px;"><strong><?php _e('IP Address','supportcandy'); ?></strong></td> |
| 49 |
<td><?php echo esc_attr($ip_address); ?></td> |
| 50 |
</tr> |
| 51 |
<tr> |
| 52 |
<?php if($source == 'raised_by'){ ?> |
| 53 |
<td><strong><?php _e('Ticket Source','supportcandy'); ?></strong></td> |
| 54 |
<?php } else { ?> |
| 55 |
<td><strong><?php _e('Thread Source','supportcandy'); ?></strong></td> |
| 56 |
<?php } ?> |
| 57 |
<td><?php echo esc_attr($reply_type); ?></td> |
| 58 |
</tr> |
| 59 |
<tr> |
| 60 |
<td><strong><?php _e('Operating System','supportcandy'); ?></strong></td> |
| 61 |
<td><?php echo esc_attr($os); ?></td> |
| 62 |
</tr> |
| 63 |
<tr> |
| 64 |
<td><strong><?php _e('Browser','supportcandy'); ?></strong></td> |
| 65 |
<td><?php echo esc_attr($browser); ?></td> |
| 66 |
</tr> |
| 67 |
<tr> |
| 68 |
<td><strong><?php _e('Ticket URL','supportcandy'); ?></strong></td> |
| 69 |
<td><?php |
| 70 |
if(get_option('wpsc_support_page_id')){ |
| 71 |
$ticket_auth_code = $wpscfunction->get_ticket_fields($ticket_id,'ticket_auth_code'); |
| 72 |
$ticket_url = get_permalink(get_option('wpsc_support_page_id')).'?support_page=open_ticket&ticket_id='.$ticket_id.'&auth_code='.$ticket_auth_code;?> |
| 73 |
<a href="<?php echo esc_url($ticket_url)?>" target="_blank"><?php _e('Click here','supportcandy')?></a><?php |
| 74 |
}else{ |
| 75 |
_e('Please select support page in settings.','supportcandy'); |
| 76 |
}?> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
<?php |
| 80 |
if($source == 'raised_by'){?> |
| 81 |
<tr> |
| 82 |
<td><strong><?php _e('Agent Created','supportcandy'); ?></strong></td> |
| 83 |
<td><?php echo esc_attr($agent_created); ?></td> |
| 84 |
</tr><?php |
| 85 |
}?> |
| 86 |
|
| 87 |
</table> |
| 88 |
</div> |
| 89 |
<?php |
| 90 |
$body = ob_get_clean(); |
| 91 |
ob_start(); |
| 92 |
?> |
| 93 |
<button type="button" class="btn wpsc_popup_close" style="background-color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_bg_color'])?> !important;color:<?php echo esc_attr($wpsc_appearance_modal_window['wpsc_close_button_text_color'])?> !important;" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button> |
| 94 |
<?php |
| 95 |
$footer = ob_get_clean(); |
| 96 |
|
| 97 |
$output = array( |
| 98 |
'body' => $body, |
| 99 |
'footer' => $footer |
| 100 |
); |
| 101 |
|
| 102 |
wp_send_json($output); |