FTP upload has failed for file $source_files[$i] ! Stopping ....
";return;
} else {
echo "Upload success from file $source_files[$i]
to $destination_files[$i] ...
";
}
}
// close the FTP stream
ftp_close($conn_id);
logxx("Ftp transfer finished succesfully!");
if($_CONFIG[cron_ftp_delb]==1){
@unlink($source_file);
logxx("Backup succesfully deleted from the original server!");
}
##############################################################################
}
elseif($_CONFIG['cron_send']==2){
#######################################STARTING Email TRANSFER################
logxx("Sending mail with backup");
$date = date("Y-m-d H:i");
$mode = '1';
$message = "
Attached is the backup generated on $date
Source Filename: $source_file
Server: $mosConfig_live_site
Powered by http://www.xcloner.com - XCloner - Backup and Restore made easy!
";
$ok = send_mail($mosConfig_mailfrom, "XCloner $msg", $message, $_CONFIG['cron_email_address'], $source_file);
#echo mosMail( $mosConfig_mailfrom, $mosConfig_fromname, $_CONFIG['cron_email_address'], "XCloner $msg", $message, $mode, '', '' );
if($ok)
logxx("Mail sent to ".$_CONFIG['cron_email_address']);
else
logxx("There was an error in sending the mail cron to ".$_CONFIG['cron_email_address']);
##############################################################################
}
logxx("Total backup size:".$bsize);
####### STARING AMAZON S3 MODE
if($_CONFIG['cron_amazon_active']){
include_once("classes/S3.php");
logxx();
if(!$_CONFIG['cron_amazon_ssl'])
$amazon_ssl = false;
else
$amazon_ssl = true;
$s3 = new S3($_CONFIG['cron_amazon_awsAccessKey'], $_CONFIG['cron_amazon_awsSecretKey'], (int)$amazon_ssl);
logxx("AMAZON S3: Starting communication with the Amazon S3 server...ssl mode ".$amazon_ssl);
$buckets = $s3->listBuckets();
if (($s3->putBucket($_CONFIG['cron_amazon_bucket'], "private")) || (@in_array($_CONFIG['cron_amazon_bucket'], $buckets))) {
if ($s3->putObjectFile($clonerPath."/".$file, $_CONFIG['cron_amazon_bucket'], $_CONFIG['cron_amazon_dirname']."/".baseName($file), "private")){
logxx("AMAZON S3: File copied to {".$_CONFIG['cron_amazon_bucket']."}/".$_CONFIG['cron_amazon_dirname']."/".$file);
}else {
logxx("AMAZON S3: Failed to copy file to {".$_CONFIG['cron_amazon_bucket']."}/".$_CONFIG['cron_amazon_dirname']."/".$file);exit;
}
}else{
logxx("AMAZON S3: Unable to create bucket ".$_CONFIG['cron_amazon_bucket']." (it may already exist and/or be owned by someone else)!");exit;
}
}
###### END
######## DELETING OLDER BACKUPS ##############################################
if($_CONFIG['cron_file_delete_act']){
logxx("
\nDeleting older backups than ".$_CONFIG['cron_file_delete']." days: ");
delete_older_backups($clonerPath);
}
###################END OLDER BACKUPS
$logemail = explode(";", $_CONFIG['cron_logemail']);
if(sizeof($logemail)>0){
for($i=0; $i\n";
if(mail($email, $email_subject, strip_tags($mail_log), $headers)){
logxx ("Notification Mail was sent to $email");
}
}
}
}
logxx("
\n\nALL DONE! I will exit now from cron.");
exit;
?>
";
if($fileatt != ""){
if($file = @fopen($fileatt,'rb')){
$data = fread($file,filesize($fileatt));
fclose($file);
}
else{
logxx("Unable to open file $fileatt");
}
}
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message .= "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_txt . "\n\n";
$data = chunk_split(base64_encode($data));
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
//"Content-Disposition: attachment;\n" .
//" filename=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$ok = mail($email_to, $email_subject, $email_message, $headers);
return $ok;
}
?>