prefix . "ap_appointments";
$Appointment = $wpdb->get_row($wpdb->prepare("SELECT * FROM `$AppointmentTable` WHERE `id` =%s",$AppointmentId));
?>
alert("Sorry, your nonce did not verify.");';
return false;
}
global $wpdb;
$UpdateAppId = intval( $_POST['updateppointments'] );
$ClientName = sanitize_text_field( $_POST['appname'] );
$ClientEmail = sanitize_email( $_POST['appemail'] );
$ClientPhone = intval( $_POST['appphone'] );
$ClientNote = sanitize_text_field( $_POST['app_desc'] );
$ServiceId = intval( $_POST['serviceid'] );
$StartTime = sanitize_text_field( $_POST['start_time'] );
$EndTime = sanitize_text_field( $_POST['end_time'] );
$AppointmentKey = sanitize_text_field( $_POST['app_key'] );
$AppointmentDate = date("Y-m-d", strtotime(sanitize_text_field( $_POST['start_date'] ) ) );
$Status = sanitize_text_field( $_POST['app_status'] );
$AppointmentBy = sanitize_text_field( $_POST['app_appointment_by'] );
$AppointmentsTable = $wpdb->prefix . "ap_appointments";
if($wpdb->query($wpdb->prepare("UPDATE `$AppointmentsTable` SET `name` = '$ClientName',
`email` = '$ClientEmail',
`service_id` = '$ServiceId',
`phone` = '$ClientPhone',
`start_time` = '$StartTime',
`end_time` = '$EndTime',
`date` = '$AppointmentDate',
`note` = '$ClientNote',
`status` = '$Status',
`appointment_by` = '$AppointmentBy' WHERE `id` =%s;",$UpdateAppId))) {
//send notification to client if appointment approved or cancelled
if($Status == 'approved' || $Status == 'cancelled' ) {
//$GetAppKey = $wpdb->get_row("SELECT * FROM `$AppointmentsTable` WHERE `id` = '$UpdateAppId' ", OBJECT);
//$MangeAppointmentUrl = site_url().'/wp-admin/admin.php?page=manage-appointments';
//$BlogUrl = site_url().'/wp-admin';
$BlogName = get_bloginfo();
$ServiceTable = $wpdb->prefix."ap_services";
$ServiceData = $wpdb->get_row($wpdb->prepare("SELECT * FROM `$ServiceTable` WHERE `id` = %s",$ServiceId), OBJECT);
$ServiceName = $ServiceData->name;
//check notification is enabled & notification type
$NotificationStatus = get_option('emailstatus');
if($NotificationStatus == "on") {
$Attachments = "";
$AppointmentTime = $StartTime." - ".$EndTime;
if($Status == "approved") {
$ClientSubject = get_option('approve_appointment_client_subject');
$ClientBody = get_option('approve_appointment_client_body');
}
if($Status == "cancelled") {
$ClientSubject = get_option('cancel_appointment_client_subject');
$ClientBody = get_option('cancel_appointment_client_body');
}
//client subject replacement
$ClientSubject = str_replace("[blog-name]", ucwords($BlogName), $ClientSubject);
$ClientSubject = str_replace("[client-name]", ucwords($ClientName), $ClientSubject);
$ClientSubject = str_replace("[client-email]", ucwords($ClientEmail), $ClientSubject);
$ClientSubject = str_replace("[client-phone]", ucwords($ClientPhone), $ClientSubject);
$ClientSubject = str_replace("[client-si]", ucwords($ClientNote), $ClientSubject);
$ClientSubject = str_replace("[service-name]", ucwords($ServiceName), $ClientSubject);
$ClientSubject = str_replace("[app-date]", $AppointmentDate, $ClientSubject);
$ClientSubject = str_replace("[app-status]", ucwords($Status), $ClientSubject);
$ClientSubject = str_replace("[app-time]", $AppointmentTime, $ClientSubject);
$ClientSubject = str_replace("[app-key]", $AppointmentKey, $ClientSubject);
$ClientSubject = str_replace("[app-note]", ucfirst($ClientNote), $ClientSubject);
//client body replacement
$ClientBody = str_replace("[blog-name]", ucwords($BlogName), $ClientBody);
$ClientBody = str_replace("[client-name]", ucwords($ClientName), $ClientBody);
$ClientBody = str_replace("[client-email]", ucwords($ClientEmail), $ClientBody);
$ClientBody = str_replace("[client-phone]", ucwords($ClientPhone), $ClientBody);
$ClientBody = str_replace("[client-si]", ucwords($ClientNote), $ClientBody);
$ClientBody = str_replace("[service-name]", ucwords($ServiceName), $ClientBody);
$ClientBody = str_replace("[app-date]", $AppointmentDate, $ClientBody);
$ClientBody = str_replace("[app-status]", ucwords($Status), $ClientBody);
$ClientBody = str_replace("[app-time]", $AppointmentTime, $ClientBody);
$ClientBody = str_replace("[app-key]", $AppointmentKey, $ClientBody);
$ClientBody = str_replace("[app-note]", ucfirst($ClientNote), $ClientBody);
//check email type
$EmailType = get_option('emailtype');
$EmailDetails = unserialize(get_option( 'emaildetails'));
//wp-email
if($EmailType == "wpmail") {
$AdminEmail = $EmailDetails['wpemail'];
$Headers[] = "From: Admin <".$AdminEmail.">";
//send wp email to client
wp_mail( $ClientEmail, $ClientSubject, $ClientBody, $Headers, $Attachments);
}
//php-email
if($EmailType == "phpmail") {
$AdminEmail = $EmailDetails['phpemail'];
$Headers[] = "From: Admin <".$AdminEmail.">";
///send php email to client
mail($ClientEmail, $ClientSubject, $ClientBody, $Headers);
}
//wp-email
if($EmailType == "smtp") {
require_once('notification/Email.php');
$AdminEmail = $EmailDetails['smtpemail'];
$HostName = $EmailDetails['hostname'];
$PortNo = $EmailDetails['portno'];
$SMTPEmail = $EmailDetails['smtpemail'];
$Password = $EmailDetails['password'];
$Headers[] = "From: Admin <".$AdminEmail.">";
$Email = new SendEmail();
//send smtp email to client
$Email->NotifyClient($HostName, $PortNo, $SMTPEmail, $Password, $AdminEmail, $ClientEmail, $ClientSubject, $ClientBody, $BlogName);
}
}
}// end of update check
//redirect to updated appointment details page
echo "";
echo "";
} else {
//redirect to updated appointment details page
echo "";
}
} // end of isset ?>
prefix . "ap_appointments";
$Appointment = $wpdb->get_row($wpdb->prepare("SELECT * FROM `$AppointmentTable` WHERE `id` = %s",$AppId));
?>
: name); ?>
|
: |
name); ?> |
|
: |
email; ?> |
|
: |
prefix . "ap_services";
$Service = $wpdb->get_row($wpdb->prepare("SELECT * FROM `$ServiceTable` WHERE `id` =%s",$Appointment->service_id));
echo ucwords($Service->name);
?>
|
|
: |
phone; ?> |
|
: |
start_time)); ?> |
|
: |
end_time)); ?> |
|
: |
date; ?> |
|
: |
note); ?> |
|
: |
appointment_key; ?> |
|
: |
status); ?> |
|
: |
appointment_by); ?> |
| |
|
|