/**
 * @return Registration
 */
function parseLines($lines)
{
    $data = array();
    $lastMarker = null;
    foreach ($lines as $line) {
        $trimmed = trim($line);
        if (isMarker($trimmed)) {
            $lastMarker = $trimmed;
        } else {
            if ($trimmed && $lastMarker) {
                $data[$lastMarker][] = $trimmed;
            }
        }
    }
    return new Registration($data);
}
 $command = $ARCPATH . ' l ' . escapeshellarg("modules/" . $file);
 $result = shell_exec($command);
 // Error?
 if (strpos($result, 'Error') !== FALSE) {
     echo "An error occured while reading the archive: {$result}.\n";
     continue;
 }
 $filesize = filesize('modules/' . $file);
 $version_info .= sprintf("\t<module size=\"%u\" name=\"%s\" url=\"%s\">\n", $filesize, $file, $MODULESURL . $file);
 $lines = explode("\n", $result);
 // Process line by line and find the start and end markers.
 $readingNames = false;
 for ($i = 0; $i < count($lines); ++$i) {
     $line = $lines[$i];
     // The markers are interpreted as toggles
     if (isMarker($line)) {
         $readingNames = !$readingNames;
         continue;
     }
     // We're reading files
     if ($readingNames) {
         // Split the line into the parts
         $parts = explode(' ', $line);
         // A typical line:
         // 2005-09-16 20:32:54 ....A      1867776       653097  python24.dll
         // 2005-09-18 13:23:54 ....A         7763               scripts/UserDict.pyo
         // We're not interested in the file size (although it would be an interesting extension)
         // So we use the first two and the last element
         $filename = trim($parts[count($parts) - 1]);
         $date = trim($parts[0]);
         list($year, $month, $day) = explode('-', $date);