From 7a831c3e2844c94feb5fea2a4710816c5024623a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Wed, 6 Apr 2016 21:01:41 +0200 Subject: [ticket/14548] Move deprecated globals and functions PHPBB3-14584 --- phpBB/includes/compatibility_globals.php | 7 +++ phpBB/includes/constants.php | 3 - phpBB/includes/functions.php | 12 ---- phpBB/includes/functions_admin.php | 39 ------------- phpBB/includes/functions_compatibility.php | 90 ++++++++++++++++++++++++++++++ phpBB/includes/functions_display.php | 12 ---- phpBB/includes/functions_posting.php | 28 ---------- 7 files changed, 97 insertions(+), 94 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php index ad394e3782..223c8a0120 100644 --- a/phpBB/includes/compatibility_globals.php +++ b/phpBB/includes/compatibility_globals.php @@ -18,6 +18,13 @@ if (!defined('IN_PHPBB')) exit; } +// +// Deprecated globals +// +define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 + /** * Sets compatibility globals in the global scope * diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 89d056f2e1..041f4c5022 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -171,11 +171,8 @@ define('CONFIRM_REPORT', 4); // Categories - Attachments define('ATTACHMENT_CATEGORY_NONE', 0); define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images -define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 -define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files -define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 // BBCode UID length define('BBCODE_UID_LEN', 8); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5234c3472d..44c51eb1ad 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -51,18 +51,6 @@ function phpbb_load_extensions_autoloaders($phpbb_root_path) } } -/** -* Casts a variable to the given type. -* -* @deprecated -*/ -function set_var(&$result, $var, $type, $multibyte = false) -{ - // no need for dependency injection here, if you have the object, call the method yourself! - $type_cast_helper = new \phpbb\request\type_cast_helper(); - $type_cast_helper->set_var($result, $var, $type, $multibyte); -} - /** * Generates an alphanumeric random string of given length * diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index c19d48b0be..1f3fe1c8e8 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1160,28 +1160,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = return count($post_ids); } -/** -* Delete Attachments -* -* @deprecated 3.2.0-a1 (To be removed: 3.4.0) -* -* @param string $mode can be: post|message|topic|attach|user -* @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids -* @param bool $resync set this to false if you are deleting posts or topics -*/ -function delete_attachments($mode, $ids, $resync = true) -{ - global $phpbb_container; - - /** @var \phpbb\attachment\manager $attachment_manager */ - $attachment_manager = $phpbb_container->get('attachment.manager'); - $num_deleted = $attachment_manager->delete($mode, $ids, $resync); - - unset($attachment_manager); - - return $num_deleted; -} - /** * Deletes shadow topics pointing to a specified forum. * @@ -1293,23 +1271,6 @@ function update_posted_info(&$topic_ids) $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); } -/** -* Delete attached file -* -* @deprecated 3.2.0-a1 (To be removed: 3.4.0) -*/ -function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) -{ - global $phpbb_container; - - /** @var \phpbb\attachment\manager $attachment_manager */ - $attachment_manager = $phpbb_container->get('attachment.manager'); - $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed); - unset($attachment_manager); - - return $unlink; -} - /** * All-encompasing sync function * diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index e95fa40a58..51d9402558 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -511,3 +511,93 @@ function phpbb_pcre_utf8_support() { return true; } + +/** + * Casts a variable to the given type. + * + * @deprecated 3.3.0-dev (To be removed 3.4.0) + */ +function set_var(&$result, $var, $type, $multibyte = false) +{ + // no need for dependency injection here, if you have the object, call the method yourself! + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($result, $var, $type, $multibyte); +} + +/** + * Delete Attachments + * + * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + * + * @param string $mode can be: post|message|topic|attach|user + * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids + * @param bool $resync set this to false if you are deleting posts or topics + */ +function delete_attachments($mode, $ids, $resync = true) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $num_deleted = $attachment_manager->delete($mode, $ids, $resync); + + unset($attachment_manager); + + return $num_deleted; +} + +/** + * Delete attached file + * + * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + */ +function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed); + unset($attachment_manager); + + return $unlink; +} + +/** + * Display reasons + * + * @deprecated 3.2.0-dev (To be removed: 3.4.0) + */ +function display_reasons($reason_id = 0) +{ + global $phpbb_container; + + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); +} + +/** + * Upload Attachment - filedata is generated here + * Uses upload class + * + * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + * + * @param string $form_name The form name of the file upload input + * @param int $forum_id The id of the forum + * @param bool $local Whether the file is local or not + * @param string $local_storage The path to the local file + * @param bool $is_message Whether it is a PM or not + * @param array $local_filedata A filespec object created for the local file + * + * @return array File data array + */ +function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); + unset($attachment_manager); + + return $file; +} diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 792467019f..509c618b69 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1148,18 +1148,6 @@ function display_custom_bbcodes() $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); } -/** -* Display reasons -* -* @deprecated 3.2.0-dev -*/ -function display_reasons($reason_id = 0) -{ - global $phpbb_container; - - $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); -} - /** * Display user activity (action forum/topic) */ diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 3640f543d9..e2ab717217 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -397,34 +397,6 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) // // Attachment related functions // - -/** -* Upload Attachment - filedata is generated here -* Uses upload class -* -* @deprecated 3.2.0-a1 (To be removed: 3.4.0) -* -* @param string $form_name The form name of the file upload input -* @param int $forum_id The id of the forum -* @param bool $local Whether the file is local or not -* @param string $local_storage The path to the local file -* @param bool $is_message Whether it is a PM or not -* @param array $local_filedata A filespec object created for the local file -* -* @return array File data array -*/ -function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) -{ - global $phpbb_container; - - /** @var \phpbb\attachment\manager $attachment_manager */ - $attachment_manager = $phpbb_container->get('attachment.manager'); - $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); - unset($attachment_manager); - - return $file; -} - /** * Calculate the needed size for Thumbnail */ -- cgit v1.2.1 From cfaf24bd451afa717b92a409c71ca97f8a3bf0f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Bartus?= Date: Wed, 6 Apr 2016 22:44:31 +0200 Subject: [ticket/14584] Change all to be removed tags to 4.0 PHPBB3-14584 --- phpBB/includes/functions_compatibility.php | 38 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 51d9402558..b5b60e118e 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -22,7 +22,7 @@ if (!defined('IN_PHPBB')) /** * Get user avatar * -* @deprecated 3.1.0-a1 (To be removed: 3.3.0) +* @deprecated 3.1.0-a1 (To be removed: 4.0.0) * * @param string $avatar Users assigned avatar name * @param int $avatar_type Type of avatar @@ -50,7 +50,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ /** * Hash the password * -* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* @deprecated 3.1.0-a2 (To be removed: 4.0.0) * * @param string $password Password to be hashed * @@ -68,7 +68,7 @@ function phpbb_hash($password) /** * Check for correct password * -* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* @deprecated 3.1.0-a2 (To be removed: 4.0.0) * * @param string $password The password in plain text * @param string $hash The stored password hash @@ -92,7 +92,7 @@ function phpbb_check_hash($password, $hash) * @param string $path Path to clean * @return string Cleaned path * -* @deprecated 3.1.0 (To be removed: 3.3.0) +* @deprecated 3.1.0 (To be removed: 4.0.0) */ function phpbb_clean_path($path) { @@ -136,7 +136,7 @@ function phpbb_clean_path($path) * * @return string Returns the options for timezone selector only * -* @deprecated 3.1.0 (To be removed: 3.3.0) +* @deprecated 3.1.0 (To be removed: 4.0.0) */ function tz_select($default = '', $truncate = false) { @@ -150,7 +150,7 @@ function tz_select($default = '', $truncate = false) * via admin_permissions. Changes of usernames and group names * must be carried through for the moderators table. * -* @deprecated 3.1.0 (To be removed: 3.3.0) +* @deprecated 3.1.0 (To be removed: 4.0.0) * @return null */ function cache_moderators() @@ -162,7 +162,7 @@ function cache_moderators() /** * Removes moderators and administrators from foe lists. * -* @deprecated 3.1.0 (To be removed: 3.3.0) +* @deprecated 3.1.0 (To be removed: 4.0.0) * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore * @return null @@ -182,7 +182,7 @@ function update_foes($group_id = false, $user_id = false) * @param string &$rank_img the rank image as full img tag is stored here after execution * @param string &$rank_img_src the rank image source is stored here after execution * -* @deprecated 3.1.0-RC5 (To be removed: 3.3.0) +* @deprecated 3.1.0-RC5 (To be removed: 4.0.0) * * Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false */ @@ -232,7 +232,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port * * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. * - * @deprecated 3.1.0 (To be removed: 3.3.0) + * @deprecated 3.1.0 (To be removed: 4.0.0) */ function add_log() { @@ -280,7 +280,7 @@ function add_log() * * @return null * - * @deprecated 3.1.0 (To be removed: 3.3.0) + * @deprecated 3.1.0 (To be removed: 4.0.0) */ function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) { @@ -310,7 +310,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\con * * @return null * - * @deprecated 3.1.0 (To be removed: 3.3.0) + * @deprecated 3.1.0 (To be removed: 4.0.0) */ function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) { @@ -331,7 +331,7 @@ function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\ * See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for * documentation of this function's use. * - * @deprecated 3.1.0 (To be removed: 3.3.0) + * @deprecated 3.1.0 (To be removed: 4.0.0) * @param mixed $var_name The form variable's name from which data shall be retrieved. * If the value is an array this may be an array of indizes which will give * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") @@ -389,7 +389,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ /** * Get tables of a database * - * @deprecated 3.1.0 (To be removed: 3.3.0) + * @deprecated 3.1.0 (To be removed: 4.0.0) */ function get_tables($db) { @@ -492,7 +492,7 @@ function phpbb_realpath($path) * @param $number int|float The number we want to get the plural case for. Float numbers are floored. * @return int The plural-case we need to use for the number plural-rule combination * - * @deprecated 3.2.0-dev (To be removed: 3.3.0) + * @deprecated 3.2.0-dev (To be removed: 4.0.0) */ function phpbb_get_plural_form($rule, $number) { @@ -515,7 +515,7 @@ function phpbb_pcre_utf8_support() /** * Casts a variable to the given type. * - * @deprecated 3.3.0-dev (To be removed 3.4.0) + * @deprecated 3.1 (To be removed 4.0.0) */ function set_var(&$result, $var, $type, $multibyte = false) { @@ -527,7 +527,7 @@ function set_var(&$result, $var, $type, $multibyte = false) /** * Delete Attachments * - * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) * * @param string $mode can be: post|message|topic|attach|user * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids @@ -549,7 +549,7 @@ function delete_attachments($mode, $ids, $resync = true) /** * Delete attached file * - * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) */ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) { @@ -566,7 +566,7 @@ function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) /** * Display reasons * - * @deprecated 3.2.0-dev (To be removed: 3.4.0) + * @deprecated 3.2.0-dev (To be removed: 4.0.0) */ function display_reasons($reason_id = 0) { @@ -579,7 +579,7 @@ function display_reasons($reason_id = 0) * Upload Attachment - filedata is generated here * Uses upload class * - * @deprecated 3.2.0-a1 (To be removed: 3.4.0) + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) * * @param string $form_name The form name of the file upload input * @param int $forum_id The id of the forum -- cgit v1.2.1 From 4e3ac92d05c8e192ef8b794a4f3153b174d9bfd3 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 15 Aug 2016 17:34:33 +0200 Subject: [ticket/14573] Add UCP breadcrumbs PHPBB3-14573 --- phpBB/includes/functions_module.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 88dafc4300..8e9719adfa 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -933,6 +933,14 @@ class p_master 'U_TITLE' => $u_title ); + if (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) + { + $template->assign_block_vars('navlinks', array( + 'FORUM_NAME' => $item_ary['lang'], + 'U_VIEW_FORUM' => $u_title, + )); + } + $template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); } -- cgit v1.2.1 From 3e6fd7e8fd419ed999fe38ee48519dae98988081 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 14 May 2018 21:14:41 +0200 Subject: [ticket/15664] Ajaxify ext actions in ACP PHPBB3-15664 --- phpBB/includes/acp/acp_extensions.php | 149 ++++++++++++++++++++++++---------- 1 file changed, 107 insertions(+), 42 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index a1cb2108e7..f805eafeba 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -182,13 +182,19 @@ class acp_extensions redirect($this->u_action); } - $this->tpl_name = 'acp_ext_enable'; - - $this->template->assign_vars(array( - 'PRE' => true, - 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), - 'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name), - )); + if (confirm_box(true)) + { + redirect($this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'enable_pre', + 'ext_name' => $ext_name, + ))); + } break; case 'enable': @@ -215,9 +221,8 @@ class acp_extensions // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $start_time) >= $safe_time_limit) { - $this->template->assign_var('S_NEXT_STEP', true); - meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); + trigger_error('EXTENSION_ENABLE_IN_PROGRESS', E_USER_NOTICE); } } @@ -233,14 +238,22 @@ class acp_extensions } catch (\phpbb\db\migration\exception $e) { - $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); + trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING); } - $this->tpl_name = 'acp_ext_enable'; - - $this->template->assign_vars(array( - 'U_RETURN' => $this->u_action . '&action=list', - )); + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('enabled', [ + 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($ext_name), + ]); + + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'EXT_ENABLE_SUCCESS' => true, + 'ACTIONS' => $actions, + )); + } + trigger_error($this->user->lang('EXTENSION_ENABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; case 'disable_pre': @@ -249,13 +262,19 @@ class acp_extensions redirect($this->u_action); } - $this->tpl_name = 'acp_ext_disable'; - - $this->template->assign_vars(array( - 'PRE' => true, - 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), - 'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name), - )); + if (confirm_box(true)) + { + redirect($this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'disable_pre', + 'ext_name' => $ext_name, + ))); + } break; case 'disable': @@ -272,15 +291,25 @@ class acp_extensions $this->template->assign_var('S_NEXT_STEP', true); meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); + trigger_error('EXTENSION_DISABLE_IN_PROGRESS', E_USER_NOTICE); } } $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); - $this->tpl_name = 'acp_ext_disable'; - - $this->template->assign_vars(array( - 'U_RETURN' => $this->u_action . '&action=list', - )); + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('disabled', [ + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($ext_name), + 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($ext_name), + ]); + + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'EXT_DISABLE_SUCCESS' => true, + 'ACTIONS' => $actions, + )); + } + trigger_error($this->user->lang('EXTENSION_DISABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; case 'delete_data_pre': @@ -288,13 +317,20 @@ class acp_extensions { redirect($this->u_action); } - $this->tpl_name = 'acp_ext_delete_data'; - $this->template->assign_vars(array( - 'PRE' => true, - 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), - 'U_PURGE' => $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name), - )); + if (confirm_box(true)) + { + redirect($this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'delete_data_pre', + 'ext_name' => $ext_name, + ))); + } break; case 'delete_data': @@ -313,20 +349,29 @@ class acp_extensions $this->template->assign_var('S_NEXT_STEP', true); meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); + trigger_error('EXTENSION_DELETE_DATA_IN_PROGRESS', E_USER_NOTICE); } } $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); } catch (\phpbb\db\migration\exception $e) { - $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); + trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING); } - $this->tpl_name = 'acp_ext_delete_data'; - - $this->template->assign_vars(array( - 'U_RETURN' => $this->u_action . '&action=list', - )); + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('disabled', [ + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($ext_name), + ]); + + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'EXT_DELETE_DATA_SUCCESS' => true, + 'ACTIONS' => $actions, + )); + } + trigger_error($this->user->lang('EXTENSION_DELETE_DATA_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; case 'details': @@ -605,17 +650,37 @@ class acp_extensions * * @param string $block * @param array $actions + * @return array List of actions to be performed on the extension */ private function output_actions($block, $actions) { - foreach ($actions as $lang => $url) + $vars_ary = array(); + foreach ($actions as $lang => $options) { - $this->template->assign_block_vars($block . '.actions', array( + $url = $options; + if (is_array($options)) + { + $url = $options['url']; + } + + $vars = array( 'L_ACTION' => $this->user->lang('EXTENSION_' . $lang), 'L_ACTION_EXPLAIN' => (isset($this->user->lang['EXTENSION_' . $lang . '_EXPLAIN'])) ? $this->user->lang('EXTENSION_' . $lang . '_EXPLAIN') : '', 'U_ACTION' => $url, - )); + 'ACTION_AJAX' => 'ext_' . strtolower($lang), + ); + + if (isset($options['color'])) + { + $vars['COLOR'] = $options['color']; + } + + $this->template->assign_block_vars($block . '.actions', $vars); + + $vars_ary[] = $vars; } + + return $vars_ary; } /** -- cgit v1.2.1 From efc2e6e570abd4ccad2954a15307da12fdc90809 Mon Sep 17 00:00:00 2001 From: 3D-I Date: Thu, 8 Mar 2018 21:19:09 +0100 Subject: [ticket/15580] Remove redundant code from ACP PHPBB3-15580 --- phpBB/includes/acp/acp_board.php | 43 ++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index e348c769bd..083bd5adac 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -85,34 +85,25 @@ class acp_board $display_vars = array( 'title' => 'ACP_BOARD_FEATURES', 'vars' => array( - 'legend1' => 'ACP_BOARD_FEATURES', - 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'legend1' => 'ACP_BOARD_FEATURES', + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), - - 'legend2' => 'ACP_LOAD_SETTINGS', - 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), - 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), - 'legend3' => 'ACP_SUBMIT_CHANGES', + 'legend2' => 'ACP_SUBMIT_CHANGES', ) ); break; -- cgit v1.2.1 From 7dae1fe48c9d62643c88bf9ae251787be024afbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 29 Jun 2018 01:34:02 +0200 Subject: [ticket/15714] Auto login after registration PHPBB3-15714 --- phpBB/includes/ucp/ucp_register.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 0e673cb692..fc74f48025 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -451,6 +451,9 @@ class ucp_register { $message = $user->lang['ACCOUNT_ADDED']; $email_template = 'user_welcome'; + + // Autologin after registration + $user->session_create($user_id, 0, false, 1); } if ($config['email_enable']) -- cgit v1.2.1 From b4d4336ef4043a5b3381a9e70d3bbc6bc6732d07 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 18 Jun 2018 20:42:16 +0200 Subject: [ticket/12627] Add debug.sql_explain parameter PHPBB3-12627 --- phpBB/includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 44c51eb1ad..6046bf1d71 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4646,6 +4646,8 @@ function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $re */ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) { + global $phpbb_container; + $debug_info = array(); // Output page creation time @@ -4677,7 +4679,7 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $debug_info[] = 'Load: ' . $user->load; } - if ($auth->acl_get('a_')) + if ($auth->acl_get('a_') && $phpbb_container->getParameter('debug.sql_explain')) { $debug_info[] = 'SQL Explain'; } -- cgit v1.2.1 From 139eb17bb729763ab670fb239c77db02e29920f6 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 18 Jun 2018 20:35:01 +0200 Subject: [ticket/12624] Add debug.load_time parameter PHPBB3-12624 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 6046bf1d71..e352d8ba33 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4651,7 +4651,7 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $debug_info = array(); // Output page creation time - if (defined('PHPBB_DISPLAY_LOAD_TIME')) + if ($phpbb_container->getParameter('debug.load_time')) { if (isset($GLOBALS['starttime'])) { -- cgit v1.2.1 From 9f20ff7b9e998688c06737a546fbcaabd87b22ef Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Mon, 18 Jun 2018 19:46:37 +0200 Subject: [ticket/12591] Improve breadcrumb naming and extend it's usage PHPBB3-12591 --- phpBB/includes/functions_display.php | 28 ++++++++++++++-------------- phpBB/includes/functions_module.php | 4 ++-- 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 509c618b69..7fa32ce217 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -783,25 +783,25 @@ function generate_forum_nav(&$forum_data_ary) } $navlinks_parents[] = array( - 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, - 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, - 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, - 'FORUM_NAME' => $parent_name, - 'FORUM_ID' => $parent_forum_id, - 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id), + 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, + 'BREADCRUMB_NAME' => $parent_name, + 'FORUM_ID' => $parent_forum_id, + 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id), ); } } $navlinks = array( - 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, - 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, - 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, - 'FORUM_NAME' => $forum_data_ary['forum_name'], - 'FORUM_ID' => $forum_data_ary['forum_id'], - 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), + 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, + 'BREADCRUMB_NAME' => $forum_data_ary['forum_name'], + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), ); $forum_template_data = array( diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 8e9719adfa..9c4ee1a631 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -936,8 +936,8 @@ class p_master if (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) { $template->assign_block_vars('navlinks', array( - 'FORUM_NAME' => $item_ary['lang'], - 'U_VIEW_FORUM' => $u_title, + 'BREADCRUMB_NAME' => $item_ary['lang'], + 'U_BREADCRUMB' => $u_title, )); } -- cgit v1.2.1 From 688d022f421c584ea02fd554a3710b20cfd56de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 30 Jul 2018 13:58:52 +0200 Subject: [ticket/15738] Remove code related with safe_mode PHPBB3-15738 --- phpBB/includes/functions_posting.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e2ab717217..60ec54909c 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -613,12 +613,6 @@ function create_thumbnail($source, $destination, $mimetype) imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); } - // If we are in safe mode create the destination file prior to using the gd functions to circumvent a PHP bug - if (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') - { - @touch($destination); - } - switch ($type['format']) { case IMG_GIF: -- cgit v1.2.1 From 9e3141d9d3a26ed84a08730b3a36b6e75317b7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Thu, 2 Aug 2018 16:18:48 +0200 Subject: [ticket/15738] Remove deprecated variables from questionnaire PHPBB3-15738 --- phpBB/includes/questionnaire/questionnaire.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 2f80582918..f5a56fda82 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -110,7 +110,6 @@ class phpbb_questionnaire_php_data_provider 'version' => PHP_VERSION, 'sapi' => PHP_SAPI, 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', - 'safe_mode' => (int) @ini_get('safe_mode'), 'open_basedir' => (int) @ini_get('open_basedir'), 'memory_limit' => @ini_get('memory_limit'), 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'), @@ -121,8 +120,6 @@ class phpbb_questionnaire_php_data_provider 'disable_functions' => @ini_get('disable_functions'), 'disable_classes' => @ini_get('disable_classes'), 'enable_dl' => (int) @ini_get('enable_dl'), - 'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'), - 'register_globals' => (int) @ini_get('register_globals'), 'filter.default' => @ini_get('filter.default'), 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), 'unicode.semantics' => (int) @ini_get('unicode.semantics'), -- cgit v1.2.1 From 65b0698ef703cef92723cc5f5adb08989179a47d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 8 May 2018 14:30:32 +0200 Subject: [ticket/15663] Remove flash attachments support PHPBB3-15663 --- phpBB/includes/acp/acp_attachments.php | 2 -- phpBB/includes/functions_content.php | 20 -------------------- phpBB/includes/functions_download.php | 26 +++++++++----------------- 3 files changed, 9 insertions(+), 39 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 5b1db5c31b..5557ecc835 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -606,7 +606,6 @@ class acp_attachments $cat_lang = array( ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], ); $group_id = $request->variable('g', 0); @@ -1385,7 +1384,6 @@ class acp_attachments $types = array( ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], - ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], ); if ($group_id) diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index a15a03f966..05e9233240 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1245,11 +1245,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a $display_cat = ATTACHMENT_CATEGORY_NONE; } - if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) - { - $display_cat = ATTACHMENT_CATEGORY_NONE; - } - $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); $l_downloaded_viewed = 'VIEWED_COUNTS'; @@ -1281,21 +1276,6 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count_a $update_count_ary[] = $attachment['attach_id']; break; - // Macromedia Flash Files - case ATTACHMENT_CATEGORY_FLASH: - list($width, $height) = @getimagesize($filename); - - $block_array += array( - 'S_FLASH_FILE' => true, - 'WIDTH' => $width, - 'HEIGHT' => $height, - 'U_VIEW_LINK' => $download_link . '&view=1', - ); - - // Viewed/Heared File ... update the download count - $update_count_ary[] = $attachment['attach_id']; - break; - default: $l_downloaded_viewed = 'DOWNLOAD_COUNTS'; diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 7be12baa13..447e89c3bc 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -206,28 +206,20 @@ function send_file_to_browser($attachment, $upload_dir, $category) header('X-Content-Type-Options: nosniff'); } - if ($category == ATTACHMENT_CATEGORY_FLASH && $request->variable('view', 0) === 1) + if (empty($user->browser) || ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7))) { - // We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline - header('Content-Disposition: inline'); + header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + } } else { - if (empty($user->browser) || ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7))) - { - header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) - { - header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); - } - } - else + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (phpbb_is_greater_ie_version($user->browser, 7) && (strpos($attachment['mimetype'], 'image') !== 0)) { - header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); - if (phpbb_is_greater_ie_version($user->browser, 7) && (strpos($attachment['mimetype'], 'image') !== 0)) - { - header('X-Download-Options: noopen'); - } + header('X-Download-Options: noopen'); } } -- cgit v1.2.1 From 0a2589b5e0b6f953fc08c382f9da412805f48527 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Thu, 7 Jun 2018 14:56:46 +0200 Subject: [ticket/15663] Move constant to compatibility_globals PHPBB3-15663 --- phpBB/includes/compatibility_globals.php | 1 + phpBB/includes/constants.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/compatibility_globals.php b/phpBB/includes/compatibility_globals.php index 223c8a0120..15880d4bc8 100644 --- a/phpBB/includes/compatibility_globals.php +++ b/phpBB/includes/compatibility_globals.php @@ -24,6 +24,7 @@ if (!defined('IN_PHPBB')) define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files - @deprecated 3.3 /** * Sets compatibility globals in the global scope diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 041f4c5022..ba4856a1cc 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -172,7 +172,6 @@ define('CONFIRM_REPORT', 4); define('ATTACHMENT_CATEGORY_NONE', 0); define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts -define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files // BBCode UID length define('BBCODE_UID_LEN', 8); -- cgit v1.2.1 From 7c26569d93dc4f533f1c912b1ab9a4b72bdd8677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Tue, 10 Jul 2018 08:28:11 +0200 Subject: [ticket/15413] Login redirect to previous page PHPBB3-15413 --- phpBB/includes/functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e352d8ba33..95e3ae8cb1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4286,7 +4286,8 @@ function page_header($page_title = '', $display_online_list = false, $item_id = } else { - $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'); + $redirect = $request->variable('redirect', rawurlencode($user->page['page'])); + $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $redirect); $l_login_logout = $user->lang['LOGIN']; } -- cgit v1.2.1 From 3914515199ba9f3c2ce84e28b0a9a2c4e3dfb270 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Thu, 26 Jul 2018 16:34:11 +0200 Subject: [ticket/11838] OAuth registration from ucp_register PHPBB3-11838 --- phpBB/includes/ucp/ucp_register.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index fc74f48025..0e3ff50268 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -602,6 +602,31 @@ class ucp_register break; } + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); + + $auth_provider_data = $auth_provider->get_login_data(); + if ($auth_provider_data) + { + if (isset($auth_provider_data['VARS'])) + { + $template->assign_vars($auth_provider_data['VARS']); + } + + if (isset($auth_provider_data['BLOCK_VAR_NAME'])) + { + foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars); + } + } + + $template->assign_vars(array( + 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'], + )); + } + // Assign template vars for timezone select phpbb_timezone_select($template, $user, $data['tz'], true); -- cgit v1.2.1 From db36318ad0f0a12a63b83fe54526103f17f3ffdc Mon Sep 17 00:00:00 2001 From: rubencm Date: Sat, 15 Sep 2018 09:13:01 +0000 Subject: [ticket/15772] Hide warning in acp when allow_install_dir is true PHPBB3-15772 --- phpBB/includes/acp/acp_main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 8f169d15a7..27fac54777 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -657,7 +657,7 @@ class acp_main } // Warn if install is still present - if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) + if (!defined('IN_INSTALL') && !$phpbb_container->getParameter('allow_install_dir') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) { $template->assign_var('S_REMOVE_INSTALL', true); } -- cgit v1.2.1 From 917880e2bf3a43c6b20bda0f9295f4fb4e6ed127 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Tue, 17 Oct 2017 01:58:27 +0200 Subject: [ticket/15410] Remove obsolete code from BBCodes ACP PHPBB3-15410 --- phpBB/includes/acp/acp_bbcodes.php | 159 ++----------------------------------- 1 file changed, 5 insertions(+), 154 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 1f7374a07f..b59f9e3a39 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -451,144 +451,7 @@ class acp_bbcodes function build_regexp(&$bbcode_match, &$bbcode_tpl) { $bbcode_match = trim($bbcode_match); - $bbcode_tpl = trim($bbcode_tpl); - - // Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens - $utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match); - - $fp_match = preg_quote($bbcode_match, '!'); - $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match); - $fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); - - $sp_match = preg_quote($bbcode_match, '!'); - $sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match); - $sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match); - $sp_replace = $bbcode_tpl; - - // @todo Make sure to change this too if something changed in message parsing - $tokens = array( - 'URL' => array( - '!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie' => "\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')" - ), - 'LOCAL_URL' => array( - '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" - ), - 'RELATIVE_URL' => array( - '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" - ), - 'EMAIL' => array( - '!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')" - ), - 'TEXT' => array( - '!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '(', ')'), trim('\$1'))" - ), - 'SIMPLETEXT' => array( - '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" - ), - 'INTTEXT' => array( - '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1" - ), - 'IDENTIFIER' => array( - '!([a-zA-Z0-9-_]+)!' => "$1" - ), - 'COLOR' => array( - '!([a-z]+|#[0-9abcdef]+)!i' => '$1' - ), - 'NUMBER' => array( - '!([0-9]+)!' => '$1' - ) - ); - - $sp_tokens = array( - 'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)', - 'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', - 'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', - 'EMAIL' => '(' . get_preg_expression('email') . ')', - 'TEXT' => '(.*?)', - 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)', - 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', - 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', - 'NUMBER' => '([0-9]+)', - ); - - $pad = 0; - $modifiers = 'i'; - $modifiers .= ($utf8) ? 'u' : ''; - - if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) - { - foreach ($m[0] as $n => $token) - { - $token_type = $m[1][$n]; - - reset($tokens[strtoupper($token_type)]); - list($match, $replace) = each($tokens[strtoupper($token_type)]); - - // Pad backreference numbers from tokens - if (preg_match_all('/(?lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } - $fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { - return strtolower($match[0]); - }, $fp_match); - $fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { - return strtolower($match[0]); - }, $fp_replace); - $sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { - return strtolower($match[0]); - }, $sp_match); - $sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { - return strtolower($match[0]); - }, $sp_replace); - return array( 'bbcode_tag' => $bbcode_tag, - 'first_pass_match' => $fp_match, - 'first_pass_replace' => $fp_replace, - 'second_pass_match' => $sp_match, - 'second_pass_replace' => $sp_replace + 'first_pass_match' => '/(?!)/', + 'first_pass_replace' => '', + // Use a non-matching, valid regexp to effectively disable this BBCode + 'second_pass_match' => '/(?!)/', + 'second_pass_replace' => '' ); } } -- cgit v1.2.1 From 4f402465bf41c88876a499cacfc6bdc1762dfe44 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 1 Aug 2018 15:05:10 +0200 Subject: [ticket/12628] Introduce debug.memory Also fix one debug.sql_explain missing from the previous PR PHPBB3-12628 --- phpBB/includes/functions.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 95e3ae8cb1..b30f500a4e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4629,7 +4629,9 @@ function page_header($page_title = '', $display_online_list = false, $item_id = */ function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db) { - if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG')) + global $phpbb_container; + + if ($phpbb_container->getParameter('debug.sql_explain') && $request->variable('explain', false) && $auth->acl_get('a_')) { $db->sql_report('display'); } @@ -4659,9 +4661,10 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $totaltime = microtime(true) - $GLOBALS['starttime']; $debug_info[] = sprintf('Time: %.3fs', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); } + } - $debug_info[] = sprintf('Queries: %d', $db->sql_num_queries(true), $db->sql_num_queries()); - + if ($phpbb_container->getParameter('debug.memory')) + { $memory_usage = memory_get_peak_usage(); if ($memory_usage) { @@ -4669,18 +4672,20 @@ function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \php $debug_info[] = 'Peak Memory Usage: ' . $memory_usage; } - } - if (defined('DEBUG')) - { $debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off'); if ($user->load) { $debug_info[] = 'Load: ' . $user->load; } + } + + if ($phpbb_container->getParameter('debug.sql_explain')) + { + $debug_info[] = sprintf('Queries: %d', $db->sql_num_queries(true), $db->sql_num_queries()); - if ($auth->acl_get('a_') && $phpbb_container->getParameter('debug.sql_explain')) + if ($auth->acl_get('a_')) { $debug_info[] = 'SQL Explain'; } -- cgit v1.2.1 From ba088f6bdc2d8dcf48f93646b13108c64124ba1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Sat, 1 Sep 2018 01:47:10 +0200 Subject: [ticket/12629] Add debug.errors_show PHPBB3-12629 --- phpBB/includes/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b30f500a4e..1bc4ae2ee4 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3320,6 +3320,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) { global $cache, $db, $auth, $template, $config, $user, $request; global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log; + global $phpbb_container; // Do not display notices if we suppress them via @ if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) @@ -3340,7 +3341,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL - if (($errno & ((defined('DEBUG')) ? E_ALL : error_reporting())) == 0) + if (($errno & ($phpbb_container->getParameter('debug.errors_show') ? E_ALL : error_reporting())) == 0) { return; } @@ -3398,7 +3399,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $log_text .= '

BACKTRACE
' . $backtrace; } - if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_')) + if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.errors_show') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; -- cgit v1.2.1 From 6643c904d52563e26e8a92338c45f38cd5e0167f Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 13 Sep 2018 14:40:47 +0000 Subject: [ticket/12629] Rename errors_show to show_errors PHPBB3-12629 --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 1bc4ae2ee4..c3108f6f8e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3341,7 +3341,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) // Check the error reporting level and return if the error level does not match // If DEBUG is defined the default level is E_ALL - if (($errno & ($phpbb_container->getParameter('debug.errors_show') ? E_ALL : error_reporting())) == 0) + if (($errno & ($phpbb_container->getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0) { return; } @@ -3399,7 +3399,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $log_text .= '

BACKTRACE
' . $backtrace; } - if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.errors_show') || isset($auth) && $auth->acl_get('a_')) + if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.show_errors') || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; -- cgit v1.2.1 From e76c673e2e6a379ae7c4beccabfaaf8a5eb18371 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 30 Dec 2018 12:31:26 +0100 Subject: [ticket/14948] Update requirements and travis build matrix PHPBB3-14948 --- phpBB/includes/startup.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 66f85657a5..d42ae58c42 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -23,11 +23,11 @@ $level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; error_reporting($level); /** -* Minimum Requirement: PHP 5.4.0 +* Minimum Requirement: PHP 7.1.0 */ -if (version_compare(PHP_VERSION, '5.4') < 0) +if (version_compare(PHP_VERSION, '7.1') < 0) { - die('You are running an unsupported PHP version. Please upgrade to PHP 5.4.0 or higher before trying to install or update to phpBB 3.2'); + die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.0 or higher before trying to install or update to phpBB 3.3'); } // Register globals and magic quotes have been dropped in PHP 5.4 so no need for extra checks -- cgit v1.2.1 From 3c0fd43f85db757a486afb0fd0c6482224b8ab5b Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 30 Dec 2018 17:32:40 +0100 Subject: [ticket/14948] Use continue 2 instead of continue to continue while loop PHPBB3-14948 --- phpBB/includes/functions_compress.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index e86da77b38..56d64d37fb 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -305,8 +305,8 @@ class compress_zip extends compress } } } - // This is a directory, we are not writting files - continue; + // This is a directory, we are not writing files + continue 2; } else { -- cgit v1.2.1 From 3f33d8957288ee988e6e276ec8cb2042eb921627 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 11 May 2019 13:40:47 +0200 Subject: [ticket/16052] Fix issues caused by merges PHPBB3-16052 --- phpBB/includes/acp/acp_extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index f805eafeba..2929de3c4f 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -38,7 +38,7 @@ class acp_extensions private $phpbb_container; private $php_ini; - function main() + function main($id, $mode) { // Start the page global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher, $phpbb_container; -- cgit v1.2.1 From 89ae1c3221c40b6394aa5da6bfc87d2f19ae4c9a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 11 May 2019 17:30:43 +0200 Subject: [ticket/16052] Update version numbers to 3.3 PHPBB3-16052 --- phpBB/includes/constants.php | 2 +- phpBB/includes/functions_module.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ba4856a1cc..9f7a325a2b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.2.8-dev'); +@define('PHPBB_VERSION', '3.3.0-b1-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 9c4ee1a631..510d98ec11 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -123,7 +123,7 @@ class p_master // We "could" build a true tree with this function - maybe mod authors want to use this... // Functions for traversing and manipulating the tree are not available though - // We might re-structure the module system to use true trees in 3.2.x... + // We might re-structure the module system to use true trees in 4.0 // $tree = $this->build_tree($this->module_cache['modules'], $this->module_cache['parents']); // Clean up module cache array to only let survive modules the user can access -- cgit v1.2.1 From 3f852a3233b2ee51c3fab7dc6d077778fd35e0fd Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 8 Aug 2019 22:01:51 +0200 Subject: [ticket/11327] Move UCP remind functionality to a controller for password reset PHPBB3-11327 --- phpBB/includes/functions.php | 5 +- phpBB/includes/ucp/ucp_remind.php | 174 -------------------------------------- 2 files changed, 4 insertions(+), 175 deletions(-) delete mode 100644 phpBB/includes/ucp/ucp_remind.php (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2aa98b384e..5ac26b450e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2519,11 +2519,14 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $s_hidden_fields = build_hidden_fields($s_hidden_fields); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + $login_box_template_data = array( 'LOGIN_ERROR' => $err, 'LOGIN_EXPLAIN' => $l_explain, - 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', + 'U_SEND_PASSWORD' => ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_reset_password_controller') : '', 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php deleted file mode 100644 index e50428bfea..0000000000 --- a/phpBB/includes/ucp/ucp_remind.php +++ /dev/null @@ -1,174 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* ucp_remind -* Sending password reminders -*/ -class ucp_remind -{ - var $u_action; - - function main($id, $mode) - { - global $config, $phpbb_root_path, $phpEx, $request; - global $db, $user, $template, $phpbb_container, $phpbb_dispatcher; - - if (!$config['allow_password_reset']) - { - trigger_error($user->lang('UCP_PASSWORD_RESET_DISABLED', '', '')); - } - - $username = $request->variable('username', '', true); - $email = strtolower($request->variable('email', '')); - $submit = (isset($_POST['submit'])) ? true : false; - - add_form_key('ucp_remind'); - - if ($submit) - { - if (!check_form_key('ucp_remind')) - { - trigger_error('FORM_INVALID'); - } - - if (empty($email)) - { - trigger_error('NO_EMAIL_USER'); - } - - $sql_array = array( - 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason', - 'FROM' => array(USERS_TABLE => 'u'), - 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'" . - (!empty($username) ? " AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : ''), - ); - - /** - * Change SQL query for fetching user data - * - * @event core.ucp_remind_modify_select_sql - * @var string email User's email from the form - * @var string username User's username from the form - * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE - * @since 3.1.11-RC1 - */ - $vars = array( - 'email', - 'username', - 'sql_array', - ); - extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars))); - - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, 2); // don't waste resources on more rows than we need - $rowset = $db->sql_fetchrowset($result); - - if (count($rowset) > 1) - { - $db->sql_freeresult($result); - - $template->assign_vars(array( - 'USERNAME_REQUIRED' => true, - 'EMAIL' => $email, - )); - } - else - { - $message = $user->lang['PASSWORD_UPDATED_IF_EXISTED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); - - if (empty($rowset)) - { - trigger_error($message); - } - - $user_row = $rowset[0]; - $db->sql_freeresult($result); - - if (!$user_row) - { - trigger_error($message); - } - - if ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE) - { - trigger_error($message); - } - - // Check users permissions - $auth2 = new \phpbb\auth\auth(); - $auth2->acl($user_row); - - if (!$auth2->acl_get('u_chgpasswd')) - { - trigger_error($message); - } - - $server_url = generate_board_url(); - - // Make password at least 8 characters long, make it longer if admin wants to. - // gen_rand_string() however has a limit of 12 or 13. - $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); - - // For the activation key a random length between 6 and 10 will do. - $user_actkey = gen_rand_string(mt_rand(6, 10)); - - // Instantiate passwords manager - /* @var $manager \phpbb\passwords\manager */ - $passwords_manager = $phpbb_container->get('passwords.manager'); - - $sql = 'UPDATE ' . USERS_TABLE . " - SET user_newpasswd = '" . $db->sql_escape($passwords_manager->hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "' - WHERE user_id = " . $user_row['user_id']; - $db->sql_query($sql); - - include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); - - $messenger = new messenger(false); - - $messenger->template('user_activate_passwd', $user_row['user_lang']); - - $messenger->set_addresses($user_row); - - $messenger->anti_abuse_headers($config, $user); - - $messenger->assign_vars(array( - 'USERNAME' => htmlspecialchars_decode($user_row['username']), - 'PASSWORD' => htmlspecialchars_decode($user_password), - 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") - ); - - $messenger->send($user_row['user_notify_type']); - - trigger_error($message); - } - } - - $template->assign_vars(array( - 'USERNAME' => $username, - 'EMAIL' => $email, - 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=sendpassword')) - ); - - $this->tpl_name = 'ucp_remind'; - $this->page_title = 'UCP_REMIND'; - } -} -- cgit v1.2.1 From 0a5599697fb9d52f067ac1846492641cf1adc05a Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 9 Aug 2019 22:51:51 +0200 Subject: [ticket/11327] Split up into forgot password and reset password PHPBB3-11327 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5ac26b450e..e8f8b0ff46 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2526,7 +2526,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa 'LOGIN_ERROR' => $err, 'LOGIN_EXPLAIN' => $l_explain, - 'U_SEND_PASSWORD' => ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_reset_password_controller') : '', + 'U_SEND_PASSWORD' => ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_forgot_password_controller') : '', 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), -- cgit v1.2.1 From 975fe1e153c35d7079d06655c43303b04a6502a7 Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Wed, 27 Mar 2019 12:09:55 +0100 Subject: [ticket/15257] Provide extension not enableable messages PHPBB3-15257 --- phpBB/includes/acp/acp_extensions.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 2929de3c4f..da03b576bf 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -172,10 +172,8 @@ class acp_extensions } $extension = $this->ext_manager->get_extension($ext_name); - if (!$extension->is_enableable()) - { - trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); - } + + $this->check_is_enableable($extension->is_enableable()); if ($this->ext_manager->is_enabled($ext_name)) { @@ -209,10 +207,8 @@ class acp_extensions } $extension = $this->ext_manager->get_extension($ext_name); - if (!$extension->is_enableable()) - { - trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); - } + + $this->check_is_enableable($extension->is_enableable()); try { @@ -727,4 +723,14 @@ class acp_extensions )); } } + + protected function check_is_enableable($enableable) + { + if ($enableable !== true) + { + $message = !empty($enableable) ? $enableable : $this->user->lang('EXTENSION_NOT_ENABLEABLE'); + $message = is_array($message) ? implode('
', $message) : $message; + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + } } -- cgit v1.2.1 From d7c644a7923783f875ed7820d52388c8d9f765fb Mon Sep 17 00:00:00 2001 From: Jakub Senko Date: Fri, 12 Apr 2019 12:36:37 +0200 Subject: [ticket/15257] Address validation issues PHPBB3-15257 --- phpBB/includes/acp/acp_extensions.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index da03b576bf..a9cbb8956b 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -724,6 +724,13 @@ class acp_extensions } } + /** + * Checks whether the extension can be enabled. Triggers error if not. + * Error message can be set by the extension. + * + * @param bool|array $enableable True if extension is enableable, array of reasons + * if not, false for generic reason. + */ protected function check_is_enableable($enableable) { if ($enableable !== true) -- cgit v1.2.1 From e54aa94e7714483f0f5ef8c18e21317a1f0524f6 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 30 Sep 2019 21:21:50 +0200 Subject: [ticket/15257] Improve readability of check_is_enableable PHPBB3-15257 --- phpBB/includes/acp/acp_extensions.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index a9cbb8956b..6ac70ce3a8 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -173,7 +173,7 @@ class acp_extensions $extension = $this->ext_manager->get_extension($ext_name); - $this->check_is_enableable($extension->is_enableable()); + $this->check_is_enableable($extension); if ($this->ext_manager->is_enabled($ext_name)) { @@ -208,7 +208,7 @@ class acp_extensions $extension = $this->ext_manager->get_extension($ext_name); - $this->check_is_enableable($extension->is_enableable()); + $this->check_is_enableable($extension); try { @@ -728,15 +728,22 @@ class acp_extensions * Checks whether the extension can be enabled. Triggers error if not. * Error message can be set by the extension. * - * @param bool|array $enableable True if extension is enableable, array of reasons - * if not, false for generic reason. + * @param \phpbb\extension\extension_interface $extension Extension to check */ - protected function check_is_enableable($enableable) + protected function check_is_enableable(\phpbb\extension\extension_interface $extension) { - if ($enableable !== true) + $message = $extension->is_enableable(); + if ($message !== true) { - $message = !empty($enableable) ? $enableable : $this->user->lang('EXTENSION_NOT_ENABLEABLE'); - $message = is_array($message) ? implode('
', $message) : $message; + if (empty($message)) + { + $message = $this->user->lang('EXTENSION_NOT_ENABLEABLE'); + } + else if (is_array($message)) + { + $message = implode('
', $message); + } + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); } } -- cgit v1.2.1 From 60bc949ba1d5a6851e525868f69e997d4c8a2075 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 3 Oct 2019 23:05:02 +0200 Subject: [ticket/14465] Remove setting for maximum password length PHPBB3-14465 --- phpBB/includes/acp/acp_board.php | 6 ++---- phpBB/includes/acp/acp_users.php | 6 +++--- phpBB/includes/questionnaire/questionnaire.php | 1 - phpBB/includes/ucp/ucp_profile.php | 6 +++--- phpBB/includes/ucp/ucp_register.php | 6 +++--- 5 files changed, 11 insertions(+), 14 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7cbd0903bd..05871e4157 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -254,7 +254,6 @@ class acp_board 'vars' => array( 'legend1' => 'GENERAL_SETTINGS', 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,), - 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), @@ -417,7 +416,6 @@ class acp_board 'remote_upload_verify' => array('lang' => 'UPLOAD_CERT_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), @@ -895,13 +893,13 @@ class acp_board } /** - * Maximum/Minimum password length + * Minimum password length */ function password_length($value, $key) { global $user; - return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + return ' ' . $user->lang['MIN_CHARS']; } /** diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index fd4b5e8c24..1b66943490 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -844,9 +844,9 @@ class acp_users // Validation data - we do not check the password complexity setting here $check_ary = array( 'new_password' => array( - array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', true, $config['min_pass_chars'], 0), array('password')), - 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', true, $config['min_pass_chars'], 0), ); // Check username if altered @@ -1130,7 +1130,7 @@ class acp_users $template->assign_vars(array( 'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), - 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index f5a56fda82..95036a95bc 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -402,7 +402,6 @@ class phpbb_questionnaire_phpbb_data_provider 'max_login_attempts' => true, 'max_name_chars' => true, 'max_num_search_keywords' => true, - 'max_pass_chars' => true, 'max_poll_options' => true, 'max_post_chars' => true, 'max_post_font_size' => true, diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 36ab3d0463..6d98362e08 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -70,9 +70,9 @@ class ucp_profile // Do not check cur_password, it is the old one. $check_ary = array( 'new_password' => array( - array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', true, $config['min_pass_chars'], 0), array('password')), - 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', true, $config['min_pass_chars'], 0), 'email' => array( array('string', false, 6, 60), array('user_email')), @@ -267,7 +267,7 @@ class ucp_profile 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), - 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false, 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 0e3ff50268..97d2631224 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -275,9 +275,9 @@ class ucp_register array('string', false, $config['min_name_chars'], $config['max_name_chars']), array('username', '')), 'new_password' => array( - array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + array('string', false, $config['min_pass_chars'], 0), array('password')), - 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + 'password_confirm' => array('string', false, $config['min_pass_chars'], 0), 'email' => array( array('string', false, 6, 60), array('user_email')), @@ -638,7 +638,7 @@ class ucp_register 'L_REG_COND' => $l_reg_cond, 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), - 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_TZ_PRESELECT' => !$submit, -- cgit v1.2.1 From bd02c5bd085e957aa4341e7fc2df2199081ab069 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 6 Oct 2019 12:07:35 +0200 Subject: [ticket/16051] Remove mysql driver as it's no longer supported in PHP >= 7.0 PHPBB3-16051 --- phpBB/includes/acp/acp_database.php | 2 -- phpBB/includes/acp/acp_forums.php | 1 - phpBB/includes/acp/acp_reasons.php | 2 -- phpBB/includes/functions_admin.php | 6 +----- phpBB/includes/functions_convert.php | 5 ----- 5 files changed, 1 insertion(+), 15 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 677fce7217..c1c748832b 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -248,8 +248,6 @@ class acp_database switch ($db->get_sql_layer()) { - case 'mysql': - case 'mysql4': case 'mysqli': case 'sqlite3': while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index cb0593b14a..9044cd0e97 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1878,7 +1878,6 @@ class acp_forums switch ($db->get_sql_layer()) { - case 'mysql4': case 'mysqli': // Delete everything else and thank MySQL for offering multi-table deletion diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index dfb2ccbfd3..f3f82bdfca 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -222,8 +222,6 @@ class acp_reasons { // The ugly one! case 'mysqli': - case 'mysql4': - case 'mysql': // Change the reports using this reason to 'other' $sql = 'UPDATE ' . REPORTS_TABLE . ' SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ce5f0812aa..4629706048 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1384,7 +1384,6 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $db->sql_transaction('begin'); switch ($db->get_sql_layer()) { - case 'mysql4': case 'mysqli': $sql = 'DELETE FROM ' . TOPICS_TABLE . ' USING ' . TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 @@ -2683,8 +2682,7 @@ function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) switch ($db->get_sql_layer()) { case 'mysqli': - case 'mysql4': - $sql = 'DELETE ' . (($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . ' + $sql = 'DELETE z.* FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug WHERE z.zebra_id = ug.user_id AND z.foe = 1 @@ -2840,8 +2838,6 @@ function get_database_size() // This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0 switch ($db->get_sql_layer()) { - case 'mysql': - case 'mysql4': case 'mysqli': $sql = 'SELECT VERSION() AS mysql_version'; $result = $db->sql_query($sql); diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 2cfbe9541d..13e01afe51 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1647,11 +1647,6 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) case 'insert': switch ($db->get_sql_layer()) { - case 'mysql': - case 'mysql4': - $sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary)); - break; - case 'sqlite3': case 'mssqlnative': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); -- cgit v1.2.1 From 32cc32c76ae39e020b62779b0c5cebb1da83e749 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 19 Oct 2019 15:13:53 +0200 Subject: [prep-release-3.3.0-b1] Update version to 3.3.0-b1 --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 9f7a325a2b..a817ec1e72 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-b1-dev'); +@define('PHPBB_VERSION', '3.3.0-b1'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From 465d0b1a4c665468e188381f6e83376bfde9422a Mon Sep 17 00:00:00 2001 From: Paul Sohier Date: Fri, 3 May 2019 22:45:53 +0200 Subject: [ticket/16043] Check if not null before getting anything from the container This is only happening when there is basicly an error during init of the container. PHPBB3-16043 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e1f6fa3d1b..c2f173b345 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3395,7 +3395,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $log_text .= '

BACKTRACE
' . $backtrace; } - if (defined('IN_INSTALL') || $phpbb_container->getParameter('debug.show_errors') || isset($auth) && $auth->acl_get('a_')) + if (defined('IN_INSTALL') || ($phpbb_container != null && $phpbb_container->getParameter('debug.show_errors')) || isset($auth) && $auth->acl_get('a_')) { $msg_text = $log_text; -- cgit v1.2.1 From e78632767c3c9eb9fc8c2757d3e6e8b5f1d60ced Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sun, 20 Oct 2019 21:35:45 +0200 Subject: [ticket/15437] Rename jquery.min.js to jquery-3.4.1.min.js PHPBB3-15437 --- phpBB/includes/functions.php | 2 +- phpBB/includes/functions_acp.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index e1f6fa3d1b..e2eca625f0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4559,7 +4559,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'], 'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], - 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.min.js?assets_version=" . $config['assets_version'], + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery-3.4.1.min.js?assets_version=" . $config['assets_version'], 'S_ALLOW_CDN' => !empty($config['allow_cdn']), 'S_COOKIE_NOTICE' => !empty($config['cookie_notice']), diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index a2014a7d5b..4926351461 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -177,7 +177,7 @@ function adm_page_footer($copyright_html = true) 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', 'S_COPYRIGHT_HTML' => $copyright_html, 'CREDIT_LINE' => $user->lang('POWERED_BY', 'phpBB® Forum Software © phpBB Limited'), - 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.min.js", + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery-3.4.1.min.js", 'S_ALLOW_CDN' => !empty($config['allow_cdn']), 'VERSION' => $config['version']) ); -- cgit v1.2.1 From 95880a5f4999e85d7a5dda2bfd592ddc9c231774 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 23 Oct 2019 21:00:01 +0200 Subject: [3.3.x] Update version numbers to 3.3.0-b2-dev --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index a817ec1e72..759bc94520 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-b1'); +@define('PHPBB_VERSION', '3.3.0-b2-dev'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From f985f42dc275a9cc935e590d25e3e9d4b763e50d Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 24 Oct 2019 21:15:23 +0000 Subject: [ticket/15958] Standarize create forums default options PHPBB3-15958 --- phpBB/includes/acp/acp_forums.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 9044cd0e97..af427eca04 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -131,11 +131,11 @@ class acp_forums 'forum_rules_link' => $request->variable('forum_rules_link', ''), 'forum_image' => $request->variable('forum_image', ''), 'forum_style' => $request->variable('forum_style', 0), - 'display_subforum_list' => $request->variable('display_subforum_list', false), - 'display_on_index' => $request->variable('display_on_index', false), + 'display_subforum_list' => $request->variable('display_subforum_list', true), + 'display_on_index' => $request->variable('display_on_index', true), 'forum_topics_per_page' => $request->variable('topics_per_page', 0), 'enable_indexing' => $request->variable('enable_indexing', true), - 'enable_icons' => $request->variable('enable_icons', false), + 'enable_icons' => $request->variable('enable_icons', true), 'enable_prune' => $request->variable('enable_prune', false), 'enable_post_review' => $request->variable('enable_post_review', true), 'enable_quick_reply' => $request->variable('enable_quick_reply', false), @@ -454,10 +454,10 @@ class acp_forums 'forum_image' => '', 'forum_style' => 0, 'display_subforum_list' => true, - 'display_on_index' => false, + 'display_on_index' => true, 'forum_topics_per_page' => 0, 'enable_indexing' => true, - 'enable_icons' => false, + 'enable_icons' => true, 'enable_prune' => false, 'prune_days' => 7, 'prune_viewed' => 7, -- cgit v1.2.1 From 163aac74dbe500eac223ea2ebdbce0a76c1d6ab4 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 31 Oct 2019 20:54:21 +0000 Subject: [ticket/16190] Deprecate phpbb's checkdnsrr wrapper PHPBB3-16190 --- phpBB/includes/functions.php | 166 ----------------------------- phpBB/includes/functions_compatibility.php | 22 ++++ phpBB/includes/functions_user.php | 2 +- 3 files changed, 23 insertions(+), 167 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3227a21e26..30f9734efd 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3141,172 +3141,6 @@ function phpbb_inet_pton($address) return false; } -/** -* Wrapper for php's checkdnsrr function. -* -* @param string $host Fully-Qualified Domain Name -* @param string $type Resource record type to lookup -* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME -* Other types may work or may not work -* -* @return mixed true if entry found, -* false if entry not found, -* null if this function is not supported by this environment -* -* Since null can also be returned, you probably want to compare the result -* with === true or === false, -*/ -function phpbb_checkdnsrr($host, $type = 'MX') -{ - // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) - if (substr($host, -1) == '.') - { - $host_fqdn = $host; - $host = substr($host, 0, -1); - } - else - { - $host_fqdn = $host . '.'; - } - // $host has format some.host.example.com - // $host_fqdn has format some.host.example.com. - - // If we're looking for an A record we can use gethostbyname() - if ($type == 'A' && function_exists('gethostbyname')) - { - return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true; - } - - if (function_exists('checkdnsrr')) - { - return checkdnsrr($host_fqdn, $type); - } - - if (function_exists('dns_get_record')) - { - // dns_get_record() expects an integer as second parameter - // We have to convert the string $type to the corresponding integer constant. - $type_constant = 'DNS_' . $type; - $type_param = (defined($type_constant)) ? constant($type_constant) : DNS_ANY; - - // dns_get_record() might throw E_WARNING and return false for records that do not exist - $resultset = @dns_get_record($host_fqdn, $type_param); - - if (empty($resultset) || !is_array($resultset)) - { - return false; - } - else if ($type_param == DNS_ANY) - { - // $resultset is a non-empty array - return true; - } - - foreach ($resultset as $result) - { - if ( - isset($result['host']) && $result['host'] == $host && - isset($result['type']) && $result['type'] == $type - ) - { - return true; - } - } - - return false; - } - - // If we're on Windows we can still try to call nslookup via exec() as a last resort - if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) - { - @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host_fqdn), $output); - - // If output is empty, the nslookup failed - if (empty($output)) - { - return NULL; - } - - foreach ($output as $line) - { - $line = trim($line); - - if (empty($line)) - { - continue; - } - - // Squash tabs and multiple whitespaces to a single whitespace. - $line = preg_replace('/\s+/', ' ', $line); - - switch ($type) - { - case 'MX': - if (stripos($line, "$host MX") === 0) - { - return true; - } - break; - - case 'NS': - if (stripos($line, "$host nameserver") === 0) - { - return true; - } - break; - - case 'TXT': - if (stripos($line, "$host text") === 0) - { - return true; - } - break; - - case 'CNAME': - if (stripos($line, "$host canonical name") === 0) - { - return true; - } - break; - - default: - case 'AAAA': - // AAAA records returned by nslookup on Windows XP/2003 have this format. - // Later Windows versions use the A record format below for AAAA records. - if (stripos($line, "$host AAAA IPv6 address") === 0) - { - return true; - } - // No break - - case 'A': - if (!empty($host_matches)) - { - // Second line - if (stripos($line, "Address: ") === 0) - { - return true; - } - else - { - $host_matches = false; - } - } - else if (stripos($line, "Name: $host") === 0) - { - // First line - $host_matches = true; - } - break; - } - } - - return false; - } - - return NULL; -} - // Handler, header and footer /** diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index b5b60e118e..1f9131c9c0 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -601,3 +601,25 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage return $file; } + +/** +* Wrapper for php's checkdnsrr function. +* +* @param string $host Fully-Qualified Domain Name +* @param string $type Resource record type to lookup +* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME +* Other types may work or may not work +* +* @return mixed true if entry found, +* false if entry not found, +* null if this function is not supported by this environment +* +* Since null can also be returned, you probably want to compare the result +* with === true or === false, +* +* @deprecated 3.3.0-b2 (To be removed: 4.0.0) +*/ +function phpbb_checkdnsrr($host, $type = 'MX') +{ + return checkdnsrr($host, $type); +} diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index e0b6a9d0c6..7dd850111e 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1910,7 +1910,7 @@ function phpbb_validate_email($email, $config = null) { list(, $domain) = explode('@', $email); - if (phpbb_checkdnsrr($domain, 'A') === false && phpbb_checkdnsrr($domain, 'MX') === false) + if (checkdnsrr($domain, 'A') === false && checkdnsrr($domain, 'MX') === false) { return 'DOMAIN_NO_MX_RECORD'; } -- cgit v1.2.1 From f09f5bc51c15eef526374105d6443270dc1172bf Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 24 Oct 2019 19:32:47 +0000 Subject: [ticket/16189] Deprecate inet_ntop and inet_pton wrappers PHPBB3-16189 --- phpBB/includes/functions.php | 160 ++--------------------------- phpBB/includes/functions_compatibility.php | 148 ++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 150 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 30f9734efd..b4090c6a40 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2980,165 +2980,25 @@ function short_ipv6($ip, $length) * @return mixed false if specified address is not valid, * string otherwise */ -function phpbb_ip_normalise($address) +function phpbb_ip_normalise(string $address) { - $address = trim($address); + $ip_normalised = false; - if (empty($address) || !is_string($address)) + if(filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { - return false; + $ip_normalised = $address; } - - if (preg_match(get_preg_expression('ipv4'), $address)) + else if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { - return $address; - } - - return phpbb_inet_ntop(phpbb_inet_pton($address)); -} - -/** -* Wrapper for inet_ntop() -* -* Converts a packed internet address to a human readable representation -* inet_ntop() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. -* -* @param string $in_addr A 32bit IPv4, or 128bit IPv6 address. -* -* @return mixed false on failure, -* string otherwise -*/ -function phpbb_inet_ntop($in_addr) -{ - $in_addr = bin2hex($in_addr); - - switch (strlen($in_addr)) - { - case 8: - return implode('.', array_map('hexdec', str_split($in_addr, 2))); - - case 32: - if (substr($in_addr, 0, 24) === '00000000000000000000ffff') - { - return phpbb_inet_ntop(pack('H*', substr($in_addr, 24))); - } - - $parts = str_split($in_addr, 4); - $parts = preg_replace('/^0+(?!$)/', '', $parts); - $ret = implode(':', $parts); + $ip_normalised = inet_ntop(inet_pton($address)); - $matches = array(); - preg_match_all('/(?<=:|^)(?::?0){2,}/', $ret, $matches, PREG_OFFSET_CAPTURE); - $matches = $matches[0]; - - if (empty($matches)) - { - return $ret; - } - - $longest_match = ''; - $longest_match_offset = 0; - foreach ($matches as $match) - { - if (strlen($match[0]) > strlen($longest_match)) - { - $longest_match = $match[0]; - $longest_match_offset = $match[1]; - } - } - - $ret = substr_replace($ret, '', $longest_match_offset, strlen($longest_match)); - - if ($longest_match_offset == strlen($ret)) - { - $ret .= ':'; - } - - if ($longest_match_offset == 0) - { - $ret = ':' . $ret; - } - - return $ret; - - default: - return false; - } -} - -/** -* Wrapper for inet_pton() -* -* Converts a human readable IP address to its packed in_addr representation -* inet_pton() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. -* -* @param string $address A human readable IPv4 or IPv6 address. -* -* @return mixed false if address is invalid, -* in_addr representation of the given address otherwise (string) -*/ -function phpbb_inet_pton($address) -{ - $ret = ''; - if (preg_match(get_preg_expression('ipv4'), $address)) - { - foreach (explode('.', $address) as $part) - { - $ret .= ($part <= 0xF ? '0' : '') . dechex($part); + // If is ipv4 + if(stripos($ip_normalised, '::ffff:') === 0) { + $ip_normalised = substr($ip_normalised, 7); } - - return pack('H*', $ret); } - if (preg_match(get_preg_expression('ipv6'), $address)) - { - $parts = explode(':', $address); - $missing_parts = 8 - count($parts) + 1; - - if (substr($address, 0, 2) === '::') - { - ++$missing_parts; - } - - if (substr($address, -2) === '::') - { - ++$missing_parts; - } - - $embedded_ipv4 = false; - $last_part = end($parts); - - if (preg_match(get_preg_expression('ipv4'), $last_part)) - { - $parts[count($parts) - 1] = ''; - $last_part = phpbb_inet_pton($last_part); - $embedded_ipv4 = true; - --$missing_parts; - } - - foreach ($parts as $i => $part) - { - if (strlen($part)) - { - $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); - } - else if ($i && $i < count($parts) - 1) - { - $ret .= str_repeat('0000', $missing_parts); - } - } - - $ret = pack('H*', $ret); - - if ($embedded_ipv4) - { - $ret .= $last_part; - } - - return $ret; - } - - return false; + return $ip_normalised; } // Handler, header and footer diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 1f9131c9c0..e93523914f 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -623,3 +623,151 @@ function phpbb_checkdnsrr($host, $type = 'MX') { return checkdnsrr($host, $type); } + +/* + * Wrapper for inet_ntop() + * + * Converts a packed internet address to a human readable representation + * inet_ntop() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. + * + * @param string $in_addr A 32bit IPv4, or 128bit IPv6 address. + * + * @return mixed false on failure, + * string otherwise + * + * @deprecated 3.2.9 (To be removed: 4.0.0) + */ +function phpbb_inet_ntop($in_addr) +{ + $in_addr = bin2hex($in_addr); + + switch (strlen($in_addr)) + { + case 8: + return implode('.', array_map('hexdec', str_split($in_addr, 2))); + + case 32: + if (substr($in_addr, 0, 24) === '00000000000000000000ffff') + { + return phpbb_inet_ntop(pack('H*', substr($in_addr, 24))); + } + + $parts = str_split($in_addr, 4); + $parts = preg_replace('/^0+(?!$)/', '', $parts); + $ret = implode(':', $parts); + + $matches = array(); + preg_match_all('/(?<=:|^)(?::?0){2,}/', $ret, $matches, PREG_OFFSET_CAPTURE); + $matches = $matches[0]; + + if (empty($matches)) + { + return $ret; + } + + $longest_match = ''; + $longest_match_offset = 0; + foreach ($matches as $match) + { + if (strlen($match[0]) > strlen($longest_match)) + { + $longest_match = $match[0]; + $longest_match_offset = $match[1]; + } + } + + $ret = substr_replace($ret, '', $longest_match_offset, strlen($longest_match)); + + if ($longest_match_offset == strlen($ret)) + { + $ret .= ':'; + } + + if ($longest_match_offset == 0) + { + $ret = ':' . $ret; + } + + return $ret; + + default: + return false; + } +} + +/** + * Wrapper for inet_pton() + * + * Converts a human readable IP address to its packed in_addr representation + * inet_pton() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. + * + * @param string $address A human readable IPv4 or IPv6 address. + * + * @return mixed false if address is invalid, + * in_addr representation of the given address otherwise (string) + * + * @deprecated 3.2.9 (To be removed: 4.0.0) + */ +function phpbb_inet_pton($address) +{ + $ret = ''; + if (preg_match(get_preg_expression('ipv4'), $address)) + { + foreach (explode('.', $address) as $part) + { + $ret .= ($part <= 0xF ? '0' : '') . dechex($part); + } + + return pack('H*', $ret); + } + + if (preg_match(get_preg_expression('ipv6'), $address)) + { + $parts = explode(':', $address); + $missing_parts = 8 - count($parts) + 1; + + if (substr($address, 0, 2) === '::') + { + ++$missing_parts; + } + + if (substr($address, -2) === '::') + { + ++$missing_parts; + } + + $embedded_ipv4 = false; + $last_part = end($parts); + + if (preg_match(get_preg_expression('ipv4'), $last_part)) + { + $parts[count($parts) - 1] = ''; + $last_part = phpbb_inet_pton($last_part); + $embedded_ipv4 = true; + --$missing_parts; + } + + foreach ($parts as $i => $part) + { + if (strlen($part)) + { + $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); + } + else if ($i && $i < count($parts) - 1) + { + $ret .= str_repeat('0000', $missing_parts); + } + } + + $ret = pack('H*', $ret); + + if ($embedded_ipv4) + { + $ret .= $last_part; + } + + return $ret; + } + + return false; +} -- cgit v1.2.1 From b6a99e7dcad10836cd2277ba2bd9a6c19afe90f1 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 24 Oct 2019 20:03:32 +0000 Subject: [ticket/16188] Remove some legacy code and fix bug PHPBB3-16189 --- phpBB/includes/functions.php | 3 +++ phpBB/includes/functions_transfer.php | 4 ++-- phpBB/includes/functions_user.php | 7 +------ 3 files changed, 6 insertions(+), 8 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b4090c6a40..b2c7d6d6b1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2851,10 +2851,13 @@ function get_preg_expression($mode) // Whoa these look impressive! // The code to generate the following two regular expressions which match valid IPv4/IPv6 addresses // can be found in the develop directory + + // @deprecated case 'ipv4': return '#^(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$#'; break; + // @deprecated case 'ipv6': return '#^(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))$#i'; break; diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php index 7427b89917..f0070b4b1e 100644 --- a/phpBB/includes/functions_transfer.php +++ b/phpBB/includes/functions_transfer.php @@ -810,7 +810,7 @@ class ftp_fsock extends transfer $server_ip = substr($socket_name, 0, strrpos($socket_name, ':')); } - if (!isset($server_ip) || preg_match(get_preg_expression('ipv4'), $server_ip)) + if (isset($server_ip) && filter_var($server_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) // ipv4 { // Passive mode $this->_send_command('PASV', '', false); @@ -831,7 +831,7 @@ class ftp_fsock extends transfer $server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3]; $server_port = $temp[4] * 256 + $temp[5]; } - else + else // ipv6 { // Extended Passive Mode - RFC2428 $this->_send_command('EPSV', '', false); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 7dd850111e..5c94a90d9d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1455,12 +1455,7 @@ function user_unban($mode, $ban) */ function user_ipwhois($ip) { - if (empty($ip)) - { - return ''; - } - - if (!preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip)) + if (!filter_var($ip, FILTER_VALIDATE_IP)) { return ''; } -- cgit v1.2.1 From 0a7e98951b27e63fa94d28f4a836f7b55f4b9bd7 Mon Sep 17 00:00:00 2001 From: rubencm Date: Thu, 24 Oct 2019 20:31:16 +0000 Subject: [ticket/16189] Update version PHPBB3-16189 --- phpBB/includes/functions.php | 7 ++++--- phpBB/includes/functions_compatibility.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index b2c7d6d6b1..d2d5b503a2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2987,16 +2987,17 @@ function phpbb_ip_normalise(string $address) { $ip_normalised = false; - if(filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) + if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $ip_normalised = $address; } - else if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) + else if (filter_var($address, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $ip_normalised = inet_ntop(inet_pton($address)); // If is ipv4 - if(stripos($ip_normalised, '::ffff:') === 0) { + if (stripos($ip_normalised, '::ffff:') === 0) + { $ip_normalised = substr($ip_normalised, 7); } } diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index e93523914f..1c9b26d8f3 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -635,7 +635,7 @@ function phpbb_checkdnsrr($host, $type = 'MX') * @return mixed false on failure, * string otherwise * - * @deprecated 3.2.9 (To be removed: 4.0.0) + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) */ function phpbb_inet_ntop($in_addr) { @@ -706,7 +706,7 @@ function phpbb_inet_ntop($in_addr) * @return mixed false if address is invalid, * in_addr representation of the given address otherwise (string) * - * @deprecated 3.2.9 (To be removed: 4.0.0) + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) */ function phpbb_inet_pton($address) { -- cgit v1.2.1 From 00682db8a625e40f720c513c72267395c4354766 Mon Sep 17 00:00:00 2001 From: rubencm Date: Wed, 30 Oct 2019 22:40:01 +0000 Subject: [ticket/16189] Make wrappers call native functions PHPBB3-16189 --- phpBB/includes/functions_compatibility.php | 116 +---------------------------- 1 file changed, 2 insertions(+), 114 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 1c9b26d8f3..2578290875 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -639,60 +639,7 @@ function phpbb_checkdnsrr($host, $type = 'MX') */ function phpbb_inet_ntop($in_addr) { - $in_addr = bin2hex($in_addr); - - switch (strlen($in_addr)) - { - case 8: - return implode('.', array_map('hexdec', str_split($in_addr, 2))); - - case 32: - if (substr($in_addr, 0, 24) === '00000000000000000000ffff') - { - return phpbb_inet_ntop(pack('H*', substr($in_addr, 24))); - } - - $parts = str_split($in_addr, 4); - $parts = preg_replace('/^0+(?!$)/', '', $parts); - $ret = implode(':', $parts); - - $matches = array(); - preg_match_all('/(?<=:|^)(?::?0){2,}/', $ret, $matches, PREG_OFFSET_CAPTURE); - $matches = $matches[0]; - - if (empty($matches)) - { - return $ret; - } - - $longest_match = ''; - $longest_match_offset = 0; - foreach ($matches as $match) - { - if (strlen($match[0]) > strlen($longest_match)) - { - $longest_match = $match[0]; - $longest_match_offset = $match[1]; - } - } - - $ret = substr_replace($ret, '', $longest_match_offset, strlen($longest_match)); - - if ($longest_match_offset == strlen($ret)) - { - $ret .= ':'; - } - - if ($longest_match_offset == 0) - { - $ret = ':' . $ret; - } - - return $ret; - - default: - return false; - } + return inet_ntop($in_addr); } /** @@ -710,64 +657,5 @@ function phpbb_inet_ntop($in_addr) */ function phpbb_inet_pton($address) { - $ret = ''; - if (preg_match(get_preg_expression('ipv4'), $address)) - { - foreach (explode('.', $address) as $part) - { - $ret .= ($part <= 0xF ? '0' : '') . dechex($part); - } - - return pack('H*', $ret); - } - - if (preg_match(get_preg_expression('ipv6'), $address)) - { - $parts = explode(':', $address); - $missing_parts = 8 - count($parts) + 1; - - if (substr($address, 0, 2) === '::') - { - ++$missing_parts; - } - - if (substr($address, -2) === '::') - { - ++$missing_parts; - } - - $embedded_ipv4 = false; - $last_part = end($parts); - - if (preg_match(get_preg_expression('ipv4'), $last_part)) - { - $parts[count($parts) - 1] = ''; - $last_part = phpbb_inet_pton($last_part); - $embedded_ipv4 = true; - --$missing_parts; - } - - foreach ($parts as $i => $part) - { - if (strlen($part)) - { - $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); - } - else if ($i && $i < count($parts) - 1) - { - $ret .= str_repeat('0000', $missing_parts); - } - } - - $ret = pack('H*', $ret); - - if ($embedded_ipv4) - { - $ret .= $last_part; - } - - return $ret; - } - - return false; + return inet_pton($address); } -- cgit v1.2.1 From 6ccffec90695becd92d1144f6cbd9ef72f0d9b51 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sat, 17 May 2014 11:20:37 +0200 Subject: [ticket/12559] Add forum setting to limit subforum legend Squashed all commits, they were basically just typos and errors PHPBB3-12559 --- phpBB/includes/acp/acp_forums.php | 3 +++ phpBB/includes/functions_display.php | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 572ae3692a..ba3901f67a 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -132,6 +132,7 @@ class acp_forums 'forum_image' => $request->variable('forum_image', ''), 'forum_style' => $request->variable('forum_style', 0), 'display_subforum_list' => $request->variable('display_subforum_list', true), + 'display_subforum_limit'=> $request->variable('display_subforum_limit', false), 'display_on_index' => $request->variable('display_on_index', true), 'forum_topics_per_page' => $request->variable('topics_per_page', 0), 'enable_indexing' => $request->variable('enable_indexing', true), @@ -454,6 +455,7 @@ class acp_forums 'forum_image' => '', 'forum_style' => 0, 'display_subforum_list' => true, + 'display_subforum_limit' => false, 'display_on_index' => true, 'forum_topics_per_page' => 0, 'enable_indexing' => true, @@ -676,6 +678,7 @@ class acp_forums 'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false, 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, + 'S_DISPLAY_SUBFORUM_LIMIT' => ($forum_data['display_subforum_limit']) ? true : false, 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, 'S_PRUNE_SHADOW_ENABLE' => ($forum_data['enable_shadow_prune']) ? true : false, diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1ac18fd3f8..1311148e8d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -30,6 +30,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; + $parent_subforum_limit = false; // Mark forums read? $mark_read = $request->variable('mark', ''); @@ -266,6 +267,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Direct child of current branch $parent_id = $forum_id; + $parent_subforum_limit = $row['display_subforum_limit']; $forum_rows[$forum_id] = $row; if ($row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id']) @@ -278,7 +280,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else if ($row['forum_type'] != FORUM_CAT) { - $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index']) ? true : false; + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && !($parent_subforum_limit && $parent_id !== $row['parent_id'])) ? true : false; $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $subforums[$parent_id][$forum_id]['children'] = array(); -- cgit v1.2.1 From c2997ada7aa4d8f63880ea68723266d7cedb4899 Mon Sep 17 00:00:00 2001 From: PayBas Date: Wed, 28 May 2014 23:16:38 +0200 Subject: [ticket/12559] Applied DeMorgan and removed unnecessary true:false PHPBB3-12559 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1311148e8d..73281b88a1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -280,7 +280,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else if ($row['forum_type'] != FORUM_CAT) { - $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && !($parent_subforum_limit && $parent_id !== $row['parent_id'])) ? true : false; + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && (!$parent_subforum_limit || $parent_id == $row['parent_id'])); $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $subforums[$parent_id][$forum_id]['children'] = array(); -- cgit v1.2.1 From 9872316cac4df4987fdabc9512ca6ebeb7e5e04f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 18 Nov 2019 21:06:00 +0100 Subject: [ticket/16167] Remove uses of user_email_hash PHPBB3-16167 --- phpBB/includes/acp/acp_users.php | 5 +---- phpBB/includes/functions_user.php | 5 ++--- phpBB/includes/ucp/ucp_profile.php | 1 - phpBB/includes/ucp/ucp_resend.php | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1b66943490..6993c86279 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -966,10 +966,7 @@ class acp_users if ($update_email !== false) { - $sql_ary += array( - 'user_email' => $update_email, - 'user_email_hash' => phpbb_email_hash($update_email), - ); + $sql_ary += ['user_email' => $update_email]; $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( 'reportee_id' => $user_id, diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 5c94a90d9d..dc6e09268a 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -204,7 +204,6 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) 'username_clean' => $username_clean, 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', 'user_email' => strtolower($user_row['user_email']), - 'user_email_hash' => phpbb_email_hash($user_row['user_email']), 'group_id' => $user_row['group_id'], 'user_type' => $user_row['user_type'], ); @@ -1948,9 +1947,9 @@ function validate_user_email($email, $allowed_email = false) if (!$config['allow_emailreuse']) { - $sql = 'SELECT user_email_hash + $sql = 'SELECT user_email FROM ' . USERS_TABLE . " - WHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email)); + WHERE user_email = '" . $db->sql_escape($email) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 6d98362e08..dca7e7eeb7 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -131,7 +131,6 @@ class ucp_profile 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], - 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? $passwords_manager->hash($data['new_password']) : $user->data['user_password'], ); diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 44c54100cd..55923668d4 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -47,7 +47,7 @@ class ucp_resend $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . " - WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' + WHERE user_email = '" . $db->sql_escape($email) . "' AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); -- cgit v1.2.1 From c628cd7e151a09e25ca0d980620b5fa3fe36a763 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 19 Nov 2019 21:15:21 +0100 Subject: [ticket/16167] Deprecate phpbb_email_hash() and remove gen_email_hash() The latter one has been deprecated for 10 years now. PHPBB3-16167 --- phpBB/includes/functions.php | 12 ------------ phpBB/includes/functions_compatibility.php | 14 ++++++++++++++ phpBB/includes/functions_convert.php | 10 ---------- 3 files changed, 14 insertions(+), 22 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d2d5b503a2..c1f77a817b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -263,18 +263,6 @@ function still_on_time($extra_time = 15) return (ceil($current_time - $start_time) < $max_execution_time) ? true : false; } -/** -* Hashes an email address to a big integer -* -* @param string $email Email address -* -* @return string Unsigned Big Integer -*/ -function phpbb_email_hash($email) -{ - return sprintf('%u', crc32(strtolower($email))) . strlen($email); -} - /** * Wrapper for version_compare() that allows using uppercase A and B * for alpha and beta releases. diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 2578290875..92e24c055c 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -659,3 +659,17 @@ function phpbb_inet_pton($address) { return inet_pton($address); } + +/** + * Hashes an email address to a big integer + * + * @param string $email Email address + * + * @return string Unsigned Big Integer + * + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) + */ +function phpbb_email_hash($email) +{ + return sprintf('%u', crc32(strtolower($email))) . strlen($email); +} diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 13e01afe51..df4c9b1875 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -206,16 +206,6 @@ function get_group_id($group_name) return $group_mapping['REGISTERED']; } -/** -* Generate the email hash stored in the users table -* -* Note: Deprecated, calls should directly go to phpbb_email_hash() -*/ -function gen_email_hash($email) -{ - return phpbb_email_hash($email); -} - /** * Convert a boolean into the appropriate phpBB constant indicating whether the topic is locked */ -- cgit v1.2.1 From 63b7518a0f8b09d23a0d45c50d98aa3ff607f613 Mon Sep 17 00:00:00 2001 From: v12mike Date: Tue, 10 Sep 2019 08:33:01 -0400 Subject: [ticket/9837] Make unapproved posts visible to posters Improvements for feature following review PHPBB3-9837 --- phpBB/includes/acp/acp_board.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 05871e4157..2441a37edc 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -101,6 +101,7 @@ class acp_board 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_unapproved_posts' => array('lang' => 'DISPLAY_UNAPPROVED_POSTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'ACP_SUBMIT_CHANGES', -- cgit v1.2.1 From 251473700aff5cceb964a9261b6d9e6dc7ad3e42 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 22 Nov 2019 11:03:07 +0100 Subject: [prep-release-3.3.0-b2] Update version numbers to 3.3.0-b2 --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 759bc94520..a3b90b045b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-b2-dev'); +@define('PHPBB_VERSION', '3.3.0-b2'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From a8e2f4256b0f1330db8eb799bb26624cf185c6d4 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 23 Nov 2019 14:25:02 +0100 Subject: [3.3.x] Update version numbers to 3.3.0-rc1-dev --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index a3b90b045b..493399bd71 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-b2'); +@define('PHPBB_VERSION', '3.3.0-RC1-dev'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From 3be57cea04fcf5e27a6de1e0c82c2beb70816aba Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Mon, 25 Nov 2019 23:09:37 +0100 Subject: [ticket/16227] Fix undefined vars on login PHPBB3-16227 --- phpBB/includes/functions.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c1f77a817b..994323531a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2264,6 +2264,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $err = ''; $form_name = 'login'; + $username = $autologin = false; // Make sure user->setup() has been called if (!$user->is_setup()) -- cgit v1.2.1 From 581fe4ec83b8c34ff464f8e95b4b4412371dcbda Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 12 Dec 2019 18:41:52 +0100 Subject: [ticket/16238] Update version for deprecation PHPBB3-16238 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 994323531a..9759eabb5a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4119,7 +4119,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = /** * Workaround for missing template variable in pre phpBB 3.2.6 styles. - * @deprecated 3.2.7 (To be removed: 3.3.0-a1) + * @deprecated 3.2.7 (To be removed: 4.0.0-a1) */ $form_token_login = $template->retrieve_var('S_FORM_TOKEN_LOGIN'); if (!empty($form_token_login)) -- cgit v1.2.1 From 2926ceba6a06a2f0f95452ae838a89247c493c93 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Fri, 13 Dec 2019 01:46:09 +0100 Subject: [ticket/16250] Add a service to check BBCodes safeness PHPBB3-16250 --- phpBB/includes/acp/acp_bbcodes.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index a67f3c54f9..9583f9a869 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -157,7 +157,7 @@ class acp_bbcodes * @var string bbcode_tpl The bbcode HTML replacement string * @var string bbcode_helpline The bbcode help line string * @var array hidden_fields Array of hidden fields for use when - * submitting form when $warn_text is true + * submitting form when $warn_unsafe is true * @since 3.1.0-a3 */ $vars = array( @@ -172,14 +172,25 @@ class acp_bbcodes ); extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars))); - $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); + $acp_utils = $phpbb_container->get('text_formatter.acp_utils'); + $bbcode_info = $acp_utils->analyse_bbcode($bbcode_match, $bbcode_tpl); + $warn_unsafe = ($bbcode_info['status'] === 'unsafe'); - if (!$warn_text && !check_form_key($form_key)) + if ($bbcode_info['status'] === 'invalid_definition') + { + trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if ($bbcode_info['status'] === 'invalid_template') + { + trigger_error($user->lang['BBCODE_INVALID_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (!$warn_unsafe && !check_form_key($form_key)) { trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } - if (!$warn_text || confirm_box(true)) + if (!$warn_unsafe || confirm_box(true)) { $data = $this->build_regexp($bbcode_match, $bbcode_tpl); -- cgit v1.2.1 From 2733ce07129dceb5b60acdceba1689fa5339a523 Mon Sep 17 00:00:00 2001 From: JoshyPHP Date: Mon, 16 Dec 2019 01:34:26 +0100 Subject: [ticket/16250] Reworked status as constants PHPBB3-16250 --- phpBB/includes/acp/acp_bbcodes.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 9583f9a869..84dbbf02ba 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -174,15 +174,15 @@ class acp_bbcodes $acp_utils = $phpbb_container->get('text_formatter.acp_utils'); $bbcode_info = $acp_utils->analyse_bbcode($bbcode_match, $bbcode_tpl); - $warn_unsafe = ($bbcode_info['status'] === 'unsafe'); + $warn_unsafe = ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_UNSAFE); - if ($bbcode_info['status'] === 'invalid_definition') + if ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_INVALID_TEMPLATE) { - trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['BBCODE_INVALID_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($bbcode_info['status'] === 'invalid_template') + if ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_INVALID_DEFINITION) { - trigger_error($user->lang['BBCODE_INVALID_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } if (!$warn_unsafe && !check_form_key($form_key)) -- cgit v1.2.1 From 9ddb1bdddb05e494e7f8f89574c569af3284b7dc Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 21 Dec 2019 10:45:23 +0100 Subject: [prep-release-3.3.0-RC1] Update version numbers to 3.3.0-RC1 --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 493399bd71..13be04140b 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-RC1-dev'); +@define('PHPBB_VERSION', '3.3.0-RC1'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From a83b8e779238b734575dd4a96a67ed1aabc704c1 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 21 Dec 2019 22:21:43 +0100 Subject: [3.3.x] Update version numbers to 3.3.0-RC2-dev --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 13be04140b..e3dbdc4adb 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-RC1'); +@define('PHPBB_VERSION', '3.3.0-RC2-dev'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From ffb0adfc59934dd6012394855f494872276b61b9 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Sat, 21 Dec 2019 23:54:32 +0100 Subject: [ticket/16260] Missing check whether the index exists in ACP - PHP 7.4 PHPBB3-16260 --- phpBB/includes/acp/acp_board.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 2441a37edc..b0cefbd064 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -530,11 +530,13 @@ class acp_board if ($submit) { - if (strpos($data['type'], 'password') === 0 && $config_value === '********') + if (strpos(isset($data['type']) ? $data['type'] : '', 'password') === 0 && $config_value === '********') { - // Do not update password fields if the content is ********, - // because that is the password replacement we use to not - // send the password to the output + /** + * Do not update password fields if the content is ********, + * because that is the password replacement we use to not + * send the password to the output + */ continue; } $config->set($config_name, $config_value); -- cgit v1.2.1 From 16a163662bf463d7fa2195e73832e8bf4a26a06f Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Sun, 22 Dec 2019 17:44:03 +0100 Subject: [ticket/16260] Missing check whether the index exists in ACP - PHP 7.4 PHPBB3-16260 --- phpBB/includes/acp/acp_board.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index b0cefbd064..2285ac997e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -530,15 +530,19 @@ class acp_board if ($submit) { - if (strpos(isset($data['type']) ? $data['type'] : '', 'password') === 0 && $config_value === '********') + if (isset($data['type'])) { - /** - * Do not update password fields if the content is ********, - * because that is the password replacement we use to not - * send the password to the output - */ - continue; + if (strpos($data['type'], 'password') === 0 && $config_value === '********') + { + /** + * Do not update password fields if the content is ********, + * because that is the password replacement we use to not + * send the password to the output + */ + continue; + } } + $config->set($config_name, $config_value); if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) -- cgit v1.2.1 From dbc164e13188a8adf4478c1b4b3ce563e16486c3 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Sun, 22 Dec 2019 21:03:35 +0100 Subject: [ticket/16260] Missing check whether the index exists in ACP - PHP 7.4 PHPBB3-16260 --- phpBB/includes/acp/acp_board.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 2285ac997e..cd72a8748a 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -530,17 +530,14 @@ class acp_board if ($submit) { - if (isset($data['type'])) + if (isset($data['type']) && strpos($data['type'], 'password') === 0 && $config_value === '********') { - if (strpos($data['type'], 'password') === 0 && $config_value === '********') - { - /** - * Do not update password fields if the content is ********, - * because that is the password replacement we use to not - * send the password to the output - */ - continue; - } + /** + * Do not update password fields if the content is ********, + * because that is the password replacement we use to not + * send the password to the output + */ + continue; } $config->set($config_name, $config_value); -- cgit v1.2.1 From 044d3278188b53243d78d9de6095f2bfffdb17a2 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 24 Dec 2019 21:51:00 +0100 Subject: [ticket/16267] Check whether the index exists in ACP BBcodes - PHP 7.4 PHPBB3-16267 --- phpBB/includes/acp/acp_bbcodes.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 84dbbf02ba..275188c5a1 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -207,7 +207,11 @@ class acp_bbcodes $db->sql_freeresult($result); // Grab the end, interrogate the last closing tag - if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) + if ( + isset($info['test']) && $info['test'] === '1' + || in_array(strtolower($data['bbcode_tag']), $hard_coded) + || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)) + ) { trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); } -- cgit v1.2.1 From 5eae76b209aeab4728e2b1dc599079ae925f028a Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Wed, 25 Dec 2019 18:35:40 +0100 Subject: [ticket/16267] Check whether the index exists in ACP BBcodes - PHP 7.4 PHPBB3-16267 --- phpBB/includes/acp/acp_bbcodes.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 275188c5a1..5e39055f50 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -207,8 +207,7 @@ class acp_bbcodes $db->sql_freeresult($result); // Grab the end, interrogate the last closing tag - if ( - isset($info['test']) && $info['test'] === '1' + if (isset($info['test']) && $info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)) ) -- cgit v1.2.1 From 790e77de019099b977593fa7f78ac82b3bda7365 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 26 Dec 2019 11:32:36 +0100 Subject: [3.2.x] Update version numbers to 3.2.10-dev --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 12df965bd9..1c77366380 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.2.9-RC1'); +@define('PHPBB_VERSION', '3.2.10-dev'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1 From 202478d1088def6e73fd0a9abc0bf951b7b13132 Mon Sep 17 00:00:00 2001 From: brunoais Date: Thu, 26 Dec 2019 18:17:39 +0000 Subject: [ticket/16262] Fixing event's $current_row_number by renaming $i PHPBB3-16262 --- phpBB/includes/mcp/mcp_topic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 83ad56f3e4..77db5f3ed0 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -242,7 +242,7 @@ function mcp_topic_view($id, $mode, $action) ); extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars))); - foreach ($rowset as $i => $row) + foreach ($rowset as $current_row_number => $row) { $message = $row['post_text']; $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; @@ -336,7 +336,7 @@ function mcp_topic_view($id, $mode, $action) } } - unset($rowset[$i]); + unset($rowset[$current_row_number]); } // Display topic icons for split topic -- cgit v1.2.1 From 7cf148ea131c73cc0c08a77e6811a6755658869e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 27 Dec 2019 14:58:42 +0100 Subject: [ticket/16271] Fix invalid docblocks PHPBB3-16271 --- phpBB/includes/bbcode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index c31b63a403..21c630d495 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -44,7 +44,7 @@ class bbcode /** * Init bbcode cache entries if bitfield is specified * - * @param string $bbcode_bitfield The bbcode bitfield + * @param string $bitfield The bbcode bitfield */ function bbcode_set_bitfield($bitfield = '') { -- cgit v1.2.1 From 82e61f501abfa2768d7faac1ccd8d688c84e5e13 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 29 Dec 2019 01:51:15 +0700 Subject: [ticket/16276] Fix bbcode_firstpass undefined mode property PHPBB3-16276 --- phpBB/includes/message_parser.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index e1c28223dc..d6214c4614 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -46,6 +46,7 @@ class bbcode_firstpass extends bbcode var $message = ''; var $warn_msg = array(); var $parsed_items = array(); + var $mode; /** * Parse BBCode @@ -1128,8 +1129,6 @@ class parse_message extends bbcode_firstpass var $allow_quote_bbcode = true; var $allow_url_bbcode = true; - var $mode; - /** * The plupload object used for dealing with attachments * @var \phpbb\plupload\plupload -- cgit v1.2.1 From dcab0762210a4059cca7458344dcc1aeb0360c42 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 29 Dec 2019 02:12:36 +0700 Subject: [ticket/16276] Further fix PHP nightly tests PHPBB3-16276 --- phpBB/includes/functions_module.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 510d98ec11..e90c11f884 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -445,7 +445,7 @@ class p_master break; default: - if (!preg_match('#(?:' . implode(array_keys($valid_tokens), ')|(?:') . ')#', $token)) + if (!preg_match('#(?:' . implode(')|(?:', array_keys($valid_tokens)) . ')#', $token)) { $token = ''; } -- cgit v1.2.1 From 80de9f6a68d7b50eb5387cdc2b99624484e75201 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 29 Dec 2019 18:56:36 +0700 Subject: [ticket/16277] Move from each() function PHPBB3-16277 --- phpBB/includes/acp/acp_permissions.php | 4 ++-- phpBB/includes/acp/auth.php | 21 +++++++-------------- phpBB/includes/diff/engine.php | 4 ++-- phpBB/includes/functions_convert.php | 3 ++- phpBB/includes/mcp/mcp_logs.php | 2 +- phpBB/includes/mcp/mcp_notes.php | 2 +- phpBB/includes/mcp/mcp_warn.php | 2 +- phpBB/includes/ucp/ucp_groups.php | 16 ++++++++-------- 8 files changed, 24 insertions(+), 30 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index e683b1972e..59bf366c1b 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -694,8 +694,8 @@ class acp_permissions } // We loop through the auth settings defined in our submit - list($ug_id, ) = each($psubmit); - list($forum_id, ) = each($psubmit[$ug_id]); + $ug_id = key($psubmit); + $forum_id = key($psubmit[$ug_id]); $settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id])) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index b414a3121a..f203f9d3ba 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -460,8 +460,7 @@ class auth_admin extends \phpbb\auth\auth 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); - @reset($content_array); - while (list($ug_id, $ug_array) = each($content_array)) + foreach ($content_array as $ug_id => $ug_array) { // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; @@ -471,8 +470,7 @@ class auth_admin extends \phpbb\auth\auth $s_role_options = ''; $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; - @reset($roles); - while (list($role_id, $role_row) = each($roles)) + foreach ($roles as $role_id => $role_row) { $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; @@ -559,8 +557,7 @@ class auth_admin extends \phpbb\auth\auth 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) ); - @reset($content_array); - while (list($forum_id, $forum_array) = each($content_array)) + foreach ($content_array as $forum_id => $forum_array) { // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; @@ -570,8 +567,7 @@ class auth_admin extends \phpbb\auth\auth $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; $s_role_options = ''; - @reset($roles); - while (list($role_id, $role_row) = each($roles)) + foreach ($roles as $role_id => $role_row) { $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; @@ -1138,8 +1134,7 @@ class auth_admin extends \phpbb\auth\auth /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); - @reset($category_array); - while (list($cat, $cat_array) = each($category_array)) + foreach ($category_array as $cat => $cat_array) { if (!$phpbb_permissions->category_defined($cat)) { @@ -1169,8 +1164,7 @@ class auth_admin extends \phpbb\auth\auth } unset($key_array, $values_array); */ - @reset($cat_array['permissions']); - while (list($permission, $allowed) = each($cat_array['permissions'])) + foreach ($cat_array['permissions'] as $permission => $allowed) { if (!$phpbb_permissions->permission_defined($permission)) { @@ -1237,8 +1231,7 @@ class auth_admin extends \phpbb\auth\auth $permissions = $permission_row[$forum_id]; ksort($permissions); - @reset($permissions); - while (list($permission, $auth_setting) = each($permissions)) + foreach ($permissions as $permission => $auth_setting) { $cat = $phpbb_permissions->get_permission_category($permission); diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index 757fdadde9..19e0bcf09e 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -285,7 +285,7 @@ class diff_engine $matches = $ymatches[$line]; reset($matches); - while (list(, $y) = each($matches)) + while ($y = current($matches)) { if (empty($this->in_seq[$y])) { @@ -296,7 +296,7 @@ class diff_engine } // no reset() here - while (list(, $y) = each($matches)) + while ($y = current($matches)) { if ($y > $this->seq[$k - 1]) { diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index df4c9b1875..96e108792d 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1209,7 +1209,8 @@ function get_config() if (is_array($convert->config_schema['table_format'])) { $convert_config = array(); - list($key, $val) = each($convert->config_schema['table_format']); + $key = key($convert->config_schema['table_format']); + $val = current($convert->config_schema['table_format']); do { diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index 79f9d35ebe..dc098fceed 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -44,7 +44,7 @@ class mcp_logs if (is_array($action)) { - list($action, ) = each($action); + $action = key($action); } else { diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php index a4c2356a43..74bd1f1f62 100644 --- a/phpBB/includes/mcp/mcp_notes.php +++ b/phpBB/includes/mcp/mcp_notes.php @@ -42,7 +42,7 @@ class mcp_notes if (is_array($action)) { - list($action, ) = each($action); + $action = key($action); } $this->page_title = 'MCP_NOTES'; diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index df175133fc..7a8599fedd 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -41,7 +41,7 @@ class mcp_warn if (is_array($action)) { - list($action, ) = each($action); + $action = key($action); } $this->page_title = 'MCP_WARN'; diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 2423af86be..d574549093 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -136,7 +136,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); $sql = 'SELECT group_type FROM ' . GROUPS_TABLE . ' @@ -240,7 +240,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -460,7 +460,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -754,7 +754,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -879,7 +879,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -906,7 +906,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -985,7 +985,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { @@ -1046,7 +1046,7 @@ class ucp_groups { trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); } - list(, $row) = each($row); + $row = current($row); if (!$row['group_leader']) { -- cgit v1.2.1 From 374dc92e8f5659f4035bee05a902e773fede1177 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 30 Dec 2019 21:27:12 +0700 Subject: [ticket/16277] Adjust patch for the diff engine PHPBB3-16277 --- phpBB/includes/diff/engine.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/includes') diff --git a/phpBB/includes/diff/engine.php b/phpBB/includes/diff/engine.php index 19e0bcf09e..0d73db02da 100644 --- a/phpBB/includes/diff/engine.php +++ b/phpBB/includes/diff/engine.php @@ -287,6 +287,7 @@ class diff_engine reset($matches); while ($y = current($matches)) { + next($matches); if (empty($this->in_seq[$y])) { $k = $this->_lcs_pos($y); @@ -298,6 +299,7 @@ class diff_engine // no reset() here while ($y = current($matches)) { + next($matches); if ($y > $this->seq[$k - 1]) { // Optimization: this is a common case: next match is just replacing previous match. -- cgit v1.2.1 From 7ef52f723cbf9714fd5e8a94f6a9b0c7b3085f1e Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 31 Dec 2019 22:07:38 +0100 Subject: [ticket/16283] Update requirements for 3.3.0 PHPBB3-16283 --- phpBB/includes/startup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index d42ae58c42..a022fd0b73 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -23,9 +23,9 @@ $level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; error_reporting($level); /** -* Minimum Requirement: PHP 7.1.0 +* Minimum Requirement: PHP 7.1.3 */ -if (version_compare(PHP_VERSION, '7.1') < 0) +if (version_compare(PHP_VERSION, '7.1.3') < 0) { die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.0 or higher before trying to install or update to phpBB 3.3'); } -- cgit v1.2.1 From 16dad60eef209c5590adef5c7e46ffdfc50c144c Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 31 Dec 2019 22:10:51 +0100 Subject: [ticket/16283] Update requirements for 3.3.0 PHPBB3-16283 --- phpBB/includes/startup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index a022fd0b73..7450ca8707 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -27,7 +27,7 @@ error_reporting($level); */ if (version_compare(PHP_VERSION, '7.1.3') < 0) { - die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.0 or higher before trying to install or update to phpBB 3.3'); + die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.3 or higher before trying to install or update to phpBB 3.3'); } // Register globals and magic quotes have been dropped in PHP 5.4 so no need for extra checks -- cgit v1.2.1 From d8dac3f80eee2c99cfb927a02d2b89b1e750d86e Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 31 Dec 2019 23:29:52 +0100 Subject: [ticket/16281] Fix Ajax refresh-data for extensions' Tab PHPBB3-16281 --- phpBB/includes/acp/acp_extensions.php | 44 +++++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 6ac70ce3a8..85a7e08a99 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -243,12 +243,20 @@ class acp_extensions 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($ext_name), ]); - $json_response = new \phpbb\json_response; - $json_response->send(array( + $data = array( 'EXT_ENABLE_SUCCESS' => true, 'ACTIONS' => $actions, - )); + ); + + $data['REFRESH_DATA'] = [ + 'url' => '', + 'time' => 0, + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); } + trigger_error($this->user->lang('EXTENSION_ENABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; @@ -299,12 +307,20 @@ class acp_extensions 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($ext_name), ]); - $json_response = new \phpbb\json_response; - $json_response->send(array( + $data = [ 'EXT_DISABLE_SUCCESS' => true, 'ACTIONS' => $actions, - )); + ]; + + $data['REFRESH_DATA'] = [ + 'url' => '', + 'time' => 0, + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); } + trigger_error($this->user->lang('EXTENSION_DISABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; @@ -361,12 +377,20 @@ class acp_extensions 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($ext_name), ]); - $json_response = new \phpbb\json_response; - $json_response->send(array( + $data = [ 'EXT_DELETE_DATA_SUCCESS' => true, - 'ACTIONS' => $actions, - )); + 'ACTIONS' => $actions, + ]; + + $data['REFRESH_DATA'] = [ + 'url' => '', + 'time' => 0, + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); } + trigger_error($this->user->lang('EXTENSION_DELETE_DATA_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); break; -- cgit v1.2.1 From 6705adf47b4a923df731f2d0576ca5a1b61421ef Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 31 Dec 2019 23:33:21 +0100 Subject: [ticket/16281] Fix Ajax refresh-data for extensions' Tab PHPBB3-16281 --- phpBB/includes/acp/acp_extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 85a7e08a99..ecb5fb00df 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -243,10 +243,10 @@ class acp_extensions 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($ext_name), ]); - $data = array( + $data = [ 'EXT_ENABLE_SUCCESS' => true, 'ACTIONS' => $actions, - ); + ]; $data['REFRESH_DATA'] = [ 'url' => '', -- cgit v1.2.1 From 314dfb294a210524783ee11d653f7c737bc46f15 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Tue, 31 Dec 2019 23:51:08 +0100 Subject: [ticket/16281] Fix Ajax refresh-data for extensions' Tab PHPBB3-16281 --- phpBB/includes/acp/acp_extensions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index ecb5fb00df..b02d9710c0 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -379,7 +379,7 @@ class acp_extensions $data = [ 'EXT_DELETE_DATA_SUCCESS' => true, - 'ACTIONS' => $actions, + 'ACTIONS' => $actions, ]; $data['REFRESH_DATA'] = [ -- cgit v1.2.1 From 7e5d0b9ec8568ea12bb2d8ef7fc7501ed17dce99 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Wed, 1 Jan 2020 00:33:59 +0100 Subject: [ticket/16281] Fix Ajax refresh-data for extensions' Tab PHPBB3-16281 --- phpBB/includes/acp/acp_extensions.php | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index b02d9710c0..86966541be 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -246,11 +246,10 @@ class acp_extensions $data = [ 'EXT_ENABLE_SUCCESS' => true, 'ACTIONS' => $actions, - ]; - - $data['REFRESH_DATA'] = [ - 'url' => '', - 'time' => 0, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], ]; $json_response = new \phpbb\json_response; @@ -310,11 +309,10 @@ class acp_extensions $data = [ 'EXT_DISABLE_SUCCESS' => true, 'ACTIONS' => $actions, - ]; - - $data['REFRESH_DATA'] = [ - 'url' => '', - 'time' => 0, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], ]; $json_response = new \phpbb\json_response; @@ -380,11 +378,10 @@ class acp_extensions $data = [ 'EXT_DELETE_DATA_SUCCESS' => true, 'ACTIONS' => $actions, - ]; - - $data['REFRESH_DATA'] = [ - 'url' => '', - 'time' => 0, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], ]; $json_response = new \phpbb\json_response; -- cgit v1.2.1 From c7dd7d42c68fc039467c55577f1a60ee1be3a744 Mon Sep 17 00:00:00 2001 From: 3D-I <480857+3D-I@users.noreply.github.com> Date: Wed, 1 Jan 2020 19:23:31 +0100 Subject: [ticket/16283] Update requirements for 3.3.0 PHPBB3-16283 --- phpBB/includes/startup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 7450ca8707..5ead3b7fbb 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -25,7 +25,7 @@ error_reporting($level); /** * Minimum Requirement: PHP 7.1.3 */ -if (version_compare(PHP_VERSION, '7.1.3') < 0) +if (version_compare(PHP_VERSION, '7.1.3', '<')) { die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.3 or higher before trying to install or update to phpBB 3.3'); } -- cgit v1.2.1 From f866a8fd1bac7da74c88763447ad2f3ff1b9a10c Mon Sep 17 00:00:00 2001 From: paul sohier Date: Thu, 2 Jan 2020 15:21:34 +0100 Subject: [ticket/16287] After installation an error is given over statistics submission The phpBB.com website required specific fields to be available for the statistics. This change switched over to a new statistics page on www.phpbb.com that uses form fields instead, and that returns JSON as value. PHPBB3-16287 --- phpBB/includes/acp/acp_help_phpbb.php | 11 +++++++---- phpBB/includes/questionnaire/questionnaire.php | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php index a36b36eddc..2b603d63f4 100644 --- a/phpBB/includes/acp/acp_help_phpbb.php +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -32,7 +32,7 @@ class acp_help_phpbb include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); } - $collect_url = "https://www.phpbb.com/stats/receive_stats.php"; + $collect_url = "https://www.phpbb.com/statistics/send"; $this->tpl_name = 'acp_help_phpbb'; $this->page_title = 'ACP_HELP_PHPBB'; @@ -90,13 +90,15 @@ class acp_help_phpbb if (!empty($response)) { - if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false)) + $decoded_response = json_decode($response, true); + + if ($decoded_response && isset($decoded_response['status']) && $decoded_response['status'] == 'ok') { trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action)); } else { - trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action)); + trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action), E_USER_WARNING); } } @@ -106,7 +108,8 @@ class acp_help_phpbb $template->assign_vars(array( 'U_COLLECT_STATS' => $collect_url, 'S_COLLECT_STATS' => (!empty($config['help_send_statistics'])) ? true : false, - 'RAW_DATA' => $collector->get_data_for_form(), + 'S_STATS' => $collector->get_data_raw(), + 'S_STATS_DATA' => json_encode($collector->get_data_raw()), 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"), 'U_ACTION' => $this->u_action, // Pass earliest time we should try to send stats again diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 95036a95bc..2bc95cf58f 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -68,7 +68,7 @@ class phpbb_questionnaire_data_collector function get_data_for_form() { - return base64_encode(serialize($this->get_data_raw())); + return base64_encode(json_encode($this->get_data_raw())); } /** @@ -124,7 +124,7 @@ class phpbb_questionnaire_php_data_provider 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), 'unicode.semantics' => (int) @ini_get('unicode.semantics'), 'zend_thread_safty' => (int) function_exists('zend_thread_id'), - 'extensions' => get_loaded_extensions(), + 'extensions' => implode(",", get_loaded_extensions()), ); } } -- cgit v1.2.1 From b3f80239c1204cdaa69d4de66674d27fd4091da9 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 2 Jan 2020 21:06:58 +0100 Subject: [ticket/16287] Use twig syntax and fix coding guidelines issues PHPBB3-16287 --- phpBB/includes/questionnaire/questionnaire.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 2bc95cf58f..ec2e6fea5d 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -124,7 +124,7 @@ class phpbb_questionnaire_php_data_provider 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), 'unicode.semantics' => (int) @ini_get('unicode.semantics'), 'zend_thread_safty' => (int) function_exists('zend_thread_id'), - 'extensions' => implode(",", get_loaded_extensions()), + 'extensions' => implode(',', get_loaded_extensions()), ); } } -- cgit v1.2.1 From a0ffbfce315ce45df4085d4c83536f2024e71a3f Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 3 Jan 2020 10:17:40 +0100 Subject: [ticket/16287] Correctly pass json response to PHP file PHPBB3-16287 --- phpBB/includes/acp/acp_help_phpbb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php index 2b603d63f4..798cff5cee 100644 --- a/phpBB/includes/acp/acp_help_phpbb.php +++ b/phpBB/includes/acp/acp_help_phpbb.php @@ -90,7 +90,7 @@ class acp_help_phpbb if (!empty($response)) { - $decoded_response = json_decode($response, true); + $decoded_response = json_decode(htmlspecialchars_decode($response), true); if ($decoded_response && isset($decoded_response['status']) && $decoded_response['status'] == 'ok') { -- cgit v1.2.1 From eb8ace14c8d4fb7f0d080bf28ffb16f8d5fe8424 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Sat, 4 Jan 2020 14:33:22 +0100 Subject: [prep-release-3.3.0] Update version numbers for 3.3.0 release --- phpBB/includes/constants.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes') diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index e3dbdc4adb..9508ce5cfc 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -@define('PHPBB_VERSION', '3.3.0-RC2-dev'); +@define('PHPBB_VERSION', '3.3.0'); // QA-related // define('PHPBB_QA', 1); -- cgit v1.2.1