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( "