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
466d8320
Commit
466d8320
authored
13 years ago
by
Peter Rotich
Browse files
Options
Downloads
Patches
Plain Diff
Add user search support to AJAX interface
parent
95d78fe2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/ajax.users.php
+50
-0
50 additions, 0 deletions
include/ajax.users.php
scp/ajax.php
+18
-17
18 additions, 17 deletions
scp/ajax.php
with
68 additions
and
17 deletions
include/ajax.users.php
0 → 100644
+
50
−
0
View file @
466d8320
<?php
/*********************************************************************
ajax.users.php
AJAX interface for users (based on submitted tickets)
XXX: osTicket doesn't support user accounts at the moment.
Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2012 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
if
(
!
defined
(
'INCLUDE_DIR'
))
die
(
'403'
);
include_once
(
INCLUDE_DIR
.
'class.ticket.php'
);
class
UsersAjaxAPI
extends
AjaxController
{
/* Assumes search by emal for now */
function
search
()
{
if
(
!
isset
(
$_REQUEST
[
'q'
]))
{
Http
::
response
(
400
,
'Query argument is required'
);
}
$limit
=
isset
(
$_REQUEST
[
'limit'
])
?
(
int
)
$_REQUEST
[
'limit'
]
:
25
;
$users
=
array
();
$sql
=
'SELECT DISTINCT email, name '
.
' FROM '
.
TICKET_TABLE
.
' WHERE email LIKE \'%'
.
db_input
(
strtolower
(
$_REQUEST
[
'q'
]),
false
)
.
'%\' '
.
' ORDER BY created '
.
' LIMIT '
.
$limit
;
if
((
$res
=
db_query
(
$sql
))
&&
db_num_rows
(
$res
)){
while
(
list
(
$email
,
$name
)
=
db_fetch_row
(
$res
))
{
$users
[]
=
array
(
'email'
=>
$email
,
'name'
=>
$name
,
'info'
=>
"
$email
-
$name
"
);
}
}
return
$this
->
encode
(
$users
);
}
}
?>
This diff is collapsed.
Click to expand it.
scp/ajax.php
+
18
−
17
View file @
466d8320
...
...
@@ -30,27 +30,28 @@ ini_set('display_startup_errors','0');
//TODO: disable direct access via the browser? i,e All request must have REFER?
if
(
!
defined
(
'INCLUDE_DIR'
))
Http
::
response
(
500
,
'config error'
);
require_once
INCLUDE_DIR
.
"
/class.dispatcher.php
"
;
require_once
INCLUDE_DIR
.
"
/class.ajax.php
"
;
$dispatcher
=
patterns
(
""
,
url
(
"
^/kb/
"
,
patterns
(
"
ajax.kbase.php:KbaseAjaxAPI
"
,
require_once
INCLUDE_DIR
.
'
/class.dispatcher.php
'
;
require_once
INCLUDE_DIR
.
'
/class.ajax.php
'
;
$dispatcher
=
patterns
(
''
,
url
(
'
^/kb/
'
,
patterns
(
'
ajax.kbase.php:KbaseAjaxAPI
'
,
# Send ticket-id as a query arg => canned-response/33?ticket=83
url_get
(
"
^canned-response/(?P<id>\d+).(?P<format>json|txt)
"
,
"
cannedResp
"
),
url_get
(
"
^faq/(?P<id>\d+)
"
,
"
faq
"
)
url_get
(
'
^canned-response/(?P<id>\d+).(?P<format>json|txt)
'
,
'
cannedResp
'
),
url_get
(
'
^faq/(?P<id>\d+)
'
,
'
faq
'
)
)),
url
(
"
^/content/
"
,
patterns
(
"
ajax.content.php:ContentAjaxAPI
"
,
url_get
(
"
^log/(?P<id>\d+)
"
,
'log'
),
url_get
(
"
^ticket_variables
"
,
'ticket_variables'
)
url
(
'
^/content/
'
,
patterns
(
'
ajax.content.php:ContentAjaxAPI
'
,
url_get
(
'
^log/(?P<id>\d+)
'
,
'log'
),
url_get
(
'
^ticket_variables
'
,
'ticket_variables'
)
)),
url
(
"
^/config/
"
,
patterns
(
"
ajax.config.php:ConfigAjaxAPI
"
,
url_get
(
"
^ui
"
,
'ui'
)
url
(
'
^/config/
'
,
patterns
(
'
ajax.config.php:ConfigAjaxAPI
'
,
url_get
(
'
^ui
'
,
'ui'
)
)),
url_get
(
"^/tickets$"
,
array
(
"ajax.tickets.php:TicketsAjaxAPI"
,
"search"
)),
url
(
"^/ticket/"
,
patterns
(
"ajax.tickets.php:TicketsAjaxAPI"
,
url_get
(
"^(?P<tid>\d+)/preview"
,
"previewTicket"
),
url_get
(
"^(?P<tid>\d+)/lock"
,
"acquireLock"
),
url_post
(
"^(?P<tid>\d+)/lock/(?P<id>\d+)/renew"
,
"renewLock"
),
url_post
(
"^(?P<tid>\d+)/lock/(?P<id>\d+)/release"
,
"releaseLock"
)
url_get
(
'^/users$'
,
array
(
'ajax.users.php:UsersAjaxAPI'
,
'search'
)),
url_get
(
'^/tickets$'
,
array
(
'ajax.tickets.php:TicketsAjaxAPI'
,
'search'
)),
url
(
'^/ticket/'
,
patterns
(
'ajax.tickets.php:TicketsAjaxAPI'
,
url_get
(
'^(?P<tid>\d+)/preview'
,
'previewTicket'
),
url_get
(
'^(?P<tid>\d+)/lock'
,
'acquireLock'
),
url_post
(
'^(?P<tid>\d+)/lock/(?P<id>\d+)/renew'
,
'renewLock'
),
url_post
(
'^(?P<tid>\d+)/lock/(?P<id>\d+)/release'
,
'releaseLock'
)
))
);
...
...
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