Mirkwood logo Twitter LiveJournal
Facebook VKontakte
// error_reporting(256);

$dir = "_news_rusid";
$found = -1;

$handler = opendir($dir);

while ($file = readdir($handler)) { // +1
if ((is_file($dir."/".$file)) && (!preg_match("/\./", $file))) { // +2
$found = ++$found;
$news[$found] = trim($file);
} // -2

} // -1

closedir($handler);

//echo count($news);
//echo $found;

sort($news);

for ($cnt = 0; $cnt <= $found; $cnt++) { // +1

$target = $dir."/".$news[$cnt];
if (file_exists($target) && $file = fopen($target, "r")) { // +2

$string1[$cnt] = fgets($file, 150);
$string1[$cnt] = chop($string1[$cnt]);

unset($tempstring);
$ready=0;

while ((! feof($file)) && ($ready < 1)) { // +3
$tempstring = fgetss($file, 1000);
$tempstring = trim($tempstring);
if ($tempstring == '') { $ready=0; } else { $ready=1; }
} // -3

$string2[$cnt] = $tempstring;
unset($tempstring);

$string2[$cnt] = chop($string2[$cnt]);
fclose($file);

} // -2

else { print "Unable to open $target.
Please try again.
\n"; }

} // -1


if ($found < 0) { echo "
Ничего не найдено\n"; } else { // +1

for ($ii = 0; $ii <= $found; $ii++) { // +2
// $string11[$ii] = $string1[$found-$ii+1];
// $string21[$ii] = $string2[$found-$ii+1];
$string11[$ii] = strip_tags($string1[$found-$ii]);
$string21[$ii] = $string2[$found-$ii];
$news1[$ii] = $news[$found-$ii];
$cont111=$news1[$ii];
$cYY = substr ($cont111, 0, 2);
$cMM = substr ($cont111, 2, 2);
$cDD = substr ($cont111, 4, 2);
$chh = substr ($cont111, 6, 2);
$cmm = substr ($cont111, 8, 2);
// $newsdate[$ii]="$cDD.$cMM.$cYY, $chh:$cmm";
$newsdate[$ii]="$cDD.$cMM.$cYY";
} // -2

$nq = 5; // news quantity to show

// top N news - with announces
include ("tab.1.php");
print " [ новости танцев ] «Это даже не жёлтая, это уже ЗЕЛЁНАЯ пресса!»\n";
include ("tab.2.php");

for ($ii = 0; $ii <= $nq-1; $ii++) { // +2
print "
\n
$newsdate[$ii] 
\n
$string11[$ii] \n
\n
";

$imgfile = "default.jpg";
$imgfiletmp = $dir."/".$news1[$ii].".jpg";
if (is_file($imgfiletmp)) { $imgfile = $news1[$ii].".jpg"; }
$imgfiletmp = $dir."/".$news1[$ii].".gif";
if (is_file($imgfiletmp)) { $imgfile = $news1[$ii].".gif"; }
print "


\"$string11[$ii]\"
";

print "

$string21[$ii]
\n
";
//

} // -2

include ("tab.3.php");



// next N news - headers only
include ("tab.1.php");
print " [ более ранние новости ] \n";

include ("tab.2.php");

print "
";

for ($ii = $nq; $ii <= $found; $ii++) { // +2

print "
$newsdate[$ii]\r\n
$string11[$ii]\r\n
";
print "
\n";
} // -2

include ("tab.3.php");

} // -1

?>


© elf.org.ru, 2003-2010. Contact us by mirkwood@elf.org.ru
test