function scan_file(SysFile $file, RuntimeContext &$shell) { set_time_limit(30); try { $file->open(SysFile::READ_ACCESS); while ($line = $file->readLine()) { $matches = array(); preg_match('~System::import\\((.[^\\*\\)]*)\\);~i', $line, $matches); if (count($matches) > 0) { $classpath = str_replace(array(' ', '\'', '"'), '', $matches[1]); if (!$shell->get('scan_results')->contains($classpath) && ereg('^System', $classpath)) { $shell->get('scan_results')->enqueue($classpath); } } } $file->close(); } catch (IOException $e) { error($e->getMessage() . ' "' . $file->getFilepath() . '"'); } }
<?php require 'c.system.php'; System::import('System.Context.HttpContext'); System::import('System.IO.SysDirectory'); System::import('System.IO.SysFile'); $context =& new HttpContext(); $tmpfile = new SysFile($context->getParam('SCRIPT_FILENAME')); $files = SysDirectory::getFiles($tmpfile->getDirectoryName()); $items = array(); if (count($files) > 0) { $iterator =& $files->getIterator(); while ($iterator->hasNext()) { $file = $iterator->next(); if ('php' == $file->getExtension()) { $filename = $file->getFilename(); $matches = array(); preg_match('|([a-z0-9_]+)\\-([a-z0-9_]+)\\-loader|', $filename, $matches); if (count($matches) > 0) { $type = ucfirst($matches[1]); if (!array_key_exists($type, $items)) { $items[$type] = array(); } $items[$type][$filename] = ucfirst($matches[2]); } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
public function __construct($filepath) { parent::__construct($filepath); $this->delimiter = ';'; $this->enclosure = '"'; }