load_template( 'shortstory.tpl' ); $sql_result = $db->query( $sql_select ); while ( $row = $db->get_row( $sql_result ) ) { $news_found = TRUE; $attachments[] = $row['id']; $tpl->set('{id}', $row['id']); $row['date'] = strtotime( $row['date'] ); $tpl->set('{date-month}',$r[(int)date("m",$row['date'])-1]); $tpl->set('{date-day}',date("d",$row['date'])); $i ++; 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 ) { $my_cat[] = $cat_info[$cat_list[0]]['name']; $my_cat_link = get_categories( $cat_list[0] ); } else { foreach ( $cat_list as $element ) { 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 ); }$row['category'] = intval( $row['category'] ); //Действие с новостью при рейтинге if ( $row['rating'] <= '-5' and $row['allow_main']){ $db->query( "UPDATE " . PREFIX . "_post SET allow_main = '0' WHERE id = '".$row['id']."'"); $cache->clear( 'news_' ); } elseif($row['rating'] >= '5' and $row['allow_main']!='1'){ $db->query( "UPDATE " . PREFIX . "_post SET allow_main = '1' WHERE id = '".$row['id']."'"); $cache->clear( 'news_' ); } //!Действие с новостью при рейтинге $news_find = array ('{comments-num}' => $row['comm_num'], '{views}' => $row['news_read'], '{category}' => $my_cat, '{link-category}' => $my_cat_link, '{news-id}' => $row['id']); $tpl->set( '', $news_find ); $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}', "" ); } 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]', "" ); /* 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']; //} $go_page = $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/"; $tpl->set( '{login}', $row['autor'] ); $tpl->set( '{author}', "" .$user. "" ); $tpl->set( '[profile]', "" ); $tpl->set( '[/profile]', "" ); if( $allow_userinfo and ! $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']) ) { $_SESSION['referrer'] = $_SERVER['REQUEST_URI']; $tpl->set( '[edit]', "" ); $tpl->set( '[/edit]', "" ); } else $tpl->set_block( "'\\[edit\\](.*?)\\[/edit\\]'si", "" ); 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 ); include SYSTEM_DIR . '/modules/newsimg.php'; if( $row['allow_comm'] ) { $comm_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html"; $tpl->set( '[com-link]', "Комментарии: " ); $tpl->set( '[/com-link]', " | " ); } else $tpl->set_block( "'\\[com-link\\](.*?)\\[/com-link\\]'si", "" ); if( $is_logged ) { $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}', "\"\"" ); } else $tpl->set( '{favorites}', "" ); if( $allow_userinfo and ! $row['approve'] ) {$tpl->set( '{approve}', $lang['approve'] ); } else $tpl->set( '{approve}', "" ); if ($smartphone_detected) { if (!$config['allow_smart_format']) { $row['short_story'] = strip_tags( $row['short_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'] ); } if ( !$config['allow_smart_video'] ) { $row['short_story'] = preg_replace( "##is", "", $row['short_story'] ); $row['short_story'] = preg_replace( "##is", "", $row['short_story'] ); }}} if( strlen( $row['title']) > 70 ) $title = substr( stripslashes( $row['title'] ), 0, 70)."..."; else $title = stripslashes( $row['title'] ); $tpl->set( '{title}', $title ); $tpl->set( '{short-story}', stripslashes( "

" . $row['short_story'] . "
" ) ); $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']); } $tpl->clear(); if( $i >= $config['news_number'] AND !isset( $view_template )){ $count_all = $db->super_query( $sql_count ); $count_all = $count_all['count']; } else $count_all = 0; if( $do == "" ) $do = $subaction; if( $do == "" and $year ) $do = "date"; $ban_short = array (); unset( $ban_short ); if( ! $news_found and $allow_userinfo and $member_id['name'] == $user and $user_group[$member_id['user_group']]['allow_adds'] ) { $tpl->load_template( 'info.tpl' ); $tpl->set( '{error}', $lang['mod_list_f'] ); $tpl->set( '{title}', $lang['all_info'] ); $tpl->compile( 'content' ); $tpl->clear(); } elseif( ! $news_found and ! $allow_userinfo and $do != '' and $do != 'favorites' and $view_template != 'rss' ) { if ( $newsmodule ) @header( "HTTP/1.0 404 Not Found" ); msgbox( $lang['all_err_1'], $lang['news_err_27'] ); } elseif( ! $news_found and $catalog != "" ) { if ( $newsmodule ) @header( "HTTP/1.0 404 Not Found" ); msgbox( $lang['all_err_1'], $lang['news_err_27'] ); } elseif( ! $news_found and $do == 'favorites' ) { if ( $member_id['favorites'] AND !$count_all) $db->query( "UPDATE " . USERPREFIX . "_users SET favorites='' WHERE user_id = '{$member_id['user_id']}'" ); if (!$count_all) msgbox( $lang['all_info'], $lang['fav_notfound'] ); else msgbox( $lang['all_info'], $lang['fav_notfound_1'] ); } //#################################################################################################################### // Навигация по новостям //#################################################################################################################### if( ! isset( $view_template ) and $count_all ) { $tpl->load_template( 'navigation.tpl' ); $no_prev = false; $no_next = false; if( isset( $cstart ) and $cstart != "" and $cstart > 0 ) { $prev = $cstart / $config['news_number']; $prev_page = $url_page . "/page/" . $prev . "/"; $tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "
\\1" ); } else { $tpl->set_block( "'\[prev-link\](.*?)\[/prev-link\]'si", "\\1" ); $no_prev = TRUE; } if( $config['news_number'] ) { if( $count_all > $config['news_number'] ) { $enpages_count = @ceil( $count_all / $config['news_number'] ); $pages = ""; $cstart = ($cstart / $config['news_number']) + 1; if( $enpages_count <= 10 ) { for($j = 1; $j <= $enpages_count; $j ++) { if( $j != $cstart ) { $pages .= "$j "; } else { $pages .= "$j "; } } } else { $start = 1; $end = 10; $nav_prefix = "{$lang['nav_trennen']} "; if( $cstart > 0 ) { if( $cstart > 6 ) { $start = $cstart - 4; $end = $start + 8; if( $end >= $enpages_count ) { $start = $enpages_count - 9; $end = $enpages_count - 1; $nav_prefix = ""; } else $nav_prefix = "{$lang['nav_trennen']} "; } } if( $start >= 2 ) { $pages .= "1 {$lang['nav_trennen']} "; } for($j = $start; $j <= $end; $j ++) { if( $j != $cstart ) { $pages .= "$j "; } else { $pages .= "$j "; } } if( $cstart != $enpages_count ) { $pages .= $nav_prefix . "{$enpages_count}"; } else $pages .= "{$enpages_count} "; } } $tpl->set( '{pages}', $pages ); } //---------------------------------- // Next link //---------------------------------- if( $config['news_number'] and $config['news_number'] < $count_all and $i < $count_all ) { $next_page = $i / $config['news_number'] + 1; $next = $url_page . '/page/' . $next_page . '/'; $tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "\\1" ); } else { $tpl->set_block( "'\[next-link\](.*?)\[/next-link\]'si", "\\1" ); $no_next = TRUE; } if (!$no_prev or !$no_next){ //$tpl->compile('navpages'); $tpl->compile('content'); } $tpl->clear(); } //$tpl->result['content'] = $tpl->result['navpages'] . $tpl->result['content'] . $tpl->result['navpages']; } ?>