aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_board.php17
-rw-r--r--phpBB/includes/acp/acp_extensions.php241
-rw-r--r--phpBB/includes/acp/acp_help_phpbb.php143
-rw-r--r--phpBB/includes/acp/acp_main.php21
-rw-r--r--phpBB/includes/acp/acp_permissions.php5
-rw-r--r--phpBB/includes/acp/acp_profile.php4
-rw-r--r--phpBB/includes/acp/acp_send_statistics.php91
-rw-r--r--phpBB/includes/acp/acp_styles.php4
-rw-r--r--phpBB/includes/acp/acp_update.php14
-rw-r--r--phpBB/includes/acp/acp_users.php4
-rw-r--r--phpBB/includes/acp/info/acp_help_phpbb.php (renamed from phpBB/includes/acp/info/acp_send_statistics.php)8
-rw-r--r--phpBB/includes/acp/info/acp_logs.php27
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/functions.php3
-rw-r--r--phpBB/includes/functions_acp.php1
-rw-r--r--phpBB/includes/functions_admin.php30
-rw-r--r--phpBB/includes/functions_content.php2
-rw-r--r--phpBB/includes/functions_display.php34
-rw-r--r--phpBB/includes/functions_download.php36
-rw-r--r--phpBB/includes/functions_messenger.php13
-rw-r--r--phpBB/includes/functions_posting.php6
-rw-r--r--phpBB/includes/functions_privmsgs.php14
-rw-r--r--phpBB/includes/functions_user.php28
-rw-r--r--phpBB/includes/mcp/mcp_forum.php2
-rw-r--r--phpBB/includes/mcp/mcp_main.php28
-rw-r--r--phpBB/includes/mcp/mcp_queue.php2
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/questionnaire/questionnaire.php6
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php13
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewfolder.php67
-rw-r--r--phpBB/includes/ucp/ucp_profile.php17
-rw-r--r--phpBB/includes/ucp/ucp_register.php22
-rw-r--r--phpBB/includes/ucp/ucp_remind.php30
33 files changed, 662 insertions, 275 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 02af98ec54..956ff7cf0f 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -26,7 +26,7 @@ if (!defined('IN_PHPBB'))
class acp_board
{
var $u_action;
- var $new_config = array();
+ var $new_config;
function main($id, $mode)
{
@@ -196,6 +196,7 @@ class acp_board
'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allowed_schemes_links' => array('lang' => 'ALLOWED_SCHEMES_LINKS', 'validate' => 'string', 'type' => 'text:0:255', 'explain' => true),
'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),
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@@ -322,7 +323,8 @@ class acp_board
'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false),
'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false),
- 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true),
+ 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
+ 'cookie_notice' => array('lang' => 'COOKIE_NOTICE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true),
)
);
break;
@@ -457,6 +459,9 @@ class acp_board
'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),
'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true),
+ 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend3' => 'ACP_SUBMIT_CHANGES',
)
@@ -485,7 +490,7 @@ class acp_board
$user->add_lang($display_vars['lang']);
}
- $this->new_config = $config;
+ $this->new_config = clone $config;
$cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config;
$error = array();
@@ -551,6 +556,12 @@ class acp_board
}
}
+ // Invalidate the text_formatter cache when posting options are changed
+ if ($mode == 'post' && $submit)
+ {
+ $phpbb_container->get('text_formatter.cache')->invalidate();
+ }
+
// Store news and exclude ids
if ($mode == 'feed' && $submit)
{
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index d2e01c80cc..164e5872bb 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -11,6 +11,9 @@
*
*/
+use phpbb\exception\exception_interface;
+use phpbb\exception\version_check_exception;
+
/**
* @ignore
*/
@@ -56,21 +59,6 @@ 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'))
{
@@ -83,16 +71,38 @@ class acp_extensions
trigger_error('FORM_INVALID', E_USER_WARNING);
}
+ /**
+ * Event to run a specific action on extension
+ *
+ * @event core.acp_extensions_run_action_before
+ * @var string action Action to run; if the event completes execution of the action, should be set to 'none'
+ * @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
+ * @var string tpl_name Template file to load
+ * @since 3.1.11-RC1
+ * @changed 3.2.1-RC1 Renamed to core.acp_extensions_run_action_before, added tpl_name, added action 'none'
+ */
+ $u_action = $this->u_action;
+ $tpl_name = '';
+ $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name');
+ extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_before', compact($vars)));
+
+ // In case they have been updated by the event
+ $this->u_action = $u_action;
+ $this->tpl_name = $tpl_name;
+
// If they've specified an extension, let's load the metadata manager and validate it.
if ($ext_name)
{
- $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path);
+ $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $phpbb_root_path);
try
{
$md_manager->get_metadata('all');
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
trigger_error($message, E_USER_WARNING);
@@ -102,6 +112,10 @@ class acp_extensions
// What are we doing?
switch ($action)
{
+ case 'none':
+ // Intentionally empty, used by extensions that execute additional actions in the prior event
+ break;
+
case 'set_config_version_check_force_unstable':
$force_unstable = $this->request->variable('force_unstable', false);
@@ -142,14 +156,14 @@ class acp_extensions
break;
case 'enable_pre':
- if (!$md_manager->validate_dir())
+ try
{
- trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $md_manager->validate_enable();
}
-
- if (!$md_manager->validate_enable())
+ catch (\phpbb\extension\exception $e)
{
- trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
+ trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
}
$extension = $phpbb_extension_manager->get_extension($ext_name);
@@ -173,14 +187,14 @@ class acp_extensions
break;
case 'enable':
- if (!$md_manager->validate_dir())
+ try
{
- trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $md_manager->validate_enable();
}
-
- if (!$md_manager->validate_enable())
+ catch (\phpbb\extension\exception $e)
{
- trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
+ trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
}
$extension = $phpbb_extension_manager->get_extension($ext_name);
@@ -303,29 +317,39 @@ class acp_extensions
case 'details':
// Output it to the template
- $md_manager->output_template_data();
+ $md_manager->output_template_data($template);
- try
+ $meta = $md_manager->get_metadata('all');
+ if (isset($meta['extra']['version-check']))
{
- $updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false));
+ try
+ {
+ $updates_available = $phpbb_extension_manager->version_check($md_manager, $request->variable('versioncheck_force', false), false, $this->config['extension_force_unstable'] ? 'unstable' : null);
- $template->assign_vars(array(
- 'S_UP_TO_DATE' => empty($updates_available),
- 'S_VERSIONCHECK' => true,
- 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
- ));
+ $template->assign_vars(array(
+ 'S_UP_TO_DATE' => empty($updates_available),
+ 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')),
+ ));
- foreach ($updates_available as $branch => $version_data)
+ foreach ($updates_available as $branch => $version_data)
+ {
+ $template->assign_block_vars('updates_available', $version_data);
+ }
+ }
+ catch (exception_interface $e)
{
- $template->assign_block_vars('updates_available', $version_data);
+ $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
+
+ $template->assign_vars(array(
+ 'S_VERSIONCHECK_FAIL' => true,
+ 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
+ ));
}
+ $template->assign_var('S_VERSIONCHECK', true);
}
- catch (\RuntimeException $e)
+ else
{
- $template->assign_vars(array(
- 'S_VERSIONCHECK_STATUS' => $e->getCode(),
- 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
- ));
+ $template->assign_var('S_VERSIONCHECK', false);
}
$template->assign_vars(array(
@@ -336,6 +360,27 @@ class acp_extensions
$this->tpl_name = 'acp_ext_details';
break;
}
+
+ /**
+ * Event to run after a specific action on extension has completed
+ *
+ * @event core.acp_extensions_run_action_after
+ * @var string action Action that has 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
+ * @var string tpl_name Template file to load
+ * @since 3.1.11-RC1
+ */
+ $u_action = $this->u_action;
+ $tpl_name = $this->tpl_name;
+ $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name');
+ extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_after', compact($vars)));
+
+ // In case they have been updated by the event
+ $this->u_action = $u_action;
+ $this->tpl_name = $tpl_name;
}
/**
@@ -350,7 +395,7 @@ class acp_extensions
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
{
- $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
+ $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
try
{
@@ -360,14 +405,28 @@ class acp_extensions
'META_VERSION' => $meta['version'],
);
- $force_update = $this->request->variable('versioncheck_force', false);
- $updates = $this->version_check($md_manager, $force_update, !$force_update);
+ if (isset($meta['extra']['version-check']))
+ {
+ try
+ {
+ $force_update = $this->request->variable('versioncheck_force', false);
+ $updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
- $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
- $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
- $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
+ $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
+ $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ }
+ catch (exception_interface $e)
+ {
+ // Ignore exceptions due to the version check
+ }
+ }
+ else
+ {
+ $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
+ }
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(
@@ -408,7 +467,7 @@ class acp_extensions
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
{
- $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
+ $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
try
{
@@ -418,14 +477,25 @@ class acp_extensions
'META_VERSION' => $meta['version'],
);
- $force_update = $this->request->variable('versioncheck_force', false);
- $updates = $this->version_check($md_manager, $force_update, !$force_update);
+ if (isset($meta['extra']['version-check']))
+ {
+ $force_update = $this->request->variable('versioncheck_force', false);
+ $updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
- $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
- $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
- $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
+ $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
+ $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ }
+ else
+ {
+ $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
+ }
+ }
+ catch (version_check_exception $e)
+ {
+ $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(
@@ -435,7 +505,7 @@ class acp_extensions
}
catch (\RuntimeException $e)
{
- $disabeld_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
+ $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
}
@@ -469,7 +539,7 @@ class acp_extensions
foreach ($uninstalled as $name => $location)
{
- $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template);
+ $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name);
try
{
@@ -479,14 +549,25 @@ class acp_extensions
'META_VERSION' => $meta['version'],
);
- $force_update = $this->request->variable('versioncheck_force', false);
- $updates = $this->version_check($md_manager, $force_update, !$force_update);
+ if (isset($meta['extra']['version-check']))
+ {
+ $force_update = $this->request->variable('versioncheck_force', false);
+ $updates = $phpbb_extension_manager->version_check($md_manager, $force_update, !$force_update);
- $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
- $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
- $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates);
+ $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true;
+ $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name'));
+ }
+ else
+ {
+ $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
+ }
+ }
+ catch (version_check_exception $e)
+ {
+ $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$this->template->assign_block_vars('disabled', array(
@@ -494,10 +575,6 @@ class acp_extensions
'S_VERSIONCHECK' => false,
));
}
- catch (\RuntimeException $e)
- {
- $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false;
- }
}
uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table'));
@@ -534,34 +611,6 @@ class acp_extensions
}
/**
- * Check the version and return the available updates.
- *
- * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check.
- * @param bool $force_update Ignores cached data. Defaults to false.
- * @param bool $force_cache Force the use of the cache. Override $force_update.
- * @return string
- * @throws RuntimeException
- */
- protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false)
- {
- $meta = $md_manager->get_metadata('all');
-
- if (!isset($meta['extra']['version-check']))
- {
- throw new \RuntimeException($this->user->lang('NO_VERSIONCHECK'), 1);
- }
-
- $version_check = $meta['extra']['version-check'];
-
- $version_helper = new \phpbb\version_helper($this->cache, $this->config, new \phpbb\file_downloader(), $this->user);
- $version_helper->set_current_version($meta['version']);
- $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false);
- $version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null);
-
- return $updates = $version_helper->get_suggested_updates($force_update, $force_cache);
- }
-
- /**
* Sort helper for the table containing the metadata about the extensions.
*/
protected function sort_extension_meta_data_table($val1, $val2)
diff --git a/phpBB/includes/acp/acp_help_phpbb.php b/phpBB/includes/acp/acp_help_phpbb.php
new file mode 100644
index 0000000000..7991a0dad6
--- /dev/null
+++ b/phpBB/includes/acp/acp_help_phpbb.php
@@ -0,0 +1,143 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @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;
+}
+
+class acp_help_phpbb
+{
+ var $u_action;
+
+ function main($id, $mode)
+ {
+ global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx;
+
+ if (!class_exists('phpbb_questionnaire_data_collector'))
+ {
+ include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
+ }
+
+ $collect_url = "https://www.phpbb.com/stats/receive_stats.php";
+
+ $this->tpl_name = 'acp_help_phpbb';
+ $this->page_title = 'ACP_HELP_PHPBB';
+
+ $submit = ($request->is_set_post('submit')) ? true : false;
+
+ $form_key = 'acp_help_phpbb';
+ add_form_key($form_key);
+ $error = array();
+
+ if ($submit && !check_form_key($form_key))
+ {
+ $error[] = $user->lang['FORM_INVALID'];
+ }
+ // Do not write values if there is an error
+ if (sizeof($error))
+ {
+ $submit = false;
+ }
+
+ // generate a unique id if necessary
+ if (!isset($config['questionnaire_unique_id']))
+ {
+ $install_id = unique_id();
+ $config->set('questionnaire_unique_id', $install_id);
+ }
+ else
+ {
+ $install_id = $config['questionnaire_unique_id'];
+ }
+
+ $collector = new phpbb_questionnaire_data_collector($install_id);
+
+ // Add data provider
+ $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
+ $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
+ $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
+
+ /**
+ * Event to modify ACP help phpBB page and/or listen to submit
+ *
+ * @event core.acp_help_phpbb_submit_before
+ * @var boolean submit Do we display the form or process the submission
+ * @since 3.2.0-RC2
+ */
+ $vars = array('submit');
+ extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars)));
+
+ if ($submit)
+ {
+ $config->set('help_send_statistics', $request->variable('help_send_statistics', false));
+ $response = $request->variable('send_statistics_response', '');
+
+ $config->set('help_send_statistics_time', time());
+
+ if (!empty($response))
+ {
+ if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false))
+ {
+ 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('CONFIG_UPDATED') . adm_back_link($this->u_action));
+ }
+
+ $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(),
+ '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
+ 'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400,
+ ));
+
+ $raw = $collector->get_data_raw();
+
+ foreach ($raw as $provider => $data)
+ {
+ if ($provider == 'install_id')
+ {
+ $data = array($provider => $data);
+ }
+
+ $template->assign_block_vars('providers', array(
+ 'NAME' => htmlspecialchars($provider),
+ ));
+
+ foreach ($data as $key => $value)
+ {
+ if (is_array($value))
+ {
+ $value = utf8_wordwrap(serialize($value), 75, "\n", true);
+ }
+
+ $template->assign_block_vars('providers.values', array(
+ 'KEY' => utf8_htmlspecialchars($key),
+ 'VALUE' => utf8_htmlspecialchars($value),
+ ));
+ }
+ }
+ }
+}
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index fe9657aecb..bb85d080ce 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -429,30 +429,39 @@ class acp_main
// Version check
$user->add_lang('install');
- if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4', '<'))
+ if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<'))
{
$template->assign_vars(array(
'S_PHP_VERSION_OLD' => true,
- 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="https://www.phpbb.com/community/viewtopic.php?f=14&amp;t=2152375">', '</a>'),
+ 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '<a href="https://www.phpbb.com/support/docs/en/3.2/ug/quickstart/requirements">', '</a>'),
));
}
if ($auth->acl_get('a_board'))
{
- /* @var $version_helper \phpbb\version_helper */
$version_helper = $phpbb_container->get('version_helper');
try
{
$recheck = $request->variable('versioncheck_force', false);
- $updates_available = $version_helper->get_suggested_updates($recheck);
+ $updates_available = $version_helper->get_update_on_branch($recheck);
+ $upgrades_available = $version_helper->get_suggested_updates();
+ if (!empty($upgrades_available))
+ {
+ $upgrades_available = array_pop($upgrades_available);
+ }
- $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available));
+ $template->assign_vars(array(
+ 'S_VERSION_UP_TO_DATE' => empty($updates_available),
+ 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available),
+ 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
+ ));
}
catch (\RuntimeException $e)
{
+ $message = call_user_func_array(array($user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
$template->assign_vars(array(
'S_VERSIONCHECK_FAIL' => true,
- 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
+ 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '',
));
}
}
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index df3e238bcc..12c43bf94c 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -758,6 +758,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));
}
@@ -829,10 +830,12 @@ class acp_permissions
if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
{
+ meta_refresh(5, $this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_ids));
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_ids)));
}
else
{
+ meta_refresh(5, $this->u_action);
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action));
}
}
@@ -904,10 +907,12 @@ class acp_permissions
if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local')
{
+ meta_refresh(5, $this->u_action . '&amp;forum_id[]=' . implode('&amp;forum_id[]=', $forum_id));
trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&amp;forum_id[]=' . implode('&amp;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 b09b496bc6..18dde382ca 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -757,6 +757,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_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php
deleted file mode 100644
index 74da5996f1..0000000000
--- a/phpBB/includes/acp/acp_send_statistics.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @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;
-}
-
-class acp_send_statistics
-{
- var $u_action;
-
- function main($id, $mode)
- {
- global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx;
-
- if (!class_exists('phpbb_questionnaire_data_collector'))
- {
- include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx);
- }
-
- $collect_url = "https://www.phpbb.com/stats/receive_stats.php";
-
- $this->tpl_name = 'acp_send_statistics';
- $this->page_title = 'ACP_SEND_STATISTICS';
-
- // generate a unique id if necessary
- if (!isset($config['questionnaire_unique_id']))
- {
- $install_id = unique_id();
- $config->set('questionnaire_unique_id', $install_id);
- }
- else
- {
- $install_id = $config['questionnaire_unique_id'];
- }
-
- $collector = new phpbb_questionnaire_data_collector($install_id);
-
- // Add data provider
- $collector->add_data_provider(new phpbb_questionnaire_php_data_provider());
- $collector->add_data_provider(new phpbb_questionnaire_system_data_provider());
- $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config));
-
- $template->assign_vars(array(
- 'U_COLLECT_STATS' => $collect_url,
- 'RAW_DATA' => $collector->get_data_for_form(),
- 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"),
- ));
-
- $raw = $collector->get_data_raw();
-
- foreach ($raw as $provider => $data)
- {
- if ($provider == 'install_id')
- {
- $data = array($provider => $data);
- }
-
- $template->assign_block_vars('providers', array(
- 'NAME' => htmlspecialchars($provider),
- ));
-
- foreach ($data as $key => $value)
- {
- if (is_array($value))
- {
- $value = utf8_wordwrap(serialize($value), 75, "\n", true);
- }
-
- $template->assign_block_vars('providers.values', array(
- 'KEY' => utf8_htmlspecialchars($key),
- 'VALUE' => utf8_htmlspecialchars($value),
- ));
- }
- }
- }
-}
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 7878cbc8e9..b954f90451 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -448,6 +448,9 @@ class acp_styles
trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ // Read style configuration file
+ $style_cfg = $this->read_style_cfg($style['style_path']);
+
// Find all available parent styles
$list = $this->find_possible_parents($styles, $id);
@@ -595,6 +598,7 @@ class acp_styles
'STYLE_ID' => $style['style_id'],
'STYLE_NAME' => htmlspecialchars($style['style_name']),
'STYLE_PATH' => htmlspecialchars($style['style_path']),
+ 'STYLE_VERSION' => htmlspecialchars($style_cfg['style_version']),
'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']),
'STYLE_PARENT' => $style['style_parent_id'],
'S_STYLE_ACTIVE' => $style['style_active'],
diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php
index b88e6d3984..b52f315d7f 100644
--- a/phpBB/includes/acp/acp_update.php
+++ b/phpBB/includes/acp/acp_update.php
@@ -38,7 +38,12 @@ class acp_update
try
{
$recheck = $request->variable('versioncheck_force', false);
- $updates_available = $version_helper->get_suggested_updates($recheck);
+ $updates_available = $version_helper->get_update_on_branch($recheck);
+ $upgrades_available = $version_helper->get_suggested_updates();
+ if (!empty($upgrades_available))
+ {
+ $upgrades_available = array_pop($upgrades_available);
+ }
}
catch (\RuntimeException $e)
{
@@ -47,10 +52,7 @@ class acp_update
$updates_available = array();
}
- foreach ($updates_available as $branch => $version_data)
- {
- $template->assign_block_vars('updates_available', $version_data);
- }
+ $template->assign_block_vars('updates_available', $updates_available);
$update_link = $phpbb_root_path . 'install/app.' . $phpEx;
@@ -62,6 +64,8 @@ class acp_update
'CURRENT_VERSION' => $config['version'],
'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link),
+ 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available),
+ 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false,
));
// Incomplete update?
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 25e9d6f658..5a2b1445dc 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -2018,7 +2018,9 @@ class acp_users
$enable_smilies = ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false;
$enable_urls = ($config['allow_sig_links']) ? $this->optionget($user_row, 'sig_links') : false;
- $decoded_message = generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $user_row['user_sig_bbcode_bitfield']);
+ $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0);
+
+ $decoded_message = generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $bbcode_flags);
$signature = $request->variable('signature', $decoded_message['text'], true);
$signature_preview = '';
diff --git a/phpBB/includes/acp/info/acp_send_statistics.php b/phpBB/includes/acp/info/acp_help_phpbb.php
index a0db1a48c4..dee8ef41d7 100644
--- a/phpBB/includes/acp/info/acp_send_statistics.php
+++ b/phpBB/includes/acp/info/acp_help_phpbb.php
@@ -11,15 +11,15 @@
*
*/
-class acp_send_statistics_info
+class acp_help_phpbb_info
{
function module()
{
return array(
- 'filename' => 'acp_send_statistics',
- 'title' => 'ACP_SEND_STATISTICS',
+ 'filename' => 'acp_help_phpbb',
+ 'title' => 'ACP_HELP_PHPBB',
'modes' => array(
- 'send_statistics' => array('title' => 'ACP_SEND_STATISTICS', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),
+ 'help_phpbb' => array('title' => 'ACP_HELP_PHPBB', 'auth' => 'acl_a_server', 'cat' => array('ACP_SERVER_CONFIGURATION')),
),
);
}
diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php
index efa35b2118..1be7b2883d 100644
--- a/phpBB/includes/acp/info/acp_logs.php
+++ b/phpBB/includes/acp/info/acp_logs.php
@@ -15,15 +15,30 @@ class acp_logs_info
{
function module()
{
+ global $phpbb_dispatcher;
+
+ $modes = array(
+ 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
+ );
+
+ /**
+ * Event to add or modify ACP log modulemodes
+ *
+ * @event core.acp_logs_info_modify_modes
+ * @var array modes Array with modes info
+ * @since 3.1.11-RC1
+ * @since 3.2.1-RC1
+ */
+ $vars = array('modes');
+ extract($phpbb_dispatcher->trigger_event('core.acp_logs_info_modify_modes', compact($vars)));
+
return array(
'filename' => 'acp_logs',
'title' => 'ACP_LOGGING',
- 'modes' => array(
- 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')),
- ),
+ 'modes' => $modes,
);
}
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 38017255b4..440064140c 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-RC2-dev');
+@define('PHPBB_VERSION', '3.2.1-dev');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 8996c0e766..3dabd1b46e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2188,7 +2188,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
$u_action .= ((strpos($u_action, '?') === false) ? '?' : '&amp;') . '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'],
@@ -4454,6 +4454,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'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'],
'S_ALLOW_CDN' => !empty($config['allow_cdn']),
+ 'S_COOKIE_NOTICE' => !empty($config['cookie_notice']),
'T_THEME_NAME' => rawurlencode($user->style['style_path']),
'T_THEME_LANG_NAME' => $user->data['user_lang'],
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 766669480d..8bf42aa36e 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -88,6 +88,7 @@ function adm_page_header($page_title)
'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/",
'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/",
'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/",
+ 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$phpbb_root_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'],
'T_ASSETS_VERSION' => $config['assets_version'],
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index c1a99da231..1ad41156f9 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -644,8 +644,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
*
* @event core.move_posts_before
* @var array post_ids Array of post ids to move
- * @var string topic_id The topic id the posts are moved to
- * @var bool auto_sync Whether or not to perform auto sync
+ * @var int topic_id The topic id the posts are moved to
+ * @var bool auto_sync Whether or not to perform auto sync
* @var array forum_ids Array of the forum ids the posts are moved from
* @var array topic_ids Array of the topic ids the posts are moved from
* @var array forum_row Array with the forum id of the topic the posts are moved to
@@ -676,8 +676,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
*
* @event core.move_posts_after
* @var array post_ids Array of the moved post ids
- * @var string topic_id The topic id the posts are moved to
- * @var bool auto_sync Whether or not to perform auto sync
+ * @var int topic_id The topic id the posts are moved to
+ * @var bool auto_sync Whether or not to perform auto sync
* @var array forum_ids Array of the forum ids the posts are moved from
* @var array topic_ids Array of the topic ids the posts are moved from
* @var array forum_row Array with the forum id of the topic the posts are moved to
@@ -701,6 +701,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
sync('topic_attachment', 'topic_id', $topic_ids);
sync('topic', 'topic_id', $topic_ids, true);
sync('forum', 'forum_id', $forum_ids, true, true);
+
+ /**
+ * Perform additional actions after move post sync
+ *
+ * @event core.move_posts_sync_after
+ * @var array post_ids Array of the moved post ids
+ * @var int topic_id The topic id the posts are moved to
+ * @var bool auto_sync Whether or not to perform auto sync
+ * @var array forum_ids Array of the forum ids the posts are moved from
+ * @var array topic_ids Array of the topic ids the posts are moved from
+ * @var array forum_row Array with the forum id of the topic the posts are moved to
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'post_ids',
+ 'topic_id',
+ 'auto_sync',
+ 'forum_ids',
+ 'topic_ids',
+ 'forum_row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars)));
}
// Update posted information
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 9ec965a6a1..387606a300 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -686,7 +686,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
* @var bool allow_url_bbcode Whether or not to parse the [url] BBCode
* @var string mode Mode to parse text as, e.g. post or sig
* @since 3.1.0-a1
- * @changed 3.2.0-a1
+ * @changed 3.2.0-a1 Added mode
*/
$vars = array(
'text',
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 4726676e2d..c8b5ec8b1a 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -282,6 +282,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
$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();
+ $subforums[$parent_id][$forum_id]['type'] = $row['forum_type'];
if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index'])
{
@@ -441,7 +442,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
* @var array root_data Array with the root forum data
* @var array row The data of the 'category'
* @since 3.1.0-RC4
- * @change 3.1.7-RC1 Removed undefined catless variable
+ * @changed 3.1.7-RC1 Removed undefined catless variable
*/
$vars = array(
'cat_row',
@@ -490,6 +491,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id),
'name' => $subforum_row['name'],
'unread' => $subforum_unread,
+ 'type' => $subforum_row['type'],
);
}
else
@@ -571,6 +573,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'U_SUBFORUM' => $subforum['link'],
'SUBFORUM_NAME' => $subforum['name'],
'S_UNREAD' => $subforum['unread'],
+ 'IS_LINK' => $subforum['type'] == FORUM_LINK,
);
}
$s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list);
@@ -645,7 +648,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
* @var array row The data of the forum
* @var array subforums_row Template data of subforums
* @since 3.1.0-a1
- * @change 3.1.0-b5 Added var subforums_row
+ * @changed 3.1.0-b5 Added var subforums_row
*/
$vars = array('forum_row', 'row', 'subforums_row');
extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars)));
@@ -726,6 +729,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
*/
function generate_forum_rules(&$forum_data)
{
+ if ($forum_data['forum_rules'])
+ {
+ $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
+ }
+
if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link'])
{
return;
@@ -733,11 +741,6 @@ function generate_forum_rules(&$forum_data)
global $template;
- if ($forum_data['forum_rules'])
- {
- $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']);
- }
-
$template->assign_vars(array(
'S_FORUM_RULES' => true,
'U_FORUM_RULES' => $forum_data['forum_rules_link'],
@@ -1543,6 +1546,23 @@ function phpbb_get_user_rank($user_data, $user_posts)
}
}
+ /**
+ * Modify a user's rank before displaying
+ *
+ * @event core.get_user_rank_after
+ * @var array user_data Array with user's data
+ * @var int user_posts User_posts to change
+ * @var array user_rank_data User rank data
+ * @since 3.1.11-RC1
+ */
+
+ $vars = array(
+ 'user_data',
+ 'user_posts',
+ 'user_rank_data',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars)));
+
return $user_rank_data;
}
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index d61ce3d098..e00be1e01a 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -124,7 +124,7 @@ function wrap_img_in_html($src, $title)
*/
function send_file_to_browser($attachment, $upload_dir, $category)
{
- global $user, $db, $phpbb_root_path, $request;
+ global $user, $db, $phpbb_dispatcher, $phpbb_root_path, $request;
$filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename'];
@@ -149,6 +149,26 @@ function send_file_to_browser($attachment, $upload_dir, $category)
// Now send the File Contents to the Browser
$size = @filesize($filename);
+ /**
+ * Event to alter attachment before it is sent to browser.
+ *
+ * @event core.send_file_to_browser_before
+ * @var array attachment Attachment data
+ * @var string upload_dir Relative path of upload directory
+ * @var int category Attachment category
+ * @var string filename Path to file, including filename
+ * @var int size File size
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'attachment',
+ 'upload_dir',
+ 'category',
+ 'filename',
+ 'size',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars)));
+
// To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work)
// Check if headers already sent or not able to get the file contents.
@@ -689,6 +709,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');
@@ -697,6 +719,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 526e18528f..757a49003b 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -1076,7 +1076,18 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false)
}
$collector = new \phpbb\error_collector;
$collector->install();
- $smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
+
+ $options = array();
+ $verify_peer = (bool) $config['smtp_verify_peer'];
+ $verify_peer_name = (bool) $config['smtp_verify_peer_name'];
+ $allow_self_signed = (bool) $config['smtp_allow_self_signed'];
+ $remote_socket = $config['smtp_host'] . ':' . $config['smtp_port'];
+
+ // Set ssl context options, see http://php.net/manual/en/context.ssl.php
+ $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed);
+ $socket_context = stream_context_create($options);
+
+ $smtp->socket = stream_socket_client($remote_socket, $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $socket_context);
$collector->uninstall();
$error_contents = $collector->format_errors();
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 551165c558..7bc9608536 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1676,7 +1676,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''),
'topic_first_poster_colour' => $user->data['user_colour'],
'topic_type' => $topic_type,
- 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,
+ 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0,
'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0,
'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED,
);
@@ -1771,7 +1771,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
'topic_title' => $subject,
'topic_first_poster_name' => $username,
'topic_type' => $topic_type,
- 'topic_time_limit' => ($topic_type == POST_STICKY || $topic_type == POST_ANNOUNCE) ? ($data_ary['topic_time_limit'] * 86400) : 0,
+ 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0,
'poll_title' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '',
'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0,
'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1,
@@ -2386,7 +2386,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
* @var string url The "Return to topic" URL
*
* @since 3.1.0-a3
- * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
+ * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* poll, update_message, update_search_index
*/
$vars = array(
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 69c3dad9e6..ff962075a8 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";
@@ -2151,7 +2158,7 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db,
}
// Get maximum number of allowed recipients
- $sql = 'SELECT MIN(g.group_' . $setting . ') as min_setting, MAX(g.group_' . $setting . ') as max_setting
+ $sql = 'SELECT MAX(g.group_' . $setting . ') as max_setting
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug
WHERE ug.user_id = ' . (int) $user_id . '
AND ug.user_pending = 0
@@ -2160,9 +2167,8 @@ function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db,
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$max_setting = (int) $row['max_setting'];
- $min_setting = (int) $row['min_setting'];
- return ($min_setting > 0) ? $max_setting : 0;
+ return $max_setting;
}
/**
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 227ac3fe0c..3dd4b3c2e5 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -272,13 +272,15 @@ function user_add($user_row, $cp_data = false, $notifications_data = null)
* Use this event to modify the values to be inserted when a user is added
*
* @event core.user_add_modify_data
- * @var array user_row Array of user details submited to user_add
- * @var array cp_data Array of Custom profile fields submited to user_add
- * @var array sql_ary Array of data to be inserted when a user is added
+ * @var array user_row Array of user details submited to user_add
+ * @var array cp_data Array of Custom profile fields submited to user_add
+ * @var array sql_ary Array of data to be inserted when a user is added
+ * @var array notifications_data Array of notification data to be inserted when a user is added
* @since 3.1.0-a1
- * @change 3.1.0-b5
+ * @changed 3.1.0-b5 Added user_row and cp_data
+ * @changed 3.1.11-RC1 Added notifications_data
*/
- $vars = array('user_row', 'cp_data', 'sql_ary');
+ $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data');
extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars)));
$sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
@@ -1299,7 +1301,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
*/
function user_unban($mode, $ban)
{
- global $db, $user, $cache, $phpbb_log;
+ global $db, $user, $cache, $phpbb_log, $phpbb_dispatcher;
// Delete stale bans
$sql = 'DELETE FROM ' . BANLIST_TABLE . '
@@ -1373,6 +1375,20 @@ function user_unban($mode, $ban)
));
}
}
+
+ /**
+ * Use this event to perform actions after the unban has been performed
+ *
+ * @event core.user_unban
+ * @var string mode One of the following: user, ip, email
+ * @var array user_ids_ary Array with user_ids
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'mode',
+ 'user_ids_ary',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars)));
}
$cache->destroy('sql', BANLIST_TABLE);
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index c8e1e46209..3e214797c8 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -466,7 +466,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id)
return;
}
- $redirect = $request->variable('redirect', build_url(array('quickmod')));
+ $redirect = $request->variable('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&amp;i=main&amp;mode=forum_view");
$s_hidden_fields = build_hidden_fields(array(
'i' => 'main',
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 0270166ad0..971982e4fc 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -164,7 +164,7 @@ class mcp_main
* @var string action Topic quick moderation action name
* @var bool quickmod Flag indicating whether MCP is in quick moderation mode
* @since 3.1.0-a4
- * @change 3.1.0-RC4 Added variables: action, quickmod
+ * @changed 3.1.0-RC4 Added variables: action, quickmod
*/
$vars = array('action', 'quickmod');
extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars)));
@@ -470,7 +470,7 @@ function change_topic_type($action, $topic_ids)
*/
function mcp_move_topic($topic_ids)
{
- global $auth, $user, $db, $template, $phpbb_log, $request;
+ global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher;
global $phpEx, $phpbb_root_path;
// Here we limit the operation to one forum only
@@ -632,6 +632,18 @@ function mcp_move_topic($topic_ids)
'poll_last_vote' => (int) $row['poll_last_vote']
);
+ /**
+ * Perform actions before shadow topic is created.
+ *
+ * @event core.mcp_main_modify_shadow_sql
+ * @var array shadow SQL array to be used by $db->sql_build_array
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'shadow',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars)));
+
$db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow));
// Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts
@@ -1327,6 +1339,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;
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 9060cc1098..f379392b12 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -577,7 +577,7 @@ class mcp_queue
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
'POST_TIME' => $user->format_date($row['post_time']),
- 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
+ 'S_HAS_ATTACHMENTS' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'],
));
}
unset($rowset, $forum_names);
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index c68ff87cd7..d6e36fec39 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1219,7 +1219,7 @@ class parse_message extends bbcode_firstpass
* @var bool return Do we return after the event is triggered if $warn_msg is not empty
* @var array warn_msg Array of the warning messages
* @since 3.1.2-RC1
- * @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
+ * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid
*/
$message = $this->message;
$warn_msg = $this->warn_msg;
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
index 6350f4bc5a..9699843db4 100644
--- a/phpBB/includes/questionnaire/questionnaire.php
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -46,9 +46,9 @@ class phpbb_questionnaire_data_collector
$this->providers = array();
}
- function add_data_provider(&$provider)
+ function add_data_provider($provider)
{
- $this->providers[] = &$provider;
+ $this->providers[] = $provider;
}
/**
@@ -80,7 +80,7 @@ class phpbb_questionnaire_data_collector
{
foreach (array_keys($this->providers) as $key)
{
- $provider = &$this->providers[$key];
+ $provider = $this->providers[$key];
$this->data[$provider->get_identifier()] = $provider->get_data();
}
$this->data['install_id'] = $this->install_id;
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b61a9fab9f..06f76aa01a 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -280,7 +280,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var bool delete Whether the user is deleting the PM
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.0-RC5
- * @change 3.2.0-a1 Removed undefined variables
+ * @changed 3.2.0-a1 Removed undefined variables
*/
$vars = array(
'sql',
@@ -345,7 +345,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var bool delete If deleting message
* @var int reply_to_all Value of reply_to_all request variable.
* @since 3.1.0-RC5
- * @change 3.2.0-a1 Removed undefined variables
+ * @changed 3.2.0-a1 Removed undefined variables
*/
$vars = array(
'sql',
@@ -889,13 +889,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature)
{
- $parse_sig = new parse_message($preview_signature);
- $parse_sig->bbcode_uid = $preview_signature_uid;
- $parse_sig->bbcode_bitfield = $preview_signature_bitfield;
-
- $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']);
- $preview_signature = $parse_sig->message;
- unset($parse_sig);
+ $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0);
+ $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $bbcode_flags);
}
else
{
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php
index af2126c83d..b5bb406d7d 100644
--- a/phpBB/includes/ucp/ucp_pm_viewfolder.php
+++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php
@@ -394,7 +394,7 @@ function view_folder($id, $mode, $folder_id, $folder)
*/
function get_pm_from($folder_id, $folder, $user_id)
{
- global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request;
+ global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher;
$start = $request->variable('start', 0);
@@ -459,7 +459,7 @@ function get_pm_from($folder_id, $folder, $user_id)
$start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count);
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start);
- $template->assign_vars(array(
+ $template_vars = array(
'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count),
'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'),
@@ -473,7 +473,33 @@ function get_pm_from($folder_id, $folder, $user_id)
'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=compose') : '',
'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&amp;mode=view&amp;action=view_folder&amp;f=$folder_id" . (($start !== 0) ? "&amp;start=$start" : '')),
- ));
+ );
+
+ /**
+ * Modify template variables before they are assigned
+ *
+ * @event core.ucp_pm_view_folder_get_pm_from_template
+ * @var int folder_id Folder ID
+ * @var array folder Folder data
+ * @var int user_id User ID
+ * @var string base_url Pagination base URL
+ * @var int start Pagination start
+ * @var int pm_count Count of PMs
+ * @var array template_vars Template variables to be assigned
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'folder_id',
+ 'folder',
+ 'user_id',
+ 'base_url',
+ 'start',
+ 'pm_count',
+ 'template_vars',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars)));
+
+ $template->assign_vars($template_vars);
// Grab all pm data
$rowset = $pm_list = array();
@@ -507,15 +533,38 @@ function get_pm_from($folder_id, $folder, $user_id)
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
}
- $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported
- FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u
- WHERE t.user_id = $user_id
+ $sql_ary = array(
+ 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported',
+ 'FROM' => array(
+ PRIVMSGS_TO_TABLE => 't',
+ PRIVMSGS_TABLE => 'p',
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => "t.user_id = $user_id
AND p.author_id = u.user_id
AND $folder_sql
AND t.msg_id = p.msg_id
- $sql_limit_time
- ORDER BY $sql_sort_order";
- $result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
+ $sql_limit_time",
+ 'ORDER_BY' => $sql_sort_order,
+ );
+
+ /**
+ * Modify SQL before it is executed
+ *
+ * @event core.ucp_pm_view_folder_get_pm_from_sql
+ * @var array sql_ary SQL array
+ * @var int sql_limit SQL limit
+ * @var int sql_start SQL start
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'sql_ary',
+ 'sql_limit',
+ 'sql_start',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars)));
+
+ $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start);
$pm_reported = array();
while ($row = $db->sql_fetchrow($result))
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index a86c4f2672..b7f8501fe4 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -478,7 +478,9 @@ class ucp_profile
$enable_smilies = ($config['allow_sig_smilies']) ? $user->optionget('sig_smilies') : false;
$enable_urls = ($config['allow_sig_links']) ? $user->optionget('sig_links') : false;
- $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $user->data['user_sig_bbcode_bitfield']);
+ $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0);
+
+ $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $bbcode_flags);
$signature = $request->variable('signature', $decoded_message['text'], true);
$signature_preview = '';
@@ -506,7 +508,7 @@ class ucp_profile
* @var bool submit Whether or not the form has been sumitted
* @var bool preview Whether or not the signature is being previewed
* @since 3.1.10-RC1
- * @change 3.2.0-RC2 Removed message parser
+ * @changed 3.2.0-RC2 Removed message parser
*/
$vars = array(
'enable_bbcode',
@@ -662,10 +664,19 @@ class ucp_profile
'user_avatar_height' => $result['avatar_height'],
);
+ /**
+ * Trigger events on successfull avatar change
+ *
+ * @event core.ucp_profile_avatar_sql
+ * @var array result Array with data to be stored in DB
+ * @since 3.1.11-RC1
+ */
+ $vars = array('result');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
WHERE user_id = ' . (int) $user->data['user_id'];
-
$db->sql_query($sql);
meta_refresh(3, $this->u_action);
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 1b62790700..594100ac65 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -45,6 +45,28 @@ class ucp_register
$change_lang = $request->variable('change_lang', '');
$user_lang = $request->variable('lang', $user->lang_name);
+ /**
+ * Add UCP register data before they are assigned to the template or submitted
+ *
+ * To assign data to the template, use $template->assign_vars()
+ *
+ * @event core.ucp_register_requests_after
+ * @var bool coppa Is set coppa
+ * @var bool agreed Did user agree to coppa?
+ * @var bool submit Is set post submit?
+ * @var string change_lang Change language request
+ * @var string user_lang User language request
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'coppa',
+ 'agreed',
+ 'submit',
+ 'change_lang',
+ 'user_lang',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars)));
+
if ($agreed)
{
add_form_key('ucp_register');
diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php
index a44f077693..7040370627 100644
--- a/phpBB/includes/ucp/ucp_remind.php
+++ b/phpBB/includes/ucp/ucp_remind.php
@@ -30,7 +30,7 @@ class ucp_remind
function main($id, $mode)
{
global $config, $phpbb_root_path, $phpEx, $request;
- global $db, $user, $template, $phpbb_container;
+ global $db, $user, $template, $phpbb_container, $phpbb_dispatcher;
if (!$config['allow_password_reset'])
{
@@ -43,10 +43,30 @@ class ucp_remind
if ($submit)
{
- $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason
- FROM ' . USERS_TABLE . "
- WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "'
- AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'";
+ $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)) . "'
+ 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($sql);
$user_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);