summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Rabinovich <virshu@users.sourceforge.net>2008-12-26 20:08:15 +0000
committerFelix Rabinovich <virshu@users.sourceforge.net>2008-12-26 20:08:15 +0000
commit6b1fa6217355a8458a84791ce02e2bb0067b1da2 (patch)
treec1062d228d1d55b9ddea74b2564c2b9bfc7579ea
parent7fdde469d3af72307efb41048fadd7a25f4ae576 (diff)
Added content type to JSON output functions
-rw-r--r--core/controllers/albums.php3
-rw-r--r--core/controllers/photos.php1
-rw-r--r--modules/user/controllers/login.php1
-rw-r--r--modules/user/controllers/users.php1
-rw-r--r--modules/watermark/controllers/admin_watermarks.php3
5 files changed, 9 insertions, 0 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index 61d6ad22..948eda12 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -70,6 +70,7 @@ class Albums_Controller extends Items_Controller {
private function _create_album($album) {
access::required("edit", $album);
+ rest::http_content_type(rest::JSON);
$form = album::get_add_form($album);
if ($form->validate()) {
$new_album = album::create(
@@ -97,6 +98,7 @@ class Albums_Controller extends Items_Controller {
private function _create_photo($album) {
access::required("edit", $album);
+ rest::http_content_type(rest::JSON);
$form = photo::get_add_form($album);
if ($form->validate()) {
$photo = photo::create(
@@ -128,6 +130,7 @@ class Albums_Controller extends Items_Controller {
public function _update($album) {
access::required("edit", $album);
+ rest::http_content_type(rest::JSON);
$form = album::get_edit_form($album);
if ($form->validate()) {
// @todo implement changing the name. This is not trivial, we have
diff --git a/core/controllers/photos.php b/core/controllers/photos.php
index 13185283..9ceaa5c9 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -45,6 +45,7 @@ class Photos_Controller extends Items_Controller {
public function _update($photo) {
access::required("edit", $photo);
+ rest::http_content_type(rest::JSON);
$form = photo::get_edit_form($photo);
if ($form->validate()) {
// @todo implement changing the name. This is not trivial, we have
diff --git a/modules/user/controllers/login.php b/modules/user/controllers/login.php
index 46957bb0..88a5ccf9 100644
--- a/modules/user/controllers/login.php
+++ b/modules/user/controllers/login.php
@@ -28,6 +28,7 @@ class Login_Controller extends Controller {
private function _try_login() {
$form = $this->_login_form();
+ rest::http_content_type(rest::JSON);
$valid = $form->validate();
if ($valid) {
diff --git a/modules/user/controllers/users.php b/modules/user/controllers/users.php
index 7ccab28f..abc0ae0f 100644
--- a/modules/user/controllers/users.php
+++ b/modules/user/controllers/users.php
@@ -25,6 +25,7 @@ class Users_Controller extends REST_Controller {
access::forbidden();
}
+ rest::http_content_type(rest::JSON);
$form = user::get_edit_form($user);
$form->edit_user->password->rules("-required");
if ($form->validate()) {
diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php
index 9c95d213..1abd0d10 100644
--- a/modules/watermark/controllers/admin_watermarks.php
+++ b/modules/watermark/controllers/admin_watermarks.php
@@ -38,6 +38,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
}
public function edit() {
+ rest::http_content_type(rest::JSON);
$form = watermark::get_edit_form();
if ($form->validate()) {
$position = $form->edit_watermark->position->value;
@@ -61,6 +62,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
}
public function delete() {
+ rest::http_content_type(rest::JSON);
$form = watermark::get_delete_form();
if ($form->validate()) {
if ($name = module::get_var("watermark", "name")) {
@@ -91,6 +93,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
}
public function add() {
+ rest::http_content_type(rest::JSON);
$form = watermark::get_add_form();
if ($form->validate()) {
$file = $_POST["file"];