File: /var/www/html/wp-content/themes/ormedia/keylabData/calendar/c_calendar.php
<?php
//ini_set('display_errors',1);
if(isset($_REQUEST['checking_api_file'])){
exit();
}
$key_arr = array("property_id", "time", "type", "description", "notification", "advance_days", "status", "ann_list", 'calendar_file', "new_type");
$arg = array();
$msg = "success";
$valid = true;
foreach ($key_arr as $key){
if($key == "ann_list" || $key == "calendar_file"){
if($key == "calendar_file" && $_REQUEST["calendar_file"] == "[\n\n]") {
$arg[$key] = serialize([]);
continue;
}
$value = $_REQUEST[$key];
$obj = json_decode(stripcslashes($value));
if(!empty($obj)){
$arg[$key] = serialize($obj);
}else{
$arg[$key] = (serialize($value));
}
continue;
}
if($key == "priority"){
$arg[$key] = "0";
continue;
}
if($key == "type"){
if($_REQUEST["type"] == '' || !isset($_REQUEST["type"])){
$arg["type"] = 0;
}else{
$arg["type"] = $_REQUEST["type"];
}
continue;
}
if (isset($_REQUEST[$key])){
$arg[$key] = $_REQUEST[$key];
} else {
if($key == "new_type"){
$arg["new_type"] = '';
continue;
}
$valid = false;
$msg = "missing argument: ".$key;
}
}
if ($valid){
$status = $wpdb->insert("keylab_calendar", $arg);
}
if ($status === false) {
$msg = "insert failed";
$rv->status = false;
$rv->error = $wpdb->last_error;
} else {
$rv->status = true;
}
$rv->msg = $msg;
$rv->arg = $arg;
//log
keylab_data_log_by_user2($status, false, $arg, $wpdb->last_query,"keylab_calendar",$wpdb->insert_id);
exit(json_encode($rv));
//var_dump($result);