/**
  * Parse file
  * @param string $Filename relative path (from FRONTEND_PATH) to file
  */
 public function parseFile($Filename)
 {
     $Archive = new ZipArchive();
     if ($Archive->open(FRONTEND_PATH . $Filename) === true) {
         $Files = array();
         for ($i = 0; $i < $Archive->numFiles; ++$i) {
             $file = $Archive->getNameIndex($i);
             $pathinfo = pathinfo($file);
             if (is_array($pathinfo) && isset($pathinfo['dirname']) && isset($pathinfo['extension']) && $pathinfo['dirname'] == '.' && substr($file, 0, 1) != '.' && ImporterFactory::canImportExtension($pathinfo['extension'])) {
                 $Files[] = $file;
             }
         }
         $Archive->extractTo(FRONTEND_PATH . ImporterUpload::relativePath(''), $Files);
         $Archive->close();
         $this->readFiles($Files);
     }
 }
예제 #2
0
 /**
  * Check for JSON-return
  * @return boolean
  */
 private function returnJSON()
 {
     $Uploader = new ImporterUpload();
     if ($Uploader->thereWasAFile()) {
         echo $Uploader->getResponse();
         Error::getInstance()->debug_displayed = true;
         return true;
     }
     return false;
 }
예제 #3
0
 /**
  * Construct for filename
  * @param string $Filename filename
  */
 private function constructForFilename($Filename)
 {
     $this->Filename = ImporterUpload::relativePath($Filename);
     $extension = Filesystem::extensionOfFile($this->Filename);
     if (self::canImportExtension($extension)) {
         $this->importWithClass(self::classFor($extension));
     } else {
         $this->throwUnknownExtension($Filename, $extension);
     }
 }