Project

General

Profile

Feature #23735 » 15998.diff

Administrator Admin, 2010-10-16 19:24

View differences:

t3lib/config_default.php (Arbeitskopie)
'versionNumberInFilename' => 'querystring', // String: embed,querystring,''. Allows to automatically include a version number (timestamp of the file) to referred CSS and JS filenames on the rendered page. This will make browsers and proxies reload the files if they change (thus avoiding caching issues). Set to 'embed' will have the timestamp embedded in the filename, ie. filename.1269312081.js. IMPORTANT: 'embed' requires extra .htaccess rules to work (please refer to misc/advanced.htaccess or the _.htaccess file from the dummy package)<p>Set to 'querystring' (default setting) to append the version number as a query parameter (doesn't require mod_rewrite). Set to '' will turn this functionality off (behaves like TYPO3 &lt; v4.4).</p>
'XCLASS' => array(), // See 'Inside TYPO3' document for more information.
),
'MAIL' => array( // Mail configurations to tune how t3lib_mail classes will send their mails.
'transport' => 'mail', // <p>String:</p><dl><dt>mail</dt><dd>Sends messages by delegating to PHP's internal mail() function. No further settings required. This is the most unreliable option. If you are serious about sending mails, consider using "smtp" or "sendmail".</dd><dt>smtp</dt><dd>Sends messages over the (standardized) Simple Message Transfer Protocol. It can deal with encryption and authentication. Most flexible option, requires a mail server and configurations in transport_smtp_* settings below. Works the same on Windows, Unix and MacOS.</dd><dt>sendmail</dt><dd>Sends messages by communicating with a locally installed MTA – such as sendmail. See setting transport_sendmail_command bellow.<dd></dl>
'transport_smtp_server' => 'localhost:25', // String: <em>only with transport=smtp</em>: &lt;server:port> of mailserver to connect to. &lt;port> defaults to "25".
'transport_smtp_encrypt' => FALSE, // Boolean: <em>only with transport=smtp</em>: Connect to the server using encryption and TLS. Requires openssl library.
'transport_smtp_username' => '', // String: <em>only with transport=smtp</em>: If your SMTP server requires authentication, enter your username here.
'transport_smtp_password' => '', // String: <em>only with transport=smtp</em>: If your SMTP server requires authentication, enter your password here.
'transport_sendmail_command' => '/usr/sbin/sendmail -bs', // String: <em>only with transport=sendmail</em>: The command to call to send a mail locally. The default works on most modern UNIX based mail server (sendmail, postfix, exim)
),
'MODS' => array( // Backend Module Configuration (obsolete, make extension instead)
),
'USER' => array( // Here you may define your own setup-vars for use in your include-scripts. (obsolete, make extension instead)
t3lib/core_autoload.php (Arbeitskopie)
't3lib_spritemanager_spriteicongenerator' => PATH_t3lib . 'interfaces/interface.t3lib_spritemanager_spriteicongenerator.php',
't3lib_spritemanager_simplehandler' => PATH_t3lib . 'spritemanager/class.t3lib_spritemanager_simplehandler.php',
't3lib_extjs_extdirectdebug' => PATH_t3lib . 'extjs/class.t3lib_extjs_extdirectdebug.php',
't3lib_mail_message' => PATH_t3lib . 'mail/class.t3lib_mail_message.php',
't3lib_mail_mailer' => PATH_t3lib . 'mail/class.t3lib_mail_mailer.php',
);
$tslibClasses = require(PATH_typo3 . 'sysext/cms/ext_autoload.php');
t3lib/mail/class.t3lib_mail_mailer.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Ernesto Baschny <ernst@cron-it.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
// Make sure Swift's auto-loader is registered
require_once(PATH_typo3 . 'contrib/swiftmailer/swift_required.php');
/**
* Adapter for Swift_Mailer to be used by TYPO3 extensions.
*
* This will use the setting in TYPO3_CONF_VARS to choose the correct transport
* for it to work out-of-the-box.
*
* $Id$
*
* @author Ernesto Baschny <ernst@cron-it.de>
* @package TYPO3
* @subpackage t3lib
*/
class t3lib_mail_mailer extends Swift_Mailer {
/**
* @var Swift_Transport
*/
protected $transport;
/**
* When constructing, also initializes the Swift_Transport like configured
*
* @throws t3lib_exception
*/
public function __construct() {
try {
$this->initializeTransport();
} catch (Exception $e) {
throw new t3lib_exception($e->getMessage());
}
parent::__construct($this->transport);
}
/**
* Prepares a transport using the TYPO3_CONF_VARS configuration
*
* Used options:
* $TYPO3_CONF_VARS['MAIL']['transport'] = 'smtp' | 'sendmail' | 'mail'
*
* $TYPO3_CONF_VARS['MAIL']['transport_smtp_server'] = 'smtp.example.org';
* $TYPO3_CONF_VARS['MAIL']['transport_smtp_port'] = '25';
* $TYPO3_CONF_VARS['MAIL']['transport_smtp_encrypt'] = FALSE; # requires openssl in PHP
* $TYPO3_CONF_VARS['MAIL']['transport_smtp_username'] = 'username';
* $TYPO3_CONF_VARS['MAIL']['transport_smtp_password'] = 'password';
*
* $TYPO3_CONF_VARS['MAIL']['transport_sendmail_command'] = '/usr/sbin/sendmail -bs'
*
* @throws Exception
*/
private function initializeTransport() {
$mailSettings = $GLOBALS['TYPO3_CONF_VARS']['MAIL'];
switch ($mailSettings['transport']) {
case 'smtp':
// Get settings to be used when constructing the transport object
list($host, $port) = split(':', $mailSettings['transport_smtp_server']);
if ($host === '') {
throw new t3lib_exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_smtp_server\'] needs to be set when transport is set to "smtp"');
}
if ($port === '') {
$port = '25';
}
$useEncryption = ( $mailSettings['transport_smtp_encrypt'] ? TRUE : FALSE);
// Create our transport
$this->transport = Swift_SmtpTransport::newInstance($host, $port, $useEncryption);
// Need authentication?
$username = $mailSettings['transport_smtp_username'];
if ($username !== '') {
$this->transport->setUsername($username);
}
$password = $mailSettings['transport_smtp_password'];
if ($password !== '') {
$this->transport->setPassword($password);
}
break;
case 'sendmail':
$sendmailCommand = $mailSettings['transport_sendmail_command'];
if ($sendmailCommand === '') {
throw new t3lib_exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_sendmail_command\'] needs to be set when transport is set to "sendmail"');
}
// Create our transport
$this->transport = Swift_SendmailTransport::newInstance($sendmailCommand);
break;
case 'mail':
default:
// Create the transport, no configuration required
$this->transport = Swift_MailTransport::newInstance();
break;
}
return;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_mailer.php']);
}
?>
t3lib/mail/class.t3lib_mail_message.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Ernesto Baschny <ernst@cron-it.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
require_once(PATH_typo3.'contrib/swiftmailer/swift_required.php');
/**
* Adapter for Swift_Mailer to be used by TYPO3 extensions
*
* $Id$
*
* @author Ernesto Baschny <ernst@cron-it.de>
* @package TYPO3
* @subpackage t3lib
*/
class t3lib_mail_message extends Swift_Message {
/**
* @var t3lib_mail_mailer
*/
var $mailer;
/**
* True if the message has been sent.
* @var boolean
*/
var $sent = FALSE;
/**
* Holds the failed recipients after the message has been sent
* @var array
*/
var $failedRecipients = array();
/**
*
* @return void
*/
private function initializeMailer() {
$this->mailer = t3lib_div::makeInstance('t3lib_mail_mailer');
}
/**
* Sends the message.
*
* @return integer the number of recipients who were accepted for delivery
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function send() {
$this->initializeMailer();
$this->sent = TRUE;
return $this->mailer->send($this, &$this->failedRecipients);
}
/**
* Checks whether the message has been sent.
*
* @return boolean
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function isSent() {
return $this->sent;
}
/**
* Returns the recipients for which the mail was not accepted for delivery.
*
* @return array the recipients who were not accepted for delivery
* @author Karsten Dambekalns <karsten@typo3.org>
*/
public function getFailedRecipients() {
return $this->failedRecipients;
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_message.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_mail_message.php']);
}
?>
(1-1/4)