codice:
if($allow_active_news){
$all_news = file("$news_file");
if($reverse == TRUE){ $all_news = array_reverse($all_news); }
$count_all = 0;
if(isset($category) and $category != ""){
foreach($all_news as $news_line){
$news_arr = explode("|", $news_line);
if($requested_cats and $requested_cats[$news_arr[6]] == TRUE){ $count_all ++; }
else{ continue; }
}
}else{ $count_all = count($all_news); }
$i = 0;
$showed = 0;
$repeat = TRUE;
$url_archive = $archive;
while($repeat != FALSE){
foreach($all_news as $news_line){
$news_arr = explode("|", $news_line);
if($category and $requested_cats[$news_arr[6]] != TRUE){ continue; }
if(isset($start_from) and $start_from != ""){
if($i < $start_from){ $i++; continue; }
elseif($showed == $number){ break; }
}
if($my_names[$news_arr[1]]){ $my_author = $my_names[$news_arr[1]]; }
else{ $my_author = $news_arr[1]; }
$output = $template_active;
$output = str_replace("{title}", $news_arr[2], $output);
$output = str_replace("{date}", date($config_timestamp_active, $news_arr[0]), $output);
$output = str_replace("{author}", $my_author, $output);
if($news_arr[5] != ""){$output = str_replace("{avatar}", "<img alt=\"\" src=\"$news_arr[5]\" style=\"border: none;\" />", $output); }
else{ $output = str_replace("{avatar}", "", $output); }
$output = str_replace("{avatar-url}", "$news_arr[5]", $output);
$output = str_replace("[link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);
$output = str_replace("[/link]","</a>", $output);
$output = str_replace("{comments-num}", countComments($news_arr[0], $archive), $output);
$output = str_replace("{short-story}", $news_arr[3], $output);
$output = str_replace("{full-story}", $news_arr[4], $output);
$output = str_replace("{category}", $cat[$news_arr[6]], $output);
$output = str_replace("{category-id}", $news_arr[6], $output);
if($cat_icon[$news_arr[6]] != ""){ $output = str_replace("{category-icon}", "<img alt=\"".$cat[$news_arr[6]]." icon\" style=\"border: none;\" src=\"".$cat_icon[$news_arr[6]]."\" />", $output); }
else{ $output = str_replace("{category-icon}", "", $output); }
$output = str_replace("{author-name}", $name_to_nick[$news_arr[1]], $output);
if($my_mails[$news_arr[1]] != ""){
$output = str_replace("[mail]","<a href=\"mailto:".$my_mails[$news_arr[1]]."\">", $output);
$output = str_replace("[/mail]","</a>", $output);
}else{
$output = str_replace("[mail]","", $output);
$output = str_replace("[/mail]","", $output);
}
$output = str_replace("{news-id}", $news_arr[0], $output);
$output = str_replace("{archive-id}", $archive, $output);
$output = str_replace("{php-self}", $PHP_SELF, $output);
$output = str_replace("{cute-http-path}", $config_http_script_dir, $output);
$output = replace_news("show", $output);
if($news_arr[4] != "" or $action == "showheadlines"){//if full story
if($config_full_popup == "yes"){
$output = preg_replace("/\\[full-link\\]/","<a href=\"#\" onclick=\"window.open('$config_http_script_dir/show_news.php?subaction=showfull&id=$news_arr[0]&archive=$archive&template=$template', '_News', '$config_full_popup_string');return false;\">", $output);
}else{
$output = str_replace("[full-link]","<a href=\"$PHP_SELF?subaction=showfull&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);
}
$output = str_replace("[/full-link]","</a>", $output);
}else{
$output = preg_replace("'\\[full-link\\].*?\\[/full-link\\]'si","", $output);
}
if($config_comments_popup == "yes"){
$output = str_replace("[com-link]","<a href=\"#\" onclick=\"window.open('$config_http_script_dir/show_news.php?subaction=showcomments&template=$template&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]', '_News', '$config_comments_popup_string');return false;\">", $output);
}else{
$output = str_replace("[com-link]","<a href=\"$PHP_SELF?subaction=showcomments&id=$news_arr[0]&archive=$archive&start_from=$my_start_from&ucat=$news_arr[6]&$user_query\">", $output);
}
$output = str_replace("[/com-link]","</a>", $output);
echo $output;
$showed++;
$i++;
if($number != 0 and $number == $i){ break; }
}
$used_archives[$archive] = TRUE;