aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/mcp/mcp_queue.php2
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php9
-rw-r--r--phpBB/phpbb/notification/type/post.php8
-rw-r--r--phpBB/phpbb/session.php2
-rw-r--r--phpBB/phpbb/template/twig/extension.php3
-rw-r--r--phpBB/phpbb/textformatter/s9e/utils.php13
-rw-r--r--phpBB/phpbb/textformatter/utils_interface.php18
-rw-r--r--phpBB/posting.php7
-rw-r--r--phpBB/styles/prosilver/template/mcp_queue.html2
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html2
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css4
-rw-r--r--phpBB/styles/prosilver/theme/common.css12
-rw-r--r--tests/functional/posting_test.php18
13 files changed, 75 insertions, 25 deletions
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 9060cc1098..f379392b12 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -577,7 +577,7 @@ class mcp_queue
'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'],
'TOPIC_TITLE' => $row['topic_title'],
'POST_TIME' => $user->format_date($row['post_time']),
- 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
+ 'S_HAS_ATTACHMENTS' => $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['post_attachment'],
));
}
unset($rowset, $forum_names);
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index b61a9fab9f..b3c0752a2f 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -889,13 +889,8 @@ function compose_pm($id, $mode, $action, $user_folders = array())
// Signature
if ($enable_sig && $config['allow_sig'] && $preview_signature)
{
- $parse_sig = new parse_message($preview_signature);
- $parse_sig->bbcode_uid = $preview_signature_uid;
- $parse_sig->bbcode_bitfield = $preview_signature_bitfield;
-
- $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']);
- $preview_signature = $parse_sig->message;
- unset($parse_sig);
+ $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0);
+ $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $bbcode_flags);
}
else
{
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index b9afc6d70a..03221e7c7a 100644
--- a/phpBB/phpbb/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
@@ -456,6 +456,12 @@ class post extends \phpbb\notification\type\base
return array();
}
- return array('notification_data' => $serialized_data);
+ $data_array = array_merge(array(
+ 'post_time' => $post['post_time'],
+ 'post_id' => $post['post_id'],
+ 'topic_id' => $post['topic_id']
+ ), $this->get_data(false));
+
+ return $data_array;
}
}
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index cbe2f02851..cc200b1adc 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -838,7 +838,7 @@ class session
$sql = 'SELECT COUNT(session_id) AS sessions
FROM ' . SESSIONS_TABLE . '
WHERE session_user_id = ' . (int) $this->data['user_id'] . '
- AND session_time >= ' . (int) ($this->time_now - (max($config['session_length'], $config['form_token_lifetime'])));
+ AND session_time >= ' . (int) ($this->time_now - (max((int) $config['session_length'], (int) $config['form_token_lifetime'])));
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
index 92f87a0331..f0e716d697 100644
--- a/phpBB/phpbb/template/twig/extension.php
+++ b/phpBB/phpbb/template/twig/extension.php
@@ -170,8 +170,7 @@ class extension extends \Twig_Extension
$args = func_get_args();
$key = $args[0];
- $context = $this->context->get_data_ref();
- $context_vars = $context['.'][0];
+ $context_vars = $this->context->get_root_ref();
if (isset($context_vars['L_' . $key]))
{
diff --git a/phpBB/phpbb/textformatter/s9e/utils.php b/phpBB/phpbb/textformatter/s9e/utils.php
index b317fe4a8d..a9a6d4b892 100644
--- a/phpBB/phpbb/textformatter/s9e/utils.php
+++ b/phpBB/phpbb/textformatter/s9e/utils.php
@@ -136,4 +136,17 @@ class utils implements \phpbb\textformatter\utils_interface
{
return \s9e\TextFormatter\Unparser::unparse($xml);
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function is_empty($text)
+ {
+ if ($text === null || $text === '')
+ {
+ return true;
+ }
+
+ return trim($this->unparse($text)) === '';
+ }
}
diff --git a/phpBB/phpbb/textformatter/utils_interface.php b/phpBB/phpbb/textformatter/utils_interface.php
index 4810453cd1..4b7392976a 100644
--- a/phpBB/phpbb/textformatter/utils_interface.php
+++ b/phpBB/phpbb/textformatter/utils_interface.php
@@ -62,10 +62,18 @@ interface utils_interface
public function remove_bbcode($text, $bbcode_name, $depth = 0);
/**
- * Return a parsed text to its original form
- *
- * @param string $text Parsed text
- * @return string Original plain text
- */
+ * Return a parsed text to its original form
+ *
+ * @param string $text Parsed text
+ * @return string Original plain text
+ */
public function unparse($text);
+
+ /**
+ * Return whether or not a parsed text represent an empty text.
+ *
+ * @param string $text Parsed text
+ * @return bool Tue if the original text is empty
+ */
+ public function is_empty($text);
}
diff --git a/phpBB/posting.php b/phpBB/posting.php
index b0aef2482a..aa10059796 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -816,6 +816,7 @@ if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_
load_drafts($topic_id, $forum_id);
}
+$bbcode_utils = $phpbb_container->get('text_formatter.utils');
if ($submit || $preview || $refresh)
{
@@ -1178,7 +1179,7 @@ if ($submit || $preview || $refresh)
$post_data['poll_title'] = '';
$post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0;
}
- else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != ''))
+ else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && !$bbcode_utils->is_empty($original_poll_data['poll_title']))
{
// We have a poll but the editing user is not permitted to create/edit it.
// So we just keep the original poll-data.
@@ -1601,7 +1602,7 @@ if ($generate_quote)
if ($config['allow_bbcode'])
{
- $message_parser->message = $phpbb_container->get('text_formatter.utils')->generate_quote(
+ $message_parser->message = $bbcode_utils->generate_quote(
censor_text($message_parser->message),
array(
'author' => $post_data['quote_username'],
@@ -1639,7 +1640,7 @@ $attachment_data = $message_parser->attachment_data;
$filename_data = $message_parser->filename_data;
$post_data['post_text'] = $message_parser->message;
-if (sizeof($post_data['poll_options']) || !empty($post_data['poll_title']))
+if (sizeof($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title'])))
{
$message_parser->message = $post_data['poll_title'];
$message_parser->bbcode_uid = $post_data['bbcode_uid'];
diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html
index c82aae5f8c..ee69bf448d 100644
--- a/phpBB/styles/prosilver/template/mcp_queue.html
+++ b/phpBB/styles/prosilver/template/mcp_queue.html
@@ -48,7 +48,7 @@
<dl>
<dt>
<div class="list-inner">
- <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <br />
+ <a href="{postrow.U_VIEW_DETAILS}" class="topictitle">{postrow.POST_SUBJECT}</a><!-- IF postrow.S_HAS_ATTACHMENTS --> <i class="icon fa-paperclip fa-fw" aria-hidden="true"></i> <!-- ENDIF --><br />
<span>{L_POSTED} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} &raquo; {postrow.POST_TIME}</span>
</div>
</dt>
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 9824989687..7df57106e1 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -192,7 +192,7 @@
<!-- IF topicrow.REPLIES --><span class="responsive-show left-box" style="display: none;">{L_REPLIES}{L_COLON} <strong>{topicrow.REPLIES}</strong></span><!-- ENDIF -->
<!-- ENDIF -->
- <div class="responsive-hide">
+ <div class="topic-poster responsive-hide">
<!-- IF topicrow.S_HAS_POLL --><i class="icon fa-bar-chart fa-fw" aria-hidden="true"></i><!-- ENDIF -->
<!-- IF topicrow.ATTACH_ICON_IMG --><i class="icon fa-paperclip fa-fw" aria-hidden="true"></i><!-- ENDIF -->
{L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} &raquo; {topicrow.FIRST_POST_TIME}
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index f09493ab3b..5e9b4cfb2d 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -261,6 +261,10 @@
margin-right: 0;
}
+.rtl .topic-poster {
+ float: right;
+ padding-left: 0.5em;
+}
/* Action Bar styles
---------------------------------------- */
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 8505ac13f9..4765230f6c 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -878,7 +878,7 @@ fieldset.fields1 dl.pmlist dd.recipients {
/* Pagination in viewforum for multipage topics */
.row .pagination {
display: block;
- margin-top: -12px;
+ margin-top: 0.3em;
}
.row .pagination > ul {
@@ -887,8 +887,14 @@ fieldset.fields1 dl.pmlist dd.recipients {
.row .pagination li a, .row .pagination li span {
border-radius: 2px;
- padding: 1px 3px;
- font-size: 9px;
+ padding: 1px 3px;
+ font-size: 9px;
+}
+
+.topic-poster {
+ float: left;
+ padding-right: 0.5em;
+ margin-top: 0.3em;
}
/* jQuery popups
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 9dd8a1dc91..83acefd2f3 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -87,6 +87,24 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
}
/**
+ * @see https://tracker.phpbb.com/browse/PHPBB3-14962
+ */
+ public function test_edit()
+ {
+ $this->login();
+ $this->create_topic(2, 'Test Topic post', 'Test topic post');
+
+ $url = self::$client->getCrawler()->selectLink('Edit')->link()->getUri();
+ $post_id = $this->get_parameter_from_link($url, 'p');
+ $crawler = self::request('GET', "posting.php?mode=edit&f=2&p={$post_id}&sid={$this->sid}");
+ $form = $crawler->selectButton('Submit')->form();
+ $form->setValues(array('message' => 'Edited post'));
+ $crawler = self::submit($form);
+
+ $this->assertContains('Edited post', $crawler->filter("#post_content{$post_id} .content")->text());
+ }
+
+ /**
* @testdox max_quote_depth is applied to the text populating the posting form
*/
public function test_quote_depth_form()