diff options
author | Vjacheslav Trushkin <arty@phpbb.com> | 2012-03-31 10:43:06 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <arty@phpbb.com> | 2012-03-31 10:43:06 +0300 |
commit | 398a6c8045113f14900bdea8c70ba032f75b45f6 (patch) | |
tree | 1a9ff30f5eeca6faf0adbd314b60caf1869079c5 /phpBB/includes/functions.php | |
parent | 506951e8aff98582ebc56fcda9ed0626497ade77 (diff) | |
parent | 013a8649a5164b90310e76d99fae2186b831a5f0 (diff) | |
download | forums-398a6c8045113f14900bdea8c70ba032f75b45f6.tar forums-398a6c8045113f14900bdea8c70ba032f75b45f6.tar.gz forums-398a6c8045113f14900bdea8c70ba032f75b45f6.tar.bz2 forums-398a6c8045113f14900bdea8c70ba032f75b45f6.tar.xz forums-398a6c8045113f14900bdea8c70ba032f75b45f6.zip |
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
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bd6272792b..99740b753b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -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('&', '&', $url); + if ($request->is_ajax()) + { + $refresh_data = array( + 'time' => $time, + 'url' => str_replace('&', '&', $url) + ); + } + else + { + $url = redirect($url, true, $disable_cd_check); + $url = str_replace('&', '&', $url); - // For XHTML compatibility we change back & to & - $template->assign_vars(array( - 'META' => '<meta http-equiv="refresh" content="' . $time . ';url=' . $url . '" />') - ); + // For XHTML compatibility we change back & to & + $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('&', '&', $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'); |