diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_extensions.php | 18 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 5 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_download.php | 14 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 12 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 9 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 9 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 12 |
13 files changed, 95 insertions, 8 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index e004d2e81f..c8f6f426c6 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -1017,7 +1017,7 @@ class acp_board $user->timezone = $old_tz; return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select> - <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />"; + <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"64\" />"; } /** diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index f97711d69d..5a2ded91e2 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -34,7 +34,7 @@ class acp_extensions function main() { // Start the page - global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache; + global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache, $phpbb_dispatcher; $this->db = $db; $this->config = $config; @@ -43,6 +43,7 @@ class acp_extensions $this->cache = $cache; $this->request = $request; $this->log = $phpbb_log; + $this->phpbb_dispatcher = $phpbb_dispatcher; $user->add_lang(array('install', 'acp/extensions', 'migrator')); @@ -55,6 +56,21 @@ class acp_extensions $safe_time_limit = (ini_get('max_execution_time') / 2); $start_time = time(); + /** + * Event to run a specific action on extension + * + * @event core.acp_extensions_run_action + * @var string action Action to run + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @since 3.1.11-RC1 + */ + $u_action = $this->u_action; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action', compact($vars))); + // Cancel action if ($request->is_set_post('cancel')) { diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 660afb4e93..62e75a2db7 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -755,6 +755,7 @@ class acp_permissions $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } @@ -825,10 +826,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } @@ -899,10 +902,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 2012d3c513..9e6cc49522 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -752,6 +752,10 @@ class acp_profile $s_one_need_edit = true; } + if (!isset($this->type_collection[$row['field_type']])) + { + continue; + } $profile_field = $this->type_collection[$row['field_type']]; $template->assign_block_vars('fields', array( 'FIELD_IDENT' => $row['field_ident'], diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 008cc02471..cd44800af8 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1929,7 +1929,7 @@ class acp_users 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), )); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a152d9b620..ba448f3125 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2776,7 +2776,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; $template->assign_vars(array( - 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title], + 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang($title, 1), 'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'], 'YES_VALUE' => $user->lang['YES'], diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8e60804d6e..8858d1a307 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -980,7 +980,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_path_helper; + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -989,6 +989,16 @@ function smiley_text($text, $force_option = false) else { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); + + /** + * Event to override the root_path for smilies + * + * @event core.smiley_text_root_path + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.smiley_text_root_path', compact($vars))); return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); } } diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index c571de579e..86c60c31ff 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -677,6 +677,8 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) */ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) { + global $phpbb_dispatcher; + if (!$auth->acl_get('u_pm_download')) { send_status_line(403, 'Forbidden'); @@ -685,6 +687,18 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) $allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id); + /** + * Event to modify PM attachments download auth + * + * @event core.modify_pm_attach_download_auth + * @var bool allowed Whether the user is allowed to download from that PM or not + * @var int msg_id The id of the PM to download from + * @var int user_id The user id for auth check + * @since 3.1.11-RC1 + */ + $vars = array('allowed', 'msg_id', 'user_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_pm_attach_download_auth', compact($vars))); + if (!$allowed) { send_status_line(403, 'Forbidden'); diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 9b3ca14101..f141637fb9 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -438,7 +438,7 @@ class messenger */ function build_header($to, $cc, $bcc) { - global $config; + global $config, $phpbb_dispatcher; // We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility $headers = array(); @@ -470,6 +470,16 @@ class messenger $headers[] = 'X-MimeOLE: phpBB3'; $headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url()); + /** + * Event to modify email header entries + * + * @event core.modify_email_headers + * @var array headers Array containing email header entries + * @since 3.1.11-RC1 + */ + $vars = array('headers'); + extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); + if (sizeof($this->extra_headers)) { $headers = array_merge($headers, $this->extra_headers); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4a4d2de0fe..30f5ba91ef 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -119,6 +119,15 @@ function generate_smilies($mode, $forum_id) foreach ($smilies as $row) { + /** + * Modify smiley root path before populating smiley list + * + * @event core.generate_smilies_before + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars))); $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 1639eb1a4c..4aad1746d5 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -889,9 +889,16 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) SET pm_unread = 0 WHERE msg_id = $msg_id AND user_id = $user_id - AND folder_id = $folder_id"; + AND folder_id = $folder_id + AND pm_unread = 1"; $db->sql_query($sql); + // If the message is already marked as read, we just skip the rest to avoid negative PM count + if (!$db->sql_affectedrows()) + { + return; + } + $sql = 'UPDATE ' . USERS_TABLE . " SET user_unread_privmsg = user_unread_privmsg - 1 WHERE user_id = $user_id"; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b82abe0c5e..0b39339c7f 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2279,7 +2279,7 @@ function phpbb_avatar_explanation_string() { global $config, $user; - return $user->lang('AVATAR_EXPLAIN', + return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $user->lang('PIXELS', (int) $config['avatar_max_width']), $user->lang('PIXELS', (int) $config['avatar_max_height']), round($config['avatar_filesize'] / 1024)); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 1e4a0a8850..599bd5d918 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1293,6 +1293,18 @@ function mcp_fork_topic($topic_ids) 'poll_vote_change' => (int) $topic_row['poll_vote_change'], ); + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_topic_id = $db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; |