aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_forums.php12
-rw-r--r--phpBB/includes/acp/acp_inactive.php2
-rw-r--r--phpBB/includes/acp/acp_users.php24
-rw-r--r--phpBB/includes/acp/auth.php4
-rw-r--r--phpBB/includes/bbcode.php2
-rw-r--r--phpBB/includes/diff/diff.php22
-rw-r--r--phpBB/includes/diff/renderer.php2
-rw-r--r--phpBB/includes/functions.php20
-rw-r--r--phpBB/includes/functions_compress.php4
-rw-r--r--phpBB/includes/functions_content.php46
-rw-r--r--phpBB/includes/functions_messenger.php129
-rw-r--r--phpBB/includes/functions_module.php2
-rw-r--r--phpBB/includes/functions_posting.php21
-rw-r--r--phpBB/includes/functions_transfer.php8
-rw-r--r--phpBB/includes/functions_user.php22
-rw-r--r--phpBB/includes/hooks/index.php2
-rw-r--r--phpBB/includes/mcp/mcp_logs.php2
-rw-r--r--phpBB/includes/mcp/mcp_main.php20
-rw-r--r--phpBB/includes/mcp/mcp_notes.php2
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php2
-rw-r--r--phpBB/includes/mcp/mcp_post.php5
-rw-r--r--phpBB/includes/mcp/mcp_queue.php2
-rw-r--r--phpBB/includes/mcp/mcp_reports.php7
-rw-r--r--phpBB/includes/mcp/mcp_warn.php2
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/questionnaire/questionnaire.php4
-rw-r--r--phpBB/includes/sphinxapi.php44
-rw-r--r--phpBB/includes/ucp/ucp_login_link.php23
-rw-r--r--phpBB/includes/ucp/ucp_main.php68
-rw-r--r--phpBB/includes/ucp/ucp_pm.php6
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php44
-rw-r--r--phpBB/includes/ucp/ucp_register.php50
32 files changed, 470 insertions, 135 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 6b841560c9..be5a7a2f26 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1012,7 +1012,7 @@ class acp_forums
}
$range_test_ary = array(
- array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'TINT:0'),
+ array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'),
);
if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image']))
@@ -1541,6 +1541,16 @@ class acp_forums
$table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE);
+ /**
+ * Perform additional actions before move forum content
+ *
+ * @event core.acp_manage_forums_move_content_sql_before
+ * @var array table_ary Array of tables from which forum_id will be updated
+ * @since 3.2.4-RC1
+ */
+ $vars = array('table_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_sql_before', compact($vars)));
+
foreach ($table_ary as $table)
{
$sql = "UPDATE $table
diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php
index 6026f44ede..66f0d2116c 100644
--- a/phpBB/includes/acp/acp_inactive.php
+++ b/phpBB/includes/acp/acp_inactive.php
@@ -24,7 +24,7 @@ class acp_inactive
var $u_action;
var $p_master;
- function acp_inactive(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 60afccdc22..b74fe535ee 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -24,7 +24,7 @@ class acp_users
var $u_action;
var $p_master;
- function acp_users(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -1883,6 +1883,17 @@ class acp_users
'user_avatar_height' => $result['avatar_height'],
);
+ /**
+ * Modify users preferences data before assigning it to the template
+ *
+ * @event core.acp_users_avatar_sql
+ * @var array user_row Array with user data
+ * @var array result Array with user avatar data to be updated in the DB
+ * @since 3.2.4-RC1
+ */
+ $vars = array('user_row', 'result');
+ extract($phpbb_dispatcher->trigger_event('core.acp_users_avatar_sql', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $result) . '
WHERE user_id = ' . (int) $user_id;
@@ -2085,6 +2096,17 @@ class acp_users
'user_sig_bbcode_bitfield' => $bbcode_bitfield,
);
+ /**
+ * Modify user signature before it is stored in the DB
+ *
+ * @event core.acp_users_modify_signature_sql_ary
+ * @var array user_row Array with user data
+ * @var array sql_ary Array with user signature data to be updated in the DB
+ * @since 3.2.4-RC1
+ */
+ $vars = array('user_row', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_signature_sql_ary', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 58da3b922f..b414a3121a 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -27,7 +27,7 @@ class auth_admin extends \phpbb\auth\auth
/**
* Init auth settings
*/
- function auth_admin()
+ function __construct()
{
global $db, $cache;
@@ -819,7 +819,7 @@ class auth_admin extends \phpbb\auth\auth
// Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed.
$this->acl_options = array();
- $this->auth_admin();
+ $this->__construct();
return true;
}
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 239e5c8ad6..c00f9bd207 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -37,7 +37,7 @@ class bbcode
* Constructor
* Init bbcode cache entries if bitfield is specified
*/
- function bbcode($bitfield = '')
+ function __construct($bitfield = '')
{
if ($bitfield)
{
diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php
index 68c6c6e6a8..d8ae9d77ac 100644
--- a/phpBB/includes/diff/diff.php
+++ b/phpBB/includes/diff/diff.php
@@ -50,7 +50,7 @@ class diff
* @param array &$to_content An array of strings.
* @param bool $preserve_cr If true, \r is replaced by a new line in the diff output
*/
- function diff(&$from_content, &$to_content, $preserve_cr = true)
+ function __construct(&$from_content, &$to_content, $preserve_cr = true)
{
$diff_engine = new diff_engine();
$this->_edits = $diff_engine->diff($from_content, $to_content, $preserve_cr);
@@ -330,14 +330,14 @@ class mapped_diff extends diff
* compared when computing the diff.
* @param array $mapped_to_lines This array should have the same number of elements as $to_lines.
*/
- function mapped_diff(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)
+ function __construct(&$from_lines, &$to_lines, &$mapped_from_lines, &$mapped_to_lines)
{
if (count($from_lines) != count($mapped_from_lines) || count($to_lines) != count($mapped_to_lines))
{
return false;
}
- parent::diff($mapped_from_lines, $mapped_to_lines);
+ parent::__construct($mapped_from_lines, $mapped_to_lines);
$xi = $yi = 0;
for ($i = 0; $i < count($this->_edits); $i++)
@@ -394,7 +394,7 @@ class diff_op
*/
class diff_op_copy extends diff_op
{
- function diff_op_copy($orig, $final = false)
+ function __construct($orig, $final = false)
{
if (!is_array($final))
{
@@ -419,7 +419,7 @@ class diff_op_copy extends diff_op
*/
class diff_op_delete extends diff_op
{
- function diff_op_delete($lines)
+ function __construct($lines)
{
$this->orig = $lines;
$this->final = false;
@@ -440,7 +440,7 @@ class diff_op_delete extends diff_op
*/
class diff_op_add extends diff_op
{
- function diff_op_add($lines)
+ function __construct($lines)
{
$this->final = $lines;
$this->orig = false;
@@ -461,7 +461,7 @@ class diff_op_add extends diff_op
*/
class diff_op_change extends diff_op
{
- function diff_op_change($orig, $final)
+ function __construct($orig, $final)
{
$this->orig = $orig;
$this->final = $final;
@@ -498,7 +498,7 @@ class diff3 extends diff
* @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line
* in the diff output
*/
- function diff3(&$orig, &$final1, &$final2, $preserve_cr = true)
+ function __construct(&$orig, &$final1, &$final2, $preserve_cr = true)
{
$diff_engine = new diff_engine();
@@ -754,7 +754,7 @@ class diff3 extends diff
*/
class diff3_op
{
- function diff3_op($orig = false, $final1 = false, $final2 = false)
+ function __construct($orig = false, $final1 = false, $final2 = false)
{
$this->orig = $orig ? $orig : array();
$this->final1 = $final1 ? $final1 : array();
@@ -1066,7 +1066,7 @@ class diff3_op
*/
class diff3_op_copy extends diff3_op
{
- function diff3_op_copy($lines = false)
+ function __construct($lines = false)
{
$this->orig = $lines ? $lines : array();
$this->final1 = &$this->orig;
@@ -1092,7 +1092,7 @@ class diff3_op_copy extends diff3_op
*/
class diff3_block_builder
{
- function diff3_block_builder()
+ function __construct()
{
$this->_init();
}
diff --git a/phpBB/includes/diff/renderer.php b/phpBB/includes/diff/renderer.php
index c12ff3b7d5..8a8b0c295e 100644
--- a/phpBB/includes/diff/renderer.php
+++ b/phpBB/includes/diff/renderer.php
@@ -56,7 +56,7 @@ class diff_renderer
/**
* Constructor.
*/
- function diff_renderer($params = array())
+ function __construct($params = array())
{
foreach ($params as $param => $value)
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 1457888c9f..3fec88a354 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -1744,14 +1744,14 @@ function redirect($url, $return = false, $disable_cd_check = false)
if ($url_parts === false)
{
// Malformed url
- trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
+ trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
else if (!empty($url_parts['scheme']) && !empty($url_parts['host']))
{
// Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work)
if (!$disable_cd_check && $url_parts['host'] !== $user->host)
{
- trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
+ trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
}
else if ($url[0] == '/')
@@ -1791,13 +1791,13 @@ function redirect($url, $return = false, $disable_cd_check = false)
if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0)
{
- trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
+ trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
// Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2
if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false)
{
- trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
+ trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
// Now, also check the protocol and for a valid url the last time...
@@ -1806,7 +1806,7 @@ function redirect($url, $return = false, $disable_cd_check = false)
if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols))
{
- trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
+ trigger_error('INSECURE_REDIRECT', E_USER_WARNING);
}
/**
@@ -2363,10 +2363,12 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
* @event core.login_box_redirect
* @var string redirect Redirect string
* @var bool admin Is admin?
+ * @var array result Result from auth provider
* @since 3.1.0-RC5
* @changed 3.1.9-RC1 Removed undefined return variable
+ * @changed 3.2.4-RC1 Added result
*/
- $vars = array('redirect', 'admin');
+ $vars = array('redirect', 'admin', 'result');
extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars)));
// append/replace SID (may change during the session for AOL users)
@@ -2539,7 +2541,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
*/
function login_forum_box($forum_data)
{
- global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher;
+ global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$password = $request->variable('password', '', true);
@@ -2624,6 +2626,8 @@ function login_forum_box($forum_data)
'body' => 'login_forum.html')
);
+ make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_data['forum_id']);
+
page_footer();
}
@@ -4506,7 +4510,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'S_COOKIE_NOTICE' => !empty($config['cookie_notice']),
'T_THEME_NAME' => rawurlencode($user->style['style_path']),
- 'T_THEME_LANG_NAME' => $user->data['user_lang'],
+ 'T_THEME_LANG_NAME' => $user->lang_name,
'T_TEMPLATE_NAME' => $user->style['style_path'],
'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->style['style_parent_tree']) && $user->style['style_parent_tree']) ? $user->style['style_parent_tree'] : $user->style['style_path']),
'T_IMAGES' => 'images',
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php
index 77e03ee449..e86da77b38 100644
--- a/phpBB/includes/functions_compress.php
+++ b/phpBB/includes/functions_compress.php
@@ -210,7 +210,7 @@ class compress_zip extends compress
/**
* Constructor
*/
- function compress_zip($mode, $file)
+ function __construct($mode, $file)
{
global $phpbb_filesystem;
@@ -569,7 +569,7 @@ class compress_tar extends compress
/**
* Constructor
*/
- function compress_tar($mode, $file, $type = '')
+ function __construct($mode, $file, $type = '')
{
global $phpbb_filesystem;
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 40d44cfe7b..43dce036a3 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -1672,7 +1672,7 @@ class bitfield
{
var $data;
- function bitfield($bitfield = '')
+ function __construct($bitfield = '')
{
$this->data = base64_decode($bitfield);
}
@@ -1758,3 +1758,47 @@ class bitfield
$this->data = $this->data | $bitfield->get_blob();
}
}
+
+/**
+ * Formats the quote according to the given BBCode status setting
+ *
+ * @param bool $bbcode_status The status of the BBCode setting
+ * @param array $quote_attributes The attributes of the quoted post
+ * @param phpbb\textformatter\utils $text_formatter_utils Text formatter utilities
+ * @param parse_message $message_parser Message parser class
+ * @param string $message_link Link of the original quoted post
+ */
+function phpbb_format_quote($bbcode_status, $quote_attributes, $text_formatter_utils, $message_parser, $message_link = '')
+{
+ if ($bbcode_status)
+ {
+ $quote_text = $text_formatter_utils->generate_quote(
+ censor_text($message_parser->message),
+ $quote_attributes
+ );
+
+ $message_parser->message = $quote_text . "\n\n";
+ }
+ else
+ {
+ $offset = 0;
+ $quote_string = "&gt; ";
+ $message = censor_text(trim($message_parser->message));
+ // see if we are nesting. It's easily tricked but should work for one level of nesting
+ if (strpos($message, "&gt;") !== false)
+ {
+ $offset = 10;
+ }
+ $message = utf8_wordwrap($message, 75 + $offset, "\n");
+
+ $message = $quote_string . $message;
+ $message = str_replace("\n", "\n" . $quote_string, $message);
+
+ $message_parser->message = $quote_attributes['author'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n";
+ }
+
+ if ($message_link)
+ {
+ $message_parser->message = $message_link . $message_parser->message;
+ }
+}
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index a85a3b67c5..4f0d40031d 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -37,7 +37,7 @@ class messenger
/**
* Constructor
*/
- function messenger($use_queue = true)
+ function __construct($use_queue = true)
{
global $config;
@@ -326,9 +326,26 @@ class messenger
));
$subject = $this->subject;
- $message = $this->msg;
+ $template = $this->template;
/**
- * Event to modify notification message text before parsing
+ * Event to modify the template before parsing
+ *
+ * @event core.modify_notification_template
+ * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH
+ * @var bool break Flag indicating if the function only formats the subject
+ * and the message without sending it
+ * @var string subject The message subject
+ * @var \phpbb\template\template template The (readonly) template object
+ * @since 3.2.4-RC1
+ */
+ $vars = array('method', 'break', 'subject', 'template');
+ extract($phpbb_dispatcher->trigger_event('core.modify_notification_template', compact($vars)));
+
+ // Parse message through template
+ $message = trim($this->template->assign_display('body'));
+
+ /**
+ * Event to modify notification message text after parsing
*
* @event core.modify_notification_message
* @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH
@@ -338,19 +355,12 @@ class messenger
* @var string message The message text
* @since 3.1.11-RC1
*/
- $vars = array(
- 'method',
- 'break',
- 'subject',
- 'message',
- );
+ $vars = array('method', 'break', 'subject', 'message');
extract($phpbb_dispatcher->trigger_event('core.modify_notification_message', compact($vars)));
+
$this->subject = $subject;
$this->msg = $message;
- unset($subject, $message);
-
- // Parse message through template
- $this->msg = trim($this->template->assign_display('body'));
+ unset($subject, $message, $template);
// Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding
$this->msg = str_replace("\r\n", "\n", $this->msg);
@@ -369,6 +379,12 @@ class messenger
$this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']);
}
+ if (preg_match('#^(List-Unsubscribe:(.*?))$#m', $this->msg, $match))
+ {
+ $this->extra_headers[] = $match[1];
+ $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#');
+ }
+
if ($drop_header)
{
$this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg));
@@ -517,7 +533,7 @@ class messenger
*/
function msg_email()
{
- global $config;
+ global $config, $phpbb_dispatcher;
if (empty($config['email_enable']))
{
@@ -545,6 +561,33 @@ class messenger
$contact_name = htmlspecialchars_decode($config['board_contact_name']);
$board_contact = (($contact_name !== '') ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>';
+ $break = false;
+ $addresses = $this->addresses;
+ $subject = $this->subject;
+ $msg = $this->msg;
+ /**
+ * Event to send message via external transport
+ *
+ * @event core.notification_message_email
+ * @var bool break Flag indicating if the function return after hook
+ * @var array addresses The message recipients
+ * @var string subject The message subject
+ * @var string msg The message text
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'break',
+ 'addresses',
+ 'subject',
+ 'msg',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.notification_message_email', compact($vars)));
+
+ if ($break)
+ {
+ return true;
+ }
+
if (empty($this->replyto))
{
$this->replyto = $board_contact;
@@ -750,7 +793,7 @@ class queue
/**
* constructor
*/
- function queue()
+ function __construct()
{
global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container;
@@ -783,7 +826,7 @@ class queue
*/
function process()
{
- global $config, $phpEx, $phpbb_root_path, $user;
+ global $config, $phpEx, $phpbb_root_path, $user, $phpbb_dispatcher;
$lock = new \phpbb\lock\flock($this->cache_file);
$lock->acquire();
@@ -880,23 +923,45 @@ class queue
switch ($object)
{
case 'email':
- $err_msg = '';
- $to = (!$to) ? 'undisclosed-recipients:;' : $to;
-
- if ($config['smtp_delivery'])
+ $break = false;
+ /**
+ * Event to send message via external transport
+ *
+ * @event core.notification_message_process
+ * @var bool break Flag indicating if the function return after hook
+ * @var array addresses The message recipients
+ * @var string subject The message subject
+ * @var string msg The message text
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'break',
+ 'addresses',
+ 'subject',
+ 'msg',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.notification_message_process', compact($vars)));
+
+ if (!$break)
{
- $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
- }
- else
- {
- $result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg);
- }
+ $err_msg = '';
+ $to = (!$to) ? 'undisclosed-recipients:;' : $to;
- if (!$result)
- {
- $messenger = new messenger();
- $messenger->error('EMAIL', $err_msg);
- continue 2;
+ if ($config['smtp_delivery'])
+ {
+ $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers);
+ }
+ else
+ {
+ $result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg);
+ }
+
+ if (!$result)
+ {
+ $messenger = new messenger();
+ $messenger->error('EMAIL', $err_msg);
+ continue 2;
+ }
}
break;
@@ -1264,7 +1329,7 @@ class smtp_class
var $backtrace = false;
var $backtrace_log = array();
- function smtp_class()
+ function __construct()
{
// Always create a backtrace for admins to identify SMTP problems
$this->backtrace = true;
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 3563a646e8..88dafc4300 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -40,7 +40,7 @@ class p_master
* Constuctor
* Set module include path
*/
- function p_master($include_path = false)
+ function __construct($include_path = false)
{
global $phpbb_root_path;
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 78c66ac6b8..1e8f1ad00d 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2282,6 +2282,19 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
'post_subject' => $subject,
));
+ /**
+ * This event allows you to modify the notification data upon submission
+ *
+ * @event core.modify_submit_notification_data
+ * @var array notification_data The notification data to be inserted in to the database
+ * @var array data_ary The data array with a lot of the post submission data
+ * @var string mode The posting mode
+ * @var int poster_id The poster id
+ * @since 3.2.4-RC1
+ */
+ $vars = array('notification_data', 'data_ary', 'mode', 'poster_id');
+ extract($phpbb_dispatcher->trigger_event('core.modify_submit_notification_data', compact($vars)));
+
/* @var $phpbb_notifications \phpbb\notification\manager */
$phpbb_notifications = $phpbb_container->get('notification_manager');
@@ -2309,8 +2322,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data
case 'edit_first_post':
case 'edit':
case 'edit_last_post':
+ if ($user->data['user_id'] == $poster_id)
+ {
+ $phpbb_notifications->update_notifications(array(
+ 'notification.type.quote',
+ ), $notification_data);
+ }
+
$phpbb_notifications->update_notifications(array(
- 'notification.type.quote',
'notification.type.bookmark',
'notification.type.topic',
'notification.type.post',
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index 67ce2211e7..7427b89917 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -38,7 +38,7 @@ class transfer
/**
* Constructor - init some basic values
*/
- function transfer()
+ function __construct()
{
global $phpbb_root_path;
@@ -264,7 +264,7 @@ class ftp extends transfer
/**
* Standard parameters for FTP session
*/
- function ftp($host, $username, $password, $root_path, $port = 21, $timeout = 10)
+ function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10)
{
$this->host = $host;
$this->port = $port;
@@ -512,7 +512,7 @@ class ftp_fsock extends transfer
/**
* Standard parameters for FTP session
*/
- function ftp_fsock($host, $username, $password, $root_path, $port = 21, $timeout = 10)
+ function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10)
{
$this->host = $host;
$this->port = $port;
@@ -529,7 +529,7 @@ class ftp_fsock extends transfer
}
// Init some needed values
- $this->transfer();
+ parent::__construct();
return;
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index f7be2d2760..d019b867fa 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -666,7 +666,7 @@ function user_delete($mode, $user_ids, $retain_username = true)
delete_posts('poster_id', $user_ids);
}
- $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE);
+ $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE, $phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'), $phpbb_container->getParameter('tables.auth_provider_oauth_states'), $phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc'));
// Delete the miscellaneous (non-post) data for the user
foreach ($table_ary as $table)
@@ -1429,21 +1429,14 @@ function user_ipwhois($ip)
return '';
}
- if (preg_match(get_preg_expression('ipv4'), $ip))
- {
- // IPv4 address
- $whois_host = 'whois.arin.net.';
- }
- else if (preg_match(get_preg_expression('ipv6'), $ip))
- {
- // IPv6 address
- $whois_host = 'whois.sixxs.net.';
- }
- else
+ if (!preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip))
{
return '';
}
+ // IPv4 & IPv6 addresses
+ $whois_host = 'whois.arin.net.';
+
$ipwhois = '';
if (($fsk = @fsockopen($whois_host, 43)))
@@ -3604,11 +3597,6 @@ function remove_newly_registered($user_id, $user_data = false)
}
}
- if (empty($user_data['user_new']))
- {
- return false;
- }
-
$sql = 'SELECT group_id
FROM ' . GROUPS_TABLE . "
WHERE group_name = 'NEWLY_REGISTERED'
diff --git a/phpBB/includes/hooks/index.php b/phpBB/includes/hooks/index.php
index 805e0eea1a..821242cbf4 100644
--- a/phpBB/includes/hooks/index.php
+++ b/phpBB/includes/hooks/index.php
@@ -44,7 +44,7 @@ class phpbb_hook
*
* @param array $valid_hooks array containing the hookable functions/methods
*/
- function phpbb_hook($valid_hooks)
+ function __construct($valid_hooks)
{
foreach ($valid_hooks as $_null => $method)
{
diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php
index cbc84e8c64..049f24b262 100644
--- a/phpBB/includes/mcp/mcp_logs.php
+++ b/phpBB/includes/mcp/mcp_logs.php
@@ -28,7 +28,7 @@ class mcp_logs
var $u_action;
var $p_master;
- function mcp_logs(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 2133bd9a19..196d2f995f 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -28,7 +28,7 @@ class mcp_main
var $p_master;
var $u_action;
- function mcp_main(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -1458,6 +1458,24 @@ function mcp_fork_topic($topic_ids)
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();
+ /**
+ * Perform actions after forked topic is created.
+ *
+ * @event core.mcp_main_fork_sql_after
+ * @var int new_topic_id The newly created topic ID
+ * @var int to_forum_id The forum ID where the forked topic has been moved to
+ * @var int new_post_id The newly created post ID
+ * @var array row Post data
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'new_topic_id',
+ 'to_forum_id',
+ 'new_post_id',
+ 'row',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_main_fork_sql_after', compact($vars)));
+
switch ($row['post_visibility'])
{
case ITEM_APPROVED:
diff --git a/phpBB/includes/mcp/mcp_notes.php b/phpBB/includes/mcp/mcp_notes.php
index 67f59bd618..12b116e495 100644
--- a/phpBB/includes/mcp/mcp_notes.php
+++ b/phpBB/includes/mcp/mcp_notes.php
@@ -28,7 +28,7 @@ class mcp_notes
var $p_master;
var $u_action;
- function mcp_notes(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index c17b9985af..ba89733bfe 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -28,7 +28,7 @@ class mcp_pm_reports
var $p_master;
var $u_action;
- function mcp_pm_reports(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index d6d0369e48..8d278079fb 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -213,6 +213,10 @@ function mcp_post_details($id, $mode, $action)
$l_deleted_by = '';
}
+ // parse signature
+ $parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
+ $post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
+
$mcp_post_template_data = array(
'U_MCP_ACTION' => "$url&amp;i=main&amp;quickmod=1&amp;mode=post_details", // Use this for mode paramaters
'U_POST_ACTION' => "$url&amp;i=$id&amp;mode=post_details", // Use this for action parameters
@@ -262,6 +266,7 @@ function mcp_post_details($id, $mode, $action)
'POST_IP' => $post_info['poster_ip'],
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
+ 'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? "$url&amp;i=$id&amp;mode=$mode&amp;lookup={$post_info['poster_ip']}#ip" : '',
'U_WHOIS' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&amp;mode=$mode&amp;action=whois&amp;p=$post_id&amp;ip={$post_info['poster_ip']}") : '',
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 4f1f9bb990..a95c8fad44 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -28,7 +28,7 @@ class mcp_queue
var $p_master;
var $u_action;
- public function mcp_queue(&$p_master)
+ public function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index f5147deb49..a1386e5d7e 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -28,7 +28,7 @@ class mcp_reports
var $p_master;
var $u_action;
- function mcp_reports(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -242,6 +242,10 @@ class mcp_reports
}
}
+ // parse signature
+ $parse_flags = ($post_info['user_sig_bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
+ $post_info['user_sig'] = generate_text_for_display($post_info['user_sig'], $post_info['user_sig_bbcode_uid'], $post_info['user_sig_bbcode_bitfield'], $parse_flags, true);
+
$template->assign_vars(array(
'S_MCP_REPORT' => true,
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&amp;mode=report_details&amp;f=' . $post_info['forum_id'] . '&amp;p=' . $post_id),
@@ -291,6 +295,7 @@ class mcp_reports
'POST_IP' => $post_info['poster_ip'],
'POST_IPADDR' => ($auth->acl_get('m_info', $post_info['forum_id']) && $request->variable('lookup', '')) ? @gethostbyaddr($post_info['poster_ip']) : '',
'POST_ID' => $post_info['post_id'],
+ 'SIGNATURE' => $post_info['user_sig'],
'U_LOOKUP_IP' => ($auth->acl_get('m_info', $post_info['forum_id'])) ? $this->u_action . '&amp;r=' . $report_id . '&amp;p=' . $post_id . '&amp;f=' . $forum_id . '&amp;lookup=' . $post_info['poster_ip'] . '#ip' : '',
));
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index 0e80372f43..888069ef5d 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -28,7 +28,7 @@ class mcp_warn
var $p_master;
var $u_action;
- function mcp_warn(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index d67bc69591..c12f2ab1aa 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1139,7 +1139,7 @@ class parse_message extends bbcode_firstpass
/**
* Init - give message here or manually
*/
- function parse_message($message = '')
+ function __construct($message = '')
{
// Init BBCode UID
$this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN);
diff --git a/phpBB/includes/questionnaire/questionnaire.php b/phpBB/includes/questionnaire/questionnaire.php
index ee6d0ee2a6..5a27124bf9 100644
--- a/phpBB/includes/questionnaire/questionnaire.php
+++ b/phpBB/includes/questionnaire/questionnaire.php
@@ -40,7 +40,7 @@ class phpbb_questionnaire_data_collector
*
* @param string
*/
- function phpbb_questionnaire_data_collector($install_id)
+ function __construct($install_id)
{
$this->install_id = $install_id;
$this->providers = array();
@@ -223,7 +223,7 @@ class phpbb_questionnaire_phpbb_data_provider
*
* @param array $config
*/
- function phpbb_questionnaire_phpbb_data_provider($config)
+ function __construct($config)
{
// generate a unique id if necessary
if (empty($config['questionnaire_unique_id']))
diff --git a/phpBB/includes/sphinxapi.php b/phpBB/includes/sphinxapi.php
index 5e1f131ac2..b63a85a90f 100644
--- a/phpBB/includes/sphinxapi.php
+++ b/phpBB/includes/sphinxapi.php
@@ -126,7 +126,7 @@ define ( "SPH_GROUPBY_ATTRPAIR", 5 );
function sphPackI64 ( $v )
{
assert ( is_numeric($v) );
-
+
// x64
if ( PHP_INT_SIZE>=8 )
{
@@ -138,7 +138,7 @@ function sphPackI64 ( $v )
if ( is_int($v) )
return pack ( "NN", $v < 0 ? -1 : 0, $v );
- // x32, bcmath
+ // x32, bcmath
if ( function_exists("bcmul") )
{
if ( bccomp ( $v, 0 ) == -1 )
@@ -175,16 +175,16 @@ function sphPackI64 ( $v )
function sphPackU64 ( $v )
{
assert ( is_numeric($v) );
-
+
// x64
if ( PHP_INT_SIZE>=8 )
{
assert ( $v>=0 );
-
+
// x64, int
if ( is_int($v) )
return pack ( "NN", $v>>32, $v&0xFFFFFFFF );
-
+
// x64, bcmath
if ( function_exists("bcmul") )
{
@@ -192,12 +192,12 @@ function sphPackU64 ( $v )
$l = bcmod ( $v, 4294967296 );
return pack ( "NN", $h, $l );
}
-
+
// x64, no-bcmath
$p = max ( 0, strlen($v) - 13 );
$lo = (int)substr ( $v, $p );
$hi = (int)substr ( $v, 0, $p );
-
+
$m = $lo + $hi*1316134912;
$l = $m % 4294967296;
$h = $hi*2328 + (int)($m/4294967296);
@@ -208,7 +208,7 @@ function sphPackU64 ( $v )
// x32, int
if ( is_int($v) )
return pack ( "NN", 0, $v );
-
+
// x32, bcmath
if ( function_exists("bcmul") )
{
@@ -221,7 +221,7 @@ function sphPackU64 ( $v )
$p = max(0, strlen($v) - 13);
$lo = (float)substr($v, $p);
$hi = (float)substr($v, 0, $p);
-
+
$m = $lo + $hi*1316134912.0;
$q = floor($m / 4294967296.0);
$l = $m - ($q * 4294967296.0);
@@ -277,11 +277,11 @@ function sphUnpackU64 ( $v )
// x32, bcmath
if ( function_exists("bcmul") )
return bcadd ( $lo, bcmul ( $hi, "4294967296" ) );
-
+
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
-
+
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@@ -324,7 +324,7 @@ function sphUnpackI64 ( $v )
return $lo;
return sprintf ( "%.0f", $lo - 4294967296.0 );
}
-
+
$neg = "";
$c = 0;
if ( $hi<0 )
@@ -333,7 +333,7 @@ function sphUnpackI64 ( $v )
$lo = ~$lo;
$c = 1;
$neg = "-";
- }
+ }
$hi = sprintf ( "%u", $hi );
$lo = sprintf ( "%u", $lo );
@@ -345,7 +345,7 @@ function sphUnpackI64 ( $v )
// x32, no-bcmath
$hi = (float)$hi;
$lo = (float)$lo;
-
+
$q = floor($hi/10000000.0);
$r = $hi - $q*10000000.0;
$m = $lo + $r*4967296.0;
@@ -427,7 +427,7 @@ class SphinxClient
/////////////////////////////////////////////////////////////////////////////
/// create a new client object and fill defaults
- function SphinxClient ()
+ function __construct ()
{
// per-client-object settings
$this->_host = "localhost";
@@ -510,7 +510,7 @@ class SphinxClient
$this->_path = $host;
return;
}
-
+
assert ( is_int($port) );
$this->_host = $host;
$this->_port = $port;
@@ -590,14 +590,14 @@ class SphinxClient
$fp = @fsockopen ( $host, $port, $errno, $errstr );
else
$fp = @fsockopen ( $host, $port, $errno, $errstr, $this->_timeout );
-
+
if ( !$fp )
{
if ( $this->_path )
$location = $this->_path;
else
$location = "{$this->_host}:{$this->_port}";
-
+
$errstr = trim ( $errstr );
$this->_error = "connection to $location failed (errno=$errno, msg=$errstr)";
$this->_connerror = true;
@@ -1236,7 +1236,7 @@ class SphinxClient
if ( $type==SPH_ATTR_FLOAT )
{
list(,$uval) = unpack ( "N*", substr ( $response, $p, 4 ) ); $p += 4;
- list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
+ list(,$fval) = unpack ( "f*", pack ( "L", $uval ) );
$attrvals[$attr] = $fval;
continue;
}
@@ -1264,7 +1264,7 @@ class SphinxClient
} else if ( $type==SPH_ATTR_STRING )
{
$attrvals[$attr] = substr ( $response, $p, $val );
- $p += $val;
+ $p += $val;
} else
{
$attrvals[$attr] = sphFixUint($val);
@@ -1345,7 +1345,7 @@ class SphinxClient
if ( !isset($opts["passage_boundary"]) ) $opts["passage_boundary"] = "none";
if ( !isset($opts["emit_zones"]) ) $opts["emit_zones"] = false;
if ( !isset($opts["load_files_scattered"]) ) $opts["load_files_scattered"] = false;
-
+
/////////////////
// build request
@@ -1634,7 +1634,7 @@ class SphinxClient
fclose ( $this->_socket );
$this->_socket = false;
-
+
return true;
}
diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php
index f4d47e30bb..c1f307eeb5 100644
--- a/phpBB/includes/ucp/ucp_login_link.php
+++ b/phpBB/includes/ucp/ucp_login_link.php
@@ -39,7 +39,7 @@ class ucp_login_link
*/
function main($id, $mode)
{
- global $phpbb_container, $request, $template, $user;
+ global $phpbb_container, $request, $template, $user, $phpbb_dispatcher;
global $phpbb_root_path, $phpEx;
// Initialize necessary variables
@@ -108,7 +108,7 @@ class ucp_login_link
}
}
- $template->assign_vars(array(
+ $tpl_ary = array(
// Common template elements
'LOGIN_LINK_ERROR' => $login_link_error,
'PASSWORD_CREDENTIAL' => 'login_password',
@@ -121,7 +121,24 @@ class ucp_login_link
// Login elements
'LOGIN_ERROR' => $login_error,
'LOGIN_USERNAME' => $login_username,
- ));
+ );
+
+ /**
+ * Event to perform additional actions before ucp_login_link is displayed
+ *
+ * @event core.ucp_login_link_template_after
+ * @var array data Login link data
+ * @var \phpbb\auth\provider_interface auth_provider Auth provider
+ * @var string login_link_error Login link error
+ * @var string login_error Login error
+ * @var string login_username Login username
+ * @var array tpl_ary Template variables
+ * @since 3.2.4-RC1
+ */
+ $vars = array('data', 'auth_provider', 'login_link_error', 'login_error', 'login_username', 'tpl_ary');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_login_link_template_after', compact($vars)));
+
+ $template->assign_vars($tpl_ary);
$this->tpl_name = 'ucp_login_link';
$this->page_title = 'UCP_LOGIN_LINK';
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 71a615e75c..ec652a5e45 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -28,7 +28,7 @@ class ucp_main
var $p_master;
var $u_action;
- function ucp_main(&$p_master)
+ function __construct(&$p_master)
{
$this->p_master = &$p_master;
}
@@ -77,6 +77,22 @@ class ucp_main
// If the user can't see any forums, he can't read any posts because fid of 0 is invalid
if (!empty($forum_ary))
{
+ /**
+ * Modify sql variables before query is processed
+ *
+ * @event core.ucp_main_front_modify_sql
+ * @var string sql_select SQL select
+ * @var string sql_from SQL from
+ * @var array forum_ary Forum array
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'sql_select',
+ 'sql_from',
+ 'forum_ary',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_sql', compact($vars)));
+
$sql = "SELECT t.* $sql_select
FROM $sql_from
WHERE t.topic_type = " . POST_GLOBAL . '
@@ -144,7 +160,7 @@ class ucp_main
$folder_img .= '_mine';
}
- $template->assign_block_vars('topicrow', array(
+ $topicrow = array(
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']),
@@ -171,8 +187,30 @@ class ucp_main
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;p=" . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id&amp;view=unread") . '#unread',
- 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"))
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id"),
);
+
+ /**
+ * Add template variables to a front topics row.
+ *
+ * @event core.ucp_main_front_modify_template_vars
+ * @var array topicrow Array containing the template variables for the row
+ * @var array row Array containing the subscribed forum row data
+ * @var int forum_id Forum ID
+ * @var string folder_img Folder image
+ * @var string folder_alt Alt text for the folder image
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'topicrow',
+ 'row',
+ 'forum_id',
+ 'folder_img',
+ 'folder_alt',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_main_front_modify_template_vars', compact($vars)));
+
+ $template->assign_block_vars('topicrow', $topicrow);
}
if ($config['load_user_activity'])
@@ -502,6 +540,9 @@ class ucp_main
$draft_subject = $draft_message = '';
add_form_key('ucp_draft');
+ include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx);
+ $message_parser = new parse_message();
+
if ($delete)
{
if (check_form_key('ucp_draft'))
@@ -535,9 +576,19 @@ class ucp_main
{
if ($draft_message && $draft_subject)
{
+ // $auth->acl_gets can't be used here because it will check for global forum permissions in this case
+ // In general we don't need too harsh checking here for permissions, as this will be handled later when submitting
+ $bbcode_status = $auth->acl_get('u_pm_bbcode') || $auth->acl_getf_global('f_bbcode');
+ $smilies_status = $auth->acl_get('u_pm_smilies') || $auth->acl_getf_global('f_smilies');
+ $img_status = $auth->acl_get('u_pm_img') || $auth->acl_getf_global('f_img');
+ $flash_status = $auth->acl_get('u_pm_flash') || $auth->acl_getf_global('f_flash');
+
+ $message_parser->message = $draft_message;
+ $message_parser->parse($bbcode_status, $config['allow_post_links'], $smilies_status, $img_status, $flash_status, true, $config['allow_post_links']);
+
$draft_row = array(
'draft_subject' => $draft_subject,
- 'draft_message' => $draft_message
+ 'draft_message' => $message_parser->message,
);
$sql = 'UPDATE ' . DRAFTS_TABLE . '
@@ -639,9 +690,16 @@ class ucp_main
$insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&amp;mode=compose&amp;d=" . $draft['draft_id']);
}
+ if (!$submit)
+ {
+ $message_parser->message = $draft['draft_message'];
+ $message_parser->decode_message();
+ $draft_message = $message_parser->message;
+ }
+
$template_row = array(
'DATE' => $user->format_date($draft['save_time']),
- 'DRAFT_MESSAGE' => ($submit) ? $draft_message : $draft['draft_message'],
+ 'DRAFT_MESSAGE' => $draft_message,
'DRAFT_SUBJECT' => ($submit) ? $draft_subject : $draft['draft_subject'],
'TITLE' => $title,
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index d145d66f59..fa374c15c8 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -170,6 +170,12 @@ class ucp_pm
trigger_error('NO_AUTH_READ_MESSAGE');
}
+ if ($view == 'print' && (!$config['print_pm'] || !$auth->acl_get('u_pm_printpm')))
+ {
+ send_status_line(403, 'Forbidden');
+ trigger_error('NO_AUTH_PRINT_MESSAGE');
+ }
+
// Do not allow hold messages to be seen
if ($folder_id == PRIVMSGS_HOLD_BOX)
{
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index f35812b90a..bc59d8ca86 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -124,7 +124,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
// Add groups to PM box
if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group'))
{
- $sql = 'SELECT g.group_id, g.group_name, g.group_type
+ $sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour
FROM ' . GROUPS_TABLE . ' g';
if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
@@ -147,7 +147,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$group_options = '';
while ($row = $db->sql_fetchrow($result))
{
- $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . $group_helper->get_name($row['group_name']) . '</option>';
+ $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '"' . ($row['group_colour'] ? ' style="color: #' . $row['group_colour'] . '"' : '') . '>' . $group_helper->get_name($row['group_name']) . '</option>';
}
$db->sql_freeresult($result);
}
@@ -658,13 +658,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
{
if (confirm_box(true))
{
+ $message_parser->message = $message;
+ $message_parser->parse($bbcode_status, $url_status, $smilies_status, $img_status, $flash_status, true, $url_status);
+
$sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => $user->data['user_id'],
'topic_id' => 0,
'forum_id' => 0,
'save_time' => $current_time,
'draft_subject' => $subject,
- 'draft_message' => $message
+ 'draft_message' => $message_parser->message,
)
);
$db->sql_query($sql);
@@ -953,7 +956,16 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$post_id = $request->variable('p', 0);
if ($config['allow_post_links'])
{
- $message_link = "[url=" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}]{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}[/url]\n\n";
+ $message_link = generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}";
+ $message_link_subject = "{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}";
+ if ($bbcode_status)
+ {
+ $message_link = "[url=" . $message_link . "]" . $message_link_subject . "[/url]\n\n";
+ }
+ else
+ {
+ $message_link = $message_link . " - " . $message_link_subject . "\n\n";
+ }
}
else
{
@@ -973,11 +985,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
{
$quote_attributes['post_id'] = $post['msg_id'];
}
- $quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote(
- censor_text($message_parser->message),
- $quote_attributes
- );
- $message_parser->message = $message_link . $quote_text . "\n\n";
+
+ phpbb_format_quote($bbcode_status, $quote_attributes, $phpbb_container->get('text_formatter.utils'), $message_parser, $message_link);
}
if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh)
@@ -1260,7 +1269,7 @@ function compose_pm($id, $mode, $action, $user_folders = array())
function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc)
{
global $auth, $db, $user;
- global $request;
+ global $request, $phpbb_dispatcher;
// Delete User [TO/BCC]
if ($remove_u && $request->variable('remove_u', array(0 => '')))
@@ -1437,6 +1446,21 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove
$error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION'];
}
}
+
+ /**
+ * Event for additional message list actions
+ *
+ * @event core.message_list_actions
+ * @var array address_list The assoc array with the recipient user/group ids
+ * @var array error The array containing error data
+ * @var bool remove_u The variable for removing a user
+ * @var bool remove_g The variable for removing a group
+ * @var bool add_to The variable for adding a user to the [TO] field
+ * @var bool add_bcc The variable for adding a user to the [BCC] field
+ * @since 3.2.4-RC1
+ */
+ $vars = array('address_list', 'error', 'remove_u', 'remove_g', 'add_to', 'add_bcc');
+ extract($phpbb_dispatcher->trigger_event('core.message_list_actions', compact($vars)));
}
/**
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 3c5f4e2826..0e673cb692 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -481,6 +481,32 @@ class ucp_register
);
}
+ /**
+ * Modify messenger data before welcome mail is sent
+ *
+ * @event core.ucp_register_welcome_email_before
+ * @var array user_row Array with user registration data
+ * @var array cp_data Array with custom profile fields data
+ * @var array data Array with current ucp registration data
+ * @var string message Message to be displayed to the user after registration
+ * @var string server_url Server URL
+ * @var int user_id New user ID
+ * @var string user_actkey User activation key
+ * @var messenger messenger phpBB Messenger
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'user_row',
+ 'cp_data',
+ 'data',
+ 'message',
+ 'server_url',
+ 'user_id',
+ 'user_actkey',
+ 'messenger',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_register_welcome_email_before', compact($vars)));
+
$messenger->send(NOTIFY_EMAIL);
}
@@ -508,6 +534,30 @@ class ucp_register
}
}
+ /**
+ * Perform additional actions after user registration
+ *
+ * @event core.ucp_register_register_after
+ * @var array user_row Array with user registration data
+ * @var array cp_data Array with custom profile fields data
+ * @var array data Array with current ucp registration data
+ * @var string message Message to be displayed to the user after registration
+ * @var string server_url Server URL
+ * @var int user_id New user ID
+ * @var string user_actkey User activation key
+ * @since 3.2.4-RC1
+ */
+ $vars = array(
+ 'user_row',
+ 'cp_data',
+ 'data',
+ 'message',
+ 'server_url',
+ 'user_id',
+ 'user_actkey',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.ucp_register_register_after', compact($vars)));
+
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
trigger_error($message);
}