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

Merge branch 'develop' into feature/merging-style-components

* develop: (175 commits)
  [feature/ajax] Remove strange non-breaking spaces from approve button
  [feature/ajax] Add entirely unrelated but nice newlines
  [feature/ajax] Unify phpbb_json_response instantiation
  [feature/ajax] Fix acp_styles activate_deactivate ajax callback name
  [feature/ajax] Send correct activate/deactivate JSON response in acp_profile
  [ticket/10270] Alter background colors for posts
  [feature/ajax] Remove not working module enable/disable ajax code
  [feature/ajax] Replace static call to phpbb_request with OO
  [feature/ajax] Remove quick-reply AJAX handling until we have something good
  [ticket/10270] Changing close button for ajax popups
  [ticket/10270] Disabling links in disappearing content
  [ticket/10291] Fixed an AJAX bug on quick reply form submit.
  [ticket/10273] Fixed accepting / denying posts AJAX.
  [ticket/10272] Removed code that was prevent event propogation in AJAX.
  [ticket/10291] Fixed a bug in the quick reply AJAX.
  [feature/ajax] Handle acp_modules error cases with JSON response
  [feature/ajax] Fix filter check, quick mod tools data-attribute
  [feature/ajax] Use the error handler
  [feature/ajax] Generic error handling with a phpbb.alert box
  [feature/ajax] Change filter semantics, some minor adjustments
  ...

Conflicts:
	phpBB/adm/style/acp_styles.html
	phpBB/includes/acp/acp_styles.php
This commit is contained in:
Vjacheslav Trushkin
2012-03-31 10:43:06 +03:00
81 changed files with 1716 additions and 627 deletions

View File

@ -24,7 +24,7 @@ class acp_bbcodes
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@ -272,6 +272,18 @@ class acp_bbcodes
$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id");
$cache->destroy('sql', BBCODES_TABLE);
add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']);
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'],
'REFRESH_DATA' => array(
'time' => 3
)
));
}
}
else
{

View File

@ -24,7 +24,7 @@ class acp_bots
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $cache;
global $config, $db, $user, $auth, $template, $cache, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$action = request_var('action', '');
@ -352,6 +352,14 @@ class acp_bots
break;
}
if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate'))
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
));
}
$s_options = '';
$_options = array('activate' => 'BOT_ACTIVATE', 'deactivate' => 'BOT_DEACTIVATE', 'delete' => 'DELETE');

View File

@ -25,7 +25,7 @@ class acp_forums
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
$user->add_lang('acp/forums');
@ -255,6 +255,12 @@ class acp_forums
add_log('admin', 'LOG_FORUM_' . strtoupper($action), $row['forum_name'], $move_forum_name);
$cache->destroy('sql', FORUMS_TABLE);
}
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array('success' => ($move_forum_name !== false)));
}
break;

View File

@ -782,6 +782,18 @@ class acp_icons
$cache->destroy('_icons');
$cache->destroy('sql', $table);
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $notice,
'REFRESH_DATA' => array(
'time' => 3
)
));
}
}
else
{

View File

@ -24,7 +24,7 @@ class acp_main
function main($id, $mode)
{
global $config, $db, $user, $auth, $template;
global $config, $db, $user, $auth, $template, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx;
// Show restore permissions notice
@ -129,6 +129,11 @@ class acp_main
set_config('record_online_users', 1, true);
set_config('record_online_date', time(), true);
add_log('admin', 'LOG_RESET_ONLINE');
if ($request->is_ajax())
{
trigger_error('RESET_ONLINE_SUCCESS');
}
break;
case 'stats':
@ -179,6 +184,11 @@ class acp_main
update_last_username();
add_log('admin', 'LOG_RESYNC_STATS');
if ($request->is_ajax())
{
trigger_error('RESYNC_STATS_SUCCESS');
}
break;
case 'user':
@ -241,7 +251,11 @@ class acp_main
}
add_log('admin', 'LOG_RESYNC_POSTCOUNTS');
if ($request->is_ajax())
{
trigger_error('RESYNC_POSTCOUNTS_SUCCESS');
}
break;
case 'date':
@ -252,6 +266,11 @@ class acp_main
set_config('board_startdate', time() - 1);
add_log('admin', 'LOG_RESET_DATE');
if ($request->is_ajax())
{
trigger_error('RESET_DATE_SUCCESS');
}
break;
case 'db_track':
@ -327,14 +346,14 @@ class acp_main
}
add_log('admin', 'LOG_RESYNC_POST_MARKING');
if ($request->is_ajax())
{
trigger_error('RESYNC_POST_MARKING_SUCCESS');
}
break;
case 'purge_cache':
if ((int) $user->data['user_type'] !== USER_FOUNDER)
{
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
}
global $cache;
$cache->purge();
@ -343,6 +362,11 @@ class acp_main
cache_moderators();
add_log('admin', 'LOG_PURGE_CACHE');
if ($request->is_ajax())
{
trigger_error('PURGE_CACHE_SUCCESS');
}
break;
case 'purge_sessions':
@ -389,6 +413,11 @@ class acp_main
$db->sql_query($sql);
add_log('admin', 'LOG_PURGE_SESSIONS');
if ($request->is_ajax())
{
trigger_error('PURGE_SESSIONS_SUCCESS');
}
break;
}
}

View File

@ -36,7 +36,7 @@ class acp_modules
function main($id, $mode)
{
global $db, $user, $auth, $template, $module;
global $db, $user, $auth, $template, $module, $request;
global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx;
// Set a global define for modules we might include (the author is able to prevent execution of code by checking this constant)
@ -373,6 +373,15 @@ class acp_modules
// Default management page
if (sizeof($errors))
{
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'MESSAGE_TEXT' => implode('<br />', $errors),
));
}
$template->assign_vars(array(
'S_ERROR' => true,
'ERROR_MSG' => implode('<br />', $errors))

View File

@ -242,6 +242,15 @@ class acp_profile
$db->sql_freeresult($result);
add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident);
if ($request->is_ajax())
{
$json_response = new phpbb_json_response();
$json_response->send(array(
'text' => $user->lang('DEACTIVATE'),
));
}
trigger_error($user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action));
break;
@ -266,7 +275,16 @@ class acp_profile
$field_ident = (string) $db->sql_fetchfield('field_ident');
$db->sql_freeresult($result);
if ($request->is_ajax())
{
$json_response = new phpbb_json_response();
$json_response->send(array(
'text' => $user->lang('ACTIVATE'),
));
}
add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident);
trigger_error($user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action));
break;

View File

@ -24,7 +24,7 @@ class acp_ranks
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache;
global $db, $user, $auth, $template, $cache, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@ -122,6 +122,18 @@ class acp_ranks
$cache->destroy('_ranks');
add_log('admin', 'LOG_RANK_REMOVED', $rank_title);
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'],
'REFRESH_DATA' => array(
'time' => 3
)
));
}
}
else
{

View File

@ -0,0 +1,68 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\Event;
class phpbb_event_data extends Event implements ArrayAccess
{
private $data;
public function __construct(array $data = array())
{
$this->set_data($data);
}
public function set_data(array $data = array())
{
$this->data = $data;
}
public function get_data()
{
return $this->data;
}
/**
* Returns data filtered to only include specified keys.
*
* This effectively discards any keys added to data by hooks.
*/
public function get_data_filtered($keys)
{
return array_intersect_key($this->data, array_flip($keys));
}
public function offsetExists($offset)
{
return isset($this->data[$offset]);
}
public function offsetGet($offset)
{
return isset($this->data[$offset]) ? $this->data[$offset] : null;
}
public function offsetSet($offset, $value)
{
$this->data[$offset] = $value;
}
public function offsetUnset($offset)
{
unset($this->data[$offset]);
}
}

View File

@ -0,0 +1,42 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventDispatcher;
/**
* Extension of the Symfony2 EventDispatcher
*
* It provides an additional `trigger_event` method, which
* gives some syntactic sugar for dispatching events. Instead
* of creating the event object, the method will do that for
* you.
*
* Example:
*
* $vars = array('page_title');
* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
*
*/
class phpbb_event_dispatcher extends EventDispatcher
{
public function trigger_event($eventName, $data = array())
{
$event = new phpbb_event_data($data);
$this->dispatch($eventName, $event);
return $event->get_data_filtered(array_keys($data));
}
}

View File

@ -0,0 +1,46 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class phpbb_event_extension_subscriber_loader
{
private $dispatcher;
private $extension_manager;
public function __construct(EventDispatcherInterface $dispatcher, phpbb_extension_manager $extension_manager)
{
$this->dispatcher = $dispatcher;
$this->extension_manager = $extension_manager;
}
public function load()
{
$finder = $this->extension_manager->get_finder();
$subscriber_classes = $finder
->extension_directory('/event')
->suffix('listener')
->core_path('event/')
->get_classes();
foreach ($subscriber_classes as $class)
{
$subscriber = new $class();
$this->dispatcher->addSubscriber($subscriber);
}
}
}

View File

@ -0,0 +1,77 @@
<?php
/**
*
* @package extension
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Abstract class extended by extension front controller classes
*
* @package extension
*/
abstract class phpbb_extension_controller implements phpbb_extension_controller_interface
{
/**
* @var phpbb_request Request class object
*/
protected $request;
/**
* @var dbal DBAL class object
*/
protected $db;
/**
* @var user User class object
*/
protected $user;
/**
* @var phpbb_template Template class object
*/
protected $template;
/**
* @var array Config array
*/
protected $config;
/**
* @var string PHP Extension
*/
protected $phpEx;
/**
* @var string Relative path to board root
*/
protected $phpbb_root_path;
/**
* Constructor method that provides the common phpBB objects as inherited class
* properties for automatic availability in extension controllers
*/
public function __construct()
{
global $request, $db, $user, $template, $config;
global $phpEx, $phpbb_root_path;
$this->request = $request;
$this->db = $db;
$this->user = $user;
$this->template = $template;
$this->config = $config;
$this->phpEx = $phpEx;
$this->phpbb_root_path = $phpbb_root_path;
}
}

View File

@ -23,7 +23,7 @@ if (!defined('IN_PHPBB'))
interface phpbb_extension_controller_interface
{
/**
* handle the request to display a page from an extension
* Handle the request to display a page from an extension
*
* @return null
*/

View File

@ -2448,15 +2448,25 @@ function build_url($strip_vars = false)
*/
function meta_refresh($time, $url, $disable_cd_check = false)
{
global $template;
global $template, $refresh_data, $request;
$url = redirect($url, true, $disable_cd_check);
$url = str_replace('&', '&amp;', $url);
if ($request->is_ajax())
{
$refresh_data = array(
'time' => $time,
'url' => str_replace('&amp;', '&', $url)
);
}
else
{
$url = redirect($url, true, $disable_cd_check);
$url = str_replace('&', '&amp;', $url);
// For XHTML compatibility we change back & to &amp;
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
);
// For XHTML compatibility we change back & to &amp;
$template->assign_vars(array(
'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />')
);
}
return $url;
}
@ -2619,7 +2629,7 @@ function check_form_key($form_name, $timespan = false, $return_page = '', $trigg
*/
function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '')
{
global $user, $template, $db;
global $user, $template, $db, $request;
global $phpEx, $phpbb_root_path, $request;
if (isset($_POST['cancel']))
@ -2699,6 +2709,21 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
WHERE user_id = " . $user->data['user_id'];
$db->sql_query($sql);
if ($request->is_ajax())
{
$u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'],
'YES_VALUE' => $user->lang['YES'],
'S_CONFIRM_ACTION' => str_replace('&amp;', '&', $u_action), //inefficient, rewrite whole function
'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields
));
}
if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin'])
{
adm_page_footer();
@ -3723,7 +3748,7 @@ function phpbb_checkdnsrr($host, $type = 'MX')
*/
function msg_handler($errno, $msg_text, $errfile, $errline)
{
global $cache, $db, $auth, $template, $config, $user;
global $cache, $db, $auth, $template, $config, $user, $request;
global $phpEx, $phpbb_root_path, $msg_title, $msg_long_text;
// Do not display notices if we suppress them via @
@ -3922,6 +3947,20 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false)
);
if ($request->is_ajax())
{
global $refresh_data;
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $msg_title,
'MESSAGE_TEXT' => $msg_text,
'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false,
'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false,
'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null
));
}
// We do not want the cron script to be called on error messages
define('IN_CRON', true);
@ -4478,6 +4517,7 @@ function phpbb_http_login($param)
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
{
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
global $phpbb_dispatcher;
if (defined('HEADER_INC'))
{
@ -4761,6 +4801,9 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'A_COOKIE_SETTINGS' => addslashes('; path=' . $config['cookie_path'] . ((!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain']) . ((!$config['cookie_secure']) ? '' : '; secure')),
));
$vars = array('page_title', 'display_online_list', 'item_id', 'item');
extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars)));
// application/xhtml+xml not used because of IE
header('Content-type: text/html; charset=UTF-8');

View File

@ -1103,8 +1103,8 @@ function extension_allowed($forum_id, $extension, &$extensions)
* @param string $string The text to truncate to the given length. String is specialchared.
* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char)
* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars).
* @param bool $allow_reply Allow Re: in front of string
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated.
* @param bool $allow_reply Allow Re: in front of string
* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated.
* @param string $append String to be appended
*/
function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '')
@ -1258,6 +1258,22 @@ function get_username_string($mode, $user_id, $username, $username_colour = '',
return str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']);
}
/**
* Add an option to the quick-mod tools.
*
* @param string $option The language key for the value of the option.
* @param string $lang_string The language string to use.
*/
function phpbb_add_quickmod_option($option, $lang_string)
{
global $template, $user;
$lang_string = $user->lang($lang_string);
$template->assign_block_vars('quickmod', array(
'VALUE' => $option,
'TITLE' => $lang_string,
));
}
/**
* @package phpBB3
*/

View File

@ -273,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
markread('topics', $forum_ids);
$message = sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect . '">', '</a>');
meta_refresh(3, $redirect);
trigger_error($user->lang['FORUMS_MARKED'] . '<br /><br />' . $message);
}
else

View File

@ -0,0 +1,41 @@
<?php
/**
*
* @package phpBB3
* @copyright (c) 2011 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* JSON class
* @package phpBB3
*/
class phpbb_json_response
{
/**
* Send the data to the client and exit the script.
*
* @param array $data Any additional data to send.
* @param bool $exit Will exit the script if true.
*/
public function send($data, $exit = true)
{
header('Content-Type: application/json');
echo json_encode($data);
if ($exit)
{
garbage_collection();
exit_handler();
}
}
}

View File

@ -451,6 +451,7 @@ function approve_post($post_id_list, $id, $mode)
{
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path;
global $request;
if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
@ -709,7 +710,20 @@ function approve_post($post_id_list, $id, $mode)
$add_message = '<br /><br />' . sprintf($user->lang['RETURN_POST'], '<a href="' . $post_url . '">', '</a>');
}
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message);
$message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>') . $add_message;
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
'REFRESH_DATA' => null,
'approved' => true
));
}
trigger_error($message);
}
}
@ -968,7 +982,20 @@ function disapprove_post($post_id_list, $id, $mode)
}
else
{
$message = $user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>');
if ($request->is_ajax())
{
$json_response = new phpbb_json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
'REFRESH_DATA' => null,
'approved' => false
));
}
meta_refresh(3, $redirect);
trigger_error($user->lang[$success_msg] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], "<a href=\"$redirect\">", '</a>'));
trigger_error($message);
}
}

View File

@ -147,5 +147,36 @@ if (function_exists('date_default_timezone_set') && function_exists('date_defaul
date_default_timezone_set(@date_default_timezone_get());
}
// Autoloading of dependencies.
// Three options are supported:
// 1. If dependencies are installed with Composer, Composer will create a
// vendor/.composer/autoload.php. If this file exists it will be
// automatically used by phpBB. This is the default mode that phpBB
// will use when shipped.
// 2. To disable composer autoloading, PHPBB_NO_COMPOSER_AUTOLOAD can be specified.
// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the
// environment. This is useful for running CLI scripts and tests.
// /path/to/autoload.php should define and register class loaders
// for all of phpBB's dependencies.
// 3. You can also set PHPBB_NO_COMPOSER_AUTOLOAD without setting PHPBB_AUTOLOAD.
// In this case autoloading needs to be defined before running any phpBB
// script. This might be useful in cases when phpBB is integrated into a
// larger program.
if (getenv('PHPBB_NO_COMPOSER_AUTOLOAD'))
{
if (getenv('PHPBB_AUTOLOAD'))
{
require(getenv('PHPBB_AUTOLOAD'));
}
}
else
{
if (!file_exists($phpbb_root_path . 'vendor/.composer/autoload.php'))
{
trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR);
}
require($phpbb_root_path . 'vendor/.composer/autoload.php');
}
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];

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,8 +198,24 @@ class ucp_zebra
}
}
}
if ($updated)
if ($request->is_ajax())
{
$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>');