open( $cprefix, $sql_news ); if( $row ) { $row = unserialize($row); $full_cache = true; } else { $row = $db->super_query( $sql_news ); $full_cache = false; } $options = news_permission( $row['access'] ); if( $options[$member_id['user_group']] and $options[$member_id['user_group']] != 3 ) $perm = 1; if( $options[$member_id['user_group']] == 3 ) $perm = 0; if( $options[$member_id['user_group']] == 1 ) $user_group[$member_id['user_group']]['allow_addc'] = 0; if( $options[$member_id['user_group']] == 2 ) $user_group[$member_id['user_group']]['allow_addc'] = 1; if( ! $row['approve'] and $member_id['name'] != $row['autor'] and $member_id['user_group'] != '1' ) $perm = 0; if( ! $row['approve'] ) $allow_comments = false; if( ! $row['category'] ) { $my_cat = "---"; $my_cat_link = "---"; } else { $my_cat = array (); $my_cat_link = array (); $cat_list = explode( ',', $row['category'] ); if( count( $cat_list ) == 1 ) { if( $allow_list[0] != "all" and ! in_array( $cat_list[0], $allow_list ) ) $perm = 0; $my_cat[] = $cat_info[$cat_list[0]]['name']; $my_cat_link = get_categories( $cat_list[0] ); } else { foreach ( $cat_list as $element ) { if( $allow_list[0] != "all" and ! in_array( $element, $allow_list ) ) $perm = 0; if( $element ) { $my_cat[] = $cat_info[$element]['name']; $my_cat_link[] = "{$cat_info[$element]['name']}"; }}$my_cat_link = implode( ', ', $my_cat_link ); }$my_cat = implode( ', ', $my_cat ); } if ( $row['id'] AND $perm ){ if( strtotime($row['date']) >= ($_TIME - 2592000) ) {$allow_full_cache = true;} if ($allow_full_cache AND !$full_cache) $cache->save( $cprefix, serialize($row), $sql_news ); if( $row['votes'] ) include_once SYSTEM_DIR . '/modules/poll.php'; $row['category'] = intval( $row['category'] ); $category_id = $row['category']; $tpl->load_template( 'fullstory.tpl' ); if (!$_SESSION["news_read_{$row['id']}"]){ $db->query( "UPDATE " . PREFIX . "_post set news_read=news_read+1 where id='{$row['id']}'" ); $_SESSION["news_read_{$row['id']}"] = "1"; } $news_found = TRUE; $row['date'] = strtotime( $row['date'] ); $tpl->set('{id}', $row['id']); $tpl->set('{date-month}',$r[(int)date("m",$row['date'])-1]); $tpl->set('{date-day}',date("d",$row['date'])); //???????? ???????????? URL preg_match( '/'.$row['id'].'-(.*?).html/is' , $_SERVER["REQUEST_URI"] , $parse_alt_name ); if($row['alt_name'] != trim($parse_alt_name[1]) )$news_found = FALSE; if( !$news_found ){ @header( "HTTP/1.0 404 Not Found" ); require_once ROOT_DIR.'/404.php'; die();} //!???????? ???????????? URL if( (strlen( $row['full_story'] ) < 13) and (strpos( $tpl->copy_template, "{short-story}" ) === false) ) { $row['full_story'] = $row['short_story']; } $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html"; $short_link = $config['http_home_url']; $row['alt_name'] = $row['id'] . "-" . $row['alt_name']; $link_page = $config['http_home_url'] . 'page,' . $news_page . ','; $news_name = $row['alt_name']; $i ++; $metatags['title'] = stripslashes( $row['title'] ) .' » '.$config['home_title']; $comments_num = $row['comm_num']; if ($is_logged and $comments_num > 0){ $tpl->set('[comm_sort]', ""); $tpl->set('{comm_sort}', comm_sort()); $tpl->set('[/comm_sort]', ""); }else{$tpl->set_block("'\\[comm_sort\\](.*?)\\[/comm_sort\\]'si", "");} $news_find = array ('{comments-num}' => $comments_num, '{views}' => $row['news_read'], '{category}' => $my_cat, '{link-category}' => $my_cat_link, '{news-id}' => $row['id'] ); if( date( Ymd, $row['date'] ) == date( Ymd, $_TIME ) ) {$tpl->set( '{date}', $lang['time_heute'] . langdate( ", H:i", $row['date'] ) ); } elseif( date( Ymd, $row['date'] ) == date( Ymd, ($_TIME - 86400) ) ) { $tpl->set( '{date}', $lang['time_gestern'] . langdate( ", H:i", $row['date'] ) ); } else {$tpl->set( '{date}', langdate( $config['timestamp_active'], $row['date'] ) );} $tpl->copy_template = preg_replace ( "#\{date=(.+?)\}#ie", "langdate('\\1', '{$row['date']}')", $tpl->copy_template ); if( $row['tags'] ) { $tpl->set( '[tags]', "" ); $tpl->set( '[/tags]', "" ); $tags = array (); $row['tags'] = explode( ",", $row['tags'] ); foreach ( $row['tags'] as $value ) { $value = trim( $value ); $tags[] = "" . $value . ""; }$tpl->set( '{tags}', implode( ", ", $tags ) ); } else { $tpl->set_block( "'\\[tags\\](.*?)\\[/tags\\]'si", "" ); $tpl->set( '{tags}', "" ); } $tpl->set( '', $news_find ); if( $row['allow_rate'] ) {$tpl->set( '{rating}', ShortRating( $row['id'], $row['rating'], $user_group[$member_id['user_group']]['allow_rating'] ) ); }else $tpl->set( '{rating}', "0" ); $tpl->set( '[day-news]', "" ); $tpl->set( '[/day-news]', "" ); $go_page = $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/"; $tpl->set( '[profile]', "" ); $tpl->set( '[/profile]', "" ); /* if ($user_group[$user_color[$row['autor']]['user_group']]['colour']){ $group_span = $user_group[$user_color[$row['autor']]['user_group']]['colour']; $user = "".$row['autor'].""; }else{*/ $user = $row['autor']; //} $tpl->set( '{author}', "" .$user. "" ); $_SESSION['referrer'] = $_SERVER['REQUEST_URI']; if( $row['remote_addr'] != "" ) { $full_link = $config['http_home_url'] . "out.php?url=" . rawurlencode( base64_encode( $row['remote_addr'] ) ); $tpl->set( '[full-link]', "" ); $tpl->set( '[/full-link]', "" ); } else { $full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html"; $tpl->set( '[full-link]', "" ); $tpl->set( '[/full-link]', "" ); } $tpl->set( '{full-link}', $full_link ); if( $row['allow_comm'] ) { $tpl->set( '[com-link]', "" ); $tpl->set( '[/com-link]', "" ); } else $tpl->set_block( "'\\[com-link\\](.*?)\\[/com-link\\]'si", "" ); if( ! $row['approve'] and ($member_id['name'] == $row['autor'] and ! $user_group[$member_id['user_group']]['allow_all_edit']) ) { $tpl->set( '[edit]', "" ); $tpl->set( '[/edit]', "" ); } elseif( $is_logged and (($member_id['name'] == $row['autor'] and $user_group[$member_id['user_group']]['allow_edit']) or $user_group[$member_id['user_group']]['allow_all_edit']) ) { $tpl->set( '[edit]', "" ); $tpl->set( '[/edit]', "" ); } else $tpl->set_block( "'\\[edit\\](.*?)\\[/edit\\]'si", "" ); //??????? ?? ???? if( $config['allow_cache'] != "yes" ) { $config['allow_cache'] = "yes"; $revert_cache = true; } else $revert_cache = false; if( $revert_cache ) $config['allow_cache'] = "no"; //!??????? ?? ???? if( $is_logged ) { $fav_arr = explode( ',', $member_id['favorites'] ); if( ! in_array( $row['id'], $fav_arr ) ) $tpl->set( '{favorites}', "\"\"" ); else $tpl->set( '{favorites}', "\"\"" ); } else $tpl->set( '{favorites}', "" ); if( $is_logged ){ $subscribe = $db->super_query("SELECT COUNT(*) as count FROM " . PREFIX . "_subscribe WHERE news_id=$row[id] AND user_id=$member_id[user_id]"); if($subscribe['count'] == 0 ) $tpl->set( '{sibscribe}', "Подписаться" ); else $tpl->set( '{sibscribe}', "Отписаться" ); } if( $row['votes'] ) $tpl->set( '{poll}', $tpl->result['poll'] ); else $tpl->set( '{poll}', '' ); $tpl->set( '{title}', stripslashes( $row['title'] )); if ($smartphone_detected) { if (!$config['allow_smart_format']) { $row['short_story'] = strip_tags( $row['short_story'], '


' ); $row['full_story'] = strip_tags( $row['full_story'], '


' ); } else { if ( !$config['allow_smart_images'] ) { $row['short_story'] = preg_replace( "#(.+?)#is", "", $row['short_story'] ); $row['short_story'] = preg_replace( "##is", "", $row['short_story'] ); $row['full_story'] = preg_replace( "#(.+?)#is", "", $row['full_story'] ); $row['full_story'] = preg_replace( "##is", "", $row['full_story'] ); } if ( !$config['allow_smart_video'] ) { $row['short_story'] = preg_replace( "##is", "", $row['short_story'] ); $row['short_story'] = preg_replace( "##is", "", $row['short_story'] ); $row['full_story'] = preg_replace( "##is", "", $row['full_story'] ); $row['full_story'] = preg_replace( "##is", "", $row['full_story'] ); }}} $tpl->set( '{short-story}', stripslashes( $row['short_story'] ) ); $tpl->set( '{full-story}', stripslashes( "

" . $row['full_story'] . "
" ) ); include_once SYSTEM_DIR . '/modules/newsimg.php'; if( $row['keywords'] == '' and $row['descr'] == '' ) create_keywords( $row['short_story'] . $row['full_story'] ); else {$metatags['keywords'] = $row['keywords']; $metatags['description'] = $row['descr'];} if ($row['metatitle']) $metatags['header_title'] = $row['metatitle']; $tpl->compile( 'content' ); if( $user_group[$member_id['user_group']]['allow_hide'] ) $tpl->result['content'] = preg_replace( "'\[hide\](.*?)\[/hide\]'si", "\\1", $tpl->result['content']); else $tpl->result['content'] = preg_replace ( "'\[hide\](.*?)\[/hide\]'si", "
" . $lang['news_regus'] . "
", $tpl->result['content'] ); $tpl->result['content'] = preg_replace ( "'\[group=(.*?)\](.*?)\[/group\]'sie",'group_hide($1,"\\2")', $tpl->result['content']); $news_id = $row['id']; $allow_comments = $row['allow_comm']; $allow_add = true; if( isset( $view_template ) ) $allow_comments = false; } $tpl->clear(); unset( $row ); if( $config['files_allow'] == "yes" ){ if( strpos( $tpl->result['content'], "[file=" ) !== false ) {$tpl->result['content'] = show_file( $tpl->result['content'], $news_id );} if( strpos( $tpl->result['content'], "[torrent=" ) !== false ) {$tpl->result['content'] = show_torrent( $tpl->result['content'], $news_id );} } if( ! $news_found and ! $perm ) msgbox( $lang['all_err_1'], "{$user_group[$member_id['user_group']]['group_name']} " . $lang['news_err_28'] ); elseif( ! $news_found ) { @header( "HTTP/1.0 404 Not Found" ); require_once ROOT_DIR.'/404.php'; die(); } if($news_found) { include_once SYSTEM_DIR . '/classes/comments.class.php'; $comments = new Comments( $db, $comments_num, intval($config['comm_nummers']) ); $comments->nid = $news_id; $comments->query = "SELECT " . PREFIX . "_comments.id, post_id, " . PREFIX . "_comments.user_id, date, autor as gast_name, " . PREFIX . "_comments.email as gast_email, text, ip, is_register, name, rating, " . USERPREFIX . "_users.email, news_num, comm_num, user_group, reg_date, signature, lastdate, foto, fullname, land, icq, repa, repa_mod, repa_off FROM " . PREFIX . "_comments LEFT JOIN " . USERPREFIX . "_users ON " . PREFIX . "_comments.user_id=" . USERPREFIX . "_users.user_id WHERE " . PREFIX . "_comments.post_id = '$news_id' ORDER BY date ".$dle_comm_sort; if ( $allow_full_cache ) $allow_full_cache = $news_id; $comments->build_comments('news', $allow_full_cache ); $comments->build_navigation('navigation.tpl', $link_page . "{page}," . $news_name . ".html#comment", "newsid=" . $newsid); $comments->build_comm_form(); unset ($comments); } ?>