Change json::reply calls to use "html" instead of "form" and not JSON
encode HTML payloads when we don't need to.
This is follow on for:
7607e1f932
This commit is contained in:
parent
e87c6a2832
commit
8eec328a06
@ -62,7 +62,7 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
"postage_name" => html::clean($postage_band->name))));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
$name = $postage->name;
|
||||
$postage->delete();
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
|
||||
$message = t("Deleted user %postage_band", array("postage_band" => html::clean($name)));
|
||||
@ -129,7 +129,7 @@ class Admin_Postage_Bands_Controller extends Controller
|
||||
array("postage_name" => html::clean($postage->name))));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
"product_name" => html::clean($product->name))));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,8 +91,7 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
$name = $product->name;
|
||||
$product->delete();
|
||||
} else {
|
||||
json::reply(array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
|
||||
$message = t("Deleted user %product_name", array("product_name" => html::clean($name)));
|
||||
@ -131,7 +130,7 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
array("product_name" => html::clean($product->name))));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string)$form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,7 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
} else {
|
||||
$v = $this->_get_module_create_content(arr::overwrite($form, $post->as_array()),
|
||||
arr::overwrite($errors, $post->errors()));
|
||||
json::reply(array("result" => "error",
|
||||
"form" => $v->__toString()));
|
||||
json::reply(array("result" => "error", "html" => (string)$v));
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,8 +126,7 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
} else {
|
||||
$v = $this->_get_test_data_view(arr::overwrite($form, $post->as_array()),
|
||||
arr::overwrite($errors, $post->errors()));
|
||||
json::reply(array("result" => "error",
|
||||
"form" => $v->__toString()));
|
||||
json::reply(array("result" => "error", "html" => (string)$v));
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,12 +150,10 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
message::success(empty($error_msg) ? $context["error_msg"] : $error_msg);
|
||||
break;
|
||||
}
|
||||
json::reply(array("result" => "success",
|
||||
"task" => $task->as_array()));
|
||||
json::reply(array("result" => "success", "task" => $task->as_array()));
|
||||
|
||||
} else {
|
||||
json::reply(array("result" => "in_progress",
|
||||
"task" => $task->as_array()));
|
||||
json::reply(array("result" => "in_progress", "task" => $task->as_array()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,9 @@ class <?= $class_name ?>_Controller extends Controller {
|
||||
|
||||
message::success(t("<?= $name ?> Processing Successfully"));
|
||||
|
||||
json::reply(
|
||||
array("result" => "success"));
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(
|
||||
array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class Favourites_Controller extends Controller {
|
||||
json::reply(array("result" => "success", "location" => url::site("favourites")));
|
||||
return;
|
||||
}
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
|
||||
public function toggle_favourites($id){
|
||||
|
@ -38,8 +38,7 @@ class Admin_Upload_Configure_Controller extends Controller
|
||||
}
|
||||
else
|
||||
{
|
||||
json::reply
|
||||
s(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "html" => (string) $form));
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ class Uploader_Controller extends Controller {
|
||||
$album = $album->parent();
|
||||
}
|
||||
|
||||
json::reply(array("form" => (string) $this->_get_add_form($album)));
|
||||
print $this->_get_add_form($album);
|
||||
}
|
||||
|
||||
public function add($id) {
|
||||
@ -85,7 +85,7 @@ class Uploader_Controller extends Controller {
|
||||
batch::stop();
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "html" => (string) $form));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
class register_Controller extends Controller {
|
||||
public function index() {
|
||||
json::reply(array("form" => (string) $this->_get_form()));
|
||||
print $this->_get_form();
|
||||
}
|
||||
|
||||
public function handler() {
|
||||
@ -59,7 +59,7 @@ class register_Controller extends Controller {
|
||||
|
||||
json::reply(array("result" => "success"));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class register_Controller extends Controller {
|
||||
|
||||
public function change_password($id, $password) {
|
||||
$user = user::lookup($id);
|
||||
json::reply(array("form" => (string) $this->_get_change_password_form($user, $password)));
|
||||
print $this->_get_change_password_form($user, $password);
|
||||
}
|
||||
|
||||
private function _get_form() {
|
||||
|
@ -123,7 +123,7 @@ class Admin_Schedule_Controller extends Admin_Maintenance_Controller {
|
||||
}
|
||||
json::reply(array("result" => "success", "reload" => 1));
|
||||
} else {
|
||||
json::reply(array("result" => "error", "form" => (string) $form));
|
||||
json::reply(array("result" => "error", "html" => (string)$form));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user