File: /var/www/html/wp-content/themes/ormedia/keylabData/calendar/u_calendar.php
<?php
//ini_set('display_errors',1);
if(isset($_REQUEST['checking_api_file'])){
exit();
}
$key_arr = array("property_id", "time", "priority", "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"){
$value = $_REQUEST[$key];
$obj = json_decode(stripslashes($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];
}
}
$arg['is_send'] = 0;
if (isset($_REQUEST['calendar_id'])){
$id = $_REQUEST['calendar_id'];
} else if (isset($_REQUEST['id'])){
$id = $_REQUEST['id'];
} else {
$valid = false;
}
if ($valid){
$old_data = $wpdb->get_results("select * from keylab_calendar where id = ".$id);
$status = $wpdb->update("keylab_calendar", $arg, array('id'=>$id));
}
if ($status == false) {
$msg = "update failed";
$rv->status = false;
$rv->last_error = $wpdb->last_error;
$rv->last_query = $wpdb->last_query;
} else {
$rv->status = true;
}
$rv->msg = $msg;
//log
keylab_data_log_by_user2($status, $old_data[0], $arg, $wpdb->last_query, "keylab_calendar", $id);
exit(json_encode($rv));
//var_dump($result);