diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 36240d578..e949815a1 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -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']; } } diff --git a/e107_plugins/forum/forum_viewtopic.php b/e107_plugins/forum/forum_viewtopic.php index dcdf76b72..5d00e1318 100644 --- a/e107_plugins/forum/forum_viewtopic.php +++ b/e107_plugins/forum/forum_viewtopic.php @@ -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) { diff --git a/e107_plugins/forum/languages/English/lan_forum.php b/e107_plugins/forum/languages/English/lan_forum.php index 1e4f0174d..5236db9b7 100644 --- a/e107_plugins/forum/languages/English/lan_forum.php +++ b/e107_plugins/forum/languages/English/lan_forum.php @@ -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'); + + + ?> \ No newline at end of file diff --git a/e107_plugins/forum/languages/English/lan_forum_viewforum.php b/e107_plugins/forum/languages/English/lan_forum_viewforum.php index c36c46118..e36fa0e60 100644 --- a/e107_plugins/forum/languages/English/lan_forum_viewforum.php +++ b/e107_plugins/forum/languages/English/lan_forum_viewforum.php @@ -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 can start new threads"); //define("LAN_205", "You cannot start new threads"); //define("LAN_206", "You can post replies"); diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php index f75522693..c36b4ea78 100644 --- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php +++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php @@ -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'] ? "

".$this->e107->tp->toHTML($this->postInfo['user_signature'], true).'' : ''); + + if($parm == 'clean') + { + return ($this->postInfo['user_signature'] ? trim($tp->toHTML($this->postInfo['user_signature'], true)) : ""); + } + + + return ($this->postInfo['user_signature'] ? "

".trim($tp->toHTML($this->postInfo['user_signature'], true)).'' : ''); } function sc_profileimg() diff --git a/e107_plugins/forum/templates/forum_viewtopic_template.php b/e107_plugins/forum/templates/forum_viewtopic_template.php index 3b8ed7739..35a43105b 100644 --- a/e107_plugins/forum/templates/forum_viewtopic_template.php +++ b/e107_plugins/forum/templates/forum_viewtopic_template.php @@ -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'] = "

[ ".LAN_29.' '; +$sc_style['LASTEDIT']['pre'] = LAN_29.' '; $sc_style['LASTEDITBY']['pre'] = ' '.FORLAN_BY.' '; -$sc_style['LASTEDITBY']['post'] = ' ]'; +$sc_style['LASTEDITBY']['post'] = ''; $sc_style['LEVEL']['pre'] = ""; $sc_style['LEVEL']['post'] = ""; -$sc_style['ATTACHMENTS']['pre'] = "

"; +$sc_style['ATTACHMENTS']['pre'] = "
"; $sc_style['ATTACHMENTS']['post'] = "
"; -$sc_style['ANON_IP']['pre'] = "
"; -$sc_style['ANON_IP']['post'] = "
"; +$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'] = "
"; @@ -410,13 +410,14 @@ $FORUM_VIEWTOPIC_TEMPLATE['start'] = " "; $FORUM_VIEWTOPIC_TEMPLATE['thread'] = " -
  • +
  • {NEWFLAG} {LEVEL=badge} {LEVEL=pic} {ANON_IP}
    -
    {THREADDATESTAMP=relative}
    -
    {POSTOPTIONS}
    +
    {THREADDATESTAMP=relative}
    +
    {LASTEDIT}{LASTEDITBY=link}
    +
    {POSTOPTIONS}
    @@ -429,7 +430,7 @@ $FORUM_VIEWTOPIC_TEMPLATE['thread'] = "
  • -
    +
    {POLL} {POST} @@ -440,12 +441,10 @@ $FORUM_VIEWTOPIC_TEMPLATE['thread'] = "
      - -
    - {ATTACHMENTS} - {LASTEDIT}{LASTEDITBY=link} - {SIGNATURE} - +
    +
    + {ATTACHMENTS} {SIGNATURE=clean} +