Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
83c2f0f4
Commit
83c2f0f4
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Changed order of parameters in decode method
Rename $var to $var - for consistency
parent
57109f53
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.mailfetch.php
+22
-24
22 additions, 24 deletions
include/class.mailfetch.php
with
22 additions
and
24 deletions
include/class.mailfetch.php
+
22
−
24
View file @
83c2f0f4
...
@@ -171,7 +171,7 @@ class MailFetcher {
...
@@ -171,7 +171,7 @@ class MailFetcher {
}
}
function
decode
(
$encoding
,
$text
)
{
function
decode
(
$text
,
$encoding
)
{
switch
(
$encoding
)
{
switch
(
$encoding
)
{
case
1
:
case
1
:
...
@@ -186,10 +186,8 @@ class MailFetcher {
...
@@ -186,10 +186,8 @@ class MailFetcher {
case
4
:
case
4
:
$text
=
imap_qprint
(
$text
);
$text
=
imap_qprint
(
$text
);
break
;
break
;
case
5
:
}
default
:
$text
=
$text
;
}
return
$text
;
return
$text
;
}
}
...
@@ -262,7 +260,7 @@ class MailFetcher {
...
@@ -262,7 +260,7 @@ class MailFetcher {
$partNumber
=
$partNumber
?
$partNumber
:
1
;
$partNumber
=
$partNumber
?
$partNumber
:
1
;
if
((
$text
=
imap_fetchbody
(
$this
->
mbox
,
$mid
,
$partNumber
)))
{
if
((
$text
=
imap_fetchbody
(
$this
->
mbox
,
$mid
,
$partNumber
)))
{
if
(
$struct
->
encoding
==
3
or
$struct
->
encoding
==
4
)
//base64 and qp decode.
if
(
$struct
->
encoding
==
3
or
$struct
->
encoding
==
4
)
//base64 and qp decode.
$text
=
$this
->
decode
(
$struct
->
encoding
,
$text
);
$text
=
$this
->
decode
(
$text
,
$struct
->
encoding
);
$charset
=
null
;
$charset
=
null
;
if
(
$encoding
)
{
//Convert text to desired mime encoding...
if
(
$encoding
)
{
//Convert text to desired mime encoding...
...
@@ -391,29 +389,29 @@ class MailFetcher {
...
@@ -391,29 +389,29 @@ class MailFetcher {
}
}
$emailId
=
$this
->
getEmailId
();
$emailId
=
$this
->
getEmailId
();
$vars
=
array
();
$var
[
'name'
]
=
$this
->
mime_decode
(
$mailinfo
[
'name'
]);
$var
s
[
'name'
]
=
$this
->
mime_decode
(
$mailinfo
[
'name'
]);
$var
[
'email'
]
=
$mailinfo
[
'email'
];
$var
s
[
'email'
]
=
$mailinfo
[
'email'
];
$var
[
'subject'
]
=
$mailinfo
[
'subject'
]
?
$this
->
mime_decode
(
$mailinfo
[
'subject'
])
:
'[No Subject]'
;
$var
s
[
'subject'
]
=
$mailinfo
[
'subject'
]
?
$this
->
mime_decode
(
$mailinfo
[
'subject'
])
:
'[No Subject]'
;
$var
[
'message'
]
=
Format
::
stripEmptyLines
(
$this
->
getBody
(
$mid
));
$var
s
[
'message'
]
=
Format
::
stripEmptyLines
(
$this
->
getBody
(
$mid
));
$var
[
'header'
]
=
$this
->
getHeader
(
$mid
);
$var
s
[
'header'
]
=
$this
->
getHeader
(
$mid
);
$var
[
'emailId'
]
=
$emailId
?
$emailId
:
$ost
->
getConfig
()
->
getDefaultEmailId
();
//ok to default?
$var
s
[
'emailId'
]
=
$emailId
?
$emailId
:
$ost
->
getConfig
()
->
getDefaultEmailId
();
//ok to default?
$var
[
'name'
]
=
$var
[
'name'
]
?
$var
[
'name'
]
:
$var
[
'email'
];
//No name? use email
$var
s
[
'name'
]
=
$var
s
[
'name'
]
?
$var
s
[
'name'
]
:
$var
s
[
'email'
];
//No name? use email
$var
[
'mid'
]
=
$mailinfo
[
'mid'
];
$var
s
[
'mid'
]
=
$mailinfo
[
'mid'
];
if
(
!
$var
[
'message'
])
//An email with just attachments can have empty body.
if
(
!
$var
s
[
'message'
])
//An email with just attachments can have empty body.
$var
[
'message'
]
=
'(EMPTY)'
;
$var
s
[
'message'
]
=
'(EMPTY)'
;
if
(
$ost
->
getConfig
()
->
useEmailPriority
())
if
(
$ost
->
getConfig
()
->
useEmailPriority
())
$var
[
'priorityId'
]
=
$this
->
getPriority
(
$mid
);
$var
s
[
'priorityId'
]
=
$this
->
getPriority
(
$mid
);
$ticket
=
null
;
$ticket
=
null
;
$newticket
=
true
;
$newticket
=
true
;
//Check the subject line for possible ID.
//Check the subject line for possible ID.
if
(
$var
[
'subject'
]
&&
preg_match
(
"[[#][0-9]
{
1,10
}
]"
,
$var
[
'subject'
],
$regs
))
{
if
(
$var
s
[
'subject'
]
&&
preg_match
(
"[[#][0-9]
{
1,10
}
]"
,
$var
s
[
'subject'
],
$regs
))
{
$tid
=
trim
(
preg_replace
(
"/[^0-9]/"
,
""
,
$regs
[
0
]));
$tid
=
trim
(
preg_replace
(
"/[^0-9]/"
,
""
,
$regs
[
0
]));
//Allow mismatched emails?? For now NO.
//Allow mismatched emails?? For now NO.
if
(
!
(
$ticket
=
Ticket
::
lookupByExtId
(
$tid
))
||
strcasecmp
(
$ticket
->
getEmail
()
,
$var
[
'email'
]))
if
(
!
(
$ticket
=
Ticket
::
lookupByExtId
(
$tid
,
$var
s
[
'email'
]))
)
$ticket
=
null
;
$ticket
=
null
;
}
}
...
@@ -422,7 +420,7 @@ class MailFetcher {
...
@@ -422,7 +420,7 @@ class MailFetcher {
if
(
!
(
$msgid
=
$ticket
->
postMessage
(
$vars
,
'Email'
)))
if
(
!
(
$msgid
=
$ticket
->
postMessage
(
$vars
,
'Email'
)))
return
false
;
return
false
;
}
elseif
((
$ticket
=
Ticket
::
create
(
$var
,
$errors
,
'Email'
)))
{
}
elseif
((
$ticket
=
Ticket
::
create
(
$var
s
,
$errors
,
'Email'
)))
{
$msgid
=
$ticket
->
getLastMsgId
();
$msgid
=
$ticket
->
getLastMsgId
();
}
else
{
}
else
{
//Report success if the email was absolutely rejected.
//Report success if the email was absolutely rejected.
...
@@ -430,8 +428,8 @@ class MailFetcher {
...
@@ -430,8 +428,8 @@ class MailFetcher {
return
true
;
return
true
;
# check if it's a bounce!
# check if it's a bounce!
if
(
$var
[
'header'
]
&&
TicketFilter
::
isAutoBounce
(
$var
[
'header'
]))
{
if
(
$var
s
[
'header'
]
&&
TicketFilter
::
isAutoBounce
(
$var
s
[
'header'
]))
{
$ost
->
logWarning
(
'Bounced email'
,
$var
[
'message'
],
false
);
$ost
->
logWarning
(
'Bounced email'
,
$var
s
[
'message'
],
false
);
return
true
;
return
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment