1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-20 21:32:09 +02:00

Forum quick-reply fix.

This commit is contained in:
Cameron
2013-06-19 19:54:29 -07:00
parent a1c768f847
commit 29f74508c2
5 changed files with 66 additions and 17 deletions

View File

@@ -27,7 +27,7 @@ $(document).ready(function()
var post = $(this).attr('data-forum-post');
var text = $('#forum-quickreply-text').val();
var insert = $(this).attr('data-forum-insert');
var token = $(this).attr('data-token');
if(action != 'stick' && action !='unstick')
@@ -40,8 +40,9 @@ $(document).ready(function()
$.ajax({
type: "POST",
url: script,
data: { thread: thread, action: action, post: post, text: text, insert:insert },
data: { thread: thread, action: action, post: post, text: text, insert:insert, e_token: token },
success: function(data) {
// alert(data);
var d = $.parseJSON(data);
@@ -189,6 +190,16 @@ class e107forum
function ajaxQuickReply()
{
$tp = e107::getParser();
if(!e107::getSession()->check(false))
{
//$ret['status'] = 'ok';
// $ret['msg'] = "Token Error";
// echo json_encode($ret);
exit;
}
if(varset($_POST['action']) == 'quickreply' && vartrue($_POST['text']))
{
@@ -223,7 +234,7 @@ class e107forum
$tmpl = e107::getTemplate('forum','forum_viewtopic','replies');
$sc = e107::getScBatch('view', 'forum');
$sc->setScVar('postInfo', $postInfo);
$ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n";
$ret['html'] = $tp->parseTemplate($tmpl, true, $sc) . "\n";
}
else
{
@@ -237,6 +248,7 @@ class e107forum
echo json_encode($ret);
}
e107::getSession()->reset();
exit;
}
@@ -246,6 +258,12 @@ class e107forum
function ajaxModerate()
{
if(!ADMIN) //FIXME check permissions per forum.
{
exit;
}
if(!vartrue($_POST['thread']) && !vartrue($_POST['post']))
{
exit;

View File

@@ -376,16 +376,18 @@ if ($forum->checkPerm($thread->threadInfo['thread_forum_id'], 'post') && $thread
$ajaxInsert = ($thread->pages == $thread->page || $thread->pages == 0) ? 1 : 0;
// echo "AJAX-INSERT=".$ajaxInsert ."(".$thread->pages." vs ".$thread->page.")";
$frm = e107::getForm();
$tVars->QUICKREPLY = "
<form action='" . $e107->url->create('forum/thread/reply', array('id' => $thread->threadId)) . "' method='post'>
<textarea cols='80' placeholder='".LAN_FORUM_2007."' rows='4' id='forum-quickreply-text' class='tbox input-xxlarge' name='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea>
<div class='center'>
<input type='submit' data-forum-insert='".$ajaxInsert."' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$threadId."' data-forum-action='quickreply' name='reply' value='".LAN_FORUM_2006. "' class='btn btn-success button' />
<input type='submit' data-token='".e_TOKEN."' data-forum-insert='".$ajaxInsert."' data-forum-post='".$thread->threadInfo['thread_forum_id']."' data-forum-thread='".$threadId."' data-forum-action='quickreply' name='reply' value='".LAN_FORUM_2006. "' class='btn btn-success button' />
<input type='hidden' name='thread_id' value='$thread_parent' />
</div>
</form>";
// Preview should be reserved for the full 'Post reply' page. <input type='submit' name='fpreview' value='" . Preview . "' class='btn button' /> &nbsp;
}
else