Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
c680a5f7
Commit
c680a5f7
authored
Dec 17, 2013
by
Robert Lyon
Committed by
Gerrit Code Review
Dec 17, 2013
Browse files
Merge "Allow a $cfg->bounceprefix that's not exactly 4 characters"
parents
3eda6554
db9c79bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/lib/config-defaults.php
View file @
c680a5f7
...
...
@@ -206,7 +206,6 @@ $cfg->bounces_min = 5;
$cfg
->
bounces_ratio
=
0.20
;
/**
* @global string $cfg->bounceprefix Identity of the Mahara instance
* This prefix must be four characters.
* If you have several Mahara, Moodle, or other VERP processors on the same
* bounce domain, you need to keep track of which processor belongs to
* which domain.
...
...
htdocs/lib/user.php
View file @
c680a5f7
...
...
@@ -790,18 +790,21 @@ function process_email($address) {
return
$email
;
}
$mailprefix
=
get_config
(
'bounceprefix'
);
$prefixlength
=
strlen
(
$mailprefix
);
list
(
$email
->
localpart
,
$email
->
domain
)
=
explode
(
'@'
,
$address
);
// The prefix is stored in the first
four
characters
$email
->
prefix
=
substr
(
$email
->
localpart
,
0
,
4
);
// The prefix is stored in the first characters
denoted by $prefixlength
$email
->
prefix
=
substr
(
$email
->
localpart
,
0
,
$prefixlength
);
// The type of message received is a one letter code
$email
->
type
=
substr
(
$email
->
localpart
,
4
,
1
);
$email
->
type
=
substr
(
$email
->
localpart
,
$prefixlength
,
1
);
// The userid should be available immediately afterwards
// Postfix and other smtp servers don't like the use of / in the extension part of an email
// We may of replaced it with another valid email character which isn't in base64, namely '-'
// If we didn't, then the preg_replace won't do anything
list
(,
$email
->
userid
)
=
unpack
(
'V'
,
base64_decode
(
preg_replace
(
'/-/'
,
'/'
,
substr
(
$email
->
localpart
,
5
,
8
))));
list
(,
$email
->
userid
)
=
unpack
(
'V'
,
base64_decode
(
preg_replace
(
'/-/'
,
'/'
,
substr
(
$email
->
localpart
,
$prefixlength
+
1
,
8
))));
// Any additional arguments
$email
->
args
=
substr
(
$email
->
localpart
,
13
,
-
16
);
$email
->
args
=
substr
(
$email
->
localpart
,
$prefixlength
+
9
,
-
16
);
// And a hash of the intended recipient for authentication
$email
->
addresshash
=
substr
(
$email
->
localpart
,
-
16
);
...
...
@@ -813,7 +816,6 @@ function process_email($address) {
switch
(
$email
->
type
)
{
case
'B'
:
// E-mail bounces
if
(
$user
=
get_record_select
(
'artefact_internal_profile_email'
,
'"owner" = ? AND principal = 1'
,
array
(
$email
->
userid
)))
{
$mailprefix
=
get_config
(
'bounceprefix'
);
$maildomain
=
get_config
(
'bouncedomain'
);
$installation_key
=
get_config
(
'installation_key'
);
// check the half md5 of their email
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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