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
57109f53
Commit
57109f53
authored
12 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Refactor how postMessage method is called - it now expects a hashtable
parent
269c5106
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/class.mailfetch.php
+1
-1
1 addition, 1 deletion
include/class.mailfetch.php
include/class.ticket.php
+17
-14
17 additions, 14 deletions
include/class.ticket.php
tickets.php
+1
-1
1 addition, 1 deletion
tickets.php
with
19 additions
and
16 deletions
include/class.mailfetch.php
+
1
−
1
View file @
57109f53
...
@@ -419,7 +419,7 @@ class MailFetcher {
...
@@ -419,7 +419,7 @@ class MailFetcher {
$errors
=
array
();
$errors
=
array
();
if
(
$ticket
)
{
if
(
$ticket
)
{
if
(
!
(
$msgid
=
$ticket
->
postMessage
(
$var
[
'message'
],
'Email'
,
$var
[
'mid'
],
$var
[
'header'
]
)))
if
(
!
(
$msgid
=
$ticket
->
postMessage
(
$var
s
,
'Email'
)))
return
false
;
return
false
;
}
elseif
((
$ticket
=
Ticket
::
create
(
$var
,
$errors
,
'Email'
)))
{
}
elseif
((
$ticket
=
Ticket
::
create
(
$var
,
$errors
,
'Email'
)))
{
...
...
This diff is collapsed.
Click to expand it.
include/class.ticket.php
+
17
−
14
View file @
57109f53
...
@@ -1379,40 +1379,43 @@ class Ticket {
...
@@ -1379,40 +1379,43 @@ class Ticket {
}
}
//Insert message from client
//Insert message from client
function
postMessage
(
$
message
,
$source
=
''
,
$emsgid
=
null
,
$head
ers
=
''
,
$newticket
=
fals
e
){
function
postMessage
(
$
vars
,
$source
=
''
,
$al
er
t
s
=
tru
e
)
{
global
$cfg
;
global
$cfg
;
if
(
!
$this
->
getId
())
return
0
;
if
(
!
$vars
||
!
$vars
[
'message'
])
return
0
;
//Strip quoted reply...on emailed replies
//Strip quoted reply...on emailed replies
if
(
!
strcasecmp
(
$source
,
'Email'
)
if
(
!
strcasecmp
(
$source
,
'Email'
)
&&
$cfg
->
stripQuotedReply
()
&&
$cfg
->
stripQuotedReply
()
&&
(
$tag
=
$cfg
->
getReplySeparator
())
&&
strpos
(
$message
,
$tag
))
&&
(
$tag
=
$cfg
->
getReplySeparator
())
&&
strpos
(
$
vars
[
'
message
'
]
,
$tag
))
list
(
$message
)
=
split
(
$tag
,
$message
);
list
(
$
vars
[
'
message
'
])
=
split
(
$tag
,
$
vars
[
'
message
'
]
);
# XXX: Refuse auto-response messages? (via email) XXX: No - but kill our auto-responder.
# XXX: Refuse auto-response messages? (via email) XXX: No - but kill our auto-responder.
$sql
=
'INSERT INTO '
.
TICKET_THREAD_TABLE
.
' SET created=NOW()'
$sql
=
'INSERT INTO '
.
TICKET_THREAD_TABLE
.
' SET created=NOW()'
.
' ,thread_type="M" '
.
' ,thread_type="M" '
.
' ,ticket_id='
.
db_input
(
$this
->
getId
())
.
' ,ticket_id='
.
db_input
(
$this
->
getId
())
# XXX: Put Subject header into the 'title' field
# XXX: Put Subject header into the 'title' field
.
' ,body='
.
db_input
(
Format
::
striptags
(
$message
))
//Tags/code stripped...meaning client can not send in code..etc
.
' ,body='
.
db_input
(
Format
::
striptags
(
$
vars
[
'
message
'
]
))
//Tags/code stripped...meaning client can not send in code..etc
.
' ,source='
.
db_input
(
$source
?
$source
:
$_SERVER
[
'REMOTE_ADDR'
])
.
' ,source='
.
db_input
(
$source
?
$source
:
$_SERVER
[
'REMOTE_ADDR'
])
.
' ,ip_address='
.
db_input
(
$_SERVER
[
'REMOTE_ADDR'
]);
.
' ,ip_address='
.
db_input
(
$_SERVER
[
'REMOTE_ADDR'
]);
if
(
!
db_query
(
$sql
)
||
!
(
$msgid
=
db_insert_id
()))
return
0
;
//bail out....
if
(
!
db_query
(
$sql
)
||
!
(
$msgid
=
db_insert_id
()))
return
0
;
//bail out....
$this
->
setLastMsgId
(
$msgid
);
$this
->
setLastMsgId
(
$msgid
);
if
(
$emsgid
!==
null
)
{
if
(
isset
(
$vars
[
'mid'
])
)
{
$sql
=
'INSERT INTO '
.
TICKET_EMAIL_INFO_TABLE
$sql
=
'INSERT INTO '
.
TICKET_EMAIL_INFO_TABLE
.
' SET message_id='
.
db_input
(
$msgid
)
.
' SET message_id='
.
db_input
(
$msgid
)
.
', email_mid='
.
db_input
(
$
emsgid
)
.
', email_mid='
.
db_input
(
$
vars
[
'mid'
]
)
.
', headers='
.
db_input
(
$header
s
);
.
', headers='
.
db_input
(
$
vars
[
'
header
'
]
);
db_query
(
$sql
);
db_query
(
$sql
);
}
}
if
(
$newticket
)
return
$msgid
;
//Our work is done...
if
(
!
$alerts
)
return
$msgid
;
//Our work is done...
$autorespond
=
true
;
$autorespond
=
true
;
if
(
$autorespond
&&
$headers
&&
TicketFilter
::
isAutoResponse
(
Mail_Parse
::
splitHeaders
(
$headers
)))
if
(
$autorespond
&&
$headers
&&
TicketFilter
::
isAutoResponse
(
Mail_Parse
::
splitHeaders
(
$headers
)))
...
@@ -1431,7 +1434,7 @@ class Ticket {
...
@@ -1431,7 +1434,7 @@ class Ticket {
//If enabled...send alert to staff (New Message Alert)
//If enabled...send alert to staff (New Message Alert)
if
(
$cfg
->
alertONNewMessage
()
&&
$tpl
&&
$email
&&
(
$msg
=
$tpl
->
getNewMessageAlertMsgTemplate
()))
{
if
(
$cfg
->
alertONNewMessage
()
&&
$tpl
&&
$email
&&
(
$msg
=
$tpl
->
getNewMessageAlertMsgTemplate
()))
{
$msg
=
$this
->
replaceVars
(
$msg
,
array
(
'message'
=>
$message
));
$msg
=
$this
->
replaceVars
(
$msg
,
array
(
'message'
=>
$
vars
[
'
message
'
]
));
//Build list of recipients and fire the alerts.
//Build list of recipients and fire the alerts.
$recipients
=
array
();
$recipients
=
array
();
...
@@ -2219,7 +2222,7 @@ class Ticket {
...
@@ -2219,7 +2222,7 @@ class Ticket {
$dept
=
$ticket
->
getDept
();
$dept
=
$ticket
->
getDept
();
//post the message.
//post the message.
$msgid
=
$ticket
->
postMessage
(
$vars
[
'message'
],
$source
,
$vars
[
'mid'
],
$vars
[
'header'
],
tru
e
);
$msgid
=
$ticket
->
postMessage
(
$vars
,
$source
,
fals
e
);
// Configure service-level-agreement for this ticket
// Configure service-level-agreement for this ticket
$ticket
->
selectSLAId
(
$vars
[
'slaId'
]);
$ticket
->
selectSLAId
(
$vars
[
'slaId'
]);
...
...
This diff is collapsed.
Click to expand it.
tickets.php
+
1
−
1
View file @
57109f53
...
@@ -40,7 +40,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
...
@@ -40,7 +40,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
if
(
!
$errors
)
{
if
(
!
$errors
)
{
//Everything checked out...do the magic.
//Everything checked out...do the magic.
if
((
$msgid
=
$ticket
->
postMessage
(
$_POST
[
'message'
]
,
'Web'
)))
{
if
((
$msgid
=
$ticket
->
postMessage
(
array
(
'message'
=>
$_POST
[
'message'
]
),
'Web'
)))
{
//Upload files
//Upload files
if
(
$cfg
->
allowOnlineAttachments
()
&&
$_FILES
[
'attachments'
])
if
(
$cfg
->
allowOnlineAttachments
()
&&
$_FILES
[
'attachments'
])
...
...
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