function init() { $oKTConfig =& KTConfig::getSingleton(); $sBasedir = $oKTConfig->get("urls/tmpDirectory"); $sTmpPath = tempnam($sBasedir, 'archiveimportstorage'); if ($sTmpPath === false) { return PEAR::raiseError(_kt("Could not create temporary directory for archive storage")); } if (!file_exists($this->sZipPath)) { return PEAR::raiseError(_kt("Archive file given does not exist")); } unlink($sTmpPath); mkdir($sTmpPath, 0700); $this->sBasePath = $sTmpPath; // Set environment language to output character encoding $sOutputEncoding = $oKTConfig->get('export/encoding', 'UTF-8'); $loc = $sOutputEncoding; putenv("LANG={$loc}"); putenv("LANGUAGE={$loc}"); $loc = setlocale(LC_ALL, $loc); // File Archive doesn't unzip properly so sticking to the original unzip functionality if ($this->sExtension == 'zip') { // ** Original zip functionality $sUnzipCommand = KTUtil::findCommand("import/unzip", "unzip"); if (empty($sUnzipCommand)) { return PEAR::raiseError(_kt("unzip command not found on system")); } $aArgs = array($sUnzipCommand, "-q", "-n", "-d", $sTmpPath, $this->sZipPath); $aRes = KTUtil::pexec($aArgs); if ($aRes['ret'] !== 0) { return PEAR::raiseError(_kt("Could not retrieve contents from zip storage")); } } else { File_Archive::extract(File_Archive::readArchive($this->sExtension, File_Archive::readUploadedFile('file')), $dst = $sTmpPath); } }