From dff1a536961cd401b8e133e260fcc3cca7c13dc6 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 25 Oct 2010 21:04:48 -0700 Subject: All modules should be named Xxx_Core for extensibility. Fixes #1458. --- modules/rest/models/user_access_key.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/rest') diff --git a/modules/rest/models/user_access_key.php b/modules/rest/models/user_access_key.php index 1da0f5eb..93c3cf7f 100644 --- a/modules/rest/models/user_access_key.php +++ b/modules/rest/models/user_access_key.php @@ -17,5 +17,5 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class User_Access_Key_Model extends ORM { +class User_Access_Key_Model_Core extends ORM { } -- cgit v1.2.3 From 554ca2e683297489251d621e2c959a6a467a6f9c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 22 Nov 2010 22:01:11 -0800 Subject: Take into account the core.url_suffix configuration setting when parsing REST urls. This fixes the problem that setting the url suffix breaks REST. Fixes #1500. --- modules/rest/controllers/rest.php | 3 +++ modules/rest/helpers/rest.php | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'modules/rest') diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php index a721ff2b..c4e0fda4 100644 --- a/modules/rest/controllers/rest.php +++ b/modules/rest/controllers/rest.php @@ -86,6 +86,9 @@ class Rest_Controller extends Controller { } $request->url = url::abs_current(true); + if ($suffix = Kohana::config('core.url_suffix')) { + $request->url = substr($request->url, 0, strlen($request->url) - strlen($suffix)); + } rest::set_active_user($request->access_key); diff --git a/modules/rest/helpers/rest.php b/modules/rest/helpers/rest.php index d5ed0452..58943700 100644 --- a/modules/rest/helpers/rest.php +++ b/modules/rest/helpers/rest.php @@ -122,7 +122,12 @@ class rest_Core { * @return mixed the corresponding object (usually a model of some kind) */ static function resolve($url) { - $relative_url = substr($url, strlen(url::abs_site("rest"))); + if ($suffix = Kohana::config('core.url_suffix')) { + $relative_url = substr($url, strlen(url::abs_site("rest")) - strlen($suffix)); + } else { + $relative_url = substr($url, strlen(url::abs_site("rest"))); + } + $path = parse_url($relative_url, PHP_URL_PATH); $components = explode("/", $path, 3); -- cgit v1.2.3