G
Gemini_13
Гость
Alexander.S, все гуд. frost444 выложил ведь готовое, надо только выдрать
INSERT INTO bb_config (config_name, config_value) VALUES ('join_interval', '18');
if(!$t_data) $this->ajax_die($lang['TOPIC_POST_NOT_EXIST']);
if ($userdata['user_id'] != ANONYMOUS )
{
$poster_id = $userdata['user_id'];
$sql = "SELECT post_id, poster_id, post_time, MAX(post_time) FROM " . BB_POSTS . " WHERE topic_id = $topic_id GROUP BY post_time ORDER BY post_time DESC LIMIT 1";
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$post_id_last_row = DB()->sql_fetchrow($result);
$post_data['poster_post'] = ($post_id_last_row['poster_id'] == $userdata['user_id']);
$post_id = $post_id_last_row['post_id'];
$current_time = time();
$difference_time = $current_time - $post_id_last_row['post_time'];
$hours = floor($difference_time/60/60);
$minutes = floor($difference_time/60%60);
$seconds = $difference_time%60;
$separator = '[br][size=9][color=#999999] добавлено спустя'. delta_time($post_id_last_row['post_time'], TIMENOW, 'seconds'). ':[/color][/size][br]';
if ($post_id_last_row['poster_id'] == $poster_id && $post_data['poster_post'] && $t_data['topic_replies'] >= 1 && ( $difference_time < ( $bb_cfg['join_interval'] * 3600 ) ) )
{
$sql = "SELECT post_text FROM " . BB_POSTS_TEXT . " WHERE post_id = $post_id";
if ( !($result = DB()->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain forums information', '', __LINE__, __FILE__, $sql);
}
$last_message_row = DB()->sql_fetchrow($result);
// i don't know much about parsing the message, so it may well be that, there are some wrongs, anyway all seems to work fine
$last_message = str_replace(':', '', $last_message_row['post_text']);
$last_message = preg_replace('/:[0-9a-z:]+]/si', ']', $last_message);
$last_message = addslashes($last_message);
}
}
DB()->sql_query("INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_time, poster_ip) VALUES ($topic_id, ". $t_data['forum_id'] .", ". $userdata['user_id'] .", '". TIMENOW ."', '". USER_IP ."')");
if ( !empty($last_message) )
{
$messages = ( $last_message != $message ) ? $last_message . $separator . $message : $message;
$added = 1;
if(mb_strlen($messages) > 2)
{
if($messages != $messages['post_text'])
{
DB()->sql_query("UPDATE ". BB_POSTS_TEXT ." SET post_text = '". DB()->escape($messages) ."' WHERE post_id = $post_id LIMIT 1");
add_search_words($post_id, stripslashes($messages), stripslashes($messages['topic_title']));
update_post_html(array(
'post_id' => $post_id,
'post_text' => $messages,
));
$this->response['html'] = bbcode2html($messages);
$this->response['post_id'] = $post_id;
$this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
}
}
}else{
$this->response['redirect'] = make_url(POST_URL . $post_id .'#'. $post_id);
}
SQLХмм, странно всё сделал как по инструкции, но нечего не работает... Нотисов тоже нету.
INSERT INTO bb_config (config_name, config_value) VALUES ('join_interval', '18');
Notice: Undefined variable: added in ***/includes/functions_post.php on line 57
if ( $added && $mode == 'editpost' )
//
// Post a new topic/reply/poll or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta,
Alexander.S, посмотри вот в этой строке дописывал ли &$added
PHP:// // Post a new topic/reply/poll or edit existing post/poll // function submit_post($mode, &$post_data, &$message, &$meta,
//
// Post a new topic/reply/poll or edit existing post/poll
//
function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_id, &$post_id, &$poll_id, &$topic_type, $post_username, $post_subject, $post_message, $poll_title, &$poll_options, &$poll_length, &$added, $update_post_time)