summaryrefslogtreecommitdiff
path: root/modules/watermark/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/watermark/controllers')
-rw-r--r--modules/watermark/controllers/admin_watermarks.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php
index 18b463ca..a2cafee0 100644
--- a/modules/watermark/controllers/admin_watermarks.php
+++ b/modules/watermark/controllers/admin_watermarks.php
@@ -49,11 +49,11 @@ class Admin_Watermarks_Controller extends Admin_Controller {
log::success("watermark", t("Watermark changed"));
message::success(t("Watermark changed"));
- print json_encode(
+ json::reply(
array("result" => "success",
"location" => url::site("admin/watermarks")));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ json::reply(array("result" => "error", "html" => (string)$form));
}
}
@@ -79,11 +79,9 @@ class Admin_Watermarks_Controller extends Admin_Controller {
log::success("watermark", t("Watermark deleted"));
message::success(t("Watermark deleted"));
}
- print json_encode(
- array("result" => "success",
- "location" => url::site("admin/watermarks")));
+ json::reply(array("result" => "success", "location" => url::site("admin/watermarks")));
} else {
- print json_encode(array("result" => "error", "form" => (string) $form));
+ json::reply(array("result" => "error", "html" => (string)$form));
}
}
@@ -120,12 +118,20 @@ class Admin_Watermarks_Controller extends Admin_Controller {
message::success(t("Watermark saved"));
log::success("watermark", t("Watermark saved"));
- print json_encode(
- array("result" => "success",
- "location" => url::site("admin/watermarks")));
+ json::reply(array("result" => "success", "location" => url::site("admin/watermarks")));
} else {
- print json_encode(array("result" => "error", "form" => rawurlencode((string) $form)));
+ // rawurlencode the results because the JS code that uploads the file buffers it in an
+ // iframe which entitizes the HTML and makes it difficult for the JS to process. If we url
+ // encode it now, it passes through cleanly. See ticket #797.
+ json::reply(array("result" => "error", "html" => rawurlencode((string)$form)));
}
+
+ // Override the application/json mime type. The dialog based HTML uploader uses an iframe to
+ // buffer the reply, and on some browsers (Firefox 3.6) it does not know what to do with the
+ // JSON that it gets back so it puts up a dialog asking the user what to do with it. So force
+ // the encoding type back to HTML for the iframe.
+ // See: http://jquery.malsup.com/form/#file-upload
+ header("Content-Type: text/html; charset=" . Kohana::CHARSET);
}
private function _update_graphics_rules() {