1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 10:20:45 +02:00

Forum template work.

This commit is contained in:
Cameron
2013-03-14 16:25:24 -07:00
parent de84481e74
commit 94e87ef454
6 changed files with 88 additions and 43 deletions

View File

@@ -51,10 +51,13 @@ $(document).ready(function()
alert(d.msg);
}
if(action == 'quickreply' && d.status == 'ok')
if(action == 'quickreply' && d.status == 'ok' )
{
// alert(d.html);
$('#forum-viewtopic li:last').after(d.html).hide().slideDown(800);
if(d.html != false)
{
$('#forum-viewtopic li:last').after(d.html).hide().slideDown(800);
}
$('#forum-quickreply-text').val('');
return;
}
@@ -63,7 +66,11 @@ $(document).ready(function()
if(d.hide)
{
var t = '#thread-' + thread ;
var p = '#post-' + post ;
alert(p);
$(t).hide('slow');
$(p).hide('slow').slideUp(800);
}
}
}
@@ -164,11 +171,12 @@ class e107forum
$postInfo['post_datestamp'] = time();
$postInfo['post_thread'] = intval($_POST['thread']);
$this->postAdd($postInfo); // save it.
$postInfo['post_id'] = $this->postAdd($postInfo); // save it.
$postInfo['user_name'] = USERNAME;
$postInfo['user_email'] = USEREMAIL;
$postInfo['user_image'] = USERIMAGE;
$postInfo['user_signature'] = USERSIG;
if($_POST['insert'] == 1)
{
@@ -198,13 +206,15 @@ class e107forum
function ajaxModerate()
{
if(!vartrue($_POST['thread']))
if(!vartrue($_POST['thread']) && !vartrue($_POST['post']))
{
exit;
}
$id = intval($_POST['thread']);
// print_r($_POST);
$ret = array('hide'=>false,'msg'=>'','status'=>null);
switch ($_POST['action'])
@@ -226,18 +236,19 @@ class e107forum
case 'deletepost':
if(!$postId = vartrue($_POST['post']))
{
echo "No Post";
exit;
}
if($this->postDelete($postId))
{
$ret['msg'] = 'Deleted Post #'.$id;
$ret['msg'] = 'Deleted Post #'.$postId;
$ret['hide'] = true;
$ret['status'] = 'ok';
}
else
{
$ret['msg'] = "Couldn't Delete the Post";
$ret['msg'] = "Couldn't Delete the Post #".$postId;
$ret['status'] = 'error';
}
break;
@@ -1649,13 +1660,18 @@ class e107forum
*/
function postDelete($postId, $updateCounts = true)
{
$postId = (int)$postId;
$e107 = e107::getInstance();
if(!$e107->sql->db_Select('forum_post', '*', 'post_id = '.$postId))
$postId = (int)$postId;
$e107 = e107::getInstance();
$sql = e107::getDb();
$deleted = false;
if(!$sql->db_Select('forum_post', '*', 'post_id = '.$postId))
{
echo 'NOT FOUND!'; return;
}
$row = $e107->sql->fetch(MYSQL_ASSOC);
$row = $sql->fetch(MYSQL_ASSOC);
//delete attachments if they exist
if($row['post_attachments'])
@@ -1664,7 +1680,10 @@ class e107forum
}
// delete post
$e107->sql->delete('forum_post', 'post_id='.$postId);
if($sql->delete('forum_post', 'post_id='.$postId))
{
$deleted = true;
}
if($updateCounts)
{
@@ -1686,7 +1705,7 @@ class e107forum
// update forum lastpost info
$this->forumUpdateLastpost('forum', $row['post_forum']);
}
return $threadInfo['thread_total_replies'];
return $deleted; // return boolean. $threadInfo['thread_total_replies'];
}
}

View File

@@ -46,7 +46,7 @@ include_once (e_PLUGIN . 'forum/forum_class.php');
$forum = new e107forum();
$thread = new e107ForumThread();
if(e_AJAX_REQUEST)
if(e_AJAX_REQUEST && varset($_POST['action']) == 'quickreply')
{
$forum->ajaxQuickReply();
}
@@ -329,6 +329,8 @@ foreach ($postList as $postInfo)
$e_hide_query = "SELECT post_id FROM `#forum_post` WHERE (`post_thread` = {$threadId} AND post_user= " . USERID . ' LIMIT 1';
$e_hide_hidden = FORLAN_HIDDEN;
$e_hide_allowed = USER;
if ($tnum > 1)
{

View File

@@ -25,6 +25,20 @@ define("LAN_08", "Website");
define("LAN_09", "Visits to site since registration");
define("LAN_10", "Back to top");
define("LAN_65", "Jump");
define("LAN_53", "Thread");
define("LAN_54", "Starter");
define("LAN_55", "Replies");
define("LAN_56", "Views");
define("LAN_57", "Latest Post");
define("LAN_58", "There are no topics in this forum yet.");
define("LAN_59", "You must be a registered member and logged in to post on this forum. Click on signup or login from the login menu.");
define("LAN_202", "Sticky");
define("LAN_203", "Sticky/Closed");
define("LAN_66", "This thread is now closed");
define("LAN_67", "Posts");
define("LAN_194", "Guest");
@@ -188,10 +202,17 @@ define("LAN_439", "here");
define("LAN_440", "to go to the registration page.");
define("LAN_441", "View forum statistics");
define('FORLAN_21', 'Threads');
define('FORLAN_22', 'Last Post');
define('FORLAN_23', 'Poll');
define('FORLAN_441', 'No rules defined.');
define('FORLAN_442', 'My Uploads');
define('FORLAN_443', '[user deleted]');
define('FORLAN_444', 'sub-forums');
?>

View File

@@ -11,23 +11,13 @@
*/
define("PAGE_NAME", "Forum");
define("LAN_01", "Forums");
define("LAN_02", "Back to top");
define("LAN_03", "Go");
define("LAN_53", "Thread");
define("LAN_54", "Starter");
define("LAN_55", "Replies");
define("LAN_56", "Views");
define("LAN_57", "Latest Post");
define("LAN_58", "There are no topics in this forum yet.");
define("LAN_59", "You must be a registered member and logged in to post on this forum. Click on signup or login from the login menu.");
// define("LAN_79", "New posts");
//define("LAN_80", " No new posts");
// define("LAN_81", "Closed thread");
// define("LAN_180", "Search");
// define("LAN_199", "Unread post exists");
define("LAN_202", "Sticky");
define("LAN_203", "Sticky/Closed");
//define("LAN_204", "You <b>can</b> start new threads");
//define("LAN_205", "You <b>cannot</b> start new threads");
//define("LAN_206", "You <b>can</b> post replies");

View File

@@ -46,6 +46,12 @@ class plugin_forum_view_shortcodes extends e_shortcode
return $gen->convert_date($this->postInfo['post_datestamp'], 'forum');
}
function sc_postid()
{
return $this->postInfo['post_id'];
}
function sc_post()
{
$emote = (isset($this->postInfo['post_options']['no_emote']) ? ',emotes_off' : '');
@@ -189,10 +195,11 @@ class plugin_forum_view_shortcodes extends e_shortcode
}
}
function sc_signature()
function sc_signature($parm='')
{
if(!USER) { return ''; }
global $forum;
$tp = e107::getParser();
static $forum_sig_shown;
if($forum->prefs->get('sig_once'))
{
@@ -200,7 +207,14 @@ class plugin_forum_view_shortcodes extends e_shortcode
if(getcachedvars($_tmp)) { return ''; }
cachevars($_tmp, 1);
}
return ($this->postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".$this->e107->tp->toHTML($this->postInfo['user_signature'], true).'</span>' : '');
if($parm == 'clean')
{
return ($this->postInfo['user_signature'] ? trim($tp->toHTML($this->postInfo['user_signature'], true)) : "");
}
return ($this->postInfo['user_signature'] ? "<br /><hr style='width:15%; text-align:left' /><span class='smalltext'>".trim($tp->toHTML($this->postInfo['user_signature'], true)).'</span>' : '');
}
function sc_profileimg()

View File

@@ -14,19 +14,19 @@
if (!defined('e107_INIT')) { exit; }
if(!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%;margin-left:auto;margin-right:auto"); }
$sc_style['LASTEDIT']['pre'] = "<br /><br /><span class='smallblacktext'>[ ".LAN_29.' ';
$sc_style['LASTEDIT']['pre'] = LAN_29.' ';
$sc_style['LASTEDITBY']['pre'] = ' '.FORLAN_BY.' ';
$sc_style['LASTEDITBY']['post'] = ' ]</span>';
$sc_style['LASTEDITBY']['post'] = '';
$sc_style['LEVEL']['pre'] = "";
$sc_style['LEVEL']['post'] = "";
$sc_style['ATTACHMENTS']['pre'] = "<div id='forum_attachments'><br />";
$sc_style['ATTACHMENTS']['pre'] = "<div>";
$sc_style['ATTACHMENTS']['post'] = "</div>";
$sc_style['ANON_IP']['pre'] = "<br /><div class='smalltext'>";
$sc_style['ANON_IP']['post'] = "</div>";
$sc_style['ANON_IP']['pre'] = "";
$sc_style['ANON_IP']['post'] = "";
$sc_style['USER_EXTENDED']['location.text_value']['mid'] = ": ";
$sc_style['USER_EXTENDED']['location.text_value']['post'] = "<br />";
@@ -410,13 +410,14 @@ $FORUM_VIEWTOPIC_TEMPLATE['start'] = "
";
$FORUM_VIEWTOPIC_TEMPLATE['thread'] = "
<li>
<li id='post-{POSTID}'>
<div class='row-fluid btn-navbar'>
<div class='span2 center'>{NEWFLAG}<small>
{LEVEL=badge} {LEVEL=pic}
</small> {ANON_IP}</div>
<div class='span6 offset1 muted'><small>{THREADDATESTAMP=relative}</small></div>
<div class='span3 right'>{POSTOPTIONS}</div>
<div class='span4 muted'><small>{THREADDATESTAMP=relative}</small></div>
<div class='span5 muted right'><small>{LASTEDIT}{LASTEDITBY=link}</small></div>
<div class='span1 right'>{POSTOPTIONS}</div>
</div>
@@ -429,7 +430,7 @@ $FORUM_VIEWTOPIC_TEMPLATE['thread'] = "
</div>
</div>
<div class='span9 offset1'>
<div class='span9 '>
{POLL}
{POST}
@@ -440,12 +441,10 @@ $FORUM_VIEWTOPIC_TEMPLATE['thread'] = "
<div class='row-fluid'>
<div class='span2 finfobar'>
&nbsp;
</td>
<div class='span9 finfobar' >
{ATTACHMENTS}
{LASTEDIT}{LASTEDITBY=link}
{SIGNATURE}
</td>
</div>
<div class='span9 finfobar' >
<small>{ATTACHMENTS} {SIGNATURE=clean}</small>
</div>
<div class='span3'>
</div>