<?php echo '<?xml version="1.0" encoding="windows-1251"?>'.chr(0xD).chr(0xA); function rec_listFiles( $from = '.', $begin_ch=0) { global $i; $i=1; if(! is_dir($from)) return false; if( $dh = opendir($from)) { while( false !== ($file = readdir($dh))) { // Skip '.' and '..' if( $file == '.' || $file == '..') continue; $path = $from . '/' . $file; if( is_dir($path) ) { /*if ($i>1) echo "</cat>\n"; //echo $i."\n"; echo "<cat id=\""; //c 6 if (substr($path,$begin_ch)=="none") echo ""; else echo substr($path,$begin_ch); echo "\" >\n"; $i=1;*/ rec_listFiles($path); } else { if (substr($path,strlen($path)-3,3)==="md5") { echo "<file$i>"; echo substr($path,1,strlen($path)-5); //echo substr($path,1,strlen($path)-1); //echo substr($path,1,strlen($path)-5).chr(0xD).chr(0xA); echo "</file$i>".chr(0xD).chr(0xA); echo "<md5_$i>"; $handle = fopen(substr($path,2,strlen($path)-2), "r"); if ($handle) { $contents = fread($handle,32); fclose($handle); echo $contents; } echo "</md5_$i>".chr(0xD).chr(0xA); $i++; } } } closedir($dh); } } echo "<main>"; echo "<news>".chr(0xD).chr(0xA); include "updater/news.txt"; echo "</news>".chr(0xD).chr(0xA); $start_folder="./updater"; echo "<update>".chr(0xD).chr(0xA); rec_listFiles($start_folder); echo "</update>".chr(0xD).chr(0xA); echo "</main>"; ?>