[geeklog-cvs] geeklog-1.3/public_html lib-common.php,1.250,1.251
geeklog-cvs-admin at lists.geeklog.net
geeklog-cvs-admin at lists.geeklog.net
Thu Sep 4 05:50:18 EDT 2003
Update of /usr/cvs/geeklog/geeklog-1.3/public_html
In directory geeklog_prod:/tmp/cvs-serv3292/public_html
Modified Files:
lib-common.php
Log Message:
Geeklog now uses PEAR::Mail to send emails.
Index: lib-common.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/lib-common.php,v
retrieving revision 1.250
retrieving revision 1.251
diff -C2 -d -r1.250 -r1.251
*** lib-common.php 1 Sep 2003 19:11:57 -0000 1.250
--- lib-common.php 4 Sep 2003 09:50:15 -0000 1.251
***************
*** 175,178 ****
--- 175,188 ----
require_once( $_CONF['path_system'] . 'lib-sessions.php' );
+ /**
+ * If needed, add our PEAR path to the list of include paths
+ *
+ */
+ if( !$_CONF['have_pear'] )
+ {
+ $curPHPIncludePath = ini_get( 'include_path' );
+ ini_set( 'include_path', $curPHPIncludePath . ':' . $_CONF['path_pear'] );
+ }
+
// Set theme
// Need to modify this code to check if theme was cached in user cookie. That
***************
*** 2967,2970 ****
--- 2977,3000 ----
global $_CONF, $LANG_CHARSET;
+ static $mailobj;
+
+ include_once ('Mail.php');
+ include_once ('Mail/RFC822.php');
+
+ $method = $_CONF['mail_settings']['backend'];
+
+ if( !isset( $mailobj ))
+ {
+ if(( $method == 'sendmail' ) || ( $method == 'smtp' ))
+ {
+ $mailobj =& Mail::factory( $method, $_CONF['mail_settings'] );
+ }
+ else
+ {
+ $method = 'mail';
+ $mailobj =& Mail::factory( $method );
+ }
+ }
+
if( empty( $LANG_CHARSET ))
{
***************
*** 2978,3010 ****
{
$charset = $LANG_CHARSET;
}
! $headers = '';
! if( empty( $from ))
{
! $headers .= "From: {$_CONF['site_name']} <{$_CONF['site_mail']}>\r\n"
! . "Return-Path: <{$_CONF['site_mail']}>\r\n";
}
! else
{
! $headers .= "From: $from\r\n";
}
if( $html )
{
! $headers .= "Content-Type: text/html; charset=$charset\r\n"
! . "Content-Transfer-Encoding: 8bit\r\n";
}
else
{
! $headers .= "Content-Type: text/plain; charset=$charset\r\n";
}
! if( $priority > 0 )
{
! $headers .= 'X-Priority: ' . $priority . "\r\n";
}
! $headers .= 'X-Mailer: GeekLog ' . VERSION;
! return mail( $to, $subject, $message, $headers );
}
--- 3008,3056 ----
{
$charset = $LANG_CHARSET;
+ }
+
+ if( empty( $from ))
+ {
+ $from = $_CONF['site_name'] . ' <' . $_CONF['site_mail'] . '>';
}
! $headers = array();
! $headers['From'] = $from;
! if( $method != 'mail' )
{
! $headers['To'] = $to;
}
! $headers['Date'] = date( 'r' ); // RFC822 formatted date
! if( $method == 'smtp' )
{
! list( $usec, $sec ) = explode( ' ', microtime());
! $m = substr( $usec, 2, 5 );
! $headers['Message-Id'] = '<' . date( 'YmdHis' ) . '.' . $m
! . '@' . $_CONF['mail_settings']['host'] . '>';
}
if( $html )
{
! $headers['Content-Type'] = 'text/html; charset=' . $charset;
! $headers['Content-Transfer-Encoding'] = '8bit';
}
else
{
! $headers['Content-Type'] = 'text/plain; charset=' . $charset;
}
! $headers['Subject'] = $subject;
! if( $priority > 0 )
{
! $headers['X-Priority'] = $priority;
}
! $headers['X-Mailer'] = 'GeekLog ' . VERSION;
! $retval = $mailobj->send( $to, $headers, $message );
! if( $retval !== true )
! {
! COM_errorLog( $retval->toString(), 1 );
! }
!
! return( $retval === true ? true : false );
}
More information about the geeklog-cvs
mailing list