diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_update.php | 5 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 5 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 11 | ||||
-rw-r--r-- | phpBB/includes/functions_compatibility.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 8 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 20 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 4 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 32 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_notifications.php | 8 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_remind.php | 7 |
10 files changed, 87 insertions, 15 deletions
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index b52f315d7f..9124a59ef2 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -52,7 +52,10 @@ class acp_update $updates_available = array(); } - $template->assign_block_vars('updates_available', $updates_available); + if (!empty($updates_available)) + { + $template->assign_block_vars('updates_available', $updates_available); + } $update_link = $phpbb_root_path . 'install/app.' . $phpEx; diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e8492a82a3..6572c0ad2c 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -501,7 +501,10 @@ class bbcode // Turn template blocks into PHP assignment statements for the values of $bbcode_tpl.. $this->bbcode_template = array(); - $matches = preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match); + // Capture the BBCode template matches + // Allow phpBB template or the Twig syntax + $matches = (preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END (?:.*?) -->#', $tpl, $match)) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match); for ($i = 0; $i < $matches; $i++) { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3dabd1b46e..6a36210dca 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1839,7 +1839,7 @@ function redirect($url, $return = false, $disable_cd_check = false) /** * Re-Apply session id after page reloads */ -function reapply_sid($url) +function reapply_sid($url, $is_route = false) { global $phpEx, $phpbb_root_path; @@ -1861,7 +1861,7 @@ function reapply_sid($url) $url = preg_replace("/$phpEx(&|&)+?/", "$phpEx?", $url); } - return append_sid($url); + return append_sid($url, false, true, false, $is_route); } /** @@ -2184,7 +2184,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo // re-add sid / transform & to & for user->page (user->page is always using &) $use_page = ($u_action) ? $u_action : str_replace('&', '&', $user->page['page']); - $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite'])); + $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite']), $phpbb_path_helper->is_router_used()); $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; $template->assign_vars(array( @@ -2815,6 +2815,11 @@ function get_preg_expression($mode) case 'path_remove_dot_trailing_slash': return '#^(?:(\.)?)+(?:(.+)?)+(?:([\\/\\\])$)#'; break; + + case 'semantic_version': + // Regular expression to match semantic versions by http://rgxdb.com/ + return '/(?<=^[Vv]|^)(?:(?<major>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<minor>(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?<patch>(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?<prerelease>(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*)))*))?(?:[+](?<build>(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+)))*))?)$/'; + break; } return ''; diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 4b085a6050..4fe7e71117 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -488,7 +488,7 @@ function phpbb_realpath($path) * Determine which plural form we should use. * For some languages this is not as simple as for English. * - * @param $rule int ID of the plural rule we want to use, see http://wiki.phpbb.com/Plural_Rules#Plural_Rules + * @param $rule int ID of the plural rule we want to use, see https://area51.phpbb.com/docs/dev/32x/language/plurals.html * @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 * diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index c3e7a7ceb7..06223027d8 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -557,6 +557,7 @@ function strip_bbcode(&$text, $uid = '') function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true) { static $bbcode; + global $auth, $config, $user; global $phpbb_dispatcher, $phpbb_container; if ($text === '') @@ -584,6 +585,13 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text // Temporarily switch off viewcensors if applicable $old_censor = $renderer->get_viewcensors(); + + // Check here if the user is having viewing censors disabled (and also allowed to do so). + if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + { + $censor_text = false; + } + if ($old_censor !== $censor_text) { $renderer->set_viewcensors($censor_text); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index afa4bb56c4..d9f395efb3 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -712,7 +712,7 @@ function posting_gen_inline_attachments(&$attachment_data) */ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) { - global $template, $config, $phpbb_root_path, $phpEx, $user; + global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; // Some default template variables $template->assign_vars(array( @@ -730,6 +730,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a foreach ($attachment_data as $count => $attach_row) { $hidden = ''; + $attachrow_template_vars = array(); $attach_row['real_filename'] = utf8_basename($attach_row['real_filename']); foreach ($attach_row as $key => $value) @@ -739,7 +740,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); - $template->assign_block_vars('attach_row', array( + $attachrow_template_vars[(int) $attach_row['attach_id']] = array( 'FILENAME' => utf8_basename($attach_row['real_filename']), 'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])), 'FILE_COMMENT' => $attach_row['attach_comment'], @@ -749,9 +750,22 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a 'FILESIZE' => get_formatted_filesize($attach_row['filesize']), 'U_VIEW_ATTACHMENT' => $download_link, - 'S_HIDDEN' => $hidden) + 'S_HIDDEN' => $hidden, ); } + + /** + * Modify inline attachments template vars + * + * @event core.modify_inline_attachments_template_vars + * @var array attachment_data Array containing attachments data + * @var array attachrow_template_vars Array containing attachments template vars + * @since 3.2.2-RC1 + */ + $vars = array('attachment_data', 'attachrow_template_vars'); + extract($phpbb_dispatcher->trigger_event('core.modify_inline_attachments_template_vars', compact($vars))); + + $template->assign_block_vars_array('attach_row', $attachrow_template_vars); } return sizeof($attachment_data); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3dd4b3c2e5..c746bd0e4c 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -734,9 +734,11 @@ function user_delete($mode, $user_ids, $retain_username = true) * @var array user_ids IDs of the deleted user * @var mixed retain_username True if username should be retained * or false if not + * @var array user_rows Array containing data of the deleted users * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added user_rows */ - $vars = array('mode', 'user_ids', 'retain_username'); + $vars = array('mode', 'user_ids', 'retain_username', 'user_rows'); extract($phpbb_dispatcher->trigger_event('core.delete_user_after', compact($vars))); // Reset newest user info if appropriate diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index d6e36fec39..45f00c9ee1 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1072,7 +1072,7 @@ class bbcode_firstpass extends bbcode if ($config['force_server_vars']) { - $check_path = $config['script_path']; + $check_path = !empty($config['script_path']) ? $config['script_path'] : '/'; } else { @@ -1530,7 +1530,7 @@ class parse_message extends bbcode_firstpass function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) { global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request; - global $phpbb_container; + global $phpbb_container, $phpbb_dispatcher; $error = array(); @@ -1598,6 +1598,20 @@ class parse_message extends bbcode_firstpass ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on submit + * + * @event core.modify_attachment_data_on_submit + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_submit', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]'; }, $this->message); @@ -1719,6 +1733,20 @@ class parse_message extends bbcode_firstpass ); $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on upload + * + * @event core.modify_attachment_data_on_upload + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_upload', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]'; }, $this->message); diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 51bd77bd4c..835db44b90 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -180,13 +180,13 @@ class ucp_notifications 'GROUP_NAME' => $user->lang($group), )); - foreach ($subscription_types as $type => $data) + foreach ($subscription_types as $type => $type_data) { $template->assign_block_vars($block, array( 'TYPE' => $type, - 'NAME' => $user->lang($data['lang']), - 'EXPLAIN' => (isset($user->lang[$data['lang'] . '_EXPLAIN'])) ? $user->lang($data['lang'] . '_EXPLAIN') : '', + 'NAME' => $user->lang($type_data['lang']), + 'EXPLAIN' => (isset($user->lang[$type_data['lang'] . '_EXPLAIN'])) ? $user->lang($type_data['lang'] . '_EXPLAIN') : '', )); foreach ($notification_methods as $method => $method_data) @@ -196,6 +196,8 @@ class ucp_notifications 'NAME' => $user->lang($method_data['lang']), + 'AVAILABLE' => $method_data['method']->is_available($type_data['type']), + 'SUBSCRIBED' => (isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type])) ? true : false, )); } diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 7040370627..f46df99edb 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -41,8 +41,15 @@ class ucp_remind $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'); + } + $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'), |