本文整理汇总了PHP中CI_Email::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Email::attach方法的具体用法?PHP CI_Email::attach怎么用?PHP CI_Email::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Email
的用法示例。
在下文中一共展示了CI_Email::attach方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backup_email_log
function backup_email_log($to, $from, $subject)
{
$tmp = function_exists('sys_get_temp_dir') ? sys_get_temp_dir() : '/tmp';
$email_options = array('useragent' => 'freepbx', 'protocol' => 'mail');
$email = new CI_Email();
$msg[] = _('BACKUP LOG ATTACHED');
$email->from($from);
$email->to($to);
$email->subject(_('Backup Log:') . $subject);
$email->message(implode("\n", $msg));
$email->attach($tmp . '/backup.log');
$email->send();
unset($msg);
}
示例2: finalize_print
/** FINALIZE PRINT TASK
*
* @param $tid - TASK ID
* @param $status - TASK STATUS (STOPPED - PERFORMED)
*
**/
function finalize_print($tid, $status)
{
//global $log;
//$log->info('Task #'.$tid.' print '.$status);
//$log->info('Task #'.$tid.' start finalizing');
//LOAD DB
$db = new Database();
//GET TASK
$task = $db->query('select * from sys_tasks where id=' . $tid);
$reset = false;
//CHECK IF TASK WAS ALREARDY FINALIZED
if ($task['status'] == 'stopped' || $task['status'] == 'performed') {
//$log->info('Task #'.$tid.' already finalized. Exit');
return;
}
//GET TASK ATTRIBUTES
$attributes = json_decode($task['attributes'], TRUE);
$print_type = $attributes['print_type'];
if ($status == 'stopped' && $print_type == 'additive') {
//IF % PROGRESS IS < 0.5 FOR SECURITY REASON I RESET THE BOARD CONTROLLER
$monitor = json_decode(file_get_contents($attributes['monitor']), TRUE);
$percent = $monitor['print']['stats']['percent'];
if ($percent < 0.2) {
/** FORCE RESET CONTROLLER */
$_command = 'sudo python ' . PYTHON_PATH . 'force_reset.py';
shell_exec($_command);
$reset = true;
//$log->info('Task #'.$tid.' reset controller');
}
}
//GET TYPE OF FILE (ADDITIVE OR SUBTRACTIVE) FOR ENDING MACRO
$file = $db->query('select * from sys_files where id=' . $attributes['id_file']);
//UPDATE TASK
update_task($tid, $status);
$_macro_end_print_response = TEMP_PATH . 'macro_response';
$_macro_end_print_trace = TEMP_PATH . 'macro_trace';
/*
if(($file['print_type'] == 'additive') && !$reset){
echo 'sudo python '.PYTHON_PATH.'gmacro.py end_print_additive_safe_zone '.$_macro_end_print_trace.' '.$_macro_end_print_response.' > /dev/null &';
shell_exec('sudo python '.PYTHON_PATH.'gmacro.py end_print_additive_safe_zone '.$_macro_end_print_trace.' '.$_macro_end_print_response.' > /dev/null &');
}
*/
$end_macro = $file['print_type'] == 'subtractive' ? 'end_print_subtractive' : 'end_print_additive';
write_file($_macro_end_print_trace, '', 'w');
chmod($_macro_end_print_trace, 0777);
write_file($_macro_end_print_response, '', 'w');
chmod($_macro_end_print_response, 0777);
//EXEC END MACRO
shell_exec('sudo python ' . PYTHON_PATH . 'gmacro.py ' . $end_macro . ' ' . $_macro_end_print_trace . ' ' . $_macro_end_print_response . ' > /dev/null &');
//$log->info('Task #'.$tid.' end macro: '.$end_macro);
sleep(2);
shell_exec('sudo kill ' . $attributes['pid']);
// SEND MAIL
if (isset($attributes['mail']) && $attributes['mail'] == 1 && $status == 'peformed') {
$user = $db->query('select * from sys_user where id=' . $task['user']);
// CREATE IMAGE TO SEND
write_file($attributes['folder'] . 'print.jpg', '', 'w');
chmod($attributes['folder'] . 'print.jpg', 0777);
// TAKE PICTURE
shell_exec('sudo raspistill -hf -vf -rot 90 --exposure off -awb sun -ISO 400 -w 768 -h 1024 -o ' . $attributes['folder'] . 'print.jpg' . ' -t 0');
$email = new CI_Email();
$config['mailtype'] = 'html';
$email->initialize($config);
$email->from('noreplay@fabtotum.com', 'Your Personal Fabricator - Fabtotum');
$email->to($user['email']);
// ATTACH
$email->attach($attributes['folder'] . 'print.jpg');
$email->subject('Your print is finished');
$message = 'Dear <strong>' . ucfirst($user['first_name']) . '</strong>,<br>i want to inform you that the print is finished right now';
$email->message($message);
if (!$email->send()) {
//$log->error('Task #'.$tid.' mail sent to '.$user['email']);
} else {
//$log->info('Task #'.$tid.' mail sent to '.$user['email']);
}
}
$db->close();
//WAIT FOR THE UI TO FINALIZE THE PROCESS
//sleep(7);
//REMOVE ALL TEMPORARY FILES
shell_exec('sudo rm -rf ' . $attributes['folder']);
//$log->info('Task #'.$tid.' end finalizing');
}
示例3: attach
public function attach($file, $disposition = '', $newname = NULL, $mime = '', $embedded_image = false)
{
//
$file = (string) $file;
$disposition = (string) $disposition;
if ($disposition == '') {
$disposition = 'attachment';
}
$newname = (string) $newname;
if ($newname == '') {
// For making strict NULL checks happy.
$newname = NULL;
}
$mime = (string) $mime;
if ($this->mailer_engine == 'phpmailer') {
if ($mime == '') {
if (strpos($file, '://') === FALSE && !file_exists($file)) {
$this->_set_error_message('lang:email_attachment_missing', $file);
// Modified by Ivan Tcholakov, 14-JAN-2014.
//return FALSE;
return $this;
//
}
if (!($fp = @fopen($file, FOPEN_READ))) {
$this->_set_error_message('lang:email_attachment_unreadable', $file);
// Modified by Ivan Tcholakov, 14-JAN-2014.
//return FALSE;
return $this;
//
}
$file_content = stream_get_contents($fp);
$mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION));
fclose($fp);
$this->_attachments[] = array('name' => array($file, $newname), 'disposition' => $disposition, 'type' => $mime);
$newname = $newname === NULL ? basename($file) : $newname;
$cid = $this->attachment_cid($file);
} else {
// A buffered file, in this case make sure that $newname has been set.
$file_content =& $file;
$this->_attachments[] = array('name' => array($newname, $newname), 'disposition' => $disposition, 'type' => $mime);
$cid = $this->attachment_cid($newname);
}
if (empty($embedded_image)) {
$this->phpmailer->addStringAttachment($file_content, $newname, 'base64', $mime, $disposition);
} else {
$this->phpmailer->addStringEmbeddedImage($file_content, $cid, $newname, 'base64', $mime, $disposition);
}
} else {
if ($this->_is_ci_3) {
parent::attach($file, $disposition, $newname, $mime);
} else {
parent::attach($file, $disposition);
}
}
return $this;
}
示例4: foreach
function store_backup()
{
foreach ($this->b['storage_servers'] as $s) {
$s = $this->s[$s];
switch ($s['type']) {
case 'local':
$path = backup__($s['path']) . '/' . $this->b['_dirname'];
//ensure directory structure
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
//would rather use the native copy() here, but by defualt
//php doesnt support files > 2GB
//see here for a posible solution:
//http://ca3.php.net/manual/en/function.fopen.php#37791
$cmd[] = fpbx_which('cp');
$cmd[] = $this->b['_tmpfile'];
$cmd[] = $path . '/' . $this->b['_file'] . '.tgz';
exec(implode(' ', $cmd), $error, $status);
unset($cmd, $error);
if ($status !== 0) {
$this->b['error'] = 'Error copying ' . $this->b['_tmpfile'] . ' to ' . $path . '/' . $this->b['_file'] . '.tgz: ' . $error;
backup_log($this->b['error']);
}
//run maintenance on the directory
$this->maintenance($s['type'], $s);
break;
case 'email':
//TODO: set agent to something informative, including fpbx & backup versions
$email_options = array('useragent' => 'freepbx', 'protocol' => 'mail');
$email = new \CI_Email();
//Generic email
$from = 'freepbx@freepbx.local';
//If we have sysadmin and "from is set"
if (function_exists('sysadmin_get_storage_email')) {
$emails = sysadmin_get_storage_email();
//Check that what we got back above is a email address
if (!empty($emails['fromemail']) && filter_var($emails['fromemail'], FILTER_VALIDATE_EMAIL)) {
$from = $emails['fromemail'];
}
}
//If the user set an email in advanced settings it wins, otherwise take whatever won above.
$from = filter_var($this->amp_conf['AMPBACKUPEMAILFROM'], FILTER_VALIDATE_EMAIL) ? $this->amp_conf['AMPBACKUPEMAILFROM'] : $from;
$msg[] = _('Name') . ': ' . $this->b['name'];
$msg[] = _('Created') . ': ' . date('r', $this->b['_ctime']);
$msg[] = _('Files') . ': ' . $this->manifest['file_count'];
$msg[] = _('Mysql Db\'s') . ': ' . $this->manifest['mysql_count'];
$msg[] = _('astDb\'s') . ': ' . $this->manifest['astdb_count'];
$email->from($from);
$email->to(backup__($s['addr']));
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup') . ' ' . $this->b['name']);
$body = implode("\n", $msg);
// If the backup file is more than 25MB, yell
$encodedsize = ceil(filesize($this->b['_tmpfile']) / 3) * 4;
if ($encodedsize > 26214400) {
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup ERROR (exceeded SMTP limits)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the maximum SMTP limits of 25MB. It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} elseif ($encodedsize > $s['maxsize']) {
$email->subject($this->amp_conf['FREEPBX_SYSTEM_IDENT'] . ' ' . _('Backup ERROR (exceeded soft limit)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the soft limit set in SMTP configuration (%s bytes). It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} else {
$email->message($body);
$email->attach($this->b['_tmpfile']);
}
$email->send();
unset($msg);
break;
case 'ftp':
//subsitute variables if nesesary
$s['host'] = backup__($s['host']);
$s['port'] = backup__($s['port']);
$s['user'] = backup__($s['user']);
$s['password'] = backup__($s['password']);
$s['path'] = trim(backup__($s['path']), '/');
$fstype = isset($s['fstype']) ? $s['fstype'] : 'auto';
$path = $s['path'] . '/' . $this->b['_dirname'];
$connection = new Connection($s['host'], $s['user'], $s['password'], $s['port'], 90, $s['transfer'] == 'passive');
try {
$connection->open();
} catch (\Exception $e) {
$this->b['error'] = $e->getMessage();
backup_log($this->b['error']);
return;
}
$wrapper = new FTPWrapper($connection);
$permFactory = new PermissionsFactory();
switch ($fstype) {
case 'auto':
$ftptype = $wrapper->systype();
if (strtolower($ftptype) == "unix") {
$fsFactory = new FilesystemFactory($permFactory);
} else {
$fsFactory = new WindowsFilesystemFactory();
}
break;
case 'unix':
$fsFactory = new FilesystemFactory($permFactory);
break;
case 'windows':
$fsFactory = new WindowsFilesystemFactory();
//.........这里部分代码省略.........
示例5: switch
}
$msg .= _('For User') . ': ' . $name . "\n";
}
}
$tif = $var['file'];
if (!empty($var['to'])) {
//build email
$email = new CI_Email();
$email->from($var['from']);
$email->to($var['to']);
$email->subject($var['subject']);
$email->message($msg);
switch ($var['attachformat']) {
case 'both':
$pdf = fax_file_convert('tif2pdf', $var['file'], '', true);
$email->attach($pdf);
$email->attach($tif);
break;
case 'tif':
$email->attach($tif);
break;
case 'pdf':
$pdf = fax_file_convert('tif2pdf', $var['file'], '', true);
$email->attach($pdf);
break;
}
$email->send();
}
if ($var['keep_file'] === false) {
unlink($tif);
if (isset($pdf)) {
示例6: attach
public function attach($file, $disposition = '', $newname = NULL, $mime = '', $embedded_image = FALSE)
{
$file = (string) $file;
$disposition = (string) $disposition;
if ($disposition == '') {
$disposition = 'attachment';
}
$newname = (string) $newname;
if ($newname == '') {
$newname = NULL;
}
$mime = (string) $mime;
if ($this->mailer_engine == 'phpmailer') {
if ($mime == '') {
if (strpos($file, '://') === FALSE && !file_exists($file)) {
$this->_set_error_message('lang:email_attachment_missing', $file);
return $this;
}
if (!($fp = @fopen($file, FOPEN_READ))) {
$this->_set_error_message('lang:email_attachment_unreadable', $file);
return $this;
}
$file_content = stream_get_contents($fp);
$mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION));
fclose($fp);
$this->_attachments[] = array('name' => array($file, $newname), 'disposition' => $disposition, 'type' => $mime);
$newname = $newname === NULL ? basename($file) : $newname;
$cid = $this->attachment_cid($file);
} else {
$file_content =& $file;
$this->_attachments[] = array('name' => array($newname, $newname), 'disposition' => $disposition, 'type' => $mime);
$cid = $this->attachment_cid($newname);
}
if (empty($embedded_image)) {
$this->phpmailer->addStringAttachment($file_content, $newname, 'base64', $mime, $disposition);
} else {
$this->phpmailer->addStringEmbeddedImage($file_content, $cid, $newname, 'base64', $mime, $disposition);
}
} else {
if ($this->_is_ci_3) {
parent::attach($file, $disposition, $newname, $mime);
} else {
parent::attach($file, $disposition);
}
}
return $this;
}
示例7: forwardMessageByExtension
/**
* Forward a voicemail message to a new folder
* @param string $msg The message ID
* @param int $ext The voicemail extension message is coming from
* @param int $rcpt The recipient, voicemail will wind up in the INBOX
*/
public function forwardMessageByExtension($msg, $ext, $to)
{
$fromVM = $this->getVoicemailBoxByExtension($ext);
$messages = $this->getMessagesByExtension($ext);
if (isset($messages['messages'][$msg])) {
$info = $messages['messages'][$msg];
$txt = $info['path'] . "/" . $info['fid'] . ".txt";
if (file_exists($txt) && is_readable($txt)) {
$toVM = $this->getVoicemailBoxByExtension($to);
$context = $toVM['vmcontext'];
$toFolder = $this->vmPath . '/' . $context . '/' . $to . '/INBOX';
if (file_exists($toFolder) && is_writable($toFolder)) {
$files = array();
$files[] = $txt;
$movedFiles = array();
foreach ($info['format'] as $format) {
if (file_exists($format['path'] . "/" . $format['filename'])) {
$files[] = $format['path'] . "/" . $format['filename'];
}
}
//if the folder is empty (meaning we dont have a 0000 file) then set this to 0000
$tname = preg_replace('/([0-9]+)/', '0000', basename($txt));
$vminfotxt = '';
if (!file_exists($toFolder . "/" . $tname)) {
foreach ($files as $file) {
$fname = preg_replace('/msg([0-9]+)/', 'msg0000', basename($file));
copy($file, $toFolder . "/" . $fname);
$movedFiles[] = $toFolder . "/" . $fname;
}
} else {
//Else we have other voicemail data in here so do something else
//figure out the last file in the directory
$oldFiles = glob($toFolder . "/*.txt");
$numbers = array();
foreach ($oldFiles as $file) {
$file = basename($file);
preg_match('/([0-9]+)/', $file, $matches);
$numbers[] = $matches[1];
}
rsort($numbers);
$next = sprintf('%04d', $numbers[0] + 1);
foreach ($files as $file) {
$fname = preg_replace('/msg([0-9]+)/', "msg" . $next, basename($file));
copy($file, $toFolder . "/" . $fname);
$movedFiles[] = $toFolder . "/" . $fname;
}
}
//send email from/to new mailbox
$vm = $this->FreePBX->LoadConfig->getConfig("voicemail.conf");
$emailInfo = array("normal" => array("body" => !empty($vm['general']['emailbody']) ? $vm['general']['emailbody'] : 'Dear ${VM_NAME}:\\n\\n\\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\\nwant to check it when you get a chance. Thanks!\\n\\n\\t\\t\\t\\t--Asterisk\\n', "subject" => !empty($vm['general']['emailsubject']) ? $vm['general']['emailsubject'] : (isset($vm['general']['pbxskip']) && $vm['general']['pbxskip'] == "no" ? "[PBX]: " : "") . 'New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}', "fromstring" => !empty($vm['general']['fromstring']) ? $vm['general']['fromstring'] : 'The Asterisk PBX'), "pager" => array("body" => !empty($vm['general']['pagerbody']) ? $vm['general']['pagerbody'] : 'New ${VM_DUR} long msg in box ${VM_MAILBOX}\\nfrom ${VM_CALLERID}, on ${VM_DATE}', "subject" => !empty($vm['general']['pagersubject']) ? $vm['general']['pagersubject'] : 'New VM', "fromstring" => !empty($vm['general']['pagerfromstring']) ? $vm['general']['pagerfromstring'] : 'The Asterisk PBX'));
$processUser = posix_getpwuid(posix_geteuid());
$from = !empty($vm['general']['serveremail']) ? $vm['general']['serveremail'] : $processUser['name'] . '@' . gethostname();
foreach ($emailInfo as &$einfo) {
$einfo['body'] = str_replace(array('\\n', '\\t'), array("\n", "\t"), $einfo['body']);
$einfo['body'] = str_replace(array('${VM_NAME}', '${VM_MAILBOX}', '${VM_CALLERID}', '${VM_DUR}', '${VM_DATE}', '${VM_MSGNUM}'), array($toVM['name'], $to, $info['callerid'], $info['duration'], $info['origdate'], $info['msg_id']), $einfo['body']);
$einfo['subject'] = str_replace(array('${VM_NAME}', '${VM_MAILBOX}', '${VM_CALLERID}', '${VM_DUR}', '${VM_DATE}', '${VM_MSGNUM}'), array($toVM['name'], $to, $info['callerid'], $info['duration'], $info['origdate'], $info['msg_id']), $einfo['subject']);
}
if (!empty($toVM['email'])) {
$em = new \CI_Email();
if ($toVM['options']['attach'] == "yes") {
$em->attach($info['path'] . "/" . $info['file']);
}
$em->from($from, $emailInfo['normal']['fromstring']);
$em->to($toVM['email']);
$em->subject($emailInfo['normal']['subject']);
$em->message($emailInfo['normal']['body']);
$em->send();
}
if (!empty($toVM['pager'])) {
$em = new \CI_Email();
$em->from($from, $emailInfo['pager']['fromstring']);
$em->to($toVM['email']);
$em->subject($emailInfo['pager']['subject']);
$em->message($emailInfo['pager']['body']);
$em->send();
}
if (isset($toVM['delete']) && $toVM['delete'] == "yes") {
//now delete the voicemail wtf.
foreach ($movedFiles as $file) {
unlink($file);
}
}
//Just for sanity sakes recheck the directories hopefully this doesnt take hours though.
$this->renumberAllMessages($toFolder);
}
}
}
if (!empty($fromVM['context'])) {
$this->astman->VoicemailRefresh($fromVM['context'], $ext);
}
if (!empty($toVM['context'])) {
$this->astman->VoicemailRefresh($toVM['context'], $to);
}
}
示例8: foreach
function store_backup()
{
foreach ($this->b['storage_servers'] as $s) {
$s = $this->s[$s];
switch ($s['type']) {
case 'local':
$path = backup__($s['path']) . '/' . $this->b['_dirname'];
//ensure directory structure
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
//would rather use the native copy() here, but by defualt
//php doesnt support files > 2GB
//see here for a posible solution:
//http://ca3.php.net/manual/en/function.fopen.php#37791
$cmd[] = fpbx_which('cp');
$cmd[] = $this->b['_tmpfile'];
$cmd[] = $path . '/' . $this->b['_file'] . '.tgz';
exec(implode(' ', $cmd), $error, $status);
unset($cmd, $error);
if ($status !== 0) {
$this->b['error'] = 'Error copying ' . $this->b['_tmpfile'] . ' to ' . $path . '/' . $this->b['_file'] . '.tgz: ' . $error;
backup_log($this->b['error']);
}
//run maintenance on the directory
$this->maintenance($s['type'], $s);
break;
case 'email':
//TODO: set agent to something informative, including fpbx & backup versions
$email_options = array('useragent' => 'freepbx', 'protocol' => 'mail');
$email = new \CI_Email();
$from = $this->amp_conf['AMPBACKUPEMAILFROM'] ? $this->amp_conf['AMPBACKUPEMAILFROM'] : 'freepbx@freepbx.org';
$msg[] = _('Name') . ': ' . $this->b['name'];
$msg[] = _('Created') . ': ' . date('r', $this->b['_ctime']);
$msg[] = _('Files') . ': ' . $this->manifest['file_count'];
$msg[] = _('Mysql Db\'s') . ': ' . $this->manifest['mysql_count'];
$msg[] = _('astDb\'s') . ': ' . $this->manifest['astdb_count'];
$email->from($from);
$email->to(backup__($s['addr']));
$email->subject(_('Backup') . ' ' . $this->b['name']);
$body = implode("\n", $msg);
// If the backup file is more than 25MB, yell
$encodedsize = ceil(filesize($this->b['_tmpfile']) / 3) * 4;
if ($encodedsize > 26214400) {
$email->subject(_('Backup ERROR (exceeded SMTP limits)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the maximum SMTP limits of 25MB. It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} elseif ($encodedsize > $s['maxsize']) {
$email->subject(_('Backup ERROR (exceeded soft limit)') . ' ' . $this->b['name']);
$email->message(_('BACKUP NOT ATTACHED') . "\n" . _('The backup file exceeded the soft limit set in SMTP configuration (%s bytes). It was not attempted to be sent. Please shrink your backup, or use a different method of transferring your backup.') . "\n{$body}\n");
} else {
$email->message($body);
$email->attach($this->b['_tmpfile']);
}
$email->send();
unset($msg);
break;
case 'ftp':
//subsitute variables if nesesary
$s['host'] = backup__($s['host']);
$s['port'] = backup__($s['port']);
$s['user'] = backup__($s['user']);
$s['password'] = backup__($s['password']);
$s['path'] = backup__($s['path']);
$ftp = @ftp_connect($s['host'], $s['port']);
if ($ftp === false) {
$this->b['error'] = _("Error connecting to the FTP Server... Check your host name or DNS");
backup_log($this->b['error']);
return $ftp;
}
if (ftp_login($ftp, $s['user'], $s['password'])) {
//chose pasive/active transfer mode
ftp_pasv($ftp, $s['transfer'] == 'passive');
//switch to directory. If we fail, build directory structure and try again
if (!@ftp_chdir($ftp, $s['path'] . '/' . $this->b['_dirname'])) {
//ensure directory structure
@ftp_mkdir($ftp, $s['path']);
@ftp_mkdir($ftp, $s['path'] . '/' . $this->b['_dirname']);
ftp_chdir($ftp, $s['path'] . '/' . $this->b['_dirname']);
}
//copy file
ftp_put($ftp, $this->b['_file'] . '.tgz', $this->b['_tmpfile'], FTP_BINARY);
//run maintenance on the directory
$this->maintenance($s['type'], $s, $ftp);
//release handel
ftp_close($ftp);
} else {
$this->b['error'] = _("Error connecting to the FTP Server...");
backup_log($this->b['error']);
}
break;
case 'awss3':
//subsitute variables if nesesary
$s['bucket'] = backup__($s['bucket']);
$s['awsaccesskey'] = backup__($s['awsaccesskey']);
$s['awssecret'] = backup__($s['awssecret']);
$awss3 = new \S3($s['awsaccesskey'], $s['awssecret']);
// Does this bucket already exist?
$buckets = $awss3->listBuckets();
if (!in_array($s['bucket'], $buckets)) {
// Create the bucket
//.........这里部分代码省略.........