elseif ($do == 'recent') {
// ################ Вывод свежих новостей #################
if($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
if($config['allow_alt_url'] AND $config['seo_control'] AND $_GET['cstart']) {
if(substr($_SERVER['REQUEST_URI'], - 1, 1 ) != '/' OR $_GET['cstart'] == 1) {
$re_url = explode ("index.php", strtolower($_SERVER['PHP_SELF']));
$re_url = reset ($re_url);
$re_url .= "recent/";
if(substr($_SERVER['REQUEST_URI'], - 1, 1) != '/' AND $_GET['cstart'] != 1) {
$re_url .= "page/".intval($_GET['cstart'])."/";
}
header("HTTP/1.0 301 Moved Permanently");
header("Location: {$re_url}");
die("Redirect");
}
}
$url_page = $config['http_home_url'] . "recent";
$user_query = "do=recent";
if($config['allow_alt_url']) $canonical = $url_page . "/"; else $canonical = $PHP_SELF."?do=recent";
if(isset($_SESSION['dle_sort_lastnews'])) $news_sort_by = $_SESSION['dle_sort_lastnews'];
else $news_sort_by = "date";
if(isset($_SESSION['dle_direction_lastnews'])) $news_direction_by = $_SESSION['dle_direction_lastnews'];
else $news_direction_by = "DESC";
$sql_select = "SELECT p.id, p.autor, p.date, p.short_story, CHAR_LENGTH(p.full_story) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE {$stop_list}approve=1" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve=1" . $where_date;
}