diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f3f6923381..69267f08dc 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1435,7 +1435,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) { $s_first_unread = $first_unread = true; } - + // $postrow = array( @@ -1614,41 +1614,44 @@ else if (!$all_marked_read) // let's set up quick_reply // TODO: introduce a per-forum and a per-user setting -$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id) ; -if ($s_can_vote || $s_quick_reply ) +$s_quick_reply = $user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id); + +if ($s_can_vote || $s_quick_reply) { add_form_key('posting'); + if ($s_quick_reply) { - - $s_attach_sig = $config['allow_sig'] && strlen($user->data['user_sig']) && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); - $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); - $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); - $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && $user->data['user_notify']; + $qr_hidden_fields = array( - 'topic_cur_post_id' => $topic_data['topic_last_post_id'], - 'lastclick' => time(), - 'topic_id' => $topic_data['topic_id'], - 'forum_id' => $forum_id, - 'disable_bbcode' => !$s_bbcode, - 'disable_smilies' => !$s_smilies, - 'disable_magic_url' => !$config['allow_post_links'], - 'attach_sig' => $s_attach_sig, - 'notify' => $s_notify, + 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], + 'lastclick' => (int) time(), + 'topic_id' => (int) $topic_data['topic_id'], + 'forum_id' => (int) $forum_id, ); - + + // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked + (!$s_bbcode) ? $qr_hidden_fields['disable_bbcode'] = 1 : true; + (!$s_smilies) ? $qr_hidden_fields['disable_smilies'] = 1 : true; + (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; + ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; + ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + $template->assign_vars(array( - 'S_QUICK_REPLY' => true, + 'S_QUICK_REPLY' => true, 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), - )); } } // now I have the urge to wash my hands :( - - + + // We overwrite $_REQUEST['f'] if there is no forum specified // to be able to display the correct online list. // One downside is that the user currently viewing this topic/post is not taken into account.