iType = $aType; if( $aDir == '' ) { $aDir = getcwd(); } if( !chdir($aDir) ) { die("PANIC: Can't access directory : $aDir"); } $this->iDir = $aDir; } function GetFiles() { $d = @dir($this->iDir); $a = array(); while( $entry=$d->Read() ) { if( strstr($entry,".php") && strstr($entry,"x") && !strstr($entry,"show") && !strstr($entry,"csim") ) { $a[] = $entry; } } $d->Close(); if( count($a) == 0 ) { die("PANIC: Apache/PHP does not have enough permission to read the scripts in directory: $this->iDir"); } sort($a); return $a; } function GetCSIMFiles() { $d = @dir($this->iDir); $a = array(); while( $entry=$d->Read() ) { if( strstr($entry,".php") && strstr($entry,"csim") ) { $a[] = $entry; } } $d->Close(); if( count($a) == 0 ) { die("PANIC: Apache/PHP does not have enough permission to read the CSIM scripts in directory: $this->iDir"); } sort($a); return $a; } function Run() { switch( $this->iType ) { case 1: $files = $this->GetFiles(); break; case 2: $files = $this->GetCSIMFiles(); break; default: die('Panic: Unknown type of test'); break; } $n = count($files); echo "
"; echo "
Done.
"; } } $type=@$_GET['type']; if( empty($type) ) { $type=1; } $driver = new TestDriver($type); $driver->Run(); ?>