Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCourrier
Commits
297d8eec
Commit
297d8eec
authored
Sep 05, 2016
by
Giovannoni Laurent
Browse files
FEAT #4543 php7 ready
parent
4e6cf747
Changes
4
Hide whitespace changes
Inline
Side-by-side
maarch_entreprise/trunk/tools/mails/htmlMimeMail.php
View file @
297d8eec
...
...
@@ -102,7 +102,7 @@ class htmlMimeMail
* Constructor function. Sets the headers
* if supplied.
*/
function
htmlMimeMail
()
public
function
__construct
()
{
/**
* Initialise some variables.
...
...
@@ -300,6 +300,14 @@ class htmlMimeMail
$this
->
return_path
=
$return_path
;
}
/**
* Accessor to set the Disposition-Notification-To
*/
function
setDispositionNotificationTo
(
$email
)
{
$this
->
headers
[
'Disposition-Notification-To'
]
=
$email
;
}
/**
* Accessor to set the reply-to
*/
...
...
@@ -307,7 +315,6 @@ class htmlMimeMail
{
$this
->
headers
[
'Reply-To'
]
=
$replyTo
;
}
/**
* Accessor to add a Cc: header
...
...
@@ -757,11 +764,17 @@ class htmlMimeMail
case
'smtp'
:
require_once
(
dirname
(
__FILE__
)
.
'/smtp.php'
);
require_once
(
dirname
(
__FILE__
)
.
'/RFC822.php'
);
$smtp
=
&
smtp
::
connect
(
$this
->
smtp_params
);
$smtpObj
=
new
smtpHtmlMimeMail
(
$this
->
smtp_params
);
$RFC822Obj
=
new
Mail_RFC822
();
$smtp
=
$smtpObj
->
connect
();
if
(
!
$smtp
)
{
return
false
;
}
// Parse recipients argument for internet addresses
foreach
(
$recipients
as
$recipient
)
{
$addresses
=
Mail_
RFC822
::
parseAddressList
(
$recipient
,
$this
->
smtp_params
[
'helo'
],
null
,
false
);
$addresses
=
$
RFC822
Obj
->
parseAddressList
(
$recipient
,
$this
->
smtp_params
[
'helo'
],
null
,
false
);
foreach
(
$addresses
as
$address
)
{
$smtp_recipients
[]
=
sprintf
(
'%s@%s'
,
$address
->
mailbox
,
$address
->
host
);
}
...
...
@@ -773,7 +786,7 @@ class htmlMimeMail
// Cc and Bcc as we go
foreach
(
$this
->
headers
as
$name
=>
$value
)
{
if
(
$name
==
'Cc'
OR
$name
==
'Bcc'
)
{
$addresses
=
Mail_
RFC822
::
parseAddressList
(
$value
,
$this
->
smtp_params
[
'helo'
],
null
,
false
);
$addresses
=
$
RFC822
Obj
->
parseAddressList
(
$value
,
$this
->
smtp_params
[
'helo'
],
null
,
false
);
foreach
(
$addresses
as
$address
)
{
$smtp_recipients
[]
=
sprintf
(
'%s@%s'
,
$address
->
mailbox
,
$address
->
host
);
}
...
...
@@ -791,7 +804,7 @@ class htmlMimeMail
$send_params
[
'recipients'
]
=
array_values
(
array_unique
(
$smtp_recipients
));
$send_params
[
'body'
]
=
$this
->
output
;
// Add Notification To
// Add Notification To
if
(
isset
(
$this
->
headers
[
'Disposition-Notification-To'
]))
{
$send_params
[
'Disposition-Notification-To'
]
=
$this
->
headers
[
'Disposition-Notification-To'
];
}
...
...
@@ -800,15 +813,15 @@ class htmlMimeMail
if
(
isset
(
$this
->
return_path
))
{
$send_params
[
'from'
]
=
$this
->
return_path
;
}
elseif
(
!
empty
(
$this
->
headers
[
'From'
]))
{
$from
=
Mail_
RFC822
::
parseAddressList
(
$this
->
headers
[
'From'
]);
$from
=
$
RFC822
Obj
->
parseAddressList
(
$this
->
headers
[
'From'
]);
$send_params
[
'from'
]
=
sprintf
(
'%s@%s'
,
$from
[
0
]
->
mailbox
,
$from
[
0
]
->
host
);
}
else
{
$send_params
[
'from'
]
=
'postmaster@'
.
$this
->
smtp_params
[
'helo'
];
}
// Send it
if
(
!
$smtp
->
send
(
$send_params
))
{
$this
->
errors
=
$smtp
->
errors
;
if
(
!
$smtp
Obj
->
send
(
$send_params
))
{
$this
->
errors
=
$smtp
Obj
->
errors
;
return
false
;
}
return
true
;
...
...
maarch_entreprise/trunk/tools/mails/mimePart.php
View file @
297d8eec
...
...
@@ -123,7 +123,7 @@ class Mail_mimePart {
* charset - Character set to use
* @access public
*/
function
Mail_mimePar
t
(
$body
=
''
,
$params
=
array
())
public
function
__construc
t
(
$body
=
''
,
$params
=
array
())
{
if
(
!
defined
(
'MAIL_MIMEPART_CRLF'
))
{
define
(
'MAIL_MIMEPART_CRLF'
,
defined
(
'MAIL_MIME_CRLF'
)
?
MAIL_MIME_CRLF
:
"
\r\n
"
,
TRUE
);
...
...
maarch_entreprise/trunk/tools/mails/smtp.php
View file @
297d8eec
...
...
@@ -9,7 +9,7 @@
define
(
'SMTP_STATUS_NOT_CONNECTED'
,
1
,
TRUE
);
define
(
'SMTP_STATUS_CONNECTED'
,
2
,
TRUE
);
class
smtp
{
class
smtp
HtmlMimeMail
{
var
$authenticated
;
var
$connection
;
...
...
@@ -43,14 +43,14 @@
* to fsockopen()
*/
function
smtp
(
$params
=
array
()){
public
function
__construct
(
$params
=
array
()){
if
(
!
defined
(
'CRLF'
))
define
(
'CRLF'
,
"
\r\n
"
,
TRUE
);
$this
->
authenticated
=
FALSE
;
$this
->
timeout
=
5
;
$this
->
status
=
SMTP_STATUS_NOT_CONNECTED
;
//
$this->status = SMTP_STATUS_NOT_CONNECTED;
$this
->
host
=
'localhost'
;
$this
->
port
=
25
;
$this
->
helo
=
'localhost'
;
...
...
@@ -58,10 +58,15 @@
$this
->
user
=
''
;
$this
->
pass
=
''
;
$this
->
errors
=
array
();
foreach
(
$params
as
$key
=>
$value
){
$this
->
$key
=
$value
;
// echo 'debut params<br />';
// var_export($params);
// echo 'fin params<br />';
foreach
(
$params
as
$key
=>
$value
)
{
$this
->
{
$key
}
=
$value
;
//echo 'key ' . $key . ' value ' . $value . '<br />';
}
//var_export($this);
}
/**
...
...
@@ -73,29 +78,21 @@
* the HELO command.
*/
function
&
connect
(
$params
=
array
()){
if
(
!
isset
(
$this
->
status
)){
$obj
=
new
smtp
(
$params
);
if
(
$obj
->
connect
()){
$obj
->
status
=
SMTP_STATUS_CONNECTED
;
}
return
$obj
;
public
function
&
connect
(
$params
=
array
()){
$obj
=
new
smtpHtmlMimeMail
(
$params
);
//var_dump($obj);
$this
->
connection
=
@
fsockopen
(
$this
->
host
,
$this
->
port
,
$errno
,
$errstr
,
$this
->
timeout
);
if
(
function_exists
(
'socket_set_timeout'
)){
@
socket_set_timeout
(
$this
->
connection
,
5
,
0
);
}
$greeting
=
$this
->
get_data
();
if
(
is_resource
(
$this
->
connection
)){
$this
->
status
=
SMTP_STATUS_CONNECTED
;
return
$this
->
auth
?
$this
->
ehlo
()
:
$this
->
helo
();
}
else
{
$this
->
connection
=
@
fsockopen
(
$this
->
host
,
$this
->
port
,
$errno
,
$errstr
,
$this
->
timeout
);
if
(
function_exists
(
'socket_set_timeout'
)){
@
socket_set_timeout
(
$this
->
connection
,
5
,
0
);
}
$greeting
=
$this
->
get_data
();
if
(
is_resource
(
$this
->
connection
)){
return
$this
->
auth
?
$this
->
ehlo
()
:
$this
->
helo
();
}
else
{
$this
->
errors
[]
=
'Failed to connect to server: '
.
$errstr
;
return
FALSE
;
}
$this
->
errors
[]
=
'Failed to connect to server: '
.
$errstr
;
return
FALSE
;
}
}
...
...
@@ -113,13 +110,14 @@
* function
*/
function
send
(
$params
=
array
()){
function
send
(
$params
=
array
())
{
foreach
(
$params
as
$key
=>
$value
){
foreach
(
$params
as
$key
=>
$value
)
{
$this
->
set
(
$key
,
$value
);
}
if
(
$this
->
is_connected
()){
if
(
$this
->
is_connected
())
{
// Do we auth or not? Note the distinction between the auth variable and auth() function
if
(
$this
->
auth
AND
!
$this
->
authenticated
){
...
...
@@ -237,7 +235,8 @@
AND
$this
->
send_data
(
base64_encode
(
$this
->
user
))
// Send username
AND
substr
(
trim
(
$error
=
$this
->
get_data
()),
0
,
3
)
===
'334'
AND
$this
->
send_data
(
base64_encode
(
$this
->
pass
))
// Send password
AND
substr
(
trim
(
$error
=
$this
->
get_data
()),
0
,
3
)
===
'235'
){
AND
substr
(
trim
(
$error
=
$this
->
get_data
()),
0
,
3
)
===
'235'
)
{
$this
->
authenticated
=
TRUE
;
return
TRUE
;
...
...
maarch_entreprise/trunk/tools/pdfb/fpdf_1_7/fpdf.php
View file @
297d8eec
...
...
@@ -73,7 +73,7 @@ var $PDFVersion; // PDF version number
* Public methods *
* *
*******************************************************************************/
function
FPDF
(
$orientation
=
'P'
,
$unit
=
'mm'
,
$size
=
'A4'
)
public
function
__construct
(
$orientation
=
'P'
,
$unit
=
'mm'
,
$size
=
'A4'
)
{
// Some checks
$this
->
_dochecks
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment