[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] CVS: phpgwapi/inc class.send.inc.php,1.15,1.16
From: |
Ralf Becker <address@hidden> |
Subject: |
[Phpgroupware-cvs] CVS: phpgwapi/inc class.send.inc.php,1.15,1.16 |
Date: |
Sat, 17 May 2003 16:41:16 -0400 |
Update of /cvsroot/phpgroupware/phpgwapi/inc
In directory subversions:/tmp/cvs-serv5679
Modified Files:
class.send.inc.php
Log Message:
added function to encode subject for 8-bit-chars and made boundary a param
Index: class.send.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/phpgwapi/inc/class.send.inc.php,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** class.send.inc.php 1 Sep 2002 15:03:19 -0000 1.15
--- class.send.inc.php 17 May 2003 20:41:14 -0000 1.16
***************
*** 40,44 ****
}
! function msg($service, $to, $subject, $body, $msgtype='',
$cc='', $bcc='', $from='', $sender='', $content_type='')
{
if ($from == '')
--- 40,44 ----
}
! function msg($service, $to, $subject, $body, $msgtype='',
$cc='', $bcc='', $from='', $sender='', $content_type='',
$boundary='Message-Boundary')
{
if ($from == '')
***************
*** 90,101 ****
}
! if (ereg('Message-Boundary', $body))
{
$header .= 'Subject: ' .
stripslashes($subject) . "\n"
. 'MIME-Version: 1.0'."\n"
. 'Content-Type:
multipart/mixed;'."\n"
! . '
boundary="Message-Boundary"'."\n\n"
! . '--Message-Boundary'."\n"
! . 'Content-type: text/'
.$content_type . '; charset=US-ASCII'."\n";
// if (!empty($msgtype))
// {
--- 90,101 ----
}
! if (ereg($boundary, $body))
{
$header .= 'Subject: ' .
stripslashes($subject) . "\n"
. 'MIME-Version: 1.0'."\n"
. 'Content-Type:
multipart/mixed;'."\n"
! . " boundary=\"$boundary\"\n\n"
! . "--$boundary\n"
! . 'Content-type: text/'
.$content_type . '; charset="'.lang('charset').'"'."\n";
// if (!empty($msgtype))
// {
***************
*** 120,124 ****
. 'Content-description: Mail
message body'."\n";
}
! if
($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'] ==
'imap' && $GLOBALS['phpgw_info']['user']['apps']['email'])
{
if(!is_object($GLOBALS['phpgw']->msg))
--- 120,125 ----
. 'Content-description: Mail
message body'."\n";
}
! if
($GLOBALS['phpgw_info']['user']['preferences']['email']['mail_server_type'] ==
'imap' && $GLOBALS['phpgw_info']['user']['apps']['email'] &&
!
$GLOBALS['phpgw_info']['user']['preferences']['email']['use_sent_folder'])
{
if(!is_object($GLOBALS['phpgw']->msg))
***************
*** 142,146 ****
$to .= ','.$bcc;
}
-
$returnccode = $this->smail($to, '', $body,
$header);
--- 143,146 ----
***************
*** 155,158 ****
--- 155,216 ----
// ==================================================[ some
sub-functions ]===
+ /*!
+ @function encode_subject
+ @abstract encode 8-bit chars in subject-line
+ @author ralfbecker
+ @note the quoted subjects get a header stateing the charset
(eg. "=?iso-8859-1?Q?"), the \
+ 8-bit chars as '=XX' (XX is the hex-representation of
the char) and a trainling '?='.
+ */
+ function encode_subject($subject)
+ {
+ $enc_start = $enc_end = 0;
+
+ $words = explode(' ',$subject);
+ foreach($words as $w => $word)
+ {
+ $str = '';
+
+ for ($i = 0; $i < strlen($word); ++$i)
+ {
+ if (($n = ord($word[$i])) > 127 ||
$word[$i] == '=') {
+ $str .= sprintf('=%0X',$n);
+ if (!$enc_start)
+ {
+ $enc_start = $w+1;
+ }
+ $enc_end = $w+1;
+ }
+ else
+ {
+ $str .= $word[$i];
+ }
+ }
+ $strs[] = $str;
+ //echo "word='$word', start=$enc_start,
end=$enc_end, encoded='$str'<br>\n";
+ }
+ if (!$enc_start)
+ {
+ return $subject;
+ }
+ $str = '';
+ foreach ($strs as $w => $s)
+ {
+ $str .= $str != '' ? ' ' : '';
+
+ if ($enc_start == $w+1) // first word to encode
+ {
+ $str .= '=?'.lang('charset').'?Q?';
+ }
+ $str .= $w+1 > $enc_end ?
str_replace('=3D','=',$s) : $s;
+
+ if ($enc_end == $w+1) // last word to encode
+ {
+ $str .= '?=';
+ }
+ }
+ //echo
"<p>send::encode_subject('$subject')='$str'</p>\n";
+ return $str;
+ }
+
function socket2msg($socket)
{
***************
*** 398,400 ****
return True;
}
! } /* end of class */
\ No newline at end of file
--- 456,458 ----
return True;
}
! } /* end of class */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] CVS: phpgwapi/inc class.send.inc.php,1.15,1.16,
Ralf Becker <address@hidden> <=
- Prev by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.send.inc.php,1.13.2.2,1.13.2.2.2.1
- Next by Date:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.sessions.inc.php,1.104,1.104.4.1 class.sessions_db.inc.php,1.2.2.10.2.2,1.2.2.10.2.3 class.sessions_php4.inc.php,1.6.2.10,1.6.2.10.2.1
- Previous by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.send.inc.php,1.13.2.2,1.13.2.2.2.1
- Next by thread:
[Phpgroupware-cvs] CVS: phpgwapi/inc class.sessions.inc.php,1.104,1.104.4.1 class.sessions_db.inc.php,1.2.2.10.2.2,1.2.2.10.2.3 class.sessions_php4.inc.php,1.6.2.10,1.6.2.10.2.1
- Index(es):