<?php

include "../admin/adminses.php";
include "../engine/functions.php";
$sitetitle="Администрирование сайта";
@$contentcenter.= "<h3>Имеющиеся категории:</h3>";
$st=file("../engine/cat_pages.php"); 
for ($i=0;$i<sizeof($st);$i++){
$sst=explode('[n]',$st[$i]);
$sst=str_replace("\n",'',$sst);
$sst=str_replace("\r",'',$sst);
$contentcenter .='../'.$sst[1].'/ - <font color=blue>'.$sst[0].'</font><br>'; 
};   

$contentcenter.= "<h3>Имеющиеся страницы:</h3>";

$dir_name="../articles/";

$dir = opendir($dir_name);
$basename = basename($dir_name);
$fileArr = array();

while ($file_name = readdir($dir))
{
if (($file_name !=".") && ($file_name != ".."))
{
#Дата модификации...
$fName = "$dir_name/$file_name";
$fTime = filemtime($fName);
$fileArr[$file_name] = $fTime;
}
}

arsort($fileArr);

$numberOfFiles = sizeOf($fileArr);

$contentcenter.=  "<BIG>0&nbsp;&#8226;&nbsp;<b><font color=red>Главная страница</font>&nbsp;&nbsp;</b></BIG>- <a href=\"../admin/edit.php?what=main\">Ред.</a><br>\n";

for($t=0;$t<$numberOfFiles;$t++)
{
$thisFile = each($fileArr);
$thisName = $thisFile[0];
$thisTime = $thisFile[1];
$thisTime = date("F j, Y, g:i a", $thisTime);
//echo"<b>$thisName</b> $thisTime. <br />";
			 
$f=$thisName;
 if (eregi("\.dat",$f)){ 
 		@$myFile = '../articles/' . $f;
		$fh = fopen($myFile, 'r');
		@$contentcenter.= $myfile;
		$data = fread($fh, filesize($myFile));
		fclose($fh);
					
$thefile="main.dat";
 				$pos = strpos($f, $thefile);
 				if ($pos === false) {
				@$dumbcount=$dumbcount+1;
						$class = 'am' . ($dumbcount % 2);
						$contentcenter.= "<BIG>";
			 $text = explode("<!-- Kan_title -->",$data);
			 $plink=menulink($thisName);
			 //$perm=makepermalink($text[1]);
			 $contentcenter.=  $dumbcount . "&nbsp;&#8226;&nbsp;<b><font color=#446D8C>" . trim($text[1]) . "</font>&nbsp;&nbsp;</b></BIG>";
			 $contentcenter.= "- <a href=\"../admin/delete.php?what=" . $plink . "\">Удалить</a>";
			 $contentcenter.= " | <a href=\"../admin/edit.php?what=" . $plink . "\">Ред.</a>";
			
			 $contentcenter.="<br>\n";
			 }
		
$i++;
				
 }
}

include "../admin/admintemplate.php";

?>