464 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			464 lines
		
	
	
		
			26 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
|  | <?PHP | |||
|  | if (! defined ( 'DATALIFEENGINE' )) {die ( "Hacking attempt!" );} | |||
|  | 
 | |||
|  | if (!isset ( $do ) AND isset ($_REQUEST['do']) ) $do = totranslit ( $_REQUEST['do'] ); elseif(isset ( $do )) $do = totranslit ( $do ); else $do = ""; | |||
|  | if (!isset ( $subaction ) AND isset ($_REQUEST['subaction']) ) $subaction = $_REQUEST['subaction']; | |||
|  | if (isset ( $_REQUEST['doaction'] )) $doaction = $_REQUEST['doaction']; else $doaction = ""; | |||
|  | if ($do == "tags" and ! $_GET['tag']) $do = "alltags"; | |||
|  | 
 | |||
|  | $dle_module = $do; | |||
|  | 
 | |||
|  | if ($do == "" and ! $subaction and $year) $dle_module = "date"; | |||
|  | elseif ($do == "") $dle_module = $subaction; | |||
|  | 
 | |||
|  | if ($subaction == '' AND $newsid) $dle_module = "showfull"; | |||
|  | $dle_module = $dle_module ? $dle_module : "main"; | |||
|  | 
 | |||
|  | if ($cstart < 0) $cstart = 0; | |||
|  | $CN_HALT = FALSE; | |||
|  | 
 | |||
|  | $allow_add_comment = FALSE; | |||
|  | $allow_active_news = FALSE; | |||
|  | $allow_comments = FALSE; | |||
|  | $allow_userinfo = FALSE; | |||
|  | $active = FALSE; | |||
|  | $newsmodule = FALSE; | |||
|  | 
 | |||
|  | switch ( $do ) { | |||
|  | 	case "search":			if ($_REQUEST['mode'] == "advanced") $_REQUEST['full_search'] = 1; include SYSTEM_DIR . '/modules/search.php'; break; | |||
|  | 	case "stats":			include SYSTEM_DIR . '/modules/stats.php';break; | |||
|  | 	case "forum":			include SYSTEM_DIR.'/forum/main.php';break; | |||
|  | 	case "addnews":			include SYSTEM_DIR . '/modules/addnews.php';break; | |||
|  | 	case "users":			include SYSTEM_DIR.'/modules/users.php';break; | |||
|  | 	case "register":		include SYSTEM_DIR . '/modules/register.php';break; | |||
|  | 	case "lostpassword":	include SYSTEM_DIR . '/modules/lostpassword.php';break; | |||
|  | 	case "newslist":		include SYSTEM_DIR.'/modules/newslist.php';break; | |||
|  | 	case "static":			include SYSTEM_DIR . '/modules/static.php';break; | |||
|  | 	case "reputation":		include SYSTEM_DIR.'/modules/reputation.php';break; | |||
|  | 	case "chat_history":	include SYSTEM_DIR . '/modules/chat/modules.php';break; | |||
|  | 	case "tracker":			include SYSTEM_DIR.'/modules/torrent/list.php';break; | |||
|  | 	case "table":			include SYSTEM_DIR.'/modules/table.php';break; | |||
|  | 	case "favorites":		if ($is_logged) {$config['allow_cache'] = false; include SYSTEM_DIR . '/modules/favorites.php';} else msgbox ( $lang['all_err_1'], $lang['fav_error'] );break; | |||
|  | 	case "feedback":		include SYSTEM_DIR . '/modules/feedback.php';break; | |||
|  | 	case "lastcomments":    include SYSTEM_DIR . '/modules/lastcomments.php';break; | |||
|  | 	case "pm":			    include SYSTEM_DIR . '/modules/pm.php';break; | |||
|  | 	case "rss":			    include SYSTEM_DIR . '/modules/rss.php';break; | |||
|  | 
 | |||
|  | 	default : | |||
|  | 		$is_main = 0; | |||
|  | 		$active = false; | |||
|  | 		$user_query = ""; | |||
|  | 		 | |||
|  | 		$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 = ""; | |||
|  | 		$fixed = "fixed desc, "; | |||
|  | 		 | |||
|  | 		$config['news_number'] = intval ( $config['news_number'] ); | |||
|  | 		$attachments = array (); | |||
|  | 		 | |||
|  | 		$news_sort_by = ($config['news_sort']) ? $config['news_sort'] : "date"; | |||
|  | 		$news_direction_by = ($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 = ""; | |||
|  | 		 | |||
|  | 		$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number']; | |||
|  | 		$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date; | |||
|  | 		$sql_news = ""; | |||
|  | 		 | |||
|  | 		// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 		if ($do == "cat" and $category != '' and $subaction == '') { | |||
|  | 			$newsmodule = true; | |||
|  | 			 | |||
|  | 			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';} | |||
|  | 			 | |||
|  | 			$get_cats = get_sub_cats ( $category_id ); | |||
|  | 			 | |||
|  | 			if ($cat_info[$category_id]['news_sort'] != "") $news_sort_by = $cat_info[$category_id]['news_sort']; | |||
|  | 			if ($cat_info[$category_id]['news_msort'] != "") $news_direction_by = $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 ); | |||
|  | 			$user_query = "do=cat&category=" . $cat_info[$category_id]['alt_name']; | |||
|  | 			 | |||
|  | 			if ($config['allow_multi_category']) {$where_category = "category regexp '[[:<:]](" . $get_cats . ")[[:>:]]'"; | |||
|  | 			} else { | |||
|  | 					$get_cats = str_replace ( "|", "','", $get_cats ); | |||
|  | 					$where_category = "category IN ('" . $get_cats . "')"; | |||
|  | 			} | |||
|  | 			 | |||
|  | 			if (isset ( $_SESSION['dle_sort_cat'] )) $news_sort_by = $_SESSION['dle_sort_cat']; | |||
|  | 			if (isset ( $_SESSION['dle_direction_cat'] )) $news_direction_by = $_SESSION['dle_direction_cat']; | |||
|  | 				 | |||
|  | 			$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$where_category} AND approve" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number']; | |||
|  | 			$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve" . $where_date; | |||
|  |   | |||
|  |  		} elseif ($do == 'lastnews') { | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################			
 | |||
|  | 			if ($cstart) { | |||
|  | 				$cstart = $cstart - 1; | |||
|  | 				$cstart = $cstart * $config['news_number']; | |||
|  | 			} | |||
|  | 			$newsmodule = true; | |||
|  | 			$url_page = $config['http_home_url'] . "lastnews"; | |||
|  | 			$user_query = "do=lastnews"; | |||
|  | 			 | |||
|  | 			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 id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}approve" . $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" . $where_date; | |||
|  | 
 | |||
|  | 		} elseif ($do == 'tags') { | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> #################			
 | |||
|  | 			if ($cstart) { | |||
|  | 				$cstart = $cstart - 1; | |||
|  | 				$cstart = $cstart * $config['news_number']; | |||
|  | 			} | |||
|  | 
 | |||
|  | 			$newsmodule = true; | |||
|  | 			 | |||
|  | 			$tag = $db->safesql ( htmlspecialchars ( strip_tags ( stripslashes ( trim ( urldecode ( $_GET['tag'] ) ) ) ), ENT_QUOTES ) ); | |||
|  | 			$url_page = $config['http_home_url'] . "tags/" . urlencode ( $tag ); | |||
|  | 			$user_query = "do=tags&tag=" . urlencode ( $tag ); | |||
|  | 			 | |||
|  | 			if (isset ( $_SESSION['dle_sort_tags'] )) $news_sort_by = $_SESSION['dle_sort_tags']; | |||
|  | 			if (isset ( $_SESSION['dle_direction_tags'] )) $news_direction_by = $_SESSION['dle_direction_tags']; | |||
|  | 			 | |||
|  | 			$db->query ( "SELECT news_id FROM " . PREFIX . "_tags WHERE tag='{$tag}'" ); | |||
|  | 			$tag_array = array (); | |||
|  | 			 | |||
|  | 			while ( $row = $db->get_row () ) {$tag_array[] = $row['news_id'];} | |||
|  | 			 | |||
|  | 			if (count ( $tag_array )) {$tag_array = "(" . implode ( ",", $tag_array ) . ")"; | |||
|  | 			} else {$tag_array = "('undefined')";} | |||
|  | 			 | |||
|  | 			$db->free (); | |||
|  | 			 | |||
|  | 			$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}id IN {$tag_array} AND approve" . $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}id IN {$tag_array} AND approve" . $where_date; | |||
|  | 			$allow_active_news = true; | |||
|  | 			 | |||
|  | 			$tag_array = array (); | |||
|  | 			unset ( $tag_array ); | |||
|  | 		 | |||
|  | 		} elseif ($subaction == 'userinfo') { | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($cstart) { | |||
|  | 				$cstart = $cstart - 1; | |||
|  | 				$cstart = $cstart * $config['news_number']; | |||
|  | 			} | |||
|  | 			 | |||
|  | 			$url_page = $config['http_home_url'] . "user/" . urlencode ( $user ); | |||
|  | 			$user_query = "subaction=userinfo&user=" . urlencode ( $user ); | |||
|  | 			 | |||
|  | 			if ($member_id['name'] == $user or $user_group[$member_id['user_group']]['allow_all_edit']) { | |||
|  | 				if (isset ( $_SESSION['dle_sort_userinfo'] )) $news_sort_by = $_SESSION['dle_sort_userinfo']; | |||
|  | 				if (isset ( $_SESSION['dle_direction_userinfo'] )) $news_direction_by = $_SESSION['dle_direction_userinfo']; | |||
|  | 				 | |||
|  | 				$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, approve, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0' ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number']; | |||
|  | 				$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE autor = '$user' AND approve = '0'"; | |||
|  | 				$allow_active_news = false; | |||
|  | 			} else {$allow_active_news = false;} | |||
|  |             $cache->off(); | |||
|  | 		} elseif ($subaction == 'allnews') { | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($cstart) { | |||
|  | 				$cstart = $cstart - 1; | |||
|  | 				$cstart = $cstart * $config['news_number']; | |||
|  | 			} | |||
|  | 
 | |||
|  | 			$newsmodule = true; | |||
|  | 			$url_page = $config['http_home_url'] . "user/" . urlencode ( $user ) . "/news"; | |||
|  | 			$user_query = "subaction=allnews&user=" . urlencode ( $user ); | |||
|  | 			 | |||
|  | 			if (isset ( $_SESSION['dle_sort_allnews'] )) $news_sort_by = $_SESSION['dle_sort_allnews']; | |||
|  | 			if (isset ( $_SESSION['dle_direction_allnews'] )) $news_direction_by = $_SESSION['dle_direction_allnews']; | |||
|  | 				 | |||
|  | 			$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, approve, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}autor = '$user' AND approve" . $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}autor = '$user' AND approve" . $where_date; | |||
|  | 			 | |||
|  | 			$allow_active_news = true; | |||
|  | 			//$config['allow_cache'] = false;
 | |||
|  | 
 | |||
|  | 		} elseif ($subaction == 'newposts') { | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($cstart) { | |||
|  | 				$cstart = $cstart - 1; | |||
|  | 				$cstart = $cstart * $config['news_number']; | |||
|  | 			} | |||
|  | 			$newsmodule = true; | |||
|  | 			 | |||
|  | 			$url_page = $config['http_home_url'] . "newposts"; | |||
|  | 			$user_query = "subaction=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)) );} | |||
|  | 			 | |||
|  | 			if (isset ( $_SESSION['dle_sort_newposts'] )) $news_sort_by = $_SESSION['dle_sort_newposts']; | |||
|  | 			if (isset ( $_SESSION['dle_direction_newposts'] )) $news_direction_by = $_SESSION['dle_direction_newposts']; | |||
|  | 			 | |||
|  | 			$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}approve AND date between '$lasttime' and '$thistime' 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 AND date between '$lasttime' and '$thistime'"; | |||
|  | 
 | |||
|  |             $cache->off(); | |||
|  | 		} else { | |||
|  | 			 | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			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 ); | |||
|  | 				$user_query = ""; | |||
|  | 				 | |||
|  | 				if (isset ( $_SESSION['dle_sort_main'] )) $news_sort_by = $_SESSION['dle_sort_main']; | |||
|  | 				if (isset ( $_SESSION['dle_direction_main'] )) $news_direction_by = $_SESSION['dle_direction_main']; | |||
|  | 				$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, fixed, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number']; | |||
|  | 				$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve AND allow_main" . $where_date; | |||
|  | 			} | |||
|  | 
 | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> #################
 | |||
|  | 			if ($year != '' and $month == '' and $day == '') { | |||
|  | 				if ($cstart) { | |||
|  | 					$cstart = $cstart - 1; | |||
|  | 					$cstart = $cstart * $config['news_number']; | |||
|  | 				} | |||
|  | 
 | |||
|  | 				$newsmodule = true; | |||
|  | 				$url_page = $config['http_home_url'] . $year; | |||
|  | 				$user_query = "year=" . $year; | |||
|  | 				 | |||
|  | 				if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date']; | |||
|  | 				if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date']; | |||
|  | 				$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-01-01'AND date < '{$year}-01-01' + INTERVAL 1 YEAR AND approve" . $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}date >= '{$year}-01-01'AND date < '{$year}-01-01' + INTERVAL 1 YEAR AND approve" . $where_date; | |||
|  | 			} | |||
|  | 			 | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($year != '' and $month != '' and $day == '') { | |||
|  | 				if ($cstart) { | |||
|  | 					$cstart = $cstart - 1; | |||
|  | 					$cstart = $cstart * $config['news_number']; | |||
|  | 				} | |||
|  | 
 | |||
|  | 				$newsmodule = true; | |||
|  | 				$url_page = $config['http_home_url'] . $year . "/" . $month; | |||
|  | 				$user_query = "year=" . $year . "&month=" . $month; | |||
|  | 				 | |||
|  | 				if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date']; | |||
|  | 				if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date']; | |||
|  | 				 | |||
|  | 				$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve" . $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}date >= '{$year}-{$month}-01'AND date < '{$year}-{$month}-01' + INTERVAL 1 MONTH AND approve" . $where_date; | |||
|  | 			} | |||
|  | 			 | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($year != '' and $month != '' and $day != '' and $subaction == '') { | |||
|  | 				if ($cstart) { | |||
|  | 					$cstart = $cstart - 1; | |||
|  | 					$cstart = $cstart * $config['news_number']; | |||
|  | 				} | |||
|  | 
 | |||
|  | 				$newsmodule = true;				 | |||
|  | 				$url_page = $config['http_home_url'] . $year . "/" . $month . "/" . $day; | |||
|  | 				$user_query = "year=" . $year . "&month=" . $month . "&day=" . $day; | |||
|  | 				 | |||
|  | 				if (isset ( $_SESSION['dle_sort_date'] )) $news_sort_by = $_SESSION['dle_sort_date']; | |||
|  | 				if (isset ( $_SESSION['dle_direction_date'] )) $news_direction_by = $_SESSION['dle_direction_date']; | |||
|  | 				 | |||
|  | 				$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, title, category, alt_name, comm_num, allow_comm, allow_main, allow_rate, rating, news_read, remote_addr, tags FROM " . PREFIX . "_post where {$stop_list}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve" . $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}date >= '{$year}-{$month}-{$day}' AND date < '{$year}-{$month}-{$day}' + INTERVAL 24 HOUR AND approve" . $where_date; | |||
|  | 			 | |||
|  | 			} | |||
|  | 			 | |||
|  | 			// ################ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #################
 | |||
|  | 			if ($subaction != '' or $newsid) { | |||
|  | 				if (! $newsid) $sql_news = "SELECT id, autor, date, short_story, full_story, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, news_read, approve, votes, access, remote_addr, tags, metatitle 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, title, category, descr, keywords, alt_name, comm_num, allow_comm, allow_rate, fixed, rating, news_read, approve, votes, access, remote_addr, tags, metatitle FROM " . PREFIX . "_post where  id = '$newsid'"; | |||
|  | 				if ($subaction == '') $subaction = "showfull"; | |||
|  | 			}} | |||
|  | 
 | |||
|  | //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  |         if($category_id){ foreach($cat_info as $c) if($c['parentid']==$category_id) { | |||
|  |             $cat_menu .= "<EFBFBD> <a href=\"/".get_url($c['id'])."\" rel=\"index section\"><b>". $c['name'] . "</b></a><div></div>"; } | |||
|  |             if ($cat_menu !='') | |||
|  |                 $cat_menu = "<div class=\"widget\"><div class=\"title\"><3E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD></div><div class=\"text\">".$cat_menu."</div></div>"; | |||
|  |         } | |||
|  | //!<21><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | 
 | |||
|  |         if ( (intval($_GET['cstart']) == 1) && (strpos($_SERVER['REQUEST_URI'], '/page/1') !== false) ) { | |||
|  |        		$first_page_url = str_replace ( "/page/1", "", $_SERVER['REQUEST_URI'] ); | |||
|  |        		header("HTTP/1.0 301 Moved Permanently"); | |||
|  |        		header("Location: $first_page_url"); | |||
|  |        		die("Redirect"); | |||
|  |        	} | |||
|  | 
 | |||
|  | 		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 (SYSTEM_DIR . '/modules/addcomments.php'); | |||
|  | 			} | |||
|  | 
 | |||
|  | 			if ($subaction == "showfull") { | |||
|  | 				$allow_comments = TRUE; | |||
|  | 				include_once (SYSTEM_DIR . '/modules/show.full.php'); | |||
|  | 			} | |||
|  | 		 | |||
|  | 		} else { | |||
|  | 			if ($subaction == 'userinfo') { | |||
|  | 				$allow_userinfo = TRUE; | |||
|  |                 include_once (SYSTEM_DIR . '/modules/profile.php'); | |||
|  | 			} else { | |||
|  | 				$allow_active_news = TRUE; | |||
|  | 			} | |||
|  | 			 | |||
|  | 			//####################################################################################################################
 | |||
|  | 			//         <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | 			//####################################################################################################################
 | |||
|  | 			 | |||
|  | 
 | |||
|  | 			$_SESSION['referrer'] = $_SERVER['REQUEST_URI']; | |||
|  | 			 | |||
|  |             if ($do == "lastnews") { | |||
|  | 				$cache_prefix = "_lastnews"; | |||
|  |             } elseif ($subaction == 'allnews') { | |||
|  |          		$cache_prefix = "_allnews_". $user; | |||
|  |          	} elseif ($do == 'tags') { | |||
|  |                 $cache_prefix = "_tagscl_". $tag; | |||
|  | 			} else { | |||
|  | 				$cache_prefix = "_"; | |||
|  | 				if ($month) $cache_prefix .= "month_" . $month; | |||
|  | 				if ($year) $cache_prefix .= "year_" . $year; | |||
|  | 				if ($day) $cache_prefix .= "day_" . $day; | |||
|  | 				if ($category) $cache_prefix .= "category_" . $category; | |||
|  | 			} | |||
|  | 			$cache_prefix .= "_tempate_" . $config['skin']; | |||
|  | 			if ($is_logged and ($user_group[$member_id['user_group']]['allow_edit'] and ! $user_group[$member_id['user_group']]['allow_all_edit'])) $cache->off(); | |||
|  |             if (isset($_SESSION['dle_no_cache']) AND $_SESSION['dle_no_cache']) $config['allow_cache'] = false; | |||
|  | 			if ($cstart) $cache_id = ($cstart / $config['news_number']) + 1; else $cache_id = "1"; | |||
|  | 				 | |||
|  | 			if ($cache_id < 6 and ! isset ( $_POST['login'] )) $active = $cache->open( "news", $cache_id . $cache_prefix, true ); | |||
|  | 			else $active = false; | |||
|  | 
 | |||
|  | 			if ($active) { | |||
|  | 				$tpl->result['content'] .= $active; | |||
|  | 				$active = null; | |||
|  | 			} else { | |||
|  | 				include_once (SYSTEM_DIR . '/modules/show.short.php'); | |||
|  | 
 | |||
|  |                  if ($config['files_allow'] == "yes"){ | |||
|  | 				    if (strpos ( $tpl->result['content'], "[file=" ) !== false) {$tpl->result['content'] = show_file ( $tpl->result['content'], $attachments );} | |||
|  |                     if (strpos ( $tpl->result['content'], "[torrent=" ) !== false) {$tpl->result['content'] = show_torrent ( $tpl->result['content'], $attachments );} | |||
|  |                  } | |||
|  |                 if ($news_found and $cache_id < 6) $cache->save( "news", $tpl->result['content'], $cache_id . $cache_prefix, true ); | |||
|  | }}} | |||
|  | 
 | |||
|  | /* | |||
|  | ===================================================== | |||
|  |  <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>  | |||
|  | ===================================================== | |||
|  | */ | |||
|  | $titl_e = ''; | |||
|  | $nam_e = ''; | |||
|  | 
 | |||
|  | if ($do == "cat" and $category != '' and $subaction == '') { | |||
|  |     //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  |     			if( $category_id AND $view_template != "rss") { | |||
|  |     				$re_cat = get_url( $category_id ); | |||
|  | 
 | |||
|  |     				if ($re_cat != $_GET['category'] OR substr ( $_SERVER['REQUEST_URI'], - 1, 1 ) != '/' ) { | |||
|  |     					$re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) ); | |||
|  |     					$re_url = reset ( $re_url ); | |||
|  | 
 | |||
|  |     					header("HTTP/1.0 301 Moved Permanently"); | |||
|  |     					header("Location: {$re_url}{$re_cat}/"); | |||
|  |     					die("Redirect"); | |||
|  |     				} | |||
|  |     			} | |||
|  |     //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD>
 | |||
|  | 
 | |||
|  | 	$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']; | |||
|  | 	if ($cat_info[$category_id]['metatitle'] != '') $metatags['header_title'] = $cat_info[$category_id]['metatitle']; else $nam_e = stripslashes ( $cat_info[$category_id]['name'] ); | |||
|  | 	//$rss_url = $url_page . "/" . "rss.xml";
 | |||
|  | 
 | |||
|  | } | |||
|  | elseif ($subaction == "showfull") $rss_url = $config['http_home_url'] . "rss/comments/$newsid/"; | |||
|  | elseif ($subaction == 'userinfo')$nam_e = $user; | |||
|  | 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 == 'reputation') $nam_e = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> '.$user; | |||
|  | elseif ($do == 'static') $titl_e = $static_descr; | |||
|  | elseif ($do == 'chat_history') $titl_e = " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD>"; | |||
|  | elseif ($do == 'tracker') $titl_e = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; | |||
|  | elseif ($do == 'lastnews') $nam_e = $lang['last_news']; | |||
|  | elseif ($do == 'tags') $nam_e = $tag; | |||
|  | elseif ($do == 'newslist') $metatags['title'] = $metatags['titles'].''.$cnt3.''.$cnt5.' <20> '.$config['home_title']; | |||
|  | 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 (intval($_GET['cstart']) > 1 ){ | |||
|  | 	$page_extra = ' » '.$lang['news_site'].' '.intval($_GET['cstart']); | |||
|  | } else $page_extra = ''; | |||
|  | 
 | |||
|  | if ($nam_e) { | |||
|  | 	$metatags['title'] = $nam_e . $page_extra . ' » ' . $metatags['title']; | |||
|  | 	$rss_title = $metatags['title']; | |||
|  | } elseif ($titl_e) { | |||
|  | 	$metatags['title'] = $titl_e . $page_extra . ' » ' . $config['home_title']; | |||
|  | } else $metatags['title'] .= $page_extra; | |||
|  | 
 | |||
|  | if ( $metatags['header_title'] ) $metatags['title'] = stripslashes($metatags['header_title']) . $page_extra; | |||
|  | 
 | |||
|  | if (! $rss_url) { | |||
|  | 	$rss_url = $config['http_home_url'] . "rss/"; | |||
|  | 	$rss_title = $config['home_title']; | |||
|  |     //$rss_url .= $config['http_home_url'] . "comments.xml";    
 | |||
|  | } | |||
|  | 
 | |||
|  | $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']}" /> | |||
|  | <link rel="shortcut icon" href="{$config['http_home_url']}favicon.ico" type="image/x-icon" /> | |||
|  | <link rel="search" type="application/opensearchdescription+xml" href="{$config['http_home_url']}system/opensearch.php" title="{$config['home_title']}" />\n | |||
|  | HTML; | |||
|  | 
 | |||
|  | if ($config['allow_rss']) $metatags .= <<<HTML | |||
|  | <link rel="alternate" type="application/rss+xml" title="{$rss_title}" href="{$rss_url}" /> | |||
|  | HTML; | |||
|  | ?>
 |