From d0ed0c14b5f25bebfac5f255ff05b7f331ebfcec Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 1 Jan 2014 23:04:37 -0600
Subject: [PATCH] Allow interaction with client-side ajax

And allow passing a callable array as the callback to the URL dispatcher
---
 ajax.php                     | 1 +
 include/class.dispatcher.php | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ajax.php b/ajax.php
index 57b6274cc..3374776c7 100644
--- a/ajax.php
+++ b/ajax.php
@@ -39,5 +39,6 @@ $dispatcher = patterns('',
         url_get('^help-topic/(?P<id>\d+)$', 'getClientFormsForHelpTopic')
     ))
 );
+Signal::send('ajax.client', $dispatcher);
 print $dispatcher->resolve($ost->get_path_info());
 ?>
diff --git a/include/class.dispatcher.php b/include/class.dispatcher.php
index 0448f5024..d586fd0ba 100644
--- a/include/class.dispatcher.php
+++ b/include/class.dispatcher.php
@@ -153,7 +153,10 @@ class UrlMatcher {
     function apply_prefix() {
         if (is_array($this->func)) { list($class, $func) = $this->func; }
         else { $func = $this->func; $class = ""; }
-        $class = $this->prefix . $class;
+        if (is_object($class))
+            return array(false, $this->func);
+        if ($this->prefix)
+            $class = $this->prefix . $class;
 
         if (strpos($class, ":")) {
             list($file, $class) = explode(":", $class, 2);
-- 
GitLab