1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/10328] Renamed the JSON class, also now using autoloading.

It is no longer static, and uses autoloading. It has also been renamed
from JSON to phpbb_json_response.

PHPBB3-10328
This commit is contained in:
Callum Macrae
2011-08-24 12:25:54 +01:00
committed by Igor Wiedler
parent c92b30d66c
commit 7a933bdb5a
6 changed files with 28 additions and 31 deletions

View File

@@ -25,7 +25,7 @@ class ucp_zebra
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx, $request;
$submit = (isset($_POST['submit']) || isset($_GET['add']) || isset($_GET['remove'])) ? true : false;
$s_hidden_fields = '';
@@ -198,13 +198,25 @@ class ucp_zebra
}
}
}
if ($updated)
if ($request->is_ajax())
{
JSON::add(array(
'message' => $user->lang[$l_mode . '_UPDATED'],
'success' => true
$message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error);
$json_response = new phpbb_json_response;
$json_response->send(array(
'success' => $updated,
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
'REFRESH_DATA' => array(
'time' => 3,
'url' => $this->u_action
)
));
}
else if ($updated)
{
meta_refresh(3, $this->u_action);
$message = $user->lang[$l_mode . '_UPDATED'] . '<br />' . implode('<br />', $error) . ((sizeof($error)) ? '<br />' : '') . '<br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
trigger_error($message);