diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 5 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_main.php | 6 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_update.php | 12 | ||||
-rw-r--r-- | phpBB/includes/constants.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 24 | ||||
-rw-r--r-- | phpBB/includes/functions_admin.php | 43 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 29 | ||||
-rw-r--r-- | phpBB/includes/functions_download.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 33 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_main.php | 1 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 2 | ||||
-rw-r--r-- | phpBB/includes/questionnaire/questionnaire.php | 1 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_compose.php | 28 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 10 |
15 files changed, 164 insertions, 36 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f08f5356c8..f487662da5 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -452,7 +452,7 @@ class acp_board 'legend2' => 'SMTP_SETTINGS', 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => false), + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), @@ -642,6 +642,9 @@ class acp_board $messenger->template('test'); $messenger->set_addresses($user->data); $messenger->anti_abuse_headers($config, $user); + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user->data['username']), + )); $messenger->send(NOTIFY_EMAIL); trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 529c3a1835..f44bbbc88d 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -459,6 +459,12 @@ class acp_main $template->assign_var('S_VERSION_UP_TO_DATE', true); } + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $template->assign_var('S_UPDATE_INCOMPLETE', true); + } + /** * Notice admin * diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 52897e1043..e42367d8a1 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -63,5 +63,17 @@ class acp_update 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link), )); + + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $database_update_link = append_sid($phpbb_root_path . 'install/database_update.' . $phpEx); + + $template->assign_vars(array( + 'S_UPDATE_INCOMPLETE' => true, + 'FILES_VERSION' => PHPBB_VERSION, + 'INCOMPLETE_INSTRUCTIONS' => $user->lang('UPDATE_INCOMPLETE_EXPLAIN', $database_update_link), + )); + } } } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index b3792dd8b9..38017255b4 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.0-b3-dev'); +@define('PHPBB_VERSION', '3.2.0-RC2-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 497403b1e5..588a717f0e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3669,6 +3669,30 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum' } } } + + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_before_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @since 3.1.10-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_before_modify', compact($vars))); + $online_userlist = implode(', ', $user_online_link); if (!$online_userlist) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index a84cbd9311..5cf65e04ba 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -204,7 +204,7 @@ function group_select_options($group_id, $exclude_ids = false, $manage_founder = */ function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = false, $no_cache = false) { - global $db, $auth; + global $db, $auth, $phpbb_dispatcher; static $forum_rows; if (!isset($forum_rows)) @@ -259,6 +259,16 @@ function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = } } + /** + * Modify the forum list data + * + * @event core.get_forum_list_modify_data + * @var array rowset Array with the forum list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.get_forum_list_modify_data', compact($vars))); + return $rowset; } @@ -2221,7 +2231,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, /** * Prune function */ -function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true) +function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true, $prune_limit = 0) { global $db, $phpbb_dispatcher; @@ -2273,9 +2283,19 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync * @var int prune_flags The prune flags * @var bool auto_sync Whether or not to perform auto sync * @var string sql_and SQL text appended to where clause + * @var int prune_limit The prune limit * @since 3.1.3-RC1 + * @changed 3.1.10-RC1 Added prune_limit */ - $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); + $vars = array( + 'forum_id', + 'prune_mode', + 'prune_date', + 'prune_flags', + 'auto_sync', + 'sql_and', + 'prune_limit', + ); extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); $sql = 'SELECT topic_id @@ -2283,7 +2303,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " AND poll_start = 0 $sql_and"; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, $prune_limit); $topic_list = array(); while ($row = $db->sql_fetchrow($result)) @@ -2300,7 +2320,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync AND poll_start > 0 AND poll_last_vote < $prune_date $sql_and"; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, $prune_limit); while ($row = $db->sql_fetchrow($result)) { @@ -2333,12 +2353,15 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr $prune_date = time() - ($prune_days * 86400); $next_prune = time() + ($prune_freq * 86400); - prune($forum_id, $prune_mode, $prune_date, $prune_flags, true); + $result = prune($forum_id, $prune_mode, $prune_date, $prune_flags, true, 300); - $sql = 'UPDATE ' . FORUMS_TABLE . " - SET prune_next = $next_prune - WHERE forum_id = $forum_id"; - $db->sql_query($sql); + if ($result['topics'] == 0 && $result['posts'] == 0) + { + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET prune_next = $next_prune + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_AUTO_PRUNE', false, array($row['forum_name'])); } diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index fd7fc478bd..173ea49acc 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -150,7 +150,7 @@ function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, */ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false) { - global $config, $auth, $template, $user, $db, $phpbb_path_helper; + global $config, $auth, $template, $user, $db, $phpbb_path_helper, $phpbb_dispatcher; // We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality) if (!$config['load_jumpbox'] && $force_display === false) @@ -205,20 +205,21 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list continue; } + $tpl_ary = array(); if (!$display_jumpbox) { - $template->assign_block_vars('jumpbox_forums', array( + $tpl_ary[] = array( 'FORUM_ID' => ($select_all) ? 0 : -1, 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], 'S_FORUM_COUNT' => $iteration, 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $forum_id)), - )); + ); $iteration++; $display_jumpbox = true; } - $template->assign_block_vars('jumpbox_forums', array( + $tpl_ary[] = array( 'FORUM_ID' => $row['forum_id'], 'FORUM_NAME' => $row['forum_name'], 'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '', @@ -227,7 +228,25 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false, 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])), - )); + ); + + /** + * Modify the jumpbox before it is assigned to the template + * + * @event core.make_jumpbox_modify_tpl_ary + * @var array row The data of the forum + * @var array tpl_ary Template data of the forum + * @since 3.1.10-RC1 + */ + $vars = array( + 'row', + 'tpl_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars_array('jumpbox_forums', $tpl_ary); + + unset($tpl_ary); for ($i = 0; $i < $padding; $i++) { diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index b295d4cd1e..1659d4b252 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -166,7 +166,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } // Make sure the database record for the filesize is correct - if ($size > 0 && $size != $attachment['filesize']) + if ($size > 0 && $size != $attachment['filesize'] && strpos($attachment['physical_filename'], 'thumb_') === false) { // Update database record $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 3fa96afb29..fa9ed84a34 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -624,31 +624,34 @@ class messenger */ protected function setup_template() { - global $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; + global $phpbb_container; if ($this->template instanceof \phpbb\template\template) { return; } + $template_environment = new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container->getParameter('core.template.cache_path'), + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_container->get('filesystem') + ) + ); + $template_environment->setLexer($phpbb_container->get('template.twig.lexer')); + $this->template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), new \phpbb\template\context(), - new \phpbb\template\twig\environment( - $phpbb_container->get('config'), - $phpbb_container->get('filesystem'), - $phpbb_container->get('path_helper'), - $phpbb_container->getParameter('core.cache_dir'), - $phpbb_container->get('ext.manager'), - new \phpbb\template\twig\loader( - $phpbb_filesystem - ) - ), - $phpbb_container->getParameter('core.cache_dir'), + $template_environment, + $phpbb_container->getParameter('core.template.cache_path'), $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), - $phpbb_extension_manager + $phpbb_container->get('ext.manager') ); } @@ -684,10 +687,10 @@ class queue */ function queue() { - global $phpEx, $phpbb_root_path, $phpbb_filesystem; + global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container; $this->data = array(); - $this->cache_file = "{$phpbb_root_path}cache/queue.$phpEx"; + $this->cache_file = $phpbb_container->getParameter('core.cache_dir') . "queue.$phpEx"; $this->filesystem = $phpbb_filesystem; } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 2bc7ed471e..48d30a9341 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -544,7 +544,7 @@ function create_thumbnail($source, $destination, $mimetype) $used_imagick = false; - // Only use imagemagick if defined and the passthru function not disabled + // Only use ImageMagick if defined and the passthru function not disabled if ($config['img_imagick'] && function_exists('passthru')) { if (substr($config['img_imagick'], -1) !== '/') diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 9702056d7b..d5ed5522f2 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1012,6 +1012,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $approve_log[] = array( 'forum_id' => $post_data['forum_id'], 'topic_id' => $post_data['topic_id'], + 'post_id' => $post_id, 'post_subject' => $post_data['post_subject'], 'poster_id' => $post_data['poster_id'], 'post_username' => $post_data['post_username'], diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index bf93593c74..1ccced7a2f 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -104,7 +104,7 @@ class mcp_queue if (!empty($topic_id_list) && $mode == 'deleted_topics') { - if (!function_exists('mcp_delete_topics')) + if (!function_exists('mcp_delete_topic')) { global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/mcp/mcp_main.' . $phpEx); diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php index 60e63eddc4..6350f4bc5a 100644 --- a/phpBB/includes/questionnaire/questionnaire.php +++ b/phpBB/includes/questionnaire/questionnaire.php @@ -190,7 +190,6 @@ class phpbb_questionnaire_system_data_provider // - 192.168.0.0/16 if ($ip_address_ary[0] == '10' || ($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) || - ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168') || ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168')) { return true; diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 1132271689..ad9a99204f 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -739,6 +739,34 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1; $enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false); + /** + * Modify private message + * + * @event core.ucp_pm_compose_modify_parse_before + * @var bool enable_bbcode Whether or not bbcode is enabled + * @var bool enable_smilies Whether or not smilies are enabled + * @var bool enable_urls Whether or not urls are enabled + * @var bool enable_sig Whether or not signature is enabled + * @var string subject PM subject text + * @var object message_parser The message parser object + * @var bool submit Whether or not the form has been sumitted + * @var bool preview Whether or not the signature is being previewed + * @var array error Any error strings + * @since 3.1.10-RC1 + */ + $vars = array( + 'enable_bbcode', + 'enable_smilies', + 'enable_urls', + 'enable_sig', + 'subject', + 'message_parser', + 'submit', + 'preview', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_parse_before', compact($vars))); + // Parse Attachments - before checksum is calculated $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 64c49e17ac..a9f8e10eef 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -558,6 +558,16 @@ class ucp_profile 'user_sig_bbcode_bitfield' => $bbcode_bitfield ); + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_modify_signature_sql_ary + * @var array sql_ary Array with user signature data to submit to the database + * @since 3.1.10-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_signature_sql_ary', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user->data['user_id']; |