aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_attachments.php15
-rw-r--r--phpBB/includes/acp/acp_ban.php5
-rw-r--r--phpBB/includes/acp/acp_bots.php6
-rw-r--r--phpBB/includes/acp/acp_disallow.php4
-rw-r--r--phpBB/includes/acp/acp_email.php11
-rw-r--r--phpBB/includes/acp/acp_forums.php31
-rw-r--r--phpBB/includes/acp/acp_groups.php10
-rw-r--r--phpBB/includes/acp/acp_inactive.php15
-rw-r--r--phpBB/includes/acp/acp_jabber.php5
-rw-r--r--phpBB/includes/acp/acp_language.php5
-rw-r--r--phpBB/includes/acp/acp_main.php31
-rw-r--r--phpBB/includes/acp/acp_permission_roles.php11
-rw-r--r--phpBB/includes/acp/acp_permissions.php11
-rw-r--r--phpBB/includes/acp/acp_profile.php11
-rw-r--r--phpBB/includes/acp/acp_prune.php6
-rw-r--r--phpBB/includes/acp/acp_send_statistics.php5
-rw-r--r--phpBB/includes/acp/acp_styles.php18
-rw-r--r--phpBB/includes/acp/acp_users.php72
-rw-r--r--phpBB/includes/functions.php21
-rw-r--r--phpBB/includes/functions_acp.php8
-rw-r--r--phpBB/includes/functions_admin.php352
-rw-r--r--phpBB/includes/functions_content.php16
-rw-r--r--phpBB/includes/functions_display.php19
-rw-r--r--phpBB/includes/functions_mcp.php36
-rw-r--r--phpBB/includes/functions_posting.php223
-rw-r--r--phpBB/includes/functions_privmsgs.php36
-rw-r--r--phpBB/includes/functions_user.php13
-rw-r--r--phpBB/includes/mcp/mcp_forum.php8
-rw-r--r--phpBB/includes/mcp/mcp_queue.php11
-rw-r--r--phpBB/includes/message_parser.php36
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php10
-rw-r--r--phpBB/includes/ucp/ucp_pm.php2
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php14
-rw-r--r--phpBB/includes/ucp/ucp_profile.php52
34 files changed, 436 insertions, 693 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 7ff9846a75..00dd209c6f 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -39,6 +39,9 @@ class acp_attachments
/** @var \phpbb\filesystem\filesystem_interface */
protected $filesystem;
+ /** @var \phpbb\attachment\manager */
+ protected $attachment_manager;
+
public $id;
public $u_action;
protected $new_config;
@@ -55,6 +58,7 @@ class acp_attachments
$this->user = $user;
$this->phpbb_container = $phpbb_container;
$this->filesystem = $phpbb_filesystem;
+ $this->attachment_manager = $phpbb_container->get('attachment.manager');
$user->add_lang(array('posting', 'viewtopic', 'acp/attachments'));
@@ -110,7 +114,10 @@ class acp_attachments
{
case 'attach':
- include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
+ if (!function_exists('get_supported_image_types'))
+ {
+ include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
+ }
$sql = 'SELECT group_name, cat_id
FROM ' . EXTENSION_GROUPS_TABLE . '
@@ -922,11 +929,11 @@ class acp_attachments
$delete_files = array();
while ($row = $db->sql_fetchrow($result))
{
- phpbb_unlink($row['physical_filename'], 'file');
+ $this->attachment_manager->unlink($row['physical_filename'], 'file');
if ($row['thumbnail'])
{
- phpbb_unlink($row['physical_filename'], 'thumbnail');
+ $this->attachment_manager->unlink($row['physical_filename'], 'thumbnail');
}
$delete_files[$row['attach_id']] = $row['real_filename'];
@@ -1091,7 +1098,7 @@ class acp_attachments
}
$db->sql_freeresult($result);
- if ($num_deleted = delete_attachments('attach', $delete_files))
+ if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files))
{
if (sizeof($delete_files) != $num_deleted)
{
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php
index b555f46a94..286bc92813 100644
--- a/phpBB/includes/acp/acp_ban.php
+++ b/phpBB/includes/acp/acp_ban.php
@@ -28,7 +28,10 @@ class acp_ban
global $user, $template, $request, $phpbb_dispatcher;
global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_ban'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$bansubmit = $request->is_set_post('bansubmit');
$unbansubmit = $request->is_set_post('unbansubmit');
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php
index e0220ad0c3..422e1e34d7 100644
--- a/phpBB/includes/acp/acp_bots.php
+++ b/phpBB/includes/acp/acp_bots.php
@@ -141,7 +141,11 @@ class acp_bots
case 'edit':
case 'add':
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+
+ if (!function_exists('user_update_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$bot_row = array(
'bot_name' => $request->variable('bot_name', '', true),
diff --git a/phpBB/includes/acp/acp_disallow.php b/phpBB/includes/acp/acp_disallow.php
index 2c27616748..b2a7128209 100644
--- a/phpBB/includes/acp/acp_disallow.php
+++ b/phpBB/includes/acp/acp_disallow.php
@@ -26,9 +26,7 @@ class acp_disallow
function main($id, $mode)
{
global $db, $user, $auth, $template, $cache, $phpbb_log, $request;
- global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
-
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ global $config, $phpbb_admin_path;
$user->add_lang('acp/posting');
diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php
index ebc4a86de3..98c74ff8b3 100644
--- a/phpBB/includes/acp/acp_email.php
+++ b/phpBB/includes/acp/acp_email.php
@@ -189,8 +189,15 @@ class acp_email
$db->sql_freeresult($result);
// Send the messages
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
+
+ if (!function_exists('get_group_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$messenger = new messenger($use_queue);
$errored = false;
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index f252f2a594..dd9ff37773 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -950,17 +950,21 @@ class acp_forums
$errors = array();
+ $forum_data_ary = $forum_data;
/**
* Validate the forum data before we create/update the forum
*
* @event core.acp_manage_forums_validate_data
- * @var array forum_data Array with new forum data
+ * @var array forum_data_ary Array with new forum data
* @var array errors Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1
+ * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
- $vars = array('forum_data', 'errors');
+ $vars = array('forum_data_ary', 'errors');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars)));
+ $forum_data = $forum_data_ary;
+ unset($forum_data_ary);
if ($forum_data['forum_name'] == '')
{
@@ -1058,18 +1062,22 @@ class acp_forums
}
unset($forum_data_sql['forum_password_unset']);
+ $forum_data_ary = $forum_data;
/**
* Remove invalid values from forum_data_sql that should not be updated
*
* @event core.acp_manage_forums_update_data_before
- * @var array forum_data Array with forum data
+ * @var array forum_data_ary Array with forum data
* @var array forum_data_sql Array with data we are going to update
* If forum_data_sql[forum_id] is set, we update
* that forum, otherwise a new one is created.
* @since 3.1.0-a1
+ * @change 3.2.0-a1 Replaced forum_data by forum_data_ary
*/
- $vars = array('forum_data', 'forum_data_sql');
+ $vars = array('forum_data_ary', 'forum_data_sql');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars)));
+ $forum_data = $forum_data_ary;
+ unset($forum_data_ary);
$is_new_forum = !isset($forum_data_sql['forum_id']);
@@ -1348,11 +1356,12 @@ class acp_forums
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data['forum_name']));
}
+ $forum_data_ary = $forum_data;
/**
* Event after a forum was updated or created
*
* @event core.acp_manage_forums_update_data_after
- * @var array forum_data Array with forum data
+ * @var array forum_data_ary Array with forum data
* @var array forum_data_sql Array with data we updated
* @var bool is_new_forum Did we create a forum or update one
* If you want to overwrite this value,
@@ -1360,9 +1369,12 @@ class acp_forums
* @var array errors Array of errors, should be strings and not
* language key.
* @since 3.1.0-a1
+ * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
- $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors');
+ $vars = array('forum_data_ary', 'forum_data_sql', 'is_new_forum', 'errors');
extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars)));
+ $forum_data = $forum_data_ary;
+ unset($forum_data_ary);
return $errors;
}
@@ -1788,7 +1800,7 @@ class acp_forums
*/
function delete_forum_content($forum_id)
{
- global $db, $config, $phpbb_root_path, $phpEx, $phpbb_dispatcher;
+ global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -1809,7 +1821,10 @@ class acp_forums
}
$db->sql_freeresult($result);
- delete_attachments('topic', $topic_ids, false);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('topic', $topic_ids, false);
+ unset($attachment_manager);
// Delete shadow topics pointing to topics in this forum
delete_topic_shadows($forum_id);
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 138234caee..41366982d2 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -42,7 +42,10 @@ class acp_groups
return;
}
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('group_user_attributes'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
// Check and set some common vars
$action = (isset($_POST['add'])) ? 'add' : ((isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', ''));
@@ -298,7 +301,10 @@ class acp_groups
case 'edit':
case 'add':
- include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ if (!function_exists('display_forums'))
+ {
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ }
$data = $submit_ary = array();
diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php
index df445394db..8c021560a0 100644
--- a/phpBB/includes/acp/acp_inactive.php
+++ b/phpBB/includes/acp/acp_inactive.php
@@ -34,7 +34,10 @@ class acp_inactive
global $config, $db, $user, $auth, $template, $phpbb_container, $phpbb_log, $request;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_active_flip'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$user->add_lang('memberlist');
@@ -111,7 +114,10 @@ class acp_inactive
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !empty($inactive_users))
{
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
$messenger = new messenger(false);
@@ -200,7 +206,10 @@ class acp_inactive
if ($row = $db->sql_fetchrow($result))
{
// Send the messages
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
$messenger = new messenger();
$usernames = $user_ids = array();
diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php
index 5058e9c769..1726728086 100644
--- a/phpBB/includes/acp/acp_jabber.php
+++ b/phpBB/includes/acp/acp_jabber.php
@@ -34,7 +34,10 @@ class acp_jabber
$user->add_lang('acp/board');
- include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
+ if (!class_exists('jabber'))
+ {
+ include($phpbb_root_path . 'includes/functions_jabber.' . $phpEx);
+ }
$action = $request->variable('action', '');
$submit = (isset($_POST['submit'])) ? true : false;
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index e7ee7f47d6..03172e475a 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -34,7 +34,10 @@ class acp_language
global $config, $db, $user, $template, $phpbb_log, $phpbb_container;
global $phpbb_root_path, $phpEx, $request;
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('validate_language_iso_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
// Check and set some common vars
$action = (isset($_POST['update_details'])) ? 'update_details' : '';
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 47e2660770..529c3a1835 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -434,21 +434,29 @@ class acp_main
));
}
- /* @var $version_helper \phpbb\version_helper */
- $version_helper = $phpbb_container->get('version_helper');
- try
+ if ($auth->acl_get('a_board'))
{
- $recheck = $request->variable('versioncheck_force', false);
- $updates_available = $version_helper->get_suggested_updates($recheck);
+ /* @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);
- $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available));
+ $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available));
+ }
+ catch (\RuntimeException $e)
+ {
+ $template->assign_vars(array(
+ 'S_VERSIONCHECK_FAIL' => true,
+ 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
+ ));
+ }
}
- catch (\RuntimeException $e)
+ else
{
- $template->assign_vars(array(
- 'S_VERSIONCHECK_FAIL' => true,
- 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '',
- ));
+ // We set this template var to true, to not display an outdated version notice.
+ $template->assign_var('S_VERSION_UP_TO_DATE', true);
}
/**
@@ -559,6 +567,7 @@ class acp_main
'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'),
'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'),
+ 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false,
'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false,
'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false,
)
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php
index 21c751b61a..2d71ab4c71 100644
--- a/phpBB/includes/acp/acp_permission_roles.php
+++ b/phpBB/includes/acp/acp_permission_roles.php
@@ -30,8 +30,15 @@ class acp_permission_roles
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
global $request, $phpbb_log;
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
- include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
+
+ if (!class_exists('auth_admin'))
+ {
+ include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ }
$this->auth_admin = new auth_admin();
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index 1c54ce2c65..26e7266409 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -34,8 +34,15 @@ class acp_permissions
global $db, $user, $auth, $template, $cache, $phpbb_container, $request;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
- include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
+
+ if (!class_exists('auth_admin'))
+ {
+ include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ }
$this->permissions = $phpbb_container->get('acl.permissions');
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index c60e203040..07620d0dcd 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -37,8 +37,15 @@ class acp_profile
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher;
- include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('generate_smilies'))
+ {
+ include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
+ }
+
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$user->add_lang(array('ucp', 'acp/profile'));
$this->tpl_name = 'acp_profile';
diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php
index 025ace9809..2ea1e89df6 100644
--- a/phpBB/includes/acp/acp_prune.php
+++ b/phpBB/includes/acp/acp_prune.php
@@ -28,7 +28,11 @@ class acp_prune
global $user, $phpEx, $phpbb_admin_path, $phpbb_root_path;
$user->add_lang('acp/prune');
- include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+
+ if (!function_exists('user_active_flip'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
switch ($mode)
{
diff --git a/phpBB/includes/acp/acp_send_statistics.php b/phpBB/includes/acp/acp_send_statistics.php
index 4c5786dbe9..74da5996f1 100644
--- a/phpBB/includes/acp/acp_send_statistics.php
+++ b/phpBB/includes/acp/acp_send_statistics.php
@@ -27,7 +27,10 @@ class acp_send_statistics
{
global $config, $template, $phpbb_admin_path, $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $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";
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index de3ca5f787..0cd6633710 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -62,9 +62,12 @@ class acp_styles
/** @var string */
protected $php_ext;
+ /** @var \phpbb\event\dispatcher_interface */
+ protected $dispatcher;
+
public function main($id, $mode)
{
- global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_container;
+ global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container;
$this->db = $db;
$this->user = $user;
@@ -76,6 +79,7 @@ class acp_styles
$this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $phpEx;
+ $this->dispatcher = $phpbb_dispatcher;
$this->default_style = $config['default_style'];
$this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/';
@@ -125,6 +129,18 @@ class acp_styles
)
);
+ /**
+ * Run code before ACP styles action execution
+ *
+ * @event core.acp_styles_action_before
+ * @var int id Module ID
+ * @var string mode Active module
+ * @var string action Module that should be run
+ * @since 3.1.7-RC1
+ */
+ $vars = array('id', 'mode', 'action');
+ extract($this->dispatcher->trigger_event('core.acp_styles_action_before', compact($vars)));
+
// Execute actions
switch ($action)
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 857c625867..b0b8fb1e60 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -57,7 +57,10 @@ class acp_users
// Whois (special case)
if ($action == 'whois')
{
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$this->page_title = 'WHOIS';
$this->tpl_name = 'simple_body';
@@ -170,7 +173,10 @@ class acp_users
{
case 'overview':
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$user->add_lang('acp/ban');
@@ -354,7 +360,10 @@ class acp_users
if ($config['email_enable'])
{
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
$server_url = generate_board_url();
@@ -440,7 +449,10 @@ class acp_users
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ if (!class_exists('messenger'))
+ {
+ include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
+ }
$messenger = new messenger(false);
@@ -543,7 +555,10 @@ class acp_users
if (confirm_box(true))
{
- delete_attachments('user', $user_id);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('user', $user_id);
+ unset($attachment_manager);
$phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username']));
trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id));
@@ -1397,7 +1412,10 @@ class acp_users
case 'profile':
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
/* @var $cp \phpbb\profilefields\manager */
$cp = $phpbb_container->get('profilefields.manager');
@@ -1557,7 +1575,10 @@ class acp_users
case 'prefs':
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('user_get_id_name'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$data = array(
'dateformat' => $request->variable('dateformat', $user_row['user_dateformat'], true),
@@ -1827,8 +1848,6 @@ class acp_users
case 'avatar':
- include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
-
$avatars_enabled = false;
if ($config['allow_avatar'])
@@ -1984,7 +2003,10 @@ class acp_users
case 'sig':
- include_once($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ if (!function_exists('display_custom_bbcodes'))
+ {
+ include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
+ }
$enable_bbcode = ($config['allow_sig_bbcode']) ? $this->optionget($user_row, 'sig_bbcode') : false;
$enable_smilies = ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false;
@@ -2007,7 +2029,20 @@ class acp_users
}
$bbcode_uid = $bbcode_bitfield = $bbcode_flags = '';
- $warn_msg = generate_text_for_storage($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags, $enable_bbcode, $enable_urls, $enable_smilies);
+ $warn_msg = generate_text_for_storage(
+ $signature,
+ $bbcode_uid,
+ $bbcode_bitfield,
+ $bbcode_flags,
+ $enable_bbcode,
+ $enable_urls,
+ $enable_smilies,
+ $config['allow_sig_img'],
+ $config['allow_sig_flash'],
+ true,
+ $config['allow_sig_links'],
+ 'sig'
+ );
if (sizeof($warn_msg))
{
@@ -2126,7 +2161,10 @@ class acp_users
}
$db->sql_freeresult($result);
- delete_attachments('attach', $marked);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('attach', $marked);
+ unset($attachment_manager);
$message = (sizeof($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED'];
@@ -2236,7 +2274,10 @@ class acp_users
case 'groups':
- include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ if (!function_exists('group_user_attributes'))
+ {
+ include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ }
$user->add_lang(array('groups', 'acp/groups'));
$group_id = $request->variable('g', 0);
@@ -2455,7 +2496,10 @@ class acp_users
case 'perm':
- include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ if (!class_exists('auth_admin'))
+ {
+ include($phpbb_root_path . 'includes/acp/auth.' . $phpEx);
+ }
$auth_admin = new auth_admin();
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 58b2f0ca57..d4f662626e 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3618,10 +3618,14 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum'
if (sizeof($online_users['online_users']))
{
- $sql = 'SELECT username, username_clean, user_id, user_type, user_allow_viewonline, user_colour
- FROM ' . USERS_TABLE . '
- WHERE ' . $db->sql_in_set('user_id', $online_users['online_users']) . '
- ORDER BY username_clean ASC';
+ $sql_ary = array(
+ 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour',
+ 'FROM' => array(
+ USERS_TABLE => 'u',
+ ),
+ 'WHERE' => $db->sql_in_set('u.user_id', $online_users['online_users']),
+ 'ORDER_BY' => 'u.username_clean ASC',
+ );
/**
* Modify SQL query to obtain online users data
@@ -3633,13 +3637,14 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum'
* @var string item Restrict online users to a certain
* session item, e.g. forum for
* session_forum_id
- * @var string sql SQL query to obtain users online data
+ * @var string sql_ary SQL query to obtain users online data
* @since 3.1.4-RC1
+ * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary.
*/
- $vars = array('online_users', 'item_id', 'item', 'sql');
+ $vars = array('online_users', 'item_id', 'item', 'sql_ary');
extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars)));
- $result = $db->sql_query($sql);
+ $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
$rowset = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);
@@ -3653,7 +3658,7 @@ function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum'
$row['username'] = '<em>' . $row['username'] . '</em>';
}
- if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline'))
+ if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id'])
{
$user_online_link[$row['user_id']] = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
}
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index eea18a0c47..390b59b9e9 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -383,6 +383,7 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
$tpl .= $vars['append'];
}
+ $new_ary = $new;
/**
* Overwrite the html code we display for the config value
*
@@ -392,14 +393,17 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
* 1 [optional] => string: size, int: minimum
* 2 [optional] => string: max. length, int: maximum
* @var string key Should be used for the id attribute in html
- * @var array new Array with the config values we display
+ * @var array new_ary Array with the config values we display
* @var string name Should be used for the name attribute
* @var array vars Array with the options for the config
* @var string tpl The resulting html code we display
* @since 3.1.0-a1
+ * @change 3.2.0-a1 Replaced new with new_ary
*/
- $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl');
+ $vars = array('tpl_type', 'key', 'new_ary', 'name', 'vars', 'tpl');
extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars)));
+ $new = $new_ary;
+ unset($new_ary);
return $tpl;
}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 3515150f93..459d61a17a 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -833,6 +833,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
'notification.type.quote',
'notification.type.approve_post',
'notification.type.post_in_queue',
+ 'notification.type.report_post',
);
/**
@@ -1024,7 +1025,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
$search->index_remove($post_ids, $poster_ids, $forum_ids);
- delete_attachments('post', $post_ids, false);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('post', $post_ids, false);
+ unset($attachment_manager);
/**
* Perform additional actions during post(s) deletion
@@ -1111,329 +1115,21 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
/**
* Delete Attachments
*
+* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
+*
* @param string $mode can be: post|message|topic|attach|user
* @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids
* @param bool $resync set this to false if you are deleting posts or topics
*/
function delete_attachments($mode, $ids, $resync = true)
{
- global $db, $config, $phpbb_dispatcher;
-
- // 0 is as bad as an empty array
- if (empty($ids))
- {
- return false;
- }
-
- if (is_array($ids))
- {
- $ids = array_unique($ids);
- $ids = array_map('intval', $ids);
- }
- else
- {
- $ids = array((int) $ids);
- }
-
- $sql_where = '';
-
- switch ($mode)
- {
- case 'post':
- case 'message':
- $sql_id = 'post_msg_id';
- $sql_where = ' AND in_message = ' . ($mode == 'message' ? 1 : 0);
- break;
-
- case 'topic':
- $sql_id = 'topic_id';
- break;
-
- case 'user':
- $sql_id = 'poster_id';
- break;
-
- case 'attach':
- default:
- $sql_id = 'attach_id';
- $mode = 'attach';
- break;
- }
-
- $post_ids = $message_ids = $topic_ids = $physical = array();
-
- /**
- * Perform additional actions before collecting data for attachment(s) deletion
- *
- * @event core.delete_attachments_collect_data_before
- * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user
- * @var mixed ids Array or comma separated list of ids corresponding to the mode
- * @var bool resync Flag indicating if posts/messages/topics should be synchronized
- * @var string sql_id The field name to collect/delete data for depending on the mode
- * @since 3.1.7-RC1
- */
- $vars = array(
- 'mode',
- 'ids',
- 'resync',
- 'sql_id',
- );
- extract($phpbb_dispatcher->trigger_event('core.delete_attachments_collect_data_before', compact($vars)));
-
- // Collect post and topic ids for later use if we need to touch remaining entries (if resync is enabled)
- $sql = 'SELECT post_msg_id, topic_id, in_message, physical_filename, thumbnail, filesize, is_orphan
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set($sql_id, $ids);
-
- $sql .= $sql_where;
-
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- // We only need to store post/message/topic ids if resync is enabled and the file is not orphaned
- if ($resync && !$row['is_orphan'])
- {
- if (!$row['in_message'])
- {
- $post_ids[] = $row['post_msg_id'];
- $topic_ids[] = $row['topic_id'];
- }
- else
- {
- $message_ids[] = $row['post_msg_id'];
- }
- }
-
- $physical[] = array('filename' => $row['physical_filename'], 'thumbnail' => $row['thumbnail'], 'filesize' => $row['filesize'], 'is_orphan' => $row['is_orphan']);
- }
- $db->sql_freeresult($result);
-
- /**
- * Perform additional actions before attachment(s) deletion
- *
- * @event core.delete_attachments_before
- * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user
- * @var mixed ids Array or comma separated list of ids corresponding to the mode
- * @var bool resync Flag indicating if posts/messages/topics should be synchronized
- * @var string sql_id The field name to collect/delete data for depending on the mode
- * @var array post_ids Array with post ids for deleted attachment(s)
- * @var array topic_ids Array with topic ids for deleted attachment(s)
- * @var array message_ids Array with private message ids for deleted attachment(s)
- * @var array physical Array with deleted attachment(s) physical file(s) data
- * @since 3.1.7-RC1
- */
- $vars = array(
- 'mode',
- 'ids',
- 'resync',
- 'sql_id',
- 'post_ids',
- 'topic_ids',
- 'message_ids',
- 'physical',
- );
- extract($phpbb_dispatcher->trigger_event('core.delete_attachments_before', compact($vars)));
-
- // Delete attachments
- $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set($sql_id, $ids);
-
- $sql .= $sql_where;
-
- $db->sql_query($sql);
- $num_deleted = $db->sql_affectedrows();
-
- /**
- * Perform additional actions after attachment(s) deletion from the database
- *
- * @event core.delete_attachments_from_database_after
- * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user
- * @var mixed ids Array or comma separated list of ids corresponding to the mode
- * @var bool resync Flag indicating if posts/messages/topics should be synchronized
- * @var string sql_id The field name to collect/delete data for depending on the mode
- * @var array post_ids Array with post ids for deleted attachment(s)
- * @var array topic_ids Array with topic ids for deleted attachment(s)
- * @var array message_ids Array with private message ids for deleted attachment(s)
- * @var array physical Array with deleted attachment(s) physical file(s) data
- * @var int num_deleted The number of deleted attachment(s) from the database
- * @since 3.1.7-RC1
- */
- $vars = array(
- 'mode',
- 'ids',
- 'resync',
- 'sql_id',
- 'post_ids',
- 'topic_ids',
- 'message_ids',
- 'physical',
- 'num_deleted',
- );
- extract($phpbb_dispatcher->trigger_event('core.delete_attachments_from_database_after', compact($vars)));
-
- if (!$num_deleted)
- {
- return 0;
- }
+ global $phpbb_container;
- // Delete attachments from filesystem
- $space_removed = $files_removed = 0;
- foreach ($physical as $file_ary)
- {
- if (phpbb_unlink($file_ary['filename'], 'file', true) && !$file_ary['is_orphan'])
- {
- // Only non-orphaned files count to the file size
- $space_removed += $file_ary['filesize'];
- $files_removed++;
- }
-
- if ($file_ary['thumbnail'])
- {
- phpbb_unlink($file_ary['filename'], 'thumbnail', true);
- }
- }
-
- /**
- * Perform additional actions after attachment(s) deletion from the filesystem
- *
- * @event core.delete_attachments_from_filesystem_after
- * @var string mode Variable containing attachments deletion mode, can be: post|message|topic|attach|user
- * @var mixed ids Array or comma separated list of ids corresponding to the mode
- * @var bool resync Flag indicating if posts/messages/topics should be synchronized
- * @var string sql_id The field name to collect/delete data for depending on the mode
- * @var array post_ids Array with post ids for deleted attachment(s)
- * @var array topic_ids Array with topic ids for deleted attachment(s)
- * @var array message_ids Array with private message ids for deleted attachment(s)
- * @var array physical Array with deleted attachment(s) physical file(s) data
- * @var int num_deleted The number of deleted attachment(s) from the database
- * @var int space_removed The size of deleted files(s) from the filesystem
- * @var int files_removed The number of deleted file(s) from the filesystem
- * @since 3.1.7-RC1
- */
- $vars = array(
- 'mode',
- 'ids',
- 'resync',
- 'sql_id',
- 'post_ids',
- 'topic_ids',
- 'message_ids',
- 'physical',
- 'num_deleted',
- 'space_removed',
- 'files_removed',
- );
- extract($phpbb_dispatcher->trigger_event('core.delete_attachments_from_filesystem_after', compact($vars)));
-
- if ($space_removed || $files_removed)
- {
- $config->increment('upload_dir_size', $space_removed * (-1), false);
- $config->increment('num_files', $files_removed * (-1), false);
- }
-
- // If we do not resync, we do not need to adjust any message, post, topic or user entries
- if (!$resync)
- {
- return $num_deleted;
- }
-
- // No more use for the original ids
- unset($ids);
-
- // Now, we need to resync posts, messages, topics. We go through every one of them
- $post_ids = array_unique($post_ids);
- $message_ids = array_unique($message_ids);
- $topic_ids = array_unique($topic_ids);
-
- // Update post indicators for posts now no longer having attachments
- if (sizeof($post_ids))
- {
- // Just check which posts are still having an assigned attachment not orphaned by querying the attachments table
- $sql = 'SELECT post_msg_id
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set('post_msg_id', $post_ids) . '
- AND in_message = 0
- AND is_orphan = 0';
- $result = $db->sql_query($sql);
-
- $remaining_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $remaining_ids[] = $row['post_msg_id'];
- }
- $db->sql_freeresult($result);
-
- // Now only unset those ids remaining
- $post_ids = array_diff($post_ids, $remaining_ids);
-
- if (sizeof($post_ids))
- {
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_attachment = 0
- WHERE ' . $db->sql_in_set('post_id', $post_ids);
- $db->sql_query($sql);
- }
- }
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $num_deleted = $attachment_manager->delete($mode, $ids, $resync);
- // Update message table if messages are affected
- if (sizeof($message_ids))
- {
- // Just check which messages are still having an assigned attachment not orphaned by querying the attachments table
- $sql = 'SELECT post_msg_id
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set('post_msg_id', $message_ids) . '
- AND in_message = 1
- AND is_orphan = 0';
- $result = $db->sql_query($sql);
-
- $remaining_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $remaining_ids[] = $row['post_msg_id'];
- }
- $db->sql_freeresult($result);
-
- // Now only unset those ids remaining
- $message_ids = array_diff($message_ids, $remaining_ids);
-
- if (sizeof($message_ids))
- {
- $sql = 'UPDATE ' . PRIVMSGS_TABLE . '
- SET message_attachment = 0
- WHERE ' . $db->sql_in_set('msg_id', $message_ids);
- $db->sql_query($sql);
- }
- }
-
- // Now update the topics. This is a bit trickier, because there could be posts still having attachments within the topic
- if (sizeof($topic_ids))
- {
- // Just check which topics are still having an assigned attachment not orphaned by querying the attachments table (much less entries expected)
- $sql = 'SELECT topic_id
- FROM ' . ATTACHMENTS_TABLE . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . '
- AND is_orphan = 0';
- $result = $db->sql_query($sql);
-
- $remaining_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $remaining_ids[] = $row['topic_id'];
- }
- $db->sql_freeresult($result);
-
- // Now only unset those ids remaining
- $topic_ids = array_diff($topic_ids, $remaining_ids);
-
- if (sizeof($topic_ids))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_attachment = 0
- WHERE ' . $db->sql_in_set('topic_id', $topic_ids);
- $db->sql_query($sql);
- }
- }
+ unset($attachment_manager);
return $num_deleted;
}
@@ -1551,27 +1247,19 @@ function update_posted_info(&$topic_ids)
/**
* Delete attached file
+*
+* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
*/
function phpbb_unlink($filename, $mode = 'file', $entry_removed = false)
{
- global $db, $phpbb_root_path, $config;
+ global $phpbb_container;
- // Because of copying topics or modifications a physical filename could be assigned more than once. If so, do not remove the file itself.
- $sql = 'SELECT COUNT(attach_id) AS num_entries
- FROM ' . ATTACHMENTS_TABLE . "
- WHERE physical_filename = '" . $db->sql_escape(utf8_basename($filename)) . "'";
- $result = $db->sql_query($sql);
- $num_entries = (int) $db->sql_fetchfield('num_entries');
- $db->sql_freeresult($result);
-
- // Do not remove file if at least one additional entry with the same name exist.
- if (($entry_removed && $num_entries > 0) || (!$entry_removed && $num_entries > 1))
- {
- return false;
- }
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed);
+ unset($attachment_manager);
- $filename = ($mode == 'thumbnail') ? 'thumb_' . utf8_basename($filename) : utf8_basename($filename);
- return @unlink($phpbb_root_path . $config['upload_path'] . '/' . $filename);
+ return $unlink;
}
/**
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 345df1d47a..b87220caa5 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -564,10 +564,11 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text
* @param bool $allow_flash_bbcode
* @param bool $allow_quote_bbcode
* @param bool $allow_url_bbcode
+* @param string $mode Mode to parse text as, e.g. post or sig
*
* @return array An array of string with the errors that occurred while parsing
*/
-function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true)
+function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $mode = 'post')
{
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
@@ -586,7 +587,9 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
* @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode
* @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode
* @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
*/
$vars = array(
'text',
@@ -600,6 +603,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
'allow_flash_bbcode',
'allow_quote_bbcode',
'allow_url_bbcode',
+ 'mode',
);
extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars)));
@@ -612,7 +616,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb
}
$message_parser = new parse_message($text);
- $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode);
+ $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, true, $mode);
$text = $message_parser->message;
$uid = $message_parser->bbcode_uid;
@@ -1206,6 +1210,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
);
}
+ $update_count_ary = $update_count;
/**
* Use this event to modify the attachment template data.
*
@@ -1219,8 +1224,9 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
* @var array extensions Array with attachment extensions data
* @var mixed forum_id The forum id the attachments are displayed in (false if in private message)
* @var bool preview Flag indicating if we are in post preview mode
- * @var array update_count Array with attachment ids to update download count
+ * @var array update_count_ary Array with attachment ids to update download count
* @since 3.1.0-RC5
+ * @change 3.2.0-a1 Replaced update_count with update_count_ary
*/
$vars = array(
'attachment',
@@ -1230,9 +1236,11 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count,
'extensions',
'forum_id',
'preview',
- 'update_count',
+ 'update_count_ary',
);
extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars)));
+ $update_count = $update_count_ary;
+ unset($update_count_ary);
$template->assign_block_vars('_file', $block_array);
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 3d61b5c098..9e45f32689 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -438,15 +438,14 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
*
* @event core.display_forums_modify_category_template_vars
* @var array cat_row Template data of the 'category'
- * @var bool catless The flag indicating whether the 'category' has a parent category
* @var bool last_catless The flag indicating whether the last forum had a parent category
* @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
*/
$vars = array(
'cat_row',
- 'catless',
'last_catless',
'root_data',
'row',
@@ -811,25 +810,29 @@ function generate_forum_nav(&$forum_data)
'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data['forum_options'])) ? true : false,
);
+ $forum_data_ary = $forum_data;
/**
* Event to modify the navlinks text
*
* @event core.generate_forum_nav
- * @var array forum_data Array with the forum data
+ * @var array forum_data_ary Array with the forum data
* @var array forum_template_data Array with generic forum template data
* @var string microdata_attr The microdata attribute
* @var array navlinks_parents Array with the forum parents navlinks data
* @var array navlinks Array with the forum navlinks data
* @since 3.1.5-RC1
+ * @change 3.2.0-a1 Replaced forum_data with forum_data_ary
*/
$vars = array(
- 'forum_data',
+ 'forum_data_ary',
'forum_template_data',
'microdata_attr',
'navlinks_parents',
'navlinks',
);
extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars)));
+ $forum_data = $forum_data_ary;
+ unset($forum_data_ary);
$template->assign_block_vars_array('navlinks', $navlinks_parents);
$template->assign_block_vars('navlinks', $navlinks);
@@ -1237,17 +1240,21 @@ function display_user_activity(&$userdata)
}
}
+ $userdata_ary = $userdata;
/**
* Alter list of forums and topics to display as active
*
* @event core.display_user_activity_modify_actives
- * @var array userdata User's data
+ * @var array userdata_ary User's data
* @var array active_f_row List of active forums
* @var array active_t_row List of active posts
* @since 3.1.0-RC3
+ * @change 3.2.0-a1 Replaced userdata with userdata_ary
*/
- $vars = array('userdata', 'active_f_row', 'active_t_row');
+ $vars = array('userdata_ary', 'active_f_row', 'active_t_row');
extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars)));
+ $userdata = $userdata_ary;
+ unset($userdata_ary);
$userdata['active_t_row'] = $active_t_row;
$userdata['active_f_row'] = $active_f_row;
diff --git a/phpBB/includes/functions_mcp.php b/phpBB/includes/functions_mcp.php
index 50acbebd4f..f9e38e8aa0 100644
--- a/phpBB/includes/functions_mcp.php
+++ b/phpBB/includes/functions_mcp.php
@@ -557,6 +557,11 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
// Default total to -1 to allow editing by the event
$total = -1;
+ $sort_by_sql_ary = $sort_by_sql;
+ $sort_days_val = $sort_days;
+ $sort_dir_val = $sort_dir;
+ $sort_key_val = $sort_key;
+ $total_val = $total;
/**
* This event allows you to control the SQL query used to get the total number
* of reports the user can access.
@@ -571,19 +576,20 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
* @var string type Which kind of information is this being used for displaying. Posts, topics, etc...
* @var int forum_id The forum id of the posts the user is trying to access, if not 0
* @var int topic_id The topic id of the posts the user is trying to access, if not 0
- * @var int sort_days The max age of the oldest report to be shown, in days
- * @var string sort_key The way the user has decided to sort the data.
+ * @var int sort_days_val The max age of the oldest report to be shown, in days
+ * @var string sort_key_val The way the user has decided to sort the data.
* The valid values must be in the keys of the sort_by_* variables
- * @var string sort_dir Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query
+ * @var string sort_dir_val Either 'd' for "DESC" or 'a' for 'ASC' in the SQL query
* @var int limit_days The possible max ages of the oldest report for the user to choose, in days.
- * @var array sort_by_sql SQL text (values) for the possible names of the ways of sorting data (keys).
+ * @var array sort_by_sql_ary SQL text (values) for the possible names of the ways of sorting data (keys).
* @var array sort_by_text Language text (values) for the possible names of the ways of sorting data (keys).
* @var int min_time Integer with the minimum post time that the user is searching for
* @var int limit_time_sql Time limiting options used in the SQL query.
- * @var int total The total number of reports that exist. Only set if you want to override the result
+ * @var int total_val The total number of reports that exist. Only set if you want to override the result
* @var string where_sql Extra information included in the WHERE clause. It must end with "WHERE" or "AND" or "OR".
* Set to "WHERE" and set total above -1 to override the total value
* @since 3.1.4-RC1
+ * @change 3.2.0-a1 Replaced sort_days, sort_key, sort_dir, sort_by_sql, total with replacement variables
*/
$vars = array(
'sql',
@@ -591,18 +597,28 @@ function phpbb_mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by
'type',
'forum_id',
'topic_id',
- 'sort_days',
- 'sort_key',
- 'sort_dir',
+ 'sort_days_val',
+ 'sort_key_val',
+ 'sort_dir_val',
'limit_days',
- 'sort_by_sql',
+ 'sort_by_sql_ary',
'sort_by_text',
'min_time',
'limit_time_sql',
- 'total',
+ 'total_val',
'where_sql',
);
extract($phpbb_dispatcher->trigger_event('core.mcp_sorting_query_before', compact($vars)));
+ $sort_by_sql = $sort_by_sql_ary;
+ $sort_days = $sort_days_val;
+ $sort_key = $sort_key_val;
+ $sort_dir = $sort_dir_val;
+ $total = $total_val;
+ unset($sort_by_sql_ary);
+ unset($sort_days_val);
+ unset($sort_key_val);
+ unset($sort_dir_val);
+ unset($total_val);
if (!isset($sort_by_sql[$sort_key]))
{
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 19756d97b4..4f14dc8683 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -391,183 +391,27 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
* Upload Attachment - filedata is generated here
* Uses upload class
*
+* @deprecated 3.2.0-a1 (To be removed: 3.4.0)
+*
* @param string $form_name The form name of the file upload input
* @param int $forum_id The id of the forum
* @param bool $local Whether the file is local or not
* @param string $local_storage The path to the local file
* @param bool $is_message Whether it is a PM or not
-* @param \filespec $local_filedata A filespec object created for the local file
-* @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype guesser object if used
-* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used
+* @param array $local_filedata A filespec object created for the local file
*
-* @return object filespec
+* @return array File data array
*/
-function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
+function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false)
{
- global $auth, $user, $config, $db, $cache;
- global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container;
-
- $filedata = array(
- 'error' => array()
- );
-
- $upload = $phpbb_container->get('files.upload');
-
- if ($config['check_attachment_content'] && isset($config['mime_triggers']))
- {
- $upload->set_disallowed_content(explode('|', $config['mime_triggers']));
- }
- else if (!$config['check_attachment_content'])
- {
- $upload->set_disallowed_content(array());
- }
-
- $filedata['post_attach'] = $local || $upload->is_valid($form_name);
+ global $phpbb_container;
- if (!$filedata['post_attach'])
- {
- $filedata['error'][] = $user->lang['NO_UPLOAD_FORM_FOUND'];
- return $filedata;
- }
-
- $extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
- $upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
-
- /** @var \phpbb\files\filespec $file */
- $file = ($local) ? $upload->handle_upload('files.types.local', $local_storage, $local_filedata) : $upload->handle_upload('files.types.form', $form_name);
-
- if ($file->init_error())
- {
- $filedata['post_attach'] = false;
- return $filedata;
- }
-
- // Whether the uploaded file is in the image category
- $is_image = (isset($extensions[$file->get('extension')]['display_cat'])) ? $extensions[$file->get('extension')]['display_cat'] == ATTACHMENT_CATEGORY_IMAGE : false;
-
- if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id))
- {
- // Check Image Size, if it is an image
- if ($is_image)
- {
- $file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
- }
-
- // Admins and mods are allowed to exceed the allowed filesize
- if (!empty($extensions[$file->get('extension')]['max_filesize']))
- {
- $allowed_filesize = $extensions[$file->get('extension')]['max_filesize'];
- }
- else
- {
- $allowed_filesize = ($is_message) ? $config['max_filesize_pm'] : $config['max_filesize'];
- }
-
- $file->upload->set_max_filesize($allowed_filesize);
- }
-
- $file->clean_filename('unique', $user->data['user_id'] . '_');
-
- // Are we uploading an image *and* this image being within the image category?
- // Only then perform additional image checks.
- $file->move_file($config['upload_path'], false, !$is_image);
-
- // Do we have to create a thumbnail?
- $filedata['thumbnail'] = ($is_image && $config['img_create_thumbnail']) ? 1 : 0;
-
- if (sizeof($file->error))
- {
- $file->remove();
- $filedata['error'] = array_merge($filedata['error'], $file->error);
- $filedata['post_attach'] = false;
-
- return $filedata;
- }
-
- // Make sure the image category only holds valid images...
- if ($is_image && !$file->is_image())
- {
- $file->remove();
-
- if ($plupload && $plupload->is_active())
- {
- $plupload->emit_error(104, 'ATTACHED_IMAGE_NOT_IMAGE');
- }
-
- // If this error occurs a user tried to exploit an IE Bug by renaming extensions
- // Since the image category is displaying content inline we need to catch this.
- trigger_error($user->lang['ATTACHED_IMAGE_NOT_IMAGE']);
- }
-
- $filedata['filesize'] = $file->get('filesize');
- $filedata['mimetype'] = $file->get('mimetype');
- $filedata['extension'] = $file->get('extension');
- $filedata['physical_filename'] = $file->get('realname');
- $filedata['real_filename'] = $file->get('uploadname');
- $filedata['filetime'] = time();
-
- /**
- * Event to modify uploaded file before submit to the post
- *
- * @event core.modify_uploaded_file
- * @var array filedata Array containing uploaded file data
- * @var bool is_image Flag indicating if the file is an image
- * @since 3.1.0-RC3
- */
- $vars = array(
- 'filedata',
- 'is_image',
- );
- extract($phpbb_dispatcher->trigger_event('core.modify_uploaded_file', compact($vars)));
-
- // Check our complete quota
- if ($config['attachment_quota'])
- {
- if ($config['upload_dir_size'] + $file->get('filesize') > $config['attachment_quota'])
- {
- $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
- $filedata['post_attach'] = false;
-
- $file->remove();
-
- return $filedata;
- }
- }
-
- // Check free disk space
- if ($free_space = @disk_free_space($phpbb_root_path . $config['upload_path']))
- {
- if ($free_space <= $file->get('filesize'))
- {
- if ($auth->acl_get('a_'))
- {
- $filedata['error'][] = $user->lang['ATTACH_DISK_FULL'];
- }
- else
- {
- $filedata['error'][] = $user->lang['ATTACH_QUOTA_REACHED'];
- }
- $filedata['post_attach'] = false;
-
- $file->remove();
-
- return $filedata;
- }
- }
-
- // Create Thumbnail
- if ($filedata['thumbnail'])
- {
- $source = $file->get('destination_file');
- $destination = $file->get('destination_path') . '/thumb_' . $file->get('realname');
-
- if (!create_thumbnail($source, $destination, $file->get('mimetype')))
- {
- $filedata['thumbnail'] = 0;
- }
- }
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata);
+ unset($attachment_manager);
- return $filedata;
+ return $file;
}
/**
@@ -1520,6 +1364,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
global $db, $auth, $user, $config, $phpEx, $template, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request;
+ $poll_ary = $poll;
+ $data_ary = $data;
/**
* Modify the data for post submitting
*
@@ -1528,23 +1374,28 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var string subject Variable containing post subject value
* @var string username Variable containing post author name
* @var int topic_type Variable containing topic type value
- * @var array poll Array with the poll data for the post
- * @var array data Array with the data for the post
+ * @var array poll_ary Array with the poll data for the post
+ * @var array data_ary Array with the data for the post
* @var bool update_message Flag indicating if the post will be updated
* @var bool update_search_index Flag indicating if the search index will be updated
* @since 3.1.0-a4
+ * @change 3.2.0-a1 Replaced poll and data with poll_ary and data_ary
*/
$vars = array(
'mode',
'subject',
'username',
'topic_type',
- 'poll',
- 'data',
+ 'poll_ary',
+ 'data_ary',
'update_message',
'update_search_index',
);
extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars)));
+ $poll = $poll_ary;
+ $data = $data_ary;
+ unset($poll_ary);
+ unset($data_ary);
// We do not handle erasing posts here
if ($mode == 'delete')
@@ -1869,22 +1720,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
break;
}
+ $poll_ary = $poll;
+ $data_ary = $data;
/**
* Modify sql query data for post submitting
*
* @event core.submit_post_modify_sql_data
- * @var array data Array with the data for the post
- * @var array poll Array with the poll data for the post
+ * @var array data_ary Array with the data for the post
+ * @var array poll_ary Array with the poll data for the post
* @var string post_mode Variable containing posting mode value
* @var bool sql_data Array with the data for the posting SQL query
* @var string subject Variable containing post subject value
* @var int topic_type Variable containing topic type value
* @var string username Variable containing post author name
* @since 3.1.3-RC1
+ * @change 3.2.0-a1 Replace poll and data with poll_ary and data_ary
*/
$vars = array(
- 'data',
- 'poll',
+ 'data_ary',
+ 'poll_ary',
'post_mode',
'sql_data',
'subject',
@@ -1892,6 +1746,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
'username',
);
extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars)));
+ $poll = $poll_ary;
+ $data = $data_ary;
+ unset($poll_ary);
+ unset($data_ary);
// Submit new topic
if ($post_mode == 'post')
@@ -2439,6 +2297,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
$url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx";
$url = append_sid($url, 'f=' . $data['forum_id'] . $params) . $add_anchor;
+ $poll_ary = $poll;
+ $data_ary = $data;
/**
* This event is used for performing actions directly after a post or topic
* has been submitted. When a new topic is posted, the topic ID is
@@ -2452,8 +2312,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @var string subject Variable containing post subject value
* @var string username Variable containing post author name
* @var int topic_type Variable containing topic type value
- * @var array poll Array with the poll data for the post
- * @var array data Array with the data for the post
+ * @var array poll_ary Array with the poll data for the post
+ * @var array data_ary Array with the data for the post
* @var int post_visibility Variable containing up to date post visibility
* @var bool update_message Flag indicating if the post will be updated
* @var bool update_search_index Flag indicating if the search index will be updated
@@ -2462,20 +2322,25 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* @since 3.1.0-a3
* @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
* poll, update_message, update_search_index
+ * @change 3.2.0-a1 Replaced data and poll with data_ary and poll_ary
*/
$vars = array(
'mode',
'subject',
'username',
'topic_type',
- 'poll',
- 'data',
+ 'poll_ary',
+ 'data_ary',
'post_visibility',
'update_message',
'update_search_index',
'url',
);
extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars)));
+ $data = $data_ary;
+ $poll = $poll_ary;
+ unset($data_ary);
+ unset($poll_ary);
return $url;
}
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 7b6540cda7..b2928d5df8 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -1153,12 +1153,10 @@ function delete_pm($user_id, $msg_ids, $folder_id)
if (sizeof($delete_ids))
{
// Check if there are any attachments we need to remove
- if (!function_exists('delete_attachments'))
- {
- include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- }
-
- delete_attachments('message', $delete_ids, false);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('message', $delete_ids, false);
+ unset($attachment_manager);
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
@@ -1363,12 +1361,10 @@ function phpbb_delete_users_pms($user_ids)
if (!empty($delete_ids))
{
// Check if there are any attachments we need to remove
- if (!function_exists('delete_attachments'))
- {
- include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- }
-
- delete_attachments('message', $delete_ids, false);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('message', $delete_ids, false);
+ unset($attachment_manager);
$sql = 'DELETE FROM ' . PRIVMSGS_TABLE . '
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
@@ -1624,17 +1620,21 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$current_time = time();
+ $data_ary = $data;
/**
* Get all parts of the PM that are to be submited to the DB.
*
* @event core.submit_pm_before
* @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit
* @var string subject Subject of the private message
- * @var array data The whole row data of the PM.
+ * @var array data_ary The whole row data of the PM.
* @since 3.1.0-b3
+ * @change 3.2.0-a1 Replaced data with data_ary
*/
- $vars = array('mode', 'subject', 'data');
+ $vars = array('mode', 'subject', 'data_ary');
extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars)));
+ $data = $data_ary;
+ unset($data_ary);
// Collect some basic information about which tables and which rows to update/insert
$sql_data = array();
@@ -1943,18 +1943,22 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
$phpbb_notifications->add_notifications('notification.type.pm', $pm_data);
}
+ $data_ary = $data;
/**
* Get PM message ID after submission to DB
*
* @event core.submit_pm_after
* @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit
* @var string subject Subject of the private message
- * @var array data The whole row data of the PM.
+ * @var array data_ary The whole row data of the PM.
* @var array pm_data The data sent to notification class
* @since 3.1.0-b5
+ * @change 3.2.0-a1 Replaced data with data_ary
*/
- $vars = array('mode', 'subject', 'data', 'pm_data');
+ $vars = array('mode', 'subject', 'data_ary', 'pm_data');
extract($phpbb_dispatcher->trigger_event('core.submit_pm_after', compact($vars)));
+ $data = $data_ary;
+ unset($data_ary);
return $data['msg_id'];
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 98ffb4227d..7620cf1ff7 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2871,6 +2871,19 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
// Clear permissions cache of relevant users
$auth->acl_clear_prefetch($user_id_ary);
+ /**
+ * Event after users are removed from a group
+ *
+ * @event core.group_delete_user_after
+ * @var int group_id ID of the group from which users are deleted
+ * @var string group_name Name of the group
+ * @var array user_id_ary IDs of the users which are removed
+ * @var array username_ary names of the users which are removed
+ * @since 3.1.7-RC1
+ */
+ $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary');
+ extract($phpbb_dispatcher->trigger_event('core.group_delete_user_after', compact($vars)));
+
if (!$group_name)
{
$group_name = get_group_name($group_id);
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index f73973b81d..8237b834d6 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -334,16 +334,20 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
));
}
+ $row_ary = $row;
/**
* Modify the topic data before it is assigned to the template in MCP
*
* @event core.mcp_view_forum_modify_topicrow
- * @var array row Array with topic data
+ * @var array row_ary Array with topic data
* @var array topic_row Template array with topic data
* @since 3.1.0-a1
+ * @change 3.2.0-a1 Replace row with row_ary
*/
- $vars = array('row', 'topic_row');
+ $vars = array('row_ary', 'topic_row');
extract($phpbb_dispatcher->trigger_event('core.mcp_view_forum_modify_topicrow', compact($vars)));
+ $row = $row_ary;
+ unset($row_ary);
$template->assign_block_vars('topicrow', $topic_row);
}
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 132786818b..cb4b590196 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -1148,6 +1148,11 @@ class mcp_queue
// Build a list of posts to be disapproved and get the related topics real replies count
foreach ($post_info as $post_id => $post_data)
{
+ if ($mode === 'unapproved_topics' && $post_data['post_visibility'] == ITEM_APPROVED)
+ {
+ continue;
+ }
+
$post_disapprove_list[$post_id] = $post_data['topic_id'];
if (!isset($topic_posts_unapproved[$post_data['topic_id']]))
{
@@ -1157,6 +1162,12 @@ class mcp_queue
$topic_posts_unapproved[$post_data['topic_id']]++;
}
+ // Do not try to disapprove if no posts are selected
+ if (empty($post_disapprove_list))
+ {
+ trigger_error('NO_POST_SELECTED');
+ }
+
// Now we build the log array
foreach ($post_disapprove_list as $post_id => $topic_id)
{
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 31fc1577a2..059037168d 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1141,12 +1141,6 @@ class parse_message extends bbcode_firstpass
protected $plupload;
/**
- * The mimetype guesser object used for attachment mimetypes
- * @var \phpbb\mimetype\guesser
- */
- protected $mimetype_guesser;
-
- /**
* Init - give message here or manually
*/
function parse_message($message = '')
@@ -1541,6 +1535,7 @@ class parse_message extends bbcode_firstpass
function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)
{
global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request;
+ global $phpbb_container;
$error = array();
@@ -1576,7 +1571,9 @@ class parse_message extends bbcode_firstpass
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id))
{
- $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = $filedata['error'];
if ($filedata['post_attach'] && !sizeof($error))
@@ -1646,6 +1643,9 @@ class parse_message extends bbcode_firstpass
if ($index !== false && !empty($this->attachment_data[$index]))
{
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+
// delete selected attachment
if ($this->attachment_data[$index]['is_orphan'])
{
@@ -1660,11 +1660,11 @@ class parse_message extends bbcode_firstpass
if ($row)
{
- phpbb_unlink($row['physical_filename'], 'file');
+ $attachment_manager->unlink($row['physical_filename'], 'file');
if ($row['thumbnail'])
{
- phpbb_unlink($row['physical_filename'], 'thumbnail');
+ $attachment_manager->unlink($row['physical_filename'], 'thumbnail');
}
$db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']);
@@ -1672,7 +1672,7 @@ class parse_message extends bbcode_firstpass
}
else
{
- delete_attachments('attach', array(intval($this->attachment_data[$index]['attach_id'])));
+ $attachment_manager->delete('attach', $this->attachment_data[$index]['attach_id']);
}
unset($this->attachment_data[$index]);
@@ -1692,7 +1692,9 @@ class parse_message extends bbcode_firstpass
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id))
{
- $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->mimetype_guesser, $this->plupload);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message);
$error = array_merge($error, $filedata['error']);
if (!sizeof($error))
@@ -1981,18 +1983,6 @@ class parse_message extends bbcode_firstpass
}
/**
- * Setter function for passing the mimetype_guesser object
- *
- * @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype_guesser object
- *
- * @return null
- */
- public function set_mimetype_guesser(\phpbb\mimetype\guesser $mimetype_guesser)
- {
- $this->mimetype_guesser = $mimetype_guesser;
- }
-
- /**
* Function to perform custom bbcode validation by extensions
* can be used in bbcode_init() to assign regexp replacement
* Example: 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->validate_bbcode_by_extension('\$1')")
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index 639f308091..b8cb3c4100 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -70,12 +70,10 @@ class ucp_attachments
if (confirm_box(true))
{
- if (!function_exists('delete_attachments'))
- {
- include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
- }
-
- delete_attachments('attach', $delete_ids);
+ /** @var \phpbb\attachment\manager $attachment_manager */
+ $attachment_manager = $phpbb_container->get('attachment.manager');
+ $attachment_manager->delete('attach', $delete_ids);
+ unset($attachment_manager);
meta_refresh(3, $this->u_action);
$message = ((sizeof($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index 5f24d05c8b..33dff97fe6 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -92,7 +92,7 @@ class ucp_pm
$user_folders = get_folder($user->data['user_id']);
- if (!$auth->acl_get('u_sendpm'))
+ if ($action != 'delete' && !$auth->acl_get('u_sendpm'))
{
// trigger_error('NO_AUTH_SEND_MESSAGE');
$template->assign_vars(array(
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 5c32a23ad6..024a9c332f 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -266,8 +266,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
*
* @event core.ucp_pm_compose_compose_pm_basic_info_query_before
* @var string sql String with the query to be executed
- * @var array forum_list List of forums that contain the posts
- * @var int visibility_const Integer with one of the possible ITEM_* constant values
* @var int msg_id topic_id in the page request
* @var int to_user_id The id of whom the message is to
* @var int to_group_id The id of the group whom the message is to
@@ -276,14 +274,11 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies
* @var bool delete Whether the user is deleting the PM
* @var int reply_to_all Value of reply_to_all request variable.
- * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
- * @var string sort_order_sql String with the ORDER BY SQL code used in this query
* @since 3.1.0-RC5
+ * @change 3.2.0-a1 Removed undefined variables
*/
$vars = array(
'sql',
- 'forum_list',
- 'visibility_const',
'msg_id',
'to_user_id',
'to_group_id',
@@ -292,8 +287,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
'action',
'delete',
'reply_to_all',
- 'limit_time_sql',
- 'sort_order_sql',
);
extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars)));
@@ -338,8 +331,6 @@ function compose_pm($id, $mode, $action, $user_folders = array())
* @var string sql The original SQL used in the query
* @var array post Associative array with the data of the quoted post
* @var array msg_id The post_id that was searched to get the message for quoting
- * @var int visibility_const Visibility of the quoted post (one of the possible ITEM_* constant values)
- * @var int topic_id Topic ID of the quoted post
* @var int to_user_id Users the message is sent to
* @var int to_group_id Groups the message is sent to
* @var bool submit Whether the user is sending the PM or not
@@ -348,13 +339,12 @@ 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
*/
$vars = array(
'sql',
'post',
'msg_id',
- 'visibility_const',
- 'topic_id',
'to_user_id',
'to_group_id',
'submit',
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index 2f4d650ed0..f6e9acc8c4 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -195,37 +195,12 @@ class ucp_profile
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
- // Grab an array of user_id's with a_user permissions ... these users can activate a user
- $admin_ary = $auth->acl_get_list(false, 'a_user', false);
- $admin_ary = (!empty($admin_ary[0]['a_user'])) ? $admin_ary[0]['a_user'] : array();
-
- // Also include founders
- $where_sql = ' WHERE user_type = ' . USER_FOUNDER;
-
- if (sizeof($admin_ary))
- {
- $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary);
- }
-
- $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type
- FROM ' . USERS_TABLE . ' ' .
- $where_sql;
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $messenger->template('admin_activate', $row['user_lang']);
- $messenger->set_addresses($row);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($data['username']),
- 'U_USER_DETAILS' => "$server_url/memberlist.$phpEx?mode=viewprofile&u={$user->data['user_id']}",
- 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey")
- );
-
- $messenger->send($row['user_notify_type']);
- }
- $db->sql_freeresult($result);
+ $notifications_manager = $phpbb_container->get('notification_manager');
+ $notifications_manager->add_notifications('notification.type.admin_activate_user', array(
+ 'user_id' => $user->data['user_id'],
+ 'user_actkey' => $user_actkey,
+ 'user_regdate' => time(), // Notification time
+ ));
}
user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE);
@@ -518,7 +493,20 @@ class ucp_profile
}
$bbcode_uid = $bbcode_bitfield = $bbcode_flags = '';
- $warn_msg = generate_text_for_storage($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags, $enable_bbcode, $enable_urls, $enable_smilies);
+ $warn_msg = generate_text_for_storage(
+ $signature,
+ $bbcode_uid,
+ $bbcode_bitfield,
+ $bbcode_flags,
+ $enable_bbcode,
+ $enable_urls,
+ $enable_smilies,
+ $config['allow_sig_img'],
+ $config['allow_sig_flash'],
+ true,
+ $config['allow_sig_links'],
+ 'sig'
+ );
if (sizeof($warn_msg))
{