コード例 #1
0
function DoEmail()
{
    global $config, $dump, $databases, $email, $lang, $out, $REMOTE_ADDR;
    $header = "";
    if ($config['cron_use_sendmail'] == 1) {
        //sendmail
        if (ini_get("sendmail_path") != $config['cron_sendmail']) {
            @ini_set("SMTP", $config['cron_sendmail']);
        }
        if (ini_get("sendmail_from") != $config['email_sender']) {
            @ini_set("SMTP", $config['email_sender']);
        }
    } else {
        //SMTP
    }
    if (ini_get("SMTP") != $config['cron_smtp']) {
        @ini_set("SMTP", $config['cron_smtp']);
    }
    if (ini_get("smtp_port") != 25) {
        @ini_set("smtp_port", 25);
    }
    if ($config['multi_part'] == 0) {
        $file = $dump['backupdatei'];
        $file_name = strpos("/", $file) ? substr($file, strrpos("/", $file)) : $file;
        $file_type = filetype($config['paths']['backup'] . $file);
        $file_size = filesize($config['paths']['backup'] . $file);
        if ($config['email_maxsize'] > 0 && $file_size > $config['email_maxsize'] || $config['send_mail_dump'] == 0) {
            //anhang zu gross
            $subject = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y H:i", time());
            $header .= "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "X-Mailer: PHP/" . phpversion() . "\n";
            $header .= "X-Sender-IP: {$REMOTE_ADDR}\n";
            $header .= "Content-Type: text/html; charset=utf-8\n";
            if ($config['send_mail_dump'] != 0) {
                $msg_body = sprintf(addslashes($lang['L_EMAILBODY_TOOBIG']), byte_output($config['email_maxsize']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")<br>");
            } else {
                $msg_body = sprintf(addslashes($lang['L_EMAILBODY_NOATTACH']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")");
            }
            include_once './inc/functions.php';
            $msg_body .= '<a href="' . getServerProtocol() . $_SERVER['HTTP_HOST'] . substr($_SERVER["PHP_SELF"], 0, strrpos($_SERVER["PHP_SELF"], "/")) . '/' . $config['paths']['backup'] . $file . '">' . $file . '</a>';
            $email_log = "Email sent to '" . $config['email_recipient'] . "'";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`<br>";
        } else {
            //alles ok, anhang generieren
            $msg_body = sprintf(addslashes($lang['L_EMAILBODY_ATTACH']), $databases['Name'][$dump['dbindex']], "{$file} (" . byte_output(filesize($config['paths']['backup'] . $file)) . ")");
            $subject = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y", time());
            $fp = fopen($config['paths']['backup'] . $file, "r");
            $contents = fread($fp, $file_size);
            $encoded_file = chunk_split(base64_encode($contents));
            fclose($fp);
            $header .= "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "Content-type: multipart/mixed; ";
            $header .= "boundary=\"Message-Boundary\"\n";
            $header .= "Content-transfer-encoding: 7BIT\n";
            $header .= "X-attachments: {$file_name}";
            $body_top = "--Message-Boundary\n";
            $body_top .= "Content-type: text/html; charset=utf-8\n";
            $body_top .= "Content-transfer-encoding: 7BIT\n";
            $body_top .= "Content-description: Mail message body\n\n";
            $msg_body = $body_top . $msg_body;
            $msg_body .= "\n\n--Message-Boundary\n";
            $msg_body .= "Content-type: {$file_type}; name=\"{$file}\"\n";
            $msg_body .= "Content-Transfer-Encoding: BASE64\n";
            $msg_body .= "Content-disposition: attachment; filename=\"{$file}\"\n\n";
            $msg_body .= "{$encoded_file}\n";
            $msg_body .= "--Message-Boundary--\n";
            $email_log = "Email was sent to '" . $config['email_recipient'] . "' with '" . $dump['backupdatei'] . "'.";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`" . $lang['L_WITH'] . "`" . $dump['backupdatei'] . "`.<br>";
        }
    } else {
        //Multipart
        $mp_sub = "Backup '" . $databases['Name'][$dump['dbindex']] . "' - " . date("d\\.m\\.Y", time());
        $subject = $mp_sub;
        $header .= "FROM:" . $config['email_sender'] . "\n";
        if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
            $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
        }
        $header .= "MIME-version: 1.0\n";
        $header .= "X-Mailer: PHP/" . phpversion() . "\n";
        $header .= "X-Sender-IP: {$REMOTE_ADDR}\n";
        $header .= "Content-Type: text/html; charset=utf-8";
        $dateistamm = substr($dump['backupdatei'], 0, strrpos($dump['backupdatei'], "part_")) . "part_";
        $dateiendung = $config['compression'] == 1 ? ".sql.gz" : ".sql";
        $mpdatei = array();
        $mpfiles = "";
        for ($i = 1; $i < $dump['part'] - $dump['part_offset']; $i++) {
            $mpdatei[$i - 1] = $dateistamm . $i . $dateiendung;
            $sz = byte_output(@filesize($config['paths']['backup'] . $mpdatei[$i - 1]));
            $mpfiles .= $mpdatei[$i - 1] . " (" . $sz . ")<br>";
        }
        $msg_body = $config['send_mail_dump'] == 1 ? sprintf(addslashes($lang['L_EMAILBODY_MP_ATTACH']), $databases['Name'][$dump['dbindex']], $mpfiles) : sprintf(addslashes($lang['L_EMAILBODY_MP_NOATTACH']), $databases['Name'][$dump['dbindex']], $mpfiles);
        $email_log = "Email was sent to '" . $config['email_recipient'] . "'";
        $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`<br>";
    }
    if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) {
        $out .= '<span class="success">' . $email_out . '</span>';
        WriteLog("{$email_log}");
    } else {
        $out .= '<span class="error">' . $lang['L_MAILERROR'] . '</span><br>';
        WriteLog("Email to '" . $config['email_recipient'] . "' failed !");
        ErrorLog("Email ", $databases['Name'][$dump['dbindex']], 'Subject: ' . stripslashes($subject), $lang['L_MAILERROR']);
        $dump['errors']++;
    }
    if (isset($mpdatei) && $config['send_mail_dump'] == 1) {
        // && ($config['email_maxsize']==0 || ($config['email_maxsize']>0 && $config['multipartgroesse2']<=$config['email_maxsize']))) {
        for ($i = 0; $i < count($mpdatei); $i++) {
            $file_name = $mpdatei[$i];
            $file_type = filetype($config['paths']['backup'] . $mpdatei[$i]);
            $file_size = filesize($config['paths']['backup'] . $mpdatei[$i]);
            $fp = fopen($config['paths']['backup'] . $mpdatei[$i], "r");
            $contents = fread($fp, $file_size);
            $encoded_file = chunk_split(base64_encode($contents));
            fclose($fp);
            $subject = $mp_sub . "  [Part " . ($i + 1) . " / " . count($mpdatei) . "]";
            $header = "FROM:" . $config['email_sender'] . "\n";
            if (isset($config['email_recipient_cc']) && trim($config['email_recipient_cc']) > '') {
                $header .= "Cc:     " . $config['email_recipient_cc'] . "\r\n";
            }
            $header .= "MIME-version: 1.0\n";
            $header .= "Content-type: multipart/mixed; ";
            $header .= "boundary=\"Message-Boundary\"\n";
            $header .= "Content-transfer-encoding: 7BIT\n";
            $header .= "X-attachments: {$file_name}";
            $body_top = "--Message-Boundary\n";
            $body_top .= "Content-type: text/html; charset=utf-8\n";
            $body_top .= "Content-transfer-encoding: 7BIT\n";
            $body_top .= "Content-description: Mail message body\n\n";
            $msg_body = $body_top . addslashes($lang['L_EMAIL_ONLY_ATTACHMENT'] . $lang['L_EMAILBODY_FOOTER']);
            $msg_body .= "\n\n--Message-Boundary\n";
            $msg_body .= "Content-type: {$file_type}; name=\"" . $mpdatei[$i] . "\"\n";
            $msg_body .= "Content-Transfer-Encoding: BASE64\n";
            $msg_body .= "Content-disposition: attachment; filename=\"" . $mpdatei[$i] . "\"\n\n";
            $msg_body .= "{$encoded_file}\n";
            $msg_body .= "--Message-Boundary--\n";
            $email_log = "Email with {$mpdatei[$i]} was sent to '" . $config['email_recipient'] . "'";
            $email_out = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email_recipient'] . "`" . $lang['L_WITH'] . "`" . $mpdatei[$i] . "`.<br>";
            if (@mail($config['email_recipient'], stripslashes($subject), $msg_body, $header)) {
                $out .= '<span class="success">' . $email_out . '</span>';
                WriteLog("{$email_log}");
            } else {
                $out .= '<span class="error">' . $lang['L_MAILERROR'] . '</span><br>';
                WriteLog("Email to '" . $config['email_recipient'] . "' failed !");
                ErrorLog("Email ", $databases['Name'][$dump['dbindex']], 'Subject: ' . stripslashes($subject), $lang['L_MAILERROR']);
                $dump['errors']++;
            }
        }
    }
}
コード例 #2
0
ファイル: appconfig.php プロジェクト: Doebe/workplace
$module->addAttribute('name', "ChromeSpeech");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/sensors/ChromeSpeech");
$module = $xml->addChild('module');
$module->addAttribute('name', "SpeechMirroringBehavior");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/processors/SpeechMirroringBehavior");
$module = $xml->addChild('module');
$module->addAttribute('name', "WinSAPISynth");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/processors/WinSAPISynth");
$module = $xml->addChild('module');
$module->addAttribute('name', "WebRTCVideo");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/sensors/WebRTCVideo");
$module = $xml->addChild('module');
$module->addAttribute('name', "VideoStreamDisplay");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/effectors/VideoStreamDisplay");
$module = $xml->addChild('module');
$module->addAttribute('name', "ClmTrackrWithOverlay");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/processors/ClmTrackr");
$module = $xml->addChild('module');
$module->addAttribute('name', "FacialMirroringBehavior");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/processors/FacialMirroringBehavior");
$module = $xml->addChild('module');
$module->addAttribute('name', "HapCharacterGirl");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/processors/HapCharacter");
$module = $xml->addChild('module');
$module->addAttribute('name', "WebGLScene");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/effectors/WebGLScene");
$module = $xml->addChild('module');
$module->addAttribute('name', "MainframePlotter");
$module->addAttribute('uri', getServerProtocol() . "://" . $_SERVER['SERVER_NAME'] . "/eEva/app/modules/effectors/MainframePlotter");
Header('Content-type: text/xml');
print $xml->asXML();
コード例 #3
0
ファイル: filemanagement.php プロジェクト: robmat/samplebator
        $cext = $config['cron_extender'] == 0 ? "pl" : "cgi";
        $actualUrl = substr($_SERVER['SCRIPT_NAME'], 0, strrpos($_SERVER['SCRIPT_NAME'], "/") + 1);
        if (substr($actualUrl, -1) != "/") {
            $actualUrl .= "/";
        }
        if (substr($actualUrl, 0, 1) != "/") {
            $actualUrl = "/{$actualUrl}";
        }
        $refdir = substr($config['cron_execution_path'], 0, 1) == "/" ? "" : $actualUrl;
        $scriptdir = $config['cron_execution_path'] . 'crondump.' . $cext;
        $sfile = $config['cron_execution_path'] . "perltest.{$cext}";
        $simplefile = $config['cron_execution_path'] . "simpletest.{$cext}";
        $scriptentry = Realpfad("./") . $config['paths']['config'];
        $cronabsolute = substr($config['cron_execution_path'], 0, 1) == "/" ? $_SERVER['DOCUMENT_ROOT'] . $scriptdir : Realpfad("./") . $scriptdir;
        $confabsolute = $config['config_file'];
        $scriptref = getServerProtocol() . $_SERVER['SERVER_NAME'] . $refdir . $config['cron_execution_path'] . 'crondump.' . $cext . "?config=" . $confabsolute;
        $cronref = "perl " . $cronabsolute . " -config=" . $confabsolute . " -html_output=0";
        //Ausgabe
        echo headline($lang['L_FM_DUMP_HEADER'] . ' <span class="small">("' . $lang['L_CONFIG_HEADLINE'] . ': ' . $config['config_file'] . '")</span>');
        if (!is_writable($config['paths']['backup'])) {
            die('<span class="error">' . sprintf($lang['L_WRONG_RIGHTS'], 'work/backup', '777') . '</span>');
        }
        echo $msg > '' ? $msg . '<br>' : '';
        echo $autodel;
        //Auswahl
        echo '<div>
		<input type="button" value=" ' . $lang['L_DUMP'] . ' PHP " class="Formbutton" onclick="document.getElementById(\'buperl\').style.display=\'none\';document.getElementById(\'buphp\').style.display=\'block\';">
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<input type="button" value=" ' . $lang['L_DUMP'] . ' PERL " class="Formbutton" onclick="document.getElementById(\'buphp\').style.display=\'none\';document.getElementById(\'buperl\').style.display=\'block\';">
		</div>';
        echo '<div id="buphp">';
コード例 #4
0
        $databases = array();
        if (getConfig($newConfig)) {
            $config['config_file'] = $newConfig;
            $_SESSION['config_file'] = $newConfig;
            $tplMenu->assign_vars(array('CONFIG_FILE' => urlencode($newConfig)));
            $p = 'config';
            // switch to configuration page
            // hand over message to config page
            $msg = sprintf($lang['L_CONFIG_LOADED'], $config['config_file']);
            $msg = Html::getOkMsg($msg);
        }
    }
}
// show Server caption?
if ($config['interface_server_caption'] == 1) {
    $tplMenu->assign_block_vars('SHOW_SERVER_CAPTION', array('KIND' => $config['interface_server_caption_position'], 'LINK' => getServerProtocol() . $_SERVER['SERVER_NAME'], 'NAME' => $_SERVER['SERVER_NAME']));
}
if (isset($_GET['dbrefresh'])) {
    // remember the name of the selected database
    $oldDbName = $config['db_actual'];
    if (isset($_GET['db_name'])) {
        // new db created -> switch to it
        $oldDbName = base64_decode($_GET['db_name']);
    }
    setDefaultConfig();
    // lets lookup if the old database is still there
    if (isset($databases[$oldDbName])) {
        $dbo->selectDb($oldDbName);
    } else {
        $dbo->selectDb($dbo->databases[0]);
    }
コード例 #5
0
    $url .= '/';
}
if (substr($url, 0, 1) != '/') {
    $url = '/' . $url;
}
$refdir = substr($config['cron_execution_path'], 0, 1) == '/' ? '' : $url;
$scriptdir = $config['cron_execution_path'] . 'crondump.' . $cext;
$perlModultest = $config['cron_execution_path'] . "perltest.{$cext}";
$perlSimpletest = $config['cron_execution_path'] . "simpletest.{$cext}";
$scriptentry = myRealpath('./') . $config['paths']['config'];
$cronabsolute = myRealpath('./') . $scriptdir;
if (substr($config['cron_execution_path'], 0, 1) == '/') {
    $cronabsolute = $_SERVER['DOCUMENT_ROOT'] . $scriptdir;
}
$confabsolute = $config['config_file'];
$perlHttpCall = getServerProtocol() . $serverName . $refdir;
$perlHttpCall .= $config['cron_execution_path'] . 'crondump.' . $cext;
$perlHttpCall .= '?config=' . $confabsolute;
$perlCrontabCall = 'perl ' . $cronabsolute . ' -config=' . $confabsolute;
$perlCrontabCall .= ' -html_output=0';
$tplDumpPrepare->assign_vars(array('SESSION_ID' => session_id(), 'CONFIG_FILE' => $config['config_file'], 'POSSIBLE_DUMP_ENCODINGS' => Html::getOptionlist($charsetsDescription, 'utf8'), 'DBS_TO_BACKUP' => $dbsToBackup, 'TABLES_TOTAL' => $dump['tables_total'], 'RECORDS_TOTAL' => String::formatNumber(intval($dump['records_total'])), 'DATASIZE_TOTAL' => byteOutput($dump['datasize_total']), 'NR_OF_DBS' => count($dump['databases']), 'DUMP_COMMENT' => Html::replaceQuotes($dump['comment']), 'PERL_TEST' => $perlSimpletest, 'PERL_MODULTEST' => $perlModultest, 'PERL_HTTP_CALL' => $perlHttpCall, 'PERL_CRONTAB_CALL' => $perlCrontabCall, 'PERL_ABSOLUTE_PATH_OF_CONFIGDIR' => $scriptentry, 'TIMESTAMP' => time()));
if (count($dump['databases']) == 1 && $config['db_actual'] == $dbsToBackup) {
    $tplDumpPrepare->assign_block_vars('TABLESELECT', array());
}
if ($config['compression'] == 1) {
    $tplDumpPrepare->assign_block_vars('GZIP_ACTIVATED', array());
} else {
    $tplDumpPrepare->assign_block_vars('GZIP_NOT_ACTIVATED', array());
}
if ($config['multi_part'] == 1) {
    $tplDumpPrepare->assign_block_vars('MULTIPART', array('SIZE' => byteOutput($config['multipart_groesse'])));
コード例 #6
0
ファイル: functions_global.php プロジェクト: thaian2009/php
function headline($title, $mainframe = 1)
{
    global $config, $lang;
    $s = '';
    if ($config['interface_server_caption'] == 1) {
        if ($config['interface_server_caption_position'] == $mainframe) {
            $s .= '<div id="server' . $mainframe . '">' . $lang['L_SERVER'] . ': <a class="server" href="' . getServerProtocol() . $_SERVER['SERVER_NAME'] . '" target="_blank" title="' . $_SERVER['SERVER_NAME'] . '">' . $_SERVER['SERVER_NAME'] . '</a></div>';
        }
    }
    if ($mainframe == 1) {
        $s .= '<div id="pagetitle">' . $title . '</div>';
        $s .= '<div id="content">';
    }
    return $s;
}
コード例 #7
0
/**
 * Send e-mail and attach file
 *
 * @param string $file
 * @return boolean
 */
function doEmail($file)
{
    global $config, $dump, $lang, $log;
    include 'lib/phpmailer/php5/class.phpmailer.php';
    include 'inc/classes/helper/Html.php';
    // get some status info from actual file
    $rootpath = $config['paths']['root'] . $config['paths']['backup'];
    $fileInfo = ReadStatusline($file);
    $fileInfo['size'] = @filesize($rootpath . $file);
    $database = $fileInfo['dbname'];
    $tablesSaved = $fileInfo['tables'];
    $recordsSaved = $fileInfo['tables'];
    if (sizeof($_SESSION['email']['filelist']) == 0) {
        // first call after backup -> create file list of all files for each database
        $_SESSION['email']['filelist'] = array();
        foreach ($_SESSION['log']['email'] as $filename) {
            $statusInfo = ReadStatusline($filename);
            if (!isset($_SESSION['email']['filelist'][$statusInfo['dbname']])) {
                $_SESSION['email']['filelist'][$statusInfo['dbname']] = array();
            }
            $_SESSION['email']['filelist'][$statusInfo['dbname']][] = $filename;
        }
    }
    // create file list for specific database
    $filelist = '';
    foreach ($_SESSION['email']['filelist'][$database] as $filename) {
        $phpSelf = $_SERVER['PHP_SELF'];
        $linkToFile = '<a href="' . getServerProtocol() . $_SERVER['HTTP_HOST'] . substr($phpSelf, 0, strrpos($phpSelf, '/')) . '/' . $config['paths']['backup'] . $filename . '">' . $filename . '</a>';
        $filelist .= $linkToFile;
        if ($file == $filename && $config['email']['attach_backup']) {
            $filelist .= ' (' . $lang['L_ATTACHED_AS_FILE'] . ')';
        }
        $filelist .= '<br />' . "\n";
    }
    $mail = new PHPMailer();
    $mail->CharSet = 'utf-8';
    $mail->PlugInDir = 'lib/phpmailer/php5/';
    $mail->From = $config['email']['sender_address'];
    $mail->FromName = $config['email']['sender_name'];
    $mail->AddAddress($config['email']['recipient_address'], $config['email']['recipient_name']);
    // add cc-recipients
    foreach ($config['email']['recipient_cc'] as $recipient) {
        if ($recipient['address'] > '') {
            $mail->AddCC($recipient['address'], $recipient['name']);
        }
    }
    //build subject
    $subject = $lang['L_DUMP_FILENAME'] . ': ' . $file;
    if ($fileInfo['comment'] > '') {
        $subject = $fileInfo['comment'] . ', ' . $subject;
    }
    $mail->Subject = $subject;
    $mail->Timeout = 60;
    // set used mail-method
    $mail->IsMail();
    //defaults to php-mail-function
    if ($config['use_mailer'] == 1) {
        $mail->IsSendmail();
        $mail->Sendmail = $config['sendmail_call'];
    } elseif ($config['use_mailer'] == 2) {
        $mail->IsSMTP();
        //debug
        //$mail->SMTPDebug = PHP_INT_MAX;
        $mail->Host = $config['smtp_server'];
        $mail->Port = $config['smtp_port'];
        // auth?
        if ($config['smtp_useauth']) {
            $mail->SMTPAuth = true;
            $mail->Username = $config['smtp_user'];
            $mail->Password = $config['smtp_pass'];
        }
        //use ssl?
        if ($config['smtp_usessl']) {
            $mail->SMTPSecure = 'tls';
        }
    }
    //build mail body
    $body = '';
    //add attachement?
    if ($config['email']['attach_backup']) {
        //check if file is bigger than allowed max size
        if ($config['email_maxsize'] > 0 && $fileInfo['size'] > $config['email_maxsize']) {
            // attachement too big -> don't attach and paste message to body
            $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, $file . ' (' . byte_output(filesize($config['paths']['backup'] . $file)) . ')<br />');
        } else {
            // add file as attachement
            $mail->AddAttachment($rootpath . $file);
            $body .= sprintf($lang['L_EMAILBODY_ATTACH'], $database, $filelist);
        }
    } else {
        // don't attach backup file according to configuration
        $body .= sprintf($lang['L_EMAILBODY_TOOBIG'], byteOutput($config['email_maxsize']), $database, "{$file} (" . byteOutput(filesize($config['paths']['backup'] . $file)) . ")<br />");
    }
    //set body
    $mail->MsgHTML($body);
    //build alternative-body without tags for mail-clients blocking HTML
    $altBody = strip_tags(Html::br2nl($body));
    $mail->AltBody = $altBody;
    $mail->Timeout = 30;
    $ret = $mail->Send();
    if (!$ret) {
        writeToErrorLog('', '', $lang['L_MAILERROR'] . ' -> ' . $mail->ErrorInfo, 0);
        $log->write(Log::PHP, $lang['L_MAILERROR']);
    } else {
        $msg = $lang['L_EMAIL_WAS_SEND'] . "`" . $config['email']['recipient_address'];
        $log->write(Log::PHP, $msg);
    }
    return $ret;
}
コード例 #8
0
ファイル: index.php プロジェクト: thedevstack/httpupload
 * 
 * The following return codes are used for deleting a file:
 * 204: Success - No Content
 * 403: If a slot does not exist or a slot is not marked for deletion.
 *   The slot does not exist
 *   The slot does not contain a delete token
 *   The slot's delete token does not match the header field "X-FILETRANSFER-HTTP-DELETE-TOKEN"
 *   The slot's delete token is not valid any more
 */
$method = $_SERVER['REQUEST_METHOD'];
// Load configuration
$config = (require __DIR__ . '/config/config.inc.php');
// Initialize directory config
$config['storage_base_path'] = __DIR__ . '/files/';
$config['slot_registry_dir'] = __DIR__ . '/slots/';
$config['base_url_put'] = getServerProtocol() . "://" . getRequestHostname() . getRequestUriWithoutFilename() . 'files/';
$config['base_url_get'] = $config['base_url_put'];
switch ($method) {
    case 'POST':
        // parse post parameters
        // check if all parameters are present - return 400 (bad request) if a parameter is missing / empty
        $xmppServerKey = getMandatoryPostParameter('xmpp_server_key');
        $userJid = getMandatoryPostParameter('user_jid');
        $slotType = getOptionalPostParameter('slot_type', 'upload');
        // Check if xmppServerKey is allowed to request slots
        if (false === checkXmppServerKey($config['valid_xmpp_server_keys'], $xmppServerKey)) {
            sendHttpReturnCodeAndJson(403, 'Server is not allowed to request an ' . $slotType . ' slot');
        }
        switch ($slotType) {
            case 'delete':
                // Check if all parameters needed for an delete are present - return 400 (bad request) if a parameter is missing / empty