function wplc_record_chat_msg($from, $cid, $msg) { global $wpdb; global $wplc_tblname_msgs; if ($from == "1") { $fromname = wplc_return_chat_name($cid); //$fromemail = wplc_return_chat_email($cid); $orig = '2'; } else { $fromname = "admin"; //$fromemail = "SET email"; $orig = '1'; } $ins_array = array('chat_sess_id' => $cid, 'timestamp' => date("Y-m-d H:i:s"), 'from' => $fromname, 'msg' => $msg, 'status' => 0, 'originates' => $orig); $rows_affected = $wpdb->insert($wplc_tblname_msgs, $ins_array); wplc_update_active_timestamp($cid); wplc_change_chat_status($cid, 3); return true; }
function wplc_record_chat_msg($from, $cid, $msg) { global $wpdb; global $wplc_tblname_msgs; if ($from == "2") { if (current_user_can("wplc_ma_agent") || current_user_can("manage_options")) { } else { return "security issue"; } } if ($from == "1") { $fromname = wplc_return_chat_name(sanitize_text_field($cid)); //$fromemail = wplc_return_chat_email($cid); $orig = '2'; } else { $fromname = "admin"; //$fromemail = "SET email"; $orig = '1'; } // $ins_array = array( // 'chat_sess_id' => $cid, // 'timestamp' => date("Y-m-d H:i:s"), // 'from' => $fromname, // 'msg' => $msg, // 'status' => 0, // 'originates' => $orig // ); // // $rows_affected = $wpdb->insert( $wplc_tblname_msgs, $ins_array ); $wpdb->insert($wplc_tblname_msgs, array('chat_sess_id' => $cid, 'timestamp' => current_time('mysql'), 'from' => $fromname, 'msg' => $msg, 'status' => 0, 'originates' => $orig), array('%s', '%s', '%s', '%s', '%d', '%s')); wplc_update_active_timestamp(sanitize_text_field($cid)); wplc_change_chat_status(sanitize_text_field($cid), 3); return true; }
function wplc_record_chat_msg_pro($from, $cid, $msg) { global $wpdb; global $wplc_tblname_msgs; if ($from == "1") { $fromname = wplc_return_chat_name($cid); $orig = '2'; } else { $fromname = $_POST['admin_name']; $orig = '1'; } if (function_exists('wplc_encrypt_msg')) { $msg = wplc_encrypt_msg($msg); } $ins_array = array('chat_sess_id' => $cid, 'timestamp' => date("Y-m-d H:i:s"), 'from' => $fromname, 'msg' => $msg, 'status' => 0, 'originates' => $orig); $rows_affected = $wpdb->insert($wplc_tblname_msgs, $ins_array); wplc_update_active_timestamp($cid); wplc_change_chat_status($cid, 3); return true; }
function wplc_api_record_admin_message($cid, $msg) { global $wpdb; global $wplc_tblname_msgs; $fromname = apply_filters("wplc_filter_admin_name", "Admin"); $orig = '1'; $msg = apply_filters("wplc_filter_message_control", $msg); $wpdb->insert($wplc_tblname_msgs, array('chat_sess_id' => $cid, 'timestamp' => current_time('mysql'), 'msgfrom' => $fromname, 'msg' => $msg, 'status' => 0, 'originates' => $orig), array('%s', '%s', '%s', '%s', '%d', '%s')); wplc_update_active_timestamp(sanitize_text_field($cid)); wplc_change_chat_status(sanitize_text_field($cid), 3); return true; }
function wplc_record_chat_msg($from, $cid, $msg) { global $wpdb; global $wplc_tblname_msgs; if ($from == "2") { $wplc_current_user = get_current_user_id(); if (get_user_meta($wplc_current_user, 'wplc_ma_agent', true)) { /* -- modified in in 6.0.04 -- if(current_user_can('wplc_ma_agent') || current_user_can('manage_options')){ */ } else { return "security issue"; } } if ($from == "1") { $fromname = wplc_return_chat_name(sanitize_text_field($cid)); //$fromemail = wplc_return_chat_email($cid); $orig = '2'; } else { $fromname = apply_filters("wplc_filter_admin_name", "Admin"); //$fromemail = "SET email"; $orig = '1'; } $msg = apply_filters("wplc_filter_message_control", $msg); $wpdb->insert($wplc_tblname_msgs, array('chat_sess_id' => $cid, 'timestamp' => current_time('mysql'), 'msgfrom' => $fromname, 'msg' => $msg, 'status' => 0, 'originates' => $orig), array('%s', '%s', '%s', '%s', '%d', '%s')); wplc_update_active_timestamp(sanitize_text_field($cid)); return true; }