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

Forum quick-reply working.

This commit is contained in:
Cameron
2013-03-14 02:26:47 -07:00
parent c4a795ce1c
commit adc108278d
4 changed files with 185 additions and 168 deletions

View File

@@ -39,7 +39,7 @@ $(document).ready(function()
url: script, url: script,
data: { thread: thread, action: action, post: post, text: text }, data: { thread: thread, action: action, post: post, text: text },
success: function(data) { success: function(data) {
alert(data); // alert(data);
var d = $.parseJSON(data); var d = $.parseJSON(data);
@@ -50,9 +50,10 @@ $(document).ready(function()
alert(d.msg); alert(d.msg);
} }
if(action == 'quickreply') if(action == 'quickreply' && d.status == 'ok')
{ {
$('#forum-viewtopic tr:last').after(d.html); $('#forum-viewtopic tr:last').after(d.html);
$('#forum-quickreply-text').val('');
return; return;
} }
@@ -82,7 +83,7 @@ e107::js('inline',$jscode,'jquery');
include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php'); include_lan(e_PLUGIN.'forum/languages/'.e_LANGUAGE.'/lan_forum.php');
include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php');
@@ -105,61 +106,87 @@ class e107forum
} }
// var_dump($this->prefs);
/*
$this->fieldTypes['forum_post']['post_user'] = 'int';
$this->fieldTypes['forum_post']['post_forum'] = 'int';
$this->fieldTypes['forum_post']['post_datestamp'] = 'int';
$this->fieldTypes['forum_post']['post_edit_datestamp'] = 'int';
$this->fieldTypes['forum_post']['post_edit_user'] = 'int';
$this->fieldTypes['forum_post']['post_thread'] = 'int';
$this->fieldTypes['forum_post']['post_options'] = 'escape';
$this->fieldTypes['forum_post']['post_attachments'] = 'escape';
$this->fieldTypes['forum_thread']['thread_user'] = 'int';
$this->fieldTypes['forum_thread']['thread_lastpost'] = 'int';
$this->fieldTypes['forum_thread']['thread_lastuser'] = 'int';
$this->fieldTypes['forum_thread']['thread_sticky'] = 'int';
$this->fieldTypes['forum_thread']['thread_forum_id'] = 'int';
$this->fieldTypes['forum_thread']['thread_active'] = 'int';
$this->fieldTypes['forum_thread']['thread_datestamp'] = 'int';
$this->fieldTypes['forum_thread']['thread_views'] = 'int';
$this->fieldTypes['forum_thread']['thread_replies'] = 'int';
$this->fieldTypes['forum_thread']['thread_options'] = 'escape';
$this->fieldTypes['forum']['forum_lastpost_user'] = 'int';
*/
}
function ajaxQuickReply()
{
$tp = e107::getParser(); $tp = e107::getParser();
if(e_AJAX_REQUEST)
{
if(varset($_POST['action']) == 'quickreply' && vartrue($_POST['text']))
{
$postInfo = array();
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
if (USER)
{
$postInfo['post_user'] = USERID;
}
else
{
$postInfo['post_user_anon'] = $_POST['anonname'];
}
if(varset($_POST['action']) == 'quickreply' && vartrue($_POST['text']))
{
$postInfo = array();
$postInfo['post_ip'] = e107::getIPHandler()->getIP(FALSE);
if (USER)
{
$postInfo['post_user'] = USERID;
}
else
{
$postInfo['post_user_anon'] = $_POST['anonname'];
}
$postInfo['post_entry'] = $_POST['text']; $postInfo['post_entry'] = $_POST['text'];
$postInfo['post_forum'] = intval($_POST['post']); $postInfo['post_forum'] = intval($_POST['post']);
$postInfo['post_datestamp'] = time(); $postInfo['post_datestamp'] = time();
$postInfo['post_thread'] = intval($_POST['thread']); $postInfo['post_thread'] = intval($_POST['thread']);
// $ret['msg'] = print_r($_POST,true);
$tmpl = e107::getTemplate('forum','forum_viewtopic','replies'); $this->postAdd($postInfo); // save it.
//FIXME - send parsed template back to $ret['html'] for inclusion in page. $postInfo['user_name'] = USERNAME;
$postInfo['user_email'] = USEREMAIL;
$sc = e107::getScBatch('view', 'forum'); $postInfo['user_image'] = USERIMAGE;
$ret['msg'] = print_r($sc, true);
$sc->setScVar('postInfo', $postInfo); $tmpl = e107::getTemplate('forum','forum_viewtopic','replies');
$sc = e107::getScBatch('view', 'forum');
// $ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n"; $sc->setScVar('postInfo', $postInfo);
$ret['html'] = "<tr><td>Help! I can't pass the template!</td><td colspan='2'>".$tp->toHtml($_POST['text'])."</td></tr>";
$this->postAdd($postInfo); // save it. $ret['html'] = $tp->parseTemplate($tmpl, true, vartrue($forum_shortcodes)) . "\n";
$ret['status'] = 'ok'; // $ret['html'] = "<tr><td>Help! I can't pass the template!</td><td colspan='2'>".$tp->toHtml($_POST['text'])."</td></tr>";
$ret['msg'] = print_r($postInfo,true); // "You post has been added";
$ret['status'] = 'ok';
$ret['msg'] = "Your post has been added";
//echo $ret;
echo json_encode($ret);
}
exit;
}
echo $ret;
echo json_encode($ret);
}
function ajaxModerate()
exit; {
if(!vartrue($_POST['thread']))
}
if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
{
if(!vartrue($_POST['thread']))
{ {
exit; exit;
} }
@@ -268,43 +295,15 @@ class e107forum
echo json_encode($ret); echo json_encode($ret);
exit; exit;
}
// var_dump($this->prefs);
/*
$this->fieldTypes['forum_post']['post_user'] = 'int';
$this->fieldTypes['forum_post']['post_forum'] = 'int';
$this->fieldTypes['forum_post']['post_datestamp'] = 'int';
$this->fieldTypes['forum_post']['post_edit_datestamp'] = 'int';
$this->fieldTypes['forum_post']['post_edit_user'] = 'int';
$this->fieldTypes['forum_post']['post_thread'] = 'int';
$this->fieldTypes['forum_post']['post_options'] = 'escape';
$this->fieldTypes['forum_post']['post_attachments'] = 'escape';
$this->fieldTypes['forum_thread']['thread_user'] = 'int';
$this->fieldTypes['forum_thread']['thread_lastpost'] = 'int';
$this->fieldTypes['forum_thread']['thread_lastuser'] = 'int';
$this->fieldTypes['forum_thread']['thread_sticky'] = 'int';
$this->fieldTypes['forum_thread']['thread_forum_id'] = 'int';
$this->fieldTypes['forum_thread']['thread_active'] = 'int';
$this->fieldTypes['forum_thread']['thread_datestamp'] = 'int';
$this->fieldTypes['forum_thread']['thread_views'] = 'int';
$this->fieldTypes['forum_thread']['thread_replies'] = 'int';
$this->fieldTypes['forum_thread']['thread_options'] = 'escape';
$this->fieldTypes['forum']['forum_lastpost_user'] = 'int';
*/
} }
private function loadPermList() private function loadPermList()
{ {

View File

@@ -39,13 +39,25 @@ if (!e_QUERY)
exit; exit;
} }
include_lan(e_PLUGIN . 'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php'); // include_lan(e_PLUGIN . 'forum/languages/'.e_LANGUAGE.'/lan_forum_viewtopic.php');
include_once (e_PLUGIN . 'forum/forum_class.php'); include_once (e_PLUGIN . 'forum/forum_class.php');
include_once(e_PLUGIN . 'forum/templates/forum_icons_template.php');
$forum = new e107forum(); $forum = new e107forum();
$thread = new e107ForumThread(); $thread = new e107ForumThread();
if(e_AJAX_REQUEST)
{
$forum->ajaxQuickReply();
}
if(e_AJAX_REQUEST && MODERATOR) // see javascript above.
{
$forum->ajaxModerate();
}
if (isset($_GET['last'])) if (isset($_GET['last']))
{ {
$_GET['f'] = 'last'; $_GET['f'] = 'last';

View File

@@ -11,6 +11,89 @@
*/ */
define("e_PAGETITLE", "Forum"); define("e_PAGETITLE", "Forum");
define("LAN_01", "Forums");
define("LAN_02", "Go to page");
define("LAN_03", "Go");
define("LAN_04", "Previous");
define("LAN_05", "Next");
define("LAN_06", "Joined");
define("LAN_07", "Location");
define("LAN_08", "Website");
define("LAN_09", "Visits to site since registration");
define("LAN_10", "Back to top");
define("LAN_65", "Jump");
define("LAN_66", "This thread is now closed");
define("LAN_67", "Posts");
define("LAN_194", "Guest");
define("LAN_195", "Registered Member");
define("LAN_321", "Moderators: ");
define("LAN_389", "Previous thread");
define("LAN_390", "Next thread");
define("LAN_391", "Track Thread");
define("LAN_392", "Cancel Thread Tracking");
define("LAN_393", "Quick Reply");
define("LAN_394", "Preview");
define("LAN_395", "Reply To Thread");
define("LAN_396", "Website");
define("LAN_397", "Email");
define("LAN_398", "Profile");
define("LAN_399", "Private Message");
define("LAN_400", "Edit");
define("LAN_401", "Quote");
define("LAN_402", "Author");
define("LAN_403", "Post");
define("LAN_404", "No previous thread");
define("LAN_405", "No next thread");
define("LAN_406", "Moderator: Edit");
define("LAN_435", "Moderator: Delete");
define("LAN_408", "Moderator: Move");
define("LAN_409", "Are you sure you want to delete this thread and any replies?");
define("LAN_410", "Are you sure you want to delete this reply?");
define("LAN_411", "posted by ");
//v.616
define("LAN_412", "Title");
define("LAN_413", "Report");
define("LAN_414", "Report this thread to a moderator");
define("LAN_415", "Thread title");
define("LAN_416", "Enter your report");
define("LAN_417", "The admin will be made aware of this thread. You may post a message explaining what you found to be objectionable.");
define("LAN_418", "<b>Do not</b> use this form to contact the admin for any other reason.");
define("LAN_419", "Send Report");
define("LAN_420", "Click to view post");
define("LAN_421", "Forum thread report from");
define("LAN_422", "This post has been reported from site ");
define("LAN_423", "Message could not be sent. ");
define("LAN_424", "Post has been reported to moderator.<br />Thank You.");
define("LAN_425", "Message from: ");
define("LAN_426", "Reporting post in topic: ");
define("LAN_427", "Error sending mail");
define("LAN_428", "Post has been reported");
define("LAN_429", "Click here to return to forum");
define("LAN_430", "poll");
define("FORLAN_26", "Reply deleted");
define("FORLAN_10", "Begin New Thread");
define("LAN_29", "Edited");
define("LAN_431", "Syndicate this thread: rss 0.92");
define("LAN_432", "Syndicate this thread: rss 2.0");
define("LAN_433", "Syndicate this thread: RDF");
define("FORLAN_101", "Email Thread");
define("FORLAN_102", "Print View");
define('FORLAN_103', '[user deleted]');
define('FORLAN_104', 'Thread not found');
define('FORLAN_105', 'Moderator: Split');
define('FORLAN_BY', 'by');
define("FORLAN_HIDDEN", "HIDDEN - LOGIN AND REPLY TO REVEAL");
define("LAN_06", "Joined");
define("LAN_30", "Welcome"); define("LAN_30", "Welcome");
define("LAN_31", "There are no new posts "); define("LAN_31", "There are no new posts ");
define("LAN_32", "There is 1 new post "); define("LAN_32", "There is 1 new post ");

View File

@@ -11,81 +11,4 @@
*/ */
define("PAGE_NAME", "Forum"); define("PAGE_NAME", "Forum");
define("LAN_01", "Forums");
define("LAN_02", "Go to page");
define("LAN_03", "Go");
define("LAN_04", "Previous");
define("LAN_05", "Next");
define("LAN_06", "Joined");
define("LAN_07", "Location");
define("LAN_08", "Website");
define("LAN_09", "Visits to site since registration");
define("LAN_10", "Back to top");
define("LAN_65", "Jump");
define("LAN_66", "This thread is now closed");
define("LAN_67", "Posts");
define("LAN_194", "Guest");
define("LAN_195", "Registered Member");
define("LAN_321", "Moderators: ");
define("LAN_389", "Previous thread");
define("LAN_390", "Next thread");
define("LAN_391", "Track Thread");
define("LAN_392", "Cancel Thread Tracking");
define("LAN_393", "Quick Reply");
define("LAN_394", "Preview");
define("LAN_395", "Reply To Thread");
define("LAN_396", "Website");
define("LAN_397", "Email");
define("LAN_398", "Profile");
define("LAN_399", "Private Message");
define("LAN_400", "Edit");
define("LAN_401", "Quote");
define("LAN_402", "Author");
define("LAN_403", "Post");
define("LAN_404", "No previous thread");
define("LAN_405", "No next thread");
define("LAN_406", "Moderator: Edit");
define("LAN_435", "Moderator: Delete");
define("LAN_408", "Moderator: Move");
define("LAN_409", "Are you sure you want to delete this thread and any replies?");
define("LAN_410", "Are you sure you want to delete this reply?");
define("LAN_411", "posted by ");
//v.616
define("LAN_412", "Title");
define("LAN_413", "Report");
define("LAN_414", "Report this thread to a moderator");
define("LAN_415", "Thread title");
define("LAN_416", "Enter your report");
define("LAN_417", "The admin will be made aware of this thread. You may post a message explaining what you found to be objectionable.");
define("LAN_418", "<b>Do not</b> use this form to contact the admin for any other reason.");
define("LAN_419", "Send Report");
define("LAN_420", "Click to view post");
define("LAN_421", "Forum thread report from");
define("LAN_422", "This post has been reported from site ");
define("LAN_423", "Message could not be sent. ");
define("LAN_424", "Post has been reported to moderator.<br />Thank You.");
define("LAN_425", "Message from: ");
define("LAN_426", "Reporting post in topic: ");
define("LAN_427", "Error sending mail");
define("LAN_428", "Post has been reported");
define("LAN_429", "Click here to return to forum");
define("LAN_430", "poll");
define("FORLAN_26", "Reply deleted");
define("FORLAN_10", "Begin New Thread");
define("LAN_29", "Edited");
define("LAN_431", "Syndicate this thread: rss 0.92");
define("LAN_432", "Syndicate this thread: rss 2.0");
define("LAN_433", "Syndicate this thread: RDF");
define("FORLAN_101", "Email Thread");
define("FORLAN_102", "Print View");
define('FORLAN_103', '[user deleted]');
define('FORLAN_104', 'Thread not found');
define('FORLAN_105', 'Moderator: Split');
define('FORLAN_BY', 'by');
define("FORLAN_HIDDEN", "HIDDEN - LOGIN AND REPLY TO REVEAL");
?> ?>