Witam!
Co w tym kodzie jest nie tak? Nie potrafię zlokalizować błędu, klamry itd. wszystko jest ok :/
<?php
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
$idbota = 6;
$urll = $board_config['server_name'];
$pathh = $board_config['script_path'];
$raportuj_ikona = '<img src="http://' . $urll . '' . $pathh . 'templates/images/icon_report.gif" alt="" /> ';
if ( isset($_POST['dalej']) ) {
$sql = "SELECT topic_id, topic_reason, forum_id, topic_action_date
FROM " . TOPICS_TABLE . "
WHERE topic_reason == 1
group by topic_id";
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
$topic_id = $row['topic_id'];
$reason = $row['reason'];
$forum_id = $row['forum_id'];
$topic_action_date = $row['topic_action_date'];
}
{
$sql = "SELECT post_id, post_parent, post_order
FROM " . POSTS_TABLE . "
WHERE topic_id = $topic_id
ORDER BY post_order";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
while ( $row = $db->sql_fetchrow($result) )
{
if ( $row['post_id'] == $post_data['post_parent'] )
{
$post_parent_order = $row['post_order'];
$begin_new_parents = 1;
}
if ( !$row['post_parent'] && !$post_parent_order )
{
$begin_new_parents = $order_last_parents = 0;
$this_tree_parents = array(); }
if ( $begin_new_parents )
{
if ( $row['post_parent'] )
{
$this_tree_parents[] = $row['post_parent'];
}
if ( $row['post_id'] == $post_data['post_parent'] || ($row['post_parent'] >= $post_data['post_parent'] && in_array($post_data['post_parent'], $this_tree_parents) ) ) {
$order_last_parents = $row['post_order'];
}
else
{
$max_order = ($order_last_parents) ? $order_last_parents : $row['post_order'];
}
}
$max_order_all = $row['post_order'];
}
$max_order = $max_order_all;
$post_order = $max_order + 1;
$sql = "INSERT INTO ".POSTS_TABLE." (`post_id`, `topic_id`, `forum_id`, `poster_id`, `post_time`, `poster_ip`, `post_username`, `enable_bbcode`, `enable_html`, `enable_smilies`, `enable_sig`, `post_edit_time`, `post_edit_count`, `post_attachment`, `user_agent`, `post_icon`, `post_expire`, `reporter_id`, `post_marked`, `post_approve`, `poster_delete`, `post_edit_by`, `post_parent`, `post_order`) VALUES (".$db->sql_nextid().", '".$topic_id."', '".$forum_id."', '".$idbota."', '".$topic_action_date."', '0', '', '1', '0', '1', '1', '0', '0', '0', '', '0', '0', '0', '', '1', '0', '0', '0', '0')";
{
message_die(CRITICAL_ERROR, 'Error1');
}
$sql = "INSERT INTO ".POSTS_TEXT_TABLE
." (`post_id`, `bbcode_uid`, `post_subject`, `post_text`) VALUES (".$db->sql_nextid().", '0', '', '".str_replace("\'", "''", sprintf($lang['bot_message'], $reason, $raportuj_ikona))."')"; {
message_die(CRITICAL_ERROR, 'Error2');
}
$sql = "SELECT post_id
FROM " . POSTS_TABLE . "
WHERE forum_id = $forum_id
AND topic_id = $topic_id
AND poster_id = $idbota";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update topics table', '', __LINE__, __FILE__, $sql);
}
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
$post_id = $row['post_id'];
}
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $post_id
WHERE forum_id = $forum_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_last_post_id = $post_id
WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
}
$sql = "SELECT user_posts
FROM " . USERS_TABLE . "
WHERE user_id = $idbota";
$result = $db->sql_query($sql);
while( $row = $db->sql_fetchrow($result) )
{
$posts_bot = $row['user_posts'];
}
$postss_bot = $posts_bot + 1;
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = $postss_bot
WHERE user_id = $idbota";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'jakis errorek', '', __LINE__, __FILE__, $sql);
}
$sql = "TRUNCATE " . READ_HISTORY_TABLE . ";
}
}
?>
Ten post edytował Mody23 29.10.2011, 14:18:55