diff --git a/application/classes/Config.php b/application/classes/Config.php index 29b6aa82..9a26fea5 100644 --- a/application/classes/Config.php +++ b/application/classes/Config.php @@ -172,10 +172,7 @@ class Config extends Kohana_Config { public static function theme() { // If we are using user admin pages (and login), we'll choose the admin theme. - if (Request::current() AND (! empty(URL::$method_directory[strtolower(Request::current()->directory())]) OR in_array(strtolower(Request::current()->controller()),array('login')))) - return 'theme/'.Kohana::$config->load('config')->theme_admin; - else - return 'theme/'.Kohana::$config->load('config')->theme; + return URL::admin_url() ? 'theme/'.Kohana::$config->load('config')->theme_admin : 'theme/'.Kohana::$config->load('config')->theme; } public static function time($date) { diff --git a/application/classes/Controller/User/Search.php b/application/classes/Controller/User/Search.php index db7a74b8..923d3901 100644 --- a/application/classes/Controller/User/Search.php +++ b/application/classes/Controller/User/Search.php @@ -21,12 +21,12 @@ class Controller_User_Search extends Controller_Search { $result = array(); if (isset($_REQUEST['term']) AND trim($_REQUEST['term'])) { - $result = array_merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'url','id',array('ACC %s: %s'=>array('id','name(TRUE)')),array(),array('urlprefix'=>'a/service/list/'))); - $result = array_merge($result,ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'url','id',array('INV %s: %s'=>array('id','account->name(TRUE)')),array(),array('urlprefix'=>'u/invoice/view/'))); - $result = array_merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'url','id',array('SVC %s: %s'=>array('id','service_name()')),array(),array('urlprefix'=>'u/service/view/'))); + $result = Arr::merge($result,ORM::factory('Account')->list_autocomplete($_REQUEST['term'],'url','id',array('ACC %s: %s'=>array('id','name(TRUE)')),array(),array('urlprefix'=>'a/service/list/'))); + $result = Arr::merge($result,ORM::factory('Invoice')->list_autocomplete($_REQUEST['term'],'url','id',array('INV %s: %s'=>array('id','account->name(TRUE)')),array(),array('urlprefix'=>'u/invoice/view/'))); + $result = Arr::merge($result,ORM::factory('Service')->list_autocomplete($_REQUEST['term'],'url','id',array('SVC %s: %s'=>array('id','service_name()')),array(),array('urlprefix'=>'u/service/view/'))); foreach (array('Service_Plugin_Adsl','Service_Plugin_Domain','Service_Plugin_Host') as $o) - $result = array_merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/'))); + $result = Arr::merge($result,ORM::factory($o)->list_autocomplete($_REQUEST['term'],'url','service_id',array('SVC %s: %s'=>array('service_id','service_name()')),array(),array('urlprefix'=>'u/service/view/'))); } $this->auto_render = FALSE; diff --git a/application/classes/HTTP/Exception/403.php b/application/classes/HTTP/Exception/403.php new file mode 100644 index 00000000..9d78aa48 --- /dev/null +++ b/application/classes/HTTP/Exception/403.php @@ -0,0 +1,15 @@ + diff --git a/application/classes/HTTP/Exception/404.php b/application/classes/HTTP/Exception/404.php index 14bf5100..d1277d63 100644 --- a/application/classes/HTTP/Exception/404.php +++ b/application/classes/HTTP/Exception/404.php @@ -9,17 +9,7 @@ * @copyright (c) 2009-2013 Open Source Billing * @license http://dev.osbill.net/license.html */ -class HTTP_Exception_404 extends Kohana_HTTP_Exception_404 { - public function get_response() { - $response = Response::factory(); - $response->status($this->_code); - - $view = View::factory('errors/404'); - $view->message = $this->getMessage(); - - $response->body($view->render()); - - return $response; - } +class HTTP_Exception_404 extends HTTP_Exception { + protected $_code = 404; } ?> diff --git a/application/classes/HTTP/Exception/501.php b/application/classes/HTTP/Exception/501.php index e79b7f1a..e1afe147 100644 --- a/application/classes/HTTP/Exception/501.php +++ b/application/classes/HTTP/Exception/501.php @@ -1,7 +1,7 @@ status($this->_code); - - // @todo This is not working as cleanly as I would like - ie: we shouldnt need to publish the headers ourselves? - header(':', true, 501); - - if (Kohana::$config->load('debug')->show_errors) - $response->body(View::factory('errors/501')->set('message',$this->getMessage())->render()); - else - $response->body('Dang, something went wrong, tell us how we got here...'); - - echo $response->render(); - - exit (501); - } } ?> diff --git a/application/classes/Model/RTM.php b/application/classes/Model/RTM.php index a5e11e22..497c933a 100644 --- a/application/classes/Model/RTM.php +++ b/application/classes/Model/RTM.php @@ -27,7 +27,7 @@ class Model_RTM extends ORM_OSB { $result = array(); foreach ($rtmo->agents_direct() as $artmo) - $result = $result+$rtmo->customers($artmo); + $result = Arr::merge($result,$rtmo->customers($artmo)); foreach ($rtmo->customers_direct() as $ao) array_push($result,$ao); diff --git a/application/classes/URL.php b/application/classes/URL.php index a7c02294..03a5fa87 100644 --- a/application/classes/URL.php +++ b/application/classes/URL.php @@ -18,6 +18,10 @@ class URL extends Kohana_URL { 'task'=>'task', ); + public static function admin_url() { + return (Request::current() AND ((Auth::instance()->logged_in() AND ! empty(URL::$method_directory[strtolower(Request::current()->directory())])) OR in_array(strtolower(Request::current()->controller()),array('login')))); + } + /** * Wrapper to provide a URL::site() link based on function */ diff --git a/application/views/errors/403.php b/application/views/errors/403.php new file mode 100644 index 00000000..e0e0516a --- /dev/null +++ b/application/views/errors/403.php @@ -0,0 +1,5 @@ +