diff options
| author | Nathan Kinkade <nath@nkinka.de> | 2013-03-19 16:41:42 +0000 | 
|---|---|---|
| committer | Nathan Kinkade <nath@nkinka.de> | 2013-03-19 16:41:42 +0000 | 
| commit | 3908e37d965fa76ea774e76ddf42365a872a5f27 (patch) | |
| tree | 457e1a1e465f83855eee96ba287cd91f1623395c /modules/watermark/controllers/admin_watermarks.php | |
| parent | 711651f727e093cc7357a6bbff6bd992fd6dfd80 (diff) | |
| parent | 1eab94f6062b5f54ea5d9db01d968e7195f3de9d (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/watermark/controllers/admin_watermarks.php')
| -rw-r--r-- | modules/watermark/controllers/admin_watermarks.php | 24 | 
1 files changed, 10 insertions, 14 deletions
| diff --git a/modules/watermark/controllers/admin_watermarks.php b/modules/watermark/controllers/admin_watermarks.php index b058d6a5..bbefcf01 100644 --- a/modules/watermark/controllers/admin_watermarks.php +++ b/modules/watermark/controllers/admin_watermarks.php @@ -55,6 +55,8 @@ class Admin_Watermarks_Controller extends Admin_Controller {      } else {        json::reply(array("result" => "error", "html" => (string)$form));      } +    // Override the application/json mime type for iframe compatibility.  See ticket #2022. +    header("Content-Type: text/plain; charset=" . Kohana::CHARSET);    }    public function form_delete() { @@ -67,7 +69,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {      $form = watermark::get_delete_form();      if ($form->validate()) {        if ($name = basename(module::get_var("watermark", "name"))) { -        @unlink(VARPATH . "modules/watermark/$name"); +        system::delete_later(VARPATH . "modules/watermark/$name");          module::clear_var("watermark", "name");          module::clear_var("watermark", "width"); @@ -83,6 +85,8 @@ class Admin_Watermarks_Controller extends Admin_Controller {      } else {        json::reply(array("result" => "error", "html" => (string)$form));      } +    // Override the application/json mime type for iframe compatibility.  See ticket #2022. +    header("Content-Type: text/plain; charset=" . Kohana::CHARSET);    }    public function form_add() { @@ -108,7 +112,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {          $name = legal_file::sanitize_filename($name, $extension, "photo");        } catch (Exception $e) {          message::error(t("Invalid or unidentifiable image file")); -        @unlink($file); +        system::delete_later($file);          return;        } @@ -120,24 +124,16 @@ class Admin_Watermarks_Controller extends Admin_Controller {        module::set_var("watermark", "position", $form->add_watermark->position->value);        module::set_var("watermark", "transparency", $form->add_watermark->transparency->value);        $this->_update_graphics_rules(); -      @unlink($file); +      system::delete_later($file);        message::success(t("Watermark saved"));        log::success("watermark", t("Watermark saved"));        json::reply(array("result" => "success", "location" => url::site("admin/watermarks")));      } else { -      // 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))); +      json::reply(array("result" => "error", "html" => (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); +    // Override the application/json mime type for iframe compatibility.  See ticket #2022. +    header("Content-Type: text/plain; charset=" . Kohana::CHARSET);    }    private function _update_graphics_rules() { | 
