Skip to content

Commit

Permalink
Merge pull request #1708 from emanuele45/fix
Browse files Browse the repository at this point in the history
Possible undefined error in getFormMsgSubject
  • Loading branch information
Spuds committed Jul 5, 2014
2 parents c62032c + ceb6c5e commit a035a28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sources/subs/Post.subs.php
Expand Up @@ -1568,6 +1568,8 @@ function getFormMsgSubject($editing, $topic, $first_subject = '')
// Posting a quoted reply?
if ((!empty($topic) && !empty($_REQUEST['quote'])) || (!empty($modSettings['enableFollowup']) && !empty($_REQUEST['followup'])))
{
$msg_id = !empty($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : (int) $_REQUEST['followup'];

// Make sure they _can_ quote this post, and if so get it.
$request = $db->query('', '
SELECT m.subject, IFNULL(mem.real_name, m.poster_name) AS poster_name, m.poster_time, m.body
Expand All @@ -1578,7 +1580,7 @@ function getFormMsgSubject($editing, $topic, $first_subject = '')
AND m.approved = {int:is_approved}') . '
LIMIT 1',
array(
'id_msg' => !empty($_REQUEST['quote']) ? (int) $_REQUEST['quote'] : (int) $_REQUEST['followup'],
'id_msg' => $msg_id,
'is_approved' => 1,
)
);
Expand Down Expand Up @@ -1615,7 +1617,7 @@ function getFormMsgSubject($editing, $topic, $first_subject = '')
$form_message = preg_replace(array('~\n?\[quote.*?\].+?\[/quote\]\n?~is', '~^\n~', '~\[/quote\]~'), '', $form_message);

// Add a quote string on the front and end.
$form_message = '[quote author=' . $mname . ' link=msg=' . (int) $_REQUEST['quote'] . ' date=' . $mdate . ']' . "\n" . rtrim($form_message) . "\n" . '[/quote]';
$form_message = '[quote author=' . $mname . ' link=msg=' . (int) $msg_id . ' date=' . $mdate . ']' . "\n" . rtrim($form_message) . "\n" . '[/quote]';
}
// Posting a reply without a quote?
elseif (!empty($topic) && empty($_REQUEST['quote']))
Expand Down
2 changes: 2 additions & 0 deletions themes/default/scripts/jquery.atwho.js
Expand Up @@ -266,6 +266,8 @@ Controller = (function() {
Controller.prototype.content = function() {
if (this.$inputor.is('textarea, input')) {
return this.$inputor.val();
} else if (this.$inputor.is('body')) {
return $(this.$inputor.html().replace(/<br[\s\/]*>/, "\n")).text();
} else {
return this.$inputor.text();
}
Expand Down

0 comments on commit a035a28

Please sign in to comment.