еми на този файл на този ред имам, проверка дали може да се свърже заявката ама ето..:
<?php
/***************************************************************************
* favorite..php
* -----------------------
* Author : baf - bafitu@abv.bg
* Created : Sunday, Feb 25, 2007
*
*
* Version : 1.0.0
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
/***************************************************************************/
$temi_na_stranica = $board_config['topics_per_page']; // може да напишете и цифра иначе броя се взима от базата данни
/***************************************************************************/
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
if (!$userdata['session_logged_in'])
{
$redirect = ( isset($start) ) ? "&start=$start" : '';
redirect(append_sid("login.$phpEx?redirect=favorite.$phpEx" . $redirect, true));
}
if ( isset($HTTP_POST_VARS['unfav_list']) )
{
$topic_ids = implode(",", $HTTP_POST_VARS['unfav_list']);
$sql = "DELETE FROM " . TOPICS_FAVORITE_TABLE . "
WHERE topic_id IN(" . $topic_ids . ")
AND user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
това е 76 ред! message_die(GENERAL_ERROR, "Could not delete topic favorite information", '', __LINE__, __FILE__, $sql);
}
}
$page_title = $lang['Favorite_Topics'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'favorite_topics_body.tpl')
);
$template->assign_vars(array(
'S_FORM_ACTION' => append_sid($phpbb_root_path . "favorite.$phpEx"),
'L_NO_FAVORITED_TOPICS' => $lang['No_Favorite_Topics'],
'L_FORUM' => $lang['Forum'],
'L_REPLIES' => $lang['Replies'],
'L_STARTED' => $lang['Fav_Topics_Started'],
'L_LAST_POST' => $lang['Last_Post'],
'L_STOP_FAV' => $lang['Fav_Topics_Stop'],
'L_CHECK_ALL' => $lang['Check_All'],
'L_UNCHECK_ALL' => $lang['UnCheck_All'],
)
);
$sql = "SELECT COUNT(*) as favorite_count FROM " . TOPICS_FAVORITE_TABLE . " f WHERE f.user_id = " . $userdata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain favorite topic information', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$fav_count = ( $row['favorite_count'] ) ? $row['favorite_count'] : 0;
$db->sql_freeresult($result);
if ($fav_count > 0)
{
$sql = "SELECT fa.*, t.*, p.post_time, p.poster_id, f.forum_name,
first.username as author_username,
last.username as last_username
FROM " . TOPICS_FAVORITE_TABLE . " fa,
" . TOPICS_TABLE . " t,
" . POSTS_TABLE . " p,
" . FORUMS_TABLE . " f,
" . USERS_TABLE . " first,
" . USERS_TABLE . " last
WHERE t.topic_id = fa.topic_id
AND p.post_id = t.topic_last_post_id
AND t.topic_poster = first.user_id
AND p.poster_id = last.user_id
AND f.forum_id = t.forum_id
AND fa.user_id = " . $userdata['user_id'] . "
ORDER BY t.topic_last_post_id DESC
LIMIT $start, $temi_na_stranica ";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain favorite topic information', '', __LINE__, __FILE__, $sql);
}
$fav_rows = $db->sql_fetchrowset($result);
// are we currently watching any topics?
if ( $fav_rows )
{
$template->assign_block_vars('switch_fav_topics_block', array());
for ( $i = 0; $i < count($fav_rows); $i++ )
{
$last_poster = ($fav_rows[$i]['poster_id'] == ANONYMOUS ) ? ( ($fav_rows[$i]['last_username'] != '' ) ? $fav_rows[$i]['last_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $fav_rows[$i]['poster_id']) . '">' . $fav_rows[$i]['last_username'] . '</a> ';
$last_poster .= '<a href="' . append_sid($phpbb_root_path . "viewtopic.$phpEx?" . POST_POST_URL . '=' . $fav_rows[$i]['topic_last_post_id']) . '#' . $fav_rows[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>';
$topic_poster = ($fav_rows[$i]['topic_poster'] == ANONYMOUS ) ? ( ($fav_rows[$i]['author_username'] != '' ) ? $fav_rows[$i]['author_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid($phpbb_root_path . "profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $fav_rows[$i]['topic_poster']) . '">' . $fav_rows[$i]['author_username'] . '</a> ';
$replies = $fav_rows[$i]['topic_replies'];
if( ( $replies + 1 ) > $board_config['posts_per_page'] )
{
$total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
$goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': ';
$times = 1;
for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
{
$goto_page .= '<a href="' . append_sid($phpbb_root_path . "viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $fav_rows[$i]['topic_id'] . "&start=$j") . '">' . $times . '</a>';
if( $times == 1 && $total_pages > 4 )
{
$goto_page .= ' ... ';
$times = $total_pages - 3;
$j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
}
else if ( $times < $total_pages )
{
$goto_page .= ', ';
}
$times++;
}
$goto_page .= ' ] ';
}
else
{
$goto_page = '';
}
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('topic_fav_row', array(
'ROW_CLASS' => $row_class,
'S_FAV_TOPIC_ID' => $fav_rows[$i]['topic_id'],
'S_FAV_TOPIC' => $fav_rows[$i]['topic_title'],
'S_FAV_TOPIC_REPLIES' => $fav_rows[$i]['topic_replies'],
'S_FAV_TOPIC_START' => create_date($board_config['default_dateformat'], $fav_rows[$i]['topic_time'], $board_config['board_timezone']),
'S_FAV_TOPIC_LAST' => create_date($board_config['default_dateformat'], $fav_rows[$i]['post_time'], $board_config['board_timezone']),
'S_FORUM_TITLE' => $fav_rows[$i]['forum_name'],
'TOPIC_POSTER' => $topic_poster,
'LAST_POSTER' => $last_poster,
'GOTO_PAGE' => $goto_page,
'U_FORUM_LINK' => append_sid($phpbb_root_path . "viewforum.$phpEx?" . POST_FORUM_URL . '=' . $fav_rows[$i]['forum_id']),
'U_FAV_TOPIC' => append_sid($phpbb_root_path . "viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $fav_rows[$i]['topic_id']),
)
);
}
$pagination = generate_pagination("favorite.$phpEx?mode=fav_topics", $fav_count, $temi_na_stranica, $start);
$template->assign_vars(array(
'PAGINATION' => $pagination,
'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $temi_na_stranica ) + 1 ), ceil( $topics_count / $temi_na_stranica )),
'L_GOTO_PAGE' => $lang['Goto_page'])
);
}
$db->sql_freeresult($result);
}
else
{
$template->assign_block_vars('switch_no_fav_topics', array());
}
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>