mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-28 02:34:10 -04:00
More patches as part of #1225. Change the 'core' modules to use the json::reply
method to set the content type header and encode the response as a json object
This commit is contained in:
committed by
Bharat Mediratta
parent
89d18c0714
commit
91a2c04a24
@@ -34,10 +34,10 @@ class Admin_Manage_Comments_Controller extends Admin_Controller {
|
||||
|
||||
public function menu_labels() {
|
||||
$menu = $this->_menu($this->_counts());
|
||||
print json_encode(array((string) $menu->get("unpublished")->label,
|
||||
(string) $menu->get("published")->label,
|
||||
(string) $menu->get("spam")->label,
|
||||
(string) $menu->get("deleted")->label));
|
||||
json::reply(array((string) $menu->get("unpublished")->label,
|
||||
(string) $menu->get("published")->label,
|
||||
(string) $menu->get("spam")->label,
|
||||
(string) $menu->get("deleted")->label));
|
||||
}
|
||||
|
||||
public function queue($state) {
|
||||
|
||||
@@ -56,13 +56,12 @@ class Comments_Controller extends Controller {
|
||||
$view = new Theme_View("comment.html", "other", "comment-fragment");
|
||||
$view->comment = $comment;
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"view" => (string) $view,
|
||||
"form" => (string) comment::get_add_form($item)));
|
||||
json::reply(array("result" => "success",
|
||||
"view" => (string) $view,
|
||||
"form" => (string) comment::get_add_form($item)));
|
||||
} else {
|
||||
$form = comment::prefill_add_form($form);
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,6 @@ class Exif_Controller extends Controller {
|
||||
$view = new View("exif_dialog.html");
|
||||
$view->details = exif::get($item);
|
||||
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ class Admin_Controller extends Controller {
|
||||
$result->location = url::abs_site("");
|
||||
}
|
||||
|
||||
print json_encode($result);
|
||||
json::reply($result);
|
||||
}
|
||||
|
||||
private static function _prompt_for_reauth($controller_name, $args) {
|
||||
|
||||
@@ -39,7 +39,7 @@ class Admin_Advanced_Settings_Controller extends Admin_Controller {
|
||||
$group->input("var_name")->label(t("Setting"))->value($var_name)->disabled(1);
|
||||
$group->textarea("value")->label(t("Value"))->value($value);
|
||||
$group->submit("")->value(t("Save"));
|
||||
print json_encode(array("form" => (string) $form));
|
||||
json::reply(array("form" => (string) $form));
|
||||
}
|
||||
|
||||
public function save($module_name, $var_name) {
|
||||
@@ -50,6 +50,6 @@ class Admin_Advanced_Settings_Controller extends Admin_Controller {
|
||||
t("Saved value for %var (%module_name)",
|
||||
array("var" => $var_name, "module_name" => $module_name)));
|
||||
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class Admin_Languages_Controller extends Admin_Controller {
|
||||
}
|
||||
module::set_var("gallery", "default_locale", $new_default_locale);
|
||||
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function share() {
|
||||
|
||||
@@ -64,7 +64,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
|
||||
log::info("tasks", t("Task %task_name started (task id %task_id)",
|
||||
array("task_name" => $task->name, "task_id" => $task->id)),
|
||||
html::anchor("admin/maintenance", t("maintenance")));
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
|
||||
log::info("tasks", t("Task %task_name resumed (task id %task_id)",
|
||||
array("task_name" => $task->name, "task_id" => $task->id)),
|
||||
html::anchor("admin/maintenance", t("maintenance")));
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -103,7 +103,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
|
||||
$view = new View("admin_maintenance_show_log.html");
|
||||
$view->task = $task;
|
||||
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +211,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
|
||||
break;
|
||||
}
|
||||
// Using sprintf("%F") to avoid comma as decimal separator.
|
||||
print json_encode(array("result" => "success",
|
||||
json::reply(array("result" => "success",
|
||||
"task" => array(
|
||||
"percent_complete" => sprintf("%F", $task->percent_complete),
|
||||
"status" => (string) $task->status,
|
||||
@@ -219,7 +219,7 @@ class Admin_Maintenance_Controller extends Admin_Controller {
|
||||
"location" => url::site("admin/maintenance")));
|
||||
|
||||
} else {
|
||||
print json_encode(array("result" => "in_progress",
|
||||
json::reply(array("result" => "in_progress",
|
||||
"task" => array(
|
||||
"percent_complete" => sprintf("%F", $task->percent_complete),
|
||||
"status" => (string) $task->status,
|
||||
|
||||
@@ -57,7 +57,7 @@ class Admin_Modules_Controller extends Admin_Controller {
|
||||
$result["dialog"] = (string)$v;
|
||||
$result["allow_continue"] = empty($messages["error"]);
|
||||
}
|
||||
print json_encode($result);
|
||||
json::reply($result);
|
||||
}
|
||||
|
||||
public function save() {
|
||||
|
||||
@@ -50,7 +50,7 @@ class Admin_Sidebar_Controller extends Admin_Controller {
|
||||
$result["active"] = $v->render();
|
||||
$message = t("Updated sidebar blocks");
|
||||
$result["message"] = (string) $message;
|
||||
print json_encode($result);
|
||||
json::reply($result);
|
||||
}
|
||||
|
||||
private function _get_blocks() {
|
||||
|
||||
@@ -113,9 +113,9 @@ class Albums_Controller extends Items_Controller {
|
||||
message::success(t("Created album %album_title",
|
||||
array("album_title" => html::purify($album->title))));
|
||||
|
||||
print json_encode(array("result" => "success", "location" => $album->url()));
|
||||
json::reply(array("result" => "success", "location" => $album->url()));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,13 +153,13 @@ class Albums_Controller extends Items_Controller {
|
||||
|
||||
if ($form->from_id->value == $album->id) {
|
||||
// Use the new url; it might have changed.
|
||||
print json_encode(array("result" => "success", "location" => $album->url()));
|
||||
json::reply(array("result" => "success", "location" => $album->url()));
|
||||
} else {
|
||||
// Stay on the same page
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class Albums_Controller extends Items_Controller {
|
||||
access::required("view", $album);
|
||||
access::required("add", $album);
|
||||
|
||||
print json_encode(array("form" => (string) album::get_add_form($album)));
|
||||
json::reply(array("form" => (string) album::get_add_form($album)));
|
||||
}
|
||||
|
||||
public function form_edit($album_id) {
|
||||
@@ -176,6 +176,6 @@ class Albums_Controller extends Items_Controller {
|
||||
access::required("view", $album);
|
||||
access::required("edit", $album);
|
||||
|
||||
print json_encode(array("form" => (string) album::get_edit_form($album)));
|
||||
json::reply(array("form" => (string) album::get_edit_form($album)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ class L10n_Client_Controller extends Controller {
|
||||
|
||||
Gallery_I18n::clear_cache($locale);
|
||||
|
||||
print json_encode(new stdClass());
|
||||
json::reply(new stdClass());
|
||||
}
|
||||
|
||||
public function toggle_l10n_mode() {
|
||||
|
||||
@@ -22,7 +22,7 @@ class Login_Controller extends Controller {
|
||||
public function ajax() {
|
||||
$view = new View("login_ajax.html");
|
||||
$view->form = auth::get_login_form("login/auth_ajax");
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
public function auth_ajax() {
|
||||
@@ -30,10 +30,9 @@ class Login_Controller extends Controller {
|
||||
|
||||
list ($valid, $form) = $this->_auth("login/auth_ajax");
|
||||
if ($valid) {
|
||||
print json_encode(
|
||||
array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class Move_Controller extends Controller {
|
||||
$view = new View("move_browse.html");
|
||||
$view->source = $source;
|
||||
$view->tree = $this->_get_tree_html($source, ORM::factory("item", 1));
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
public function save($source_id) {
|
||||
@@ -41,9 +41,7 @@ class Move_Controller extends Controller {
|
||||
|
||||
item::move($source, $target);
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"location" => $target->url()));
|
||||
json::reply(array("result" => "success", "location" => $target->url()));
|
||||
}
|
||||
|
||||
public function show_sub_tree($source_id, $target_id) {
|
||||
|
||||
@@ -87,13 +87,13 @@ class Movies_Controller extends Items_Controller {
|
||||
|
||||
if ($form->from_id->value == $movie->id) {
|
||||
// Use the new url; it might have changed.
|
||||
print json_encode(array("result" => "success", "location" => $movie->url()));
|
||||
json::reply(array("result" => "success", "location" => $movie->url()));
|
||||
} else {
|
||||
// Stay on the same page
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,6 @@ class Movies_Controller extends Items_Controller {
|
||||
access::required("view", $movie);
|
||||
access::required("edit", $movie);
|
||||
|
||||
print json_encode(array("form" => (string) movie::get_edit_form($movie)));
|
||||
json::reply(array("form" => (string) movie::get_edit_form($movie)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class Permissions_Controller extends Controller {
|
||||
$view->parents = $item->parents();
|
||||
$view->form = $this->_get_form($item);
|
||||
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
function form($id) {
|
||||
|
||||
@@ -87,13 +87,13 @@ class Photos_Controller extends Items_Controller {
|
||||
|
||||
if ($form->from_id->value == $photo->id) {
|
||||
// Use the new url; it might have changed.
|
||||
print json_encode(array("result" => "success", "location" => $photo->url()));
|
||||
json::reply(array("result" => "success", "location" => $photo->url()));
|
||||
} else {
|
||||
// Stay on the same page
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,6 +102,6 @@ class Photos_Controller extends Items_Controller {
|
||||
access::required("view", $photo);
|
||||
access::required("edit", $photo);
|
||||
|
||||
print json_encode(array("form" => (string) photo::get_edit_form($photo)));
|
||||
json::reply(array("form" => (string) photo::get_edit_form($photo)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ class Quick_Controller extends Controller {
|
||||
}
|
||||
|
||||
if (Input::instance()->get("page_type") == "collection") {
|
||||
print json_encode(
|
||||
json::reply(
|
||||
array("src" => $item->thumb_url(),
|
||||
"width" => $item->thumb_width,
|
||||
"height" => $item->thumb_height));
|
||||
} else {
|
||||
print json_encode(
|
||||
json::reply(
|
||||
array("src" => $item->resize_url(),
|
||||
"width" => $item->resize_width,
|
||||
"height" => $item->resize_height));
|
||||
@@ -83,7 +83,7 @@ class Quick_Controller extends Controller {
|
||||
item::make_album_cover($item);
|
||||
message::success($msg);
|
||||
|
||||
print json_encode(array("result" => "success", "reload" => 1));
|
||||
json::reply(array("result" => "success", "reload" => 1));
|
||||
}
|
||||
|
||||
public function form_delete($id) {
|
||||
@@ -94,7 +94,7 @@ class Quick_Controller extends Controller {
|
||||
$v = new View("quick_delete_confirm.html");
|
||||
$v->item = $item;
|
||||
$v->form = item::get_delete_form($item);
|
||||
print json_encode(array("form" => (string) $v));
|
||||
json::reply(array("form" => (string) $v));
|
||||
}
|
||||
|
||||
public function delete($id) {
|
||||
@@ -125,9 +125,9 @@ class Quick_Controller extends Controller {
|
||||
$from_id = Input::instance()->get("from_id");
|
||||
if (Input::instance()->get("page_type") == "collection" &&
|
||||
$from_id != $id /* deleted the item we were viewing */) {
|
||||
print json_encode(array("result" => "success", "reload" => 1));
|
||||
json::reply(array("result" => "success", "reload" => 1));
|
||||
} else {
|
||||
print json_encode(array("result" => "success",
|
||||
json::reply(array("result" => "success",
|
||||
"location" => $parent->url()));
|
||||
}
|
||||
}
|
||||
@@ -154,6 +154,6 @@ class Quick_Controller extends Controller {
|
||||
// Pass on the source item where this form was generated, so we have an idea where to return to.
|
||||
$form->hidden("from_id")->value((int)Input::instance()->get("from_id", 0));
|
||||
|
||||
print json_encode(array("form" => (string) $form));
|
||||
json::reply(array("form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class Reauthenticate_Controller extends Controller {
|
||||
access::forbidden();
|
||||
}
|
||||
if (request::is_ajax()) {
|
||||
print json_encode(array("form" => (string) self::_form()));
|
||||
json::reply(array("form" => (string) self::_form()));
|
||||
} else {
|
||||
self::_show_form(self::_form());
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class Reauthenticate_Controller extends Controller {
|
||||
if (empty($reauthenticate["in_dialog"])) {
|
||||
self::_show_form($form);
|
||||
} else {
|
||||
print json_encode(array("form" => (string) $form));
|
||||
json::reply(array("form" => (string) $form));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ class Uploader_Controller extends Controller {
|
||||
$item = $item->parent();
|
||||
}
|
||||
|
||||
print json_encode(array("form" => (string)$this->_get_add_form($item)));
|
||||
json::reply(array("form" => (string)$this->_get_add_form($item)));
|
||||
//print $this->_get_add_form($item);
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class Uploader_Controller extends Controller {
|
||||
access::verify_csrf();
|
||||
|
||||
batch::stop();
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
private function _get_add_form($album) {
|
||||
|
||||
@@ -44,7 +44,7 @@ class User_Profile_Controller extends Controller {
|
||||
|
||||
public function contact($id) {
|
||||
$user = identity::lookup_user($id);
|
||||
print json_encode(array("form" => (string) user_profile::get_contact_form($user)));
|
||||
json::reply(array("form" => (string) user_profile::get_contact_form($user)));
|
||||
}
|
||||
|
||||
public function send($id) {
|
||||
@@ -61,9 +61,9 @@ class User_Profile_Controller extends Controller {
|
||||
->message(html::purify($form->message->message->value))
|
||||
->send();
|
||||
message::success(t("Sent message to %user_name", array("user_name" => $user->display_name())));
|
||||
print json_encode(array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ class Organize_Controller extends Controller {
|
||||
$v->controller_uri = url::site("organize") . "/";
|
||||
$v->swf_uri = url::file("modules/organize/lib/Gallery3WebClient.swf?") .
|
||||
filemtime(MODPATH . "organize/lib/Gallery3WebClient.swf");
|
||||
print json_encode(array("form" => (string) $v));
|
||||
json::reply(array("form" => (string) $v));
|
||||
}
|
||||
|
||||
function add_album_fields() {
|
||||
print json_encode(array("title" => (string)t("Title"),
|
||||
"description" => (string)t("Description"),
|
||||
"name" => (string)t("Directory name"),
|
||||
"slug" => (string)t("Internet Address")));
|
||||
json::reply(array("title" => (string)t("Title"),
|
||||
"description" => (string)t("Description"),
|
||||
"name" => (string)t("Directory name"),
|
||||
"slug" => (string)t("Internet Address")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,8 +35,7 @@ class rest_Core {
|
||||
}
|
||||
print "<pre>$html</pre>";
|
||||
} else {
|
||||
header("Content-type: application/json");
|
||||
print json_encode($data);
|
||||
json::reply($data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ class Server_Add_Controller extends Admin_Controller {
|
||||
$view->tree = new View("server_add_tree.html");
|
||||
$view->tree->files = $files;
|
||||
$view->tree->parents = array();
|
||||
print json_encode(array("form" => (string) $view));
|
||||
json::reply(array("form" => (string) $view));
|
||||
}
|
||||
|
||||
public function children() {
|
||||
@@ -91,7 +91,7 @@ class Server_Add_Controller extends Admin_Controller {
|
||||
->name(t("Add from server"));
|
||||
$task = task::create($task_def, array("item_id" => $item->id, "queue" => $paths));
|
||||
|
||||
print json_encode(
|
||||
json::reply(
|
||||
array("result" => "started",
|
||||
"status" => (string)$task->status,
|
||||
"url" => url::site("server_add/run/$task->id?csrf=" . access::csrf_token())));
|
||||
@@ -111,7 +111,7 @@ class Server_Add_Controller extends Admin_Controller {
|
||||
$task = task::run($task_id);
|
||||
// Prevent the JavaScript code from breaking by forcing a period as
|
||||
// decimal separator for all locales with sprintf("%F", $value).
|
||||
print json_encode(array("done" => (bool)$task->done,
|
||||
json::reply(array("done" => (bool)$task->done,
|
||||
"status" => (string)$task->status,
|
||||
"percent_complete" => sprintf("%F", $task->percent_complete)));
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class Admin_Tags_Controller extends Admin_Controller {
|
||||
public function form_delete($id) {
|
||||
$tag = ORM::factory("tag", $id);
|
||||
if ($tag->loaded()) {
|
||||
print json_encode(array("form" => (string) tag::get_delete_form($tag)));
|
||||
json::reply(array("form" => (string) tag::get_delete_form($tag)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,11 +57,9 @@ class Admin_Tags_Controller extends Admin_Controller {
|
||||
message::success(t("Deleted tag %tag_name", array("tag_name" => $name)));
|
||||
log::success("tags", t("Deleted tag %tag_name", array("tag_name" => $name)));
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"location" => url::site("admin/tags")));
|
||||
json::reply(array("result" => "success", "location" => url::site("admin/tags")));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,10 +96,9 @@ class Admin_Tags_Controller extends Admin_Controller {
|
||||
message::success($message);
|
||||
log::success("tags", $message);
|
||||
|
||||
print json_encode(array("result" => "success",
|
||||
"location" => url::site("admin/tags")));
|
||||
json::reply(array("result" => "success", "location" => url::site("admin/tags")));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => $in_place_edit->render()));
|
||||
json::reply(array("result" => "error", "form" => $in_place_edit->render()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,11 +67,9 @@ class Tags_Controller extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"cloud" => (string)tag::cloud(30)));
|
||||
json::reply(array("result" => "success", "cloud" => (string)tag::cloud(30)));
|
||||
} else {
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,10 @@ class Password_Controller extends Controller {
|
||||
if ($form->validate()) {
|
||||
$this->_send_reset($form);
|
||||
} else {
|
||||
print json_encode(array("result" => "error",
|
||||
"form" => (string) $form));
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
} else {
|
||||
print $form;
|
||||
json::reply(array("form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +82,7 @@ class Password_Controller extends Controller {
|
||||
// Always pretend that an email has been sent to avoid leaking
|
||||
// information on what user names are actually real.
|
||||
message::success(t("Password reset email sent"));
|
||||
print json_encode(
|
||||
array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
private static function _reset_form() {
|
||||
|
||||
@@ -35,7 +35,7 @@ class Admin_Watermarks_Controller extends Admin_Controller {
|
||||
}
|
||||
|
||||
public function form_edit() {
|
||||
print json_encode(array("form" => (string) watermark::get_edit_form()));
|
||||
json::reply(array("form" => (string) watermark::get_edit_form()));
|
||||
}
|
||||
|
||||
public function edit() {
|
||||
@@ -49,16 +49,16 @@ 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", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
public function form_delete() {
|
||||
print json_encode(array("form" => (string) watermark::get_delete_form()));
|
||||
json::reply(array("form" => (string) watermark::get_delete_form()));
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
@@ -79,16 +79,14 @@ 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", "form" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
public function form_add() {
|
||||
print json_encode(array("form" => (string) watermark::get_add_form()));
|
||||
json::reply(array("form" => (string) watermark::get_add_form()));
|
||||
}
|
||||
|
||||
public function add() {
|
||||
@@ -120,11 +118,9 @@ 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)));
|
||||
json::reply(array("result" => "error", "form" => rawurlencode((string) $form)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user