'.sprintf(__('Database On \'%s\' Failed To Restore', 'wp-dbmanager'), $nice_file_date).'';
} else {
$text = ''.sprintf(__('Database On \'%s\' Restored Successfully', 'wp-dbmanager'), $nice_file_date).'';
}
} else {
$text = ''.__('No Backup Database File Selected', 'wp-dbmanager').'';
}
break;
case __('E-Mail', 'wp-dbmanager'):
if(!empty($database_file)) {
// Get And Read The Database Backup File
$file_path = $backup['path'].'/'.$database_file;
$file_size = format_size(filesize($file_path));
$file_date = gmdate(sprintf(__('%s @ %s', 'wp-dbmanager'), get_option('date_format'), get_option('time_format')), substr($database_file, 0, 10));
$file = fopen($file_path,'rb');
$file_data = fread($file,filesize($file_path));
fclose($file);
$file_data = chunk_split(base64_encode($file_data));
// Create Mail To, Mail Subject And Mail Header
if(!empty($_POST['email_to'])) {
$mail_to = trim($_POST['email_to']);
} else {
$mail_to = get_option('admin_email');
}
$mail_subject = sprintf(__('%s Database Backup File For %s', 'wp-dbmanager'), get_bloginfo('name'), $file_date);
$mail_header = 'From: '.get_bloginfo('name').' Administrator <'.get_option('admin_email').'>';
// MIME Boundary
$random_time = md5(time());
$mime_boundary = "==WP-DBManager- $random_time";
// Create Mail Header And Mail Message
$mail_header .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$mail_message = __('Website Name:', 'wp-dbmanager').' '.get_bloginfo('name')."\n".
__('Website URL:', 'wp-dbmanager').' '.get_bloginfo('siteurl')."\n".
__('Backup File Name:', 'wp-dbmanager').' '.$database_file."\n".
__('Backup File Date:', 'wp-dbmanager').' '.$file_date."\n".
__('Backup File Size:', 'wp-dbmanager').' '.$file_size."\n\n".
__('With Regards,', 'wp-dbmanager')."\n".
get_bloginfo('name').' '. __('Administrator', 'wp-dbmanager')."\n".
get_bloginfo('siteurl');
$mail_message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/plain; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n".$mail_message."\n\n";
$mail_message .= "--{$mime_boundary}\n" .
"Content-Type: application/octet-stream;\n" .
" name=\"$database_file\"\n" .
"Content-Disposition: attachment;\n" .
" filename=\"$database_file\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$file_data."\n\n--{$mime_boundary}--\n";
if(mail($mail_to, $mail_subject, $mail_message, $mail_header)) {
$text .= ''.sprintf(__('Database Backup File For \'%s\' Successfully E-Mailed To \'%s\'', 'wp-dbmanager'), $file_date, $mail_to).'
';
} else {
$text = ''.sprintf(__('Unable To E-Mail Database Backup File For \'%s\' To \'%s\'', 'wp-dbmanager'), $file_date, $mail_to).'';
}
} else {
$text = ''.__('No Backup Database File Selected', 'wp-dbmanager').'';
}
break;
case __('Download', 'wp-dbmanager'):
if(empty($database_file)) {
$text = ''.__('No Backup Database File Selected', 'wp-dbmanager').'';
}
break;
case __('Delete', 'wp-dbmanager'):
if(!empty($database_file)) {
$nice_file_date = gmdate(sprintf(__('%s @ %s', 'wp-dbmanager'), get_option('date_format'), get_option('time_format')), substr($database_file, 0, 10));
if(is_file($backup['path'].'/'.$database_file)) {
if(!unlink($backup['path'].'/'.$database_file)) {
$text .= ''.sprintf(__('Unable To Delete Database Backup File On \'%s\'', 'wp-dbmanager'), $nice_file_date).'
';
} else {
$text .= ''.sprintf(__('Database Backup File On \'%s\' Deleted Successfully', 'wp-dbmanager'), $nice_file_date).'
';
}
} else {
$text = ''.sprintf(__('Invalid Database Backup File On \'%s\'', 'wp-dbmanager'), $nice_file_date).'';
}
} else {
$text = ''.__('No Backup Database File Selected', 'wp-dbmanager').'';
}
break;
}
}
?>
'.$text.'