:]]' AND ";
} else {$stop_list = "category IN ('" . implode( "','", $allow_list ) . "') AND ";}
} else
$stop_list = "";
if( $user_group[$member_id['user_group']]['allow_short'] ) $stop_list = "";
if (isset ( $_SESSION['dle_sort_favorites'] )) $news_sort_by = $_SESSION['dle_sort_favorites']; else $news_sort_by = $config['news_sort'];
if (isset ( $_SESSION['dle_direction_favorites'] )) $news_direction_by = $_SESSION['dle_direction_favorites']; else $news_direction_by = $config['news_msort'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}id in {$favorites}";
$temp = $db->super_query($sql_count);
$posts = $temp['count'];
if($posts){
$page = intval( $cstart );
$total = intval( ( ( $posts - 1 ) / $limit ) + 1 );
if( $page <= 0 ) $page = 1;
if( $page > $total ) $page = $total;
$start = $page * $limit - $limit;
$i = $start;
$sql_select = "SELECT id, autor, date, title, category, alt_name, comm_num, rating, news_read FROM " . PREFIX . "_post where {$stop_list}id in $favorites ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $start . "," . $limit;
$result = $db->query($sql_select);
$tpl->load_template('fav/news.tpl');
while($row = $db->get_row($result)){
$i++;
if (strlen($row['title']) > $word) $title = stripcslashes(substr ($row['title'], 0, $word))." ..."; else $title = stripcslashes($row['title']);
$fav_arr = explode( ',', $member_id['favorites'] );
if( ! in_array( $row['id'], $fav_arr ) or $config['allow_cache'] == "yes" ) $tpl->set( '{favorites}', "" );
else $tpl->set( '{favorites}', "" );
$set = array(
'{category}' => "".$cat_info[$row['category']]['name']."",
'{date}' => date("d.m.Y",strtotime($row['date'])),
'{title}' => $title,
'{link}' => $config['http_home_url'].$row['id']."-".$row['alt_name'].".html",
'{id}' => $row['id'],
);
$tpl->set('', $set);
$tpl->compile('fileslist');
}
$list = $tpl->result['fileslist'];
$tpl->load_template('fav/favorites.tpl');
$tpl->set('{list}', $list);
$tpl->set ( '{sort}', news_sort ( $do ) );
$tpl->compile('content');
$tpl->clear();
$nav = "/favorites/page/{page}/";
CreateNavigation( $nav, $page, $total );
} else {
$tpl->load_template('info.tpl');
$tpl->set('{error}', "К сожалению вами не было добавлено ни одного материала в закладки.");
$tpl->set('{title}', "Закладки");
$tpl->compile('content');
$tpl->clear();
}
?>