summaryrefslogtreecommitdiff
path: root/modules/rest
diff options
context:
space:
mode:
authormamouneyya <mamoun.diraneyya@gmail.com>2010-12-09 18:31:01 +0200
committermamouneyya <mamoun.diraneyya@gmail.com>2010-12-09 18:31:01 +0200
commit3e2610ea83c60805d5e727df6509da6c49fd6c7b (patch)
tree28638f7a1cd2e298587f4b3960caf409f7d2d2fa /modules/rest
parent6aabab4b715ff8ac00cc667e9d0a40c9868410d8 (diff)
parentc3ef8921260db8e39b6d2a7b4708e3d19f35f8b5 (diff)
Merge remote branch 'gallery3/master'
Diffstat (limited to 'modules/rest')
-rw-r--r--modules/rest/controllers/rest.php3
-rw-r--r--modules/rest/helpers/rest.php7
-rw-r--r--modules/rest/models/user_access_key.php2
3 files changed, 10 insertions, 2 deletions
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);
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 {
}