diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-07-21 08:15:21 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-07-31 15:44:55 -0700 |
commit | bb04015149f35d7ef5ef1e98e53a1659679d83d7 (patch) | |
tree | d2782ceb0d8e1b0b5a21e6af37fe2ee284446c37 | |
parent | 5c0998c4ac9ad7572df68f5c2cc351f0d03a7bd2 (diff) |
Partial fix for #1225. Create a json reply helper that sets the content type to application/json and then json encodes the reply.
-rw-r--r-- | modules/gallery/helpers/json.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/modules/gallery/helpers/json.php b/modules/gallery/helpers/json.php new file mode 100644 index 00000000..5fcdc268 --- /dev/null +++ b/modules/gallery/helpers/json.php @@ -0,0 +1,34 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2010 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class json_Core { + /** + * Does the active user have this permission on this item? + * + * @param string $perm_name + * @param Item_Model $item + * @return boolean + */ + static function reply($message) { + if (!headers_sent()) { + header("Content-Type: application/json"); + } + print json_encode($message); + } +}
\ No newline at end of file |