diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index f098cfff5..b2397a254 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -947,6 +947,10 @@ CREATE TABLE IF NOT EXISTS `bb_posts` ( `post_attachment` tinyint(1) NOT NULL DEFAULT '0', `post_reported` tinyint(1) NOT NULL DEFAULT '0', `user_post` tinyint(1) NOT NULL DEFAULT '1', + `post_mod_comment` TEXT NOT NULL DEFAULT '', + `post_mod_comment_type` TINYINT( 1 ) NOT NULL DEFAULT '0', + `post_mc_mod_id` mediumint(8) NOT NULL, + `post_mc_mod_name` varchar(25) NOT NULL DEFAULT '', PRIMARY KEY (`post_id`), KEY `topic_id` (`topic_id`), KEY `poster_id` (`poster_id`), diff --git a/upload/ajax.php b/upload/ajax.php index aefb94b17..da055c832 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -21,6 +21,7 @@ switch ($ajax->action) break; case 'posts': + case 'post_mod_comment': require(INC_DIR .'bbcode.php'); require(INC_DIR .'functions_post.php'); require(INC_DIR .'functions_admin.php'); @@ -87,6 +88,7 @@ class ajax_common 'posts' => array('guest'), 'index_data' => array('guest'), + 'post_mod_comment' => array('mod'), ); var $action = null; @@ -447,6 +449,31 @@ class ajax_common } } + function post_mod_comment () + { + global $lang, $user; + + $post_id = (int) $this->request['post_id']; + $post = DB()->fetch_row("SELECT t.*, f.*, p.*, pt.post_text + FROM ". BB_TOPICS ." t, ". BB_FORUMS ." f, ". BB_POSTS ." p, ". BB_POSTS_TEXT ." pt + WHERE p.post_id = $post_id + AND t.topic_id = p.topic_id + AND f.forum_id = t.forum_id + AND p.post_id = pt.post_id + LIMIT 1"); + if(!$post) $this->ajax_die('not post'); + $type = (int) $this->request['mc_type']; + $text = (string) $this->request['mc_text']; + $text = prepare_message($text); + if (!$text) $this->ajax_die('no text'); + DB()->query("UPDATE ". BB_POSTS ." SET post_mod_comment = '". DB()->escape($text) ."', post_mod_comment_type = $type, post_mc_mod_id = ". $user->id .", post_mc_mod_name = '". $user->data['username'] ."' WHERE post_id = $post_id LIMIT 1"); + $this->response['type'] = $type; + $this->response['post_id'] = $post_id; + if ($type == 0) $this->response['html'] = ''; + else if ($type == 1) $this->response['html'] = '
K | '. $user->data['username'] .' '. $lang['WROTE'] .': '. bbcode2html($text) .' |
! | '. $user->data['username'] .' '. $lang['WROTE'] .': '. bbcode2html($text) .' |
+ {MC_IMG}{POST_BTN_SPACER} {QUOTE_IMG}{POST_BTN_SPACER} {EDIT_POST_IMG}{POST_BTN_SPACER} {DELETE_POST_IMG}{POST_BTN_SPACER} @@ -326,6 +374,7 @@ ajax.callback.mod_action = function(data) {
K | '. $postrow[$i]['post_mc_mod_name'] .' '. $lang['WROTE'] .': '. bbcode2html($postrow[$i]['post_mod_comment']) .' |
! | '. $postrow[$i]['post_mc_mod_name'] .' '. $lang['WROTE'] .': '. bbcode2html($postrow[$i]['post_mod_comment']) .' |