Exemple #1
0
             }
             $found[] = array('id' => $item[NEW_ID], 'src' => $newsfile, 'title' => $item[NEW_TITLE], 'cat' => $item[NEW_CAT]);
         }
     }
 }
 if (count($found)) {
     $itemid = 0;
     // Show results
     foreach ($found as $i => $resline) {
         $itemid++;
         if ($start_from > $itemid) {
             continue;
         }
         $id = $resline['id'];
         $title = htmlspecialchars($resline['title']);
         $title = $config_useutf8 ? UTF8ToEntities($title) : $title;
         $ucat = $resline['cat'];
         $archive = 0;
         if (preg_match('~(\\d+)\\.news\\.arch$~i', $resline['src'], $arc)) {
             $archive = $arc[1];
         }
         $URL = $PHP_SELF . build_uri('subaction,id,archive,ucat', array('showfull'));
         $url = RWU('readmore', $URL);
         echo "<div class='cutenews_search_item'>{$itemid} <b><a href='{$url}'>{$title}</a></b> (" . date("d F, Y", $id) . ")</div>";
     }
     echo "<p class='cutenews_founded'><b>" . lang('Founded news articles') . " [" . count($found) . "]</b> ";
     echo str_replace(array('%1', '%2'), array(date("d F Y", $date_from), date("d F Y", $date_to)), lang("from <b>%1</b> to <b>%2</b></p>", 'search'));
 } else {
     echo "<div class='cutenews_not_match'>" . lang('There are no news matching your search criteria') . "</div>";
 }
 echo '<div class="cutenews_search_results"><i>' . lang('Search performed for') . ' ' . round(microtime(true) - $mc_start, 4) . ' s.</i></div>';
<?php

if (!defined('INIT_INSTANCE')) {
    die('Access restricted');
}
$all_active_news = file($news_file);
foreach ($all_active_news as $active_news) {
    $news_arr = explode("|", $active_news);
    if ($news_arr[NEW_ID] == $id and (empty($category) or $is_in_category)) {
        $found = true;
        $output = template_replacer_news($news_arr, $template_full);
        $output = hook('replace_fullstory', $output);
        $output = UTF8ToEntities($output);
        echo $output;
    }
}
// Article ID was not found, if we have not specified an archive -> try to find the article in some archive.
// Auto-Find ID In archives
//----------------------------------------------------------------------
if (!$found) {
    echo '<a id="com_form"></a>';
    if (!$archive or $archive == '') {
        // Get all archives. (if any) and fit our lost id in the most propper archive.
        $lost_id = $id;
        $all_archives = false;
        $hope_archive = false;
        if (!($handle = opendir(SERVDIR . "/cdata/archives"))) {
            echo "<!-- " . lang('cannot open directory') . " " . SERVDIR . "/cdata/archives --> ";
        }
        while (false !== ($file = readdir($handle))) {
            if ($file != "." and $file != ".." and !is_dir(SERVDIR . "/cdata/archives/{$file}") and substr($file, -9) == 'news.arch') {
                        $mail_or_url = "";
                        if (substr($comment_arr[COM_MAIL], 0, 3) == "www") {
                            $mail_or_url = "http://";
                        }
                    }
                    $output = str_replace("{author}", "<a {$url_target} href=\"{$mail_or_url}" . stripslashes($comment_arr[COM_MAIL]) . "\">" . stripslashes(UTF8ToEntities($comment_arr[1])) . "</a>", $template_comment);
                } else {
                    $output = str_replace("{author}", UTF8ToEntities($comment_arr[COM_USER]), $template_comment);
                }
                $comment_arr[COM_TEXT] = preg_replace("/\\b((http(s?):\\/\\/)|(www\\.))([\\w\\.]+)([&-~\\%\\/\\w+\\.-?]+)\\b/i", "<a href=\"http\$3://\$4\$5\$6\" target=\"_blank\">\$2\$4\$5\$6</a>", $comment_arr[COM_TEXT]);
                $comment_arr[COM_TEXT] = preg_replace("/([\\w\\.]+)(@)([-\\w\\.]+)/i", "<a href=\"mailto:\$0\">\$0</a>", $comment_arr[COM_TEXT]);
                $output = str_replace("{mail}", $comment_arr[2], $output);
                $output = str_replace("{date}", date($config_timestamp_comment, $comment_arr[0]), $output);
                $output = embedateformat($news_arr[0], $output);
                $output = str_replace("{comment-id}", $comment_arr[0], $output);
                $output = str_replace("{comment}", "<a name=\"" . $comment_arr[0] . "\"></a>" . UTF8ToEntities($comment_arr[4]), $output);
                $output = str_replace("{comment-iteration}", $iteration, $output);
                $output = replace_comment("show", $output);
                echo $output;
                $showed_comments++;
                if ($comm_per_page != 0 and $comm_per_page == $showed_comments) {
                    break;
                }
            }
        }
    }
}
//----------------------------------
// Prepare the Comment Pagination
//----------------------------------
$prev_next_msg = $template_comments_prev_next;