• DONATE to NULLED!
    Форуму и его команде можно помочь, мотивировать модераторов разделов.
    Помогите модератору этого раздела killoff лично.

[Хак] Сортивовка постов, с пролистыванием

Статус
В этой теме нельзя размещать новые ответы.

Sland

ПротNв те4ениR
Регистрация
15 Дек 2006
Сообщения
194
Реакции
159
1206700856_sortby.jpg

Описание: Хак позволяет сортировать посты по: РЕЙТИНГУ / ПОСЕЩАеМОСТИ / САМЫЕ КОММЕНТИРУЕМЫЕ
Возможности: Пролистывание, просмотр любой страници в отсортированном порядке.

Установка

Oткрываем файл engine/engine.php
Ищем:

PHP:
        $sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
            $sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;

Вместо этого вставляем :

PHP:
if (isset($_GET['rating']) && $_GET['rating'] != "")
            {
                $config['allow_cache'] = false;
                $addsql = "ORDER BY rating DESC, ".$config['news_sort']." ".$config['news_msort']."";
                $url_page = $config['http_home_url']."ratingorder";
                }
                else
                    if (isset($_GET['mostcomment']) && $_GET['mostcomment'] != "")
                    {
                        $config['allow_cache'] = false;
                        $addsql = "ORDER BY comm_num DESC, ".$config['news_sort']." ".$config['news_msort']."";
                        $url_page = $config['http_home_url']."commorder";
                        }
                        else
                            if (isset($_GET['mostread']) && $_GET['mostread'] != "")
                            {
                            $config['allow_cache'] = false;
                            $addsql = "ORDER BY news_read DESC, ".$config['news_sort']." ".$config['news_msort']."";
                            $url_page = $config['http_home_url']."readorder";
                            }
                        else
                    if(!isset($_GET['rating']) and !isset($_GET['mostcomment']) and !isset($_GET['mostread']))
                $addsql = "ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."";
                                    
            $sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ".$addsql." LIMIT ".$cstart.",".$config['news_number'];
            $sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;

откройте файл .htaccess в корне сайта и после строки RewriteEngine On, добавьте
следующие строки:

PHP:
# order by
RewriteRule ^ratingorder(/?)+$ index.php?rating=1 [L]
RewriteRule ^ratingorder/page/([0-9]+)(/?)+$ index.php?rating=1&cstart=$1 [L]
RewriteRule ^commorder(/?)+$ index.php?mostcomment=1 [L]
RewriteRule ^commorder/page/([0-9]+)(/?)+$ index.php?mostcomment=1&cstart=$1 [L]
RewriteRule ^readorder(/?)+$ index.php?mostread=1 [L]
RewriteRule ^readorder/page/([0-9]+)(/?)+$ index.php?mostread=1&cstart=$1 [L]

Oткрываем файл templates/default/main.tpl
Ищем:
PHP:
{speedbar}

После вставляем :

PHP:
[aviable=main]<div style=" padding-right:10px; float:right;"> сортировать посты по:  <a href="/ratingorder/">РЕЙТИНГУ</a> | <a href="/readorder/">ПОСЕЩАЕМОСТИ</a> | <a href="/commorder/">САМЫЕ КОММЕНТИРУЕМЫЕ</a>  </div>
<br />[/aviable]

автор не я.
 
Можно ли такое сделать только для какой то одной определенной категории?
 
da , propishy v IF && $category_id = nomer kategoriji.
 
Voobsce jab zdelal so switch, i tolko s odnoi peremennoi, dopustim - $sortirovka.

jesli nuzno tolko dlia konkretnyh kategorij to pishesh pered switch

if in_array spisok nuznyh kategorij $category_id
switch($sortirovka)
= 1 //sortirovka dopustim po kolicestvo citanyh i po date ubyvaja to
$addsql = "ORDER BY news_read DESC, ".$config['news_sort']." ".$config['news_msort']."";

= 2 //sortirovka dopustim po raitingu
$addsql = ... kod

=3 // sortirovka jescio po cemuto

default // liuboje drugoje znacenije

sortirovka po standartnomu.

$addsql = "ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."";

if zakryli.

tolko nenado vozmozno stavit allow_cache na NO, tak kak budit bolshaja nagruzka na server - puskai lutche kesirujet.

vrodeb vsio. ter poniatnei?
 
Voobsce jab zdelal so switch, i tolko s odnoi peremennoi, dopustim - $sortirovka.

jesli nuzno tolko dlia konkretnyh kategorij to pishesh pered switch

if in_array spisok nuznyh kategorij $category_id
switch($sortirovka)
= 1 //sortirovka dopustim po kolicestvo citanyh i po date ubyvaja to
$addsql = "ORDER BY news_read DESC, ".$config['news_sort']." ".$config['news_msort']."";

= 2 //sortirovka dopustim po raitingu
$addsql = ... kod

=3 // sortirovka jescio po cemuto

default // liuboje drugoje znacenije

sortirovka po standartnomu.

$addsql = "ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."";

if zakryli.

tolko nenado vozmozno stavit allow_cache na NO, tak kak budit bolshaja nagruzka na server - puskai lutche kesirujet.

vrodeb vsio. ter poniatnei?
This is not good.
If o press page 2,3,4 or any other, then sorting will be droped and probably redirected to main page.
 
$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];

- подскажите строку в DLE 7.0, хоть примерно - а то не могу найти и ppc.
 
на 6,5 почему то не заработало :confused:
я один такой или нет?
 
У меня тоже на 6.5 не работает, помогите пожалуйста!
 
скрины в студию, а то ч не вьехал
 
скрины в студию, а то ч не вьехал
Вот выкладываю код своего engine.php. Не сортирует почему-то и все (версия 6.5).
PHP:
<?PHP
/*
=====================================================
 Файл: engine.php
-----------------------------------------------------
 Назначение: подключение основных компонентов
=====================================================
*/
if(!defined('DATALIFEENGINE'))
{
  die("Hacking attempt!");
}

	if (isset ($_REQUEST['do'])) $do = $_REQUEST['do']; else $do = "";
	if (isset ($_REQUEST['subaction'])) $subaction = $_REQUEST['subaction']; else $subaction = "";
	if (isset ($_REQUEST['doaction'])) $doaction = $_REQUEST['doaction']; else $doaction = "";
        if ($_REQUEST['act'] == "Arcade") $do = 'arcade';

	if ($cstart < 0) $cstart = 0;
	$CN_HALT = FALSE;

	$allow_add_comment         = FALSE;
	$allow_full_story          = FALSE;
	$allow_active_news         = FALSE;
	$allow_comments            = FALSE;
	$allow_userinfo            = FALSE;
	$active 				   = FALSE;

switch ($do) {
           case "video" :
                        include ENGINE_DIR . '/modules/video/main.php';
                        break;
           case "repa-stats" :
                       $action = "list";
                        include ENGINE_DIR.'/modules/repa.php';
                        break;

           case "repa-change" :
                        $action = "change";
                        include ENGINE_DIR.'/modules/repa.php';
                        break;
           case "tv-program" :
		include ENGINE_DIR.'/modules/tv-program.php';
		break;
           case "chat" :
		include ENGINE_DIR.'/chat/chat.php';
		break;
	
	case "link" :
		include ENGINE_DIR.'/modules/link.php';
		break;
	case "partner" :
       $partner_action = "partner-form";
       include ENGINE_DIR.'/modules/partner.php';
       break;

	case "search" :

		if ($_REQUEST['mode'] == "advanced") $_REQUEST['full_search'] = 1;

		if ($config['full_search']) {
			include ENGINE_DIR.'/modules/fullsearch.php';
		} else {
			include ENGINE_DIR.'/modules/search.php';
		}

		break;

        case "guestbook" :
	        include ENGINE_DIR.'/modules/guestbook.php';
	        break;

        case "comments" :
		include ENGINE_DIR.'/modules/comments.php';
		break;

        case "faq" :
                 include ENGINE_DIR.'/modules/faq.php';
                 break;

        case "files" :
                include ENGINE_DIR.'/modules/files.php';
                break;

        case "addfile" :
                include ENGINE_DIR.'/modules/addfile.php';
                break;

        case "fileslastcomments" :
                include ENGINE_DIR.'/modules/fileslastcomments.php';
                break;
			
	case "stats" :
		include ENGINE_DIR.'/modules/stats.php';
		break;
        case "banlist" :
                include ENGINE_DIR.'/modules/banlist.php';
                break;
        case "arcade":
        include ENGINE_DIR.'/modules/arcade/arcade.php';
        break;
	
	case "addnews" :
		include ENGINE_DIR.'/modules/addnews.php';
		break;
           
            case "sitemap" :
                        include ENGINE_DIR.'/modules/sitemap.php';
                        break;
		
	case "avatars" :
		include ENGINE_DIR.'/modules/avatars.php';
		break;

	case "register" :
		include ENGINE_DIR.'/modules/register.php';
		break;

	case "radio" :
        include ENGINE_DIR.'/modules/radio.php';
        break;
		
	case "lostpassword" :
		include ENGINE_DIR.'/modules/lostpassword.php';
		break;

	case "static" :
		include ENGINE_DIR.'/modules/static.php';
		break;
        case "portfolio" :
		include ENGINE_DIR.'/modules/portfolio.php';
		break;
        case "library" :
                include ENGINE_DIR.'/modules/library.php';
                break;

	case "favorites" :
		if ($is_logged) {

		$config['allow_cache'] = false;

		include ENGINE_DIR.'/modules/favorites.php';

		} else msgbox ($lang['all_err_1'], $lang['fav_error']);
		break;

	case "feedback" :
		include ENGINE_DIR.'/modules/feedback.php';
		break;

	case "lastcomments" :
		include ENGINE_DIR.'/modules/lastcomments.php';
		break;

	case "pm" :
		include ENGINE_DIR.'/modules/pm.php';
		break;
        case "rate" :
		include ENGINE_DIR.'/modules/rate.php';
		break;
        case "googlemaps" :
                include ENGINE_DIR.'/modules/googlemaps/index.php';
                break;
        case "gallery" :
                include ENGINE_DIR.'/gallery/gallery.php';
                break;
        case "horoscope" :
	        include ENGINE_DIR.'/modules/horoscope.php';
	        break;
        case "sonnik" :
                include ENGINE_DIR.'/modules/sonnik.php';
                break;
        case "work" :
        include ENGINE_DIR.'/modules/work.php';
        break;

	case "rulles" :
        include ENGINE_DIR.'/modules/rulles.php';
        break;


	default:

	$is_main = 0;
	$active = false;

	$thisdate = date ("Y-m-d H:i:s", (time()+ ($config['date_adjust']*60)));
	if (intval($config['no_date'])) $where_date = " AND date < '".$thisdate."'"; else $where_date = "";


	$config['news_number'] = intval($config['news_number']);
	$attachments = array();

	if ($config['news_sort'] == "")  $config['news_sort'] = "date";
	if ($config['news_msort'] == "") $config['news_msort'] = "DESC";

	$allow_list = explode (',', $user_group[$member_id['user_group']]['allow_cats']);

	if ($allow_list[0] != "all") { 

		if ($config['allow_multi_category']) {

			$stop_list = "category regexp '[[:<:]](".implode ('|', $allow_list).")[[:>:]]' 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($_GET['rating']) && $_GET['rating'] != "")
            {
                $config['allow_cache'] = false;
                $addsql = "ORDER BY rating DESC, ".$config['news_sort']." ".$config['news_msort']."";
                $url_page = $config['http_home_url']."ratingorder";
                }
                else
                    if (isset($_GET['mostcomment']) && $_GET['mostcomment'] != "")
                    {
                        $config['allow_cache'] = false;
                        $addsql = "ORDER BY comm_num DESC, ".$config['news_sort']." ".$config['news_msort']."";
                        $url_page = $config['http_home_url']."commorder";
                        }
                        else
                            if (isset($_GET['mostread']) && $_GET['mostread'] != "")
                            {
                            $config['allow_cache'] = false;
                            $addsql = "ORDER BY news_read DESC, ".$config['news_sort']." ".$config['news_msort']."";
                            $url_page = $config['http_home_url']."readorder";
                            }
                        else
                    if(!isset($_GET['rating']) and !isset($_GET['mostcomment']) and !isset($_GET['mostread']))
                $addsql = "ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."";
                                    
            $sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ".$addsql." LIMIT ".$cstart.",".$config['news_number'];
            $sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;
	$sql_news = "";

// ################ Вывод отдельной категории #################
	if ($do == "cat" AND $category != '' AND $subaction == '') {

		if (!$category_id) $category_id = 'not detected';

		if ($allow_list[0] != "all") {
			if (!$user_group[$member_id['user_group']]['allow_short'] AND !in_array ($category_id, $allow_list)) $category_id = 'not detected';
		}

		if ($config['show_sub_cats']) $get_cats = get_sub_cats ($category_id); else $get_cats = $category_id;

		if ($cat_info[$category_id]['news_sort'] != "") $config['news_sort'] = $cat_info[$category_id]['news_sort'];
		if ($cat_info[$category_id]['news_msort'] != "") $config['news_msort'] = $cat_info[$category_id]['news_msort'];
		if ($cat_info[$category_id]['news_number']) $config['news_number'] = $cat_info[$category_id]['news_number'];

		if ($cstart){
			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];
		}

	    $url_page = $config['http_home_url'].get_url($category_id);

		if ($config['allow_multi_category']) {

			$where_category = "category regexp '[[:<:]](".$get_cats.")[[:>:]]'";

		} else {

			if ($config['show_sub_cats']) {

				$get_cats = str_replace ("|", "','", $get_cats);
				$where_category = "category IN ('".$get_cats."')";

			} else {

				$where_category = "category = '{$get_cats}'";

			}

		}


		$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
		$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date;

	}
// ################ Вывод профиля пользователя #################
	elseif ($subaction == 'userinfo')
	{

	$url_page = $config['http_home_url']."user/".urlencode ($user);

	if ($member_id['name'] == $user OR $user_group[$member_id['user_group']]['allow_all_edit'])
	{

		$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, approve, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0' order by approve ASC, ".$config['news_sort']." ".$config['news_msort'];
		$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where autor = '$user' AND approve = '0'";
		$allow_active_news = true; 
	} 
	else 
	{
		$allow_active_news = false; 
	}

	$config['allow_cache'] = false;
	}
// ################ Вывод всех новостей пользователя #################
	elseif ($subaction == 'allnews')
	{
		if ($cstart){

			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];

		}

		$url_page = $config['http_home_url']."user/".urlencode ($user). "/news";

		$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, approve, flag FROM " . PREFIX . "_post where {$stop_list}autor = '$user' AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
		$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}autor = '$user' AND approve = '1'".$where_date;

		$allow_active_news = true;
		$config['allow_cache'] = false;

	}
// ################ Вывод непрочитанных новостей #################
	elseif ($subaction == 'newposts')
	{
		if ($cstart){
		$cstart = $cstart - 1;
		$cstart = $cstart * $config['news_number'];
		}

		$url_page = $config['http_home_url']."newposts";
		$thistime = date ("Y-m-d H:i:s", $_TIME);

		if (isset($_SESSION['member_lasttime']))
		{
			$lasttime = date ("Y-m-d H:i:s", $_SESSION['member_lasttime']);
		}
        else 
		{
			 $lasttime = date ("Y-m-d H:i:s", (time()+ ($config['date_adjust']*60) - (3600*4)));
		}

	$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post where {$stop_list}approve = '1' AND date between '$lasttime' and '$thistime' order by ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
	$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}approve = '1' AND date between '$lasttime' and '$thistime'";

	$config['allow_cache'] = false;
	}
// ################ Вывод по буквенному идентификатору #################
	elseif ($catalog != "")
	{
		if ($cstart){
			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];
		}

		$url_page = $config['http_home_url']."catalog/".urlencode ($catalog);

		$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, approve, flag FROM " . PREFIX . "_post WHERE {$stop_list}symbol = '$catalog' AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
		$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}symbol = '$catalog' AND approve = '1'".$where_date;

		$config['allow_cache'] = false;
	}
	else {

// ################ Новости на главной #################
	if ($year == '' AND $month == '' AND $day == '') {
		if ($cstart){

			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];

		}

		$url_page = substr($config['http_home_url'], 0, strlen ($config['http_home_url'])-1);

		if (isset($view_template) AND $view_template == "rss") {

			$sql_select = "SELECT id, autor, date, short_story, full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1'";

			if ($config['rss_mtype']) {

				$sql_select .= " AND allow_main = '1'";

			}

			$sql_select .= $where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT 0,".$config['rss_number'];

		} else {

			$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
			$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;

		}
	}

// ################ Новости за год #################
	if ($year != '' AND $month == '' AND $day == '') {
		if ($cstart){

			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];
		}

	$url_page = $config['http_home_url'].$year;

	$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-01-01'AND date < '{$year}-01-01' + INTERVAL 1 YEAR AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
	$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}year(date) = '$year' AND approve = '1'".$where_date;
	}

// ################ Новости за месяц #################
	if ($year != '' AND $month != '' AND $day == '') {
		if ($cstart){
		$cstart = $cstart - 1;
		$cstart = $cstart * $config['news_number'];
		}
	$url_page = $config['http_home_url'].$year."/".$month;

	$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
	$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve = '1'".$where_date;
	}

// ################ Новости за день #################
	if ($year != '' AND $month != '' AND $day != '' AND $subaction == '') {
		if ($cstart){
			$cstart = $cstart - 1;
			$cstart = $cstart * $config['news_number'];
		}

	$url_page = $config['http_home_url'].$year."/".$month."/".$day;

	$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve = '1'".$where_date." ORDER BY ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
	$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve = '1'".$where_date;

	$config['allow_cache'] = false;
	}

// ################ Новость целиком #################
	if ($subaction != '' OR $newsid) {
		if (!$newsid)
			$sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, approve, votes, access, is_icq_razdacha, flag FROM " . PREFIX . "_post WHERE alt_name ='$news_name' AND date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR LIMIT 0,1";
		else
			$sql_news = "SELECT id, autor, date, short_story, full_story, xfields, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_thanks, allow_rate, rating, vote_num, news_read, approve, votes, access, flag FROM " . PREFIX . "_post where  id = '$newsid'";

		if ($subaction == '') $subaction = "showfull";

	}
  }


	if(($subaction == "showfull" or $subaction == "addcomment") and ((!isset($category) or $category == "")) ){

//####################################################################################################################
//             Добавление комментария в базу данных
//####################################################################################################################
	    if($_POST['subaction'] == "addcomment")	{ 

				$allow_add_comment    = TRUE; 
				$allow_comments = TRUE;
				$ajax_adds = false;

				include_once (ENGINE_DIR.'/modules/addcomments.php');
		}
//####################################################################################################################
//         Просмотр полной новости
//####################################################################################################################
	    if($subaction == "showfull") { 
				$allow_full_story = TRUE; 
				$allow_comments = TRUE;

				include_once (ENGINE_DIR.'/modules/show.full.php');
		}

	} else{

//####################################################################################################################
//         Просмотр профиля пользователя
//####################################################################################################################
		if ($subaction == 'userinfo'){ 

				$allow_userinfo = TRUE;
				include_once (ENGINE_DIR.'/modules/profile.php');

		} else {
				$allow_active_news = TRUE; 
		}

//####################################################################################################################
//         Просмотр кратких новостей
//####################################################################################################################

	if ($view_template == "rss") {

		$active = dle_cache("rss", $category_id, false);

	} else {

		if ($is_logged AND ($user_group[$member_id['user_group']]['allow_edit'] AND !$user_group[$member_id['user_group']]['allow_all_edit'])) $config['allow_cache'] = false;

		if ($cstart) $cache_id = ($cstart / $config['news_number']) + 1; else $cache_id = "1";
	
		if ($cache_id < 8 AND !isset($_POST['login'])) $active = dle_cache("news", $config['skin'].$cache_id.$month.$year.$category, true); else $active = false;

	}

	if ($active) $tpl->result['content'] .= $active;
		else {

			include_once (ENGINE_DIR.'/modules/show.short.php');

			if ($config['files_allow'] == "yes")
				if ( stristr( $tpl->result['content'], "[attachment=" ) )
				{
				$tpl->result['content'] = show_attach($tpl->result['content'], $attachments);
				}

			if ($view_template == "rss" AND $news_found) {

				create_cache("rss", $tpl->result['content'], $category_id, false);

	        } elseif ($news_found AND $cache_id < 8) create_cache("news", $tpl->result['content'], $config['skin'].$cache_id.$month.$year.$category, true);

		}

	}

}

/*
=====================================================
 Вывод заголовка страницы 
=====================================================
*/
	$titl_e = '';
	$nam_e ='';
	$rss_url ='';

		if ($do == "cat" AND $category != '' AND $subaction == '') {

			$metatags['description'] = ($cat_info[$category_id]['descr'] != '') ? $cat_info[$category_id]['descr'] : $metatags['description'];
			$metatags['keywords'] = ($cat_info[$category_id]['keywords'] != '') ? $cat_info[$category_id]['keywords'] : $metatags['keywords'];
			$nam_e= stripslashes($cat_info[$category_id]['name']);

			if ($config['allow_alt_url'] == "yes") {
				$rss_url = $url_page."/"."rss.xml";
			} else {
				$rss_url = $config['http_home_url']."engine/rss.php?do=cat&category=".$cat_info[$category_id]['alt_name'];
			}

		}
		elseif ($subaction == 'userinfo') $nam_e = $lang['title_users'].' &raquo; '.$user;
elseif ($do == 'arcade') {
if (!empty($arcade->title)) {
$nam_e = $arcade_lng['arcade'].' &raquo; '.$arcade->title;
$metatags['description'] = $arcade->description;
$metatags['keywords'] = $arcade->title;
}
else $nam_e = $arcade_lng['arcade'];
}
		elseif ($subaction == 'allnews') $nam_e = $lang['show_user_news'].' '.$user;
		elseif ($subaction == 'newposts') $nam_e=$lang['title_new'];
		elseif ($do == 'stats') $nam_e=$lang['title_stats']; 
		elseif ($do == 'addnews') $nam_e=$lang['title_addnews'];
		elseif ($do == 'register') $nam_e=$lang['title_register']; 
		elseif ($do == 'favorites') $nam_e=$lang['title_fav']; 
		elseif ($do == 'pm') $nam_e=$lang['title_pm']; 
		elseif ($do == 'feedback') $nam_e=$lang['title_feed'];
		elseif ($do == 'lastcomments') $nam_e=$lang['title_last'];
		elseif ($do == 'lostpassword') $nam_e=$lang['title_lost'];
		elseif ($do == 'search') $nam_e=$lang['title_search'];
		elseif ($do == 'static') $titl_e=$static_descr;
                        elseif ($do == 'repa-stats') $titl_e='Просмотр репутации пользователя'.' &raquo; '.$us;
                        elseif ($do == 'repa-change') $titl_e='Изменение репутации пользователя'.' &raquo; '.$us;
                elseif ($do == 'googlemaps') $nam_e="GoogleMaps";
                elseif ($do == 'guestbook') $nam_e="Гостевая книга";
                elseif ($do == 'files') $nam_e="Архив файлов";
                elseif ($do == 'addfile') $nam_e="Добавление файла в архив файлов"; 
		elseif ($catalog != "") $nam_e = $lang['title_catalog'].' &raquo; '.$catalog;
		else {

		    if ($year != '' AND $month == '' AND $day == '') $nam_e=$lang['title_date'].' '.$year.' '.$lang['title_year'];
		    if ($year != '' AND $month != '' AND $day == '') $nam_e=$lang['title_date'].' '.$r[$month-1].' '.$year.' '.$lang['title_year1']; 
		    if ($year != '' AND $month != '' AND $day != '' AND $subaction == '') $nam_e=$lang['title_date'].' '.$day.'.'.$month.'.'.$year;
		    if (($subaction != '' OR $newsid !='') AND $news_found) $titl_e = $metatags['title'];

		}

	if($nam_e) { 
		$metatags['title'] = $nam_e.' &raquo; '.$metatags['title'];
		$rss_title = $metatags['title'];
	}

	if($titl_e) $metatags['title'] = $titl_e.' &raquo; '.$config['home_title'];

	if(!$rss_url) {

		if ($config['allow_alt_url'] == "yes") {
			$rss_url = $config['http_home_url']."rss.xml";
		} else {
			$rss_url = $config['http_home_url']."engine/rss.php";
		}
 
		$rss_title = $config['home_title'];
	}
if ($do == 'banlist'){
$metatags['title'] = $metatags['titles'].' » '.$config['home_title'];
$nam_e = $metatags['titlet'];
}

$metatags = <<<HTML
<title>{$metatags['title']}</title>
<meta http-equiv="Content-Type" content="text/html; charset={$config['charset']}" />
<meta name="description" content="{$metatags['description']}" />
<meta name="keywords" content="{$metatags['keywords']}" />
<meta name="generator" content="Развлекательный портал HotSoft(http://www.softhot.ru)" />
<meta name="robots" content="all" />
<meta name="revisit-after" content="1 days" />
<link rel="search" type="application/opensearchdescription+xml" href="{$config['http_home_url']}engine/opensearch.php" title="{$config['home_title']}" />
HTML;

if ($config['allow_rss'])
$metatags .= <<<HTML
<link rel="alternate" type="application/rss+xml" title="{$rss_title}" href="{$rss_url}" />
HTML;

if ($config['speedbar'] AND !isset($view_template)) {

	$s_navigation = "<a href=\"{$config['http_home_url']}\">".$config['short_title']."</a>";

	if ($category_id) $s_navigation .= " &raquo; ". get_categories ($category_id);
	elseif ($nam_e) $s_navigation .= " &raquo; ". $nam_e;
	if ($titl_e) $s_navigation .= " &raquo; ". $titl_e;


	$tpl->load_template('speedbar.tpl');
	$tpl->set('{speedbar}', '<span id=\'dle-speedbar\'>'.stripslashes($s_navigation).'</span>');
  	$tpl->compile('speedbar');
	$tpl->clear();

}

?>
 
Статус
В этой теме нельзя размещать новые ответы.
Назад
Сверху