Файл: restore.php
Строк: 48
<?php
set_time_limit(300);
header('Content-Type: text/plain');
print "---===:::{START}::===---n";
$sitespath="/home/kmx/www/sites";
array($sites);
$d=dir($sitespath);
while ($directory=$d->read())
{
if (filetype($sitespath.'/'.$directory)!='dir') continue;
# if ($directory=='_default') continue;
if (($directory=='..')||($directory=='.')) continue;
$sites[]=$directory;
}
$d->close();
@sort($sites, SORT_STRING);
$cntsite=$cntpage=0;
while ($_site=@each($sites))
{
$cntsite++;
$site=$_site[1];
#if ($site!='heretic') continue;
unset($files);
array($files);
$d=dir($sitespath.'/'.$site);
while ($currentfile=$d->read())
{
if (filetype($sitespath.'/'.$site.'/'.$currentfile)!='file') continue;
# if ($currentfile!='index.wml') continue;
if (substr($currentfile,-4)!='.wml') continue;
# if (substr($currentfile,-4)=='.dat') continue;
if (($currentfile=='..')||($currentfile=='.')) continue;
$files[]=$currentfile;
}
$d->close();
@sort($files, SORT_STRING);
while ($_file=@each($files))
{
$wmlfile=$_file[1];
#=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-="=-.,.-=
# ЗАДАНИЕ ДЛЯ ОБРАБОТКИ WML-файлов
$npage='';
$page=file($sitespath.'/'.$site.'/'.$wmlfile);
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
$found=true;
for ($i=0;$i<sizeof($page);$i++)
{
if (trim($page[$i])=='</p></card></wml>') $found=false;
}
if ($found)
{
if (file_exists('/home/kmx/www/sites_backup/'.$site.'/'.$wmlfile))
{
unlink('/home/kmx/www/sites/'.$site.'/'.$wmlfile);
copy('/home/kmx/www/sites_backup/'.$site.'/'.$wmlfile, '/home/kmx/www/sites/'.$site.'/'.$wmlfile);
}
$cntpage++;
}
}
}
print "Sites=$cntsite / Pages=$cntpagen---===:::{STOP}:::===---";
exit;
?>