Loading XML2HTMLPlugin.php +7 −27 Changes for XML2HTMLPlugin.php: 7 added lines, 27 removed lines. Original line number Diff line number Diff line Loading @@ -244,55 +244,35 @@ class XML2HTMLPlugin extends GenericPlugin $zipPath = $filesDir . $path; $zipPathParts = pathinfo($zipPath); if (file_exists($zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'])) { return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; } if ($zip->open($zipPath) === TRUE) { $nbFiles = $zip->numFiles; if ($nbFiles > 0) { //a zipped file if ($nbFiles == 1 && str_ends_with($zip->getNameIndex(0), '.xml')) { if ($nbFiles > 0 && !str_ends_with($zip->getNameIndex(0), '/')) { $basePath = $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'] . '/'; $zip->extractTo($basePath); rename( $basePath . $zip->getNameIndex(0), $basePath . $zipPathParts['filename'] . '.xml' ); return $basePath . $zipPathParts['filename'] . '.xml'; } //a zipped folder else if (str_ends_with($zip->getNameIndex(0), '/')) { $archiveFolderName = $zip->getNameIndex(0); //gets root folder name $zip->extractTo($zipPathParts['dirname']); rename( $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $archiveFolderName, $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename']); $zip->close(); $files = scandir($zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename']); foreach ($files as $file) { $extension = $fileManager->parseFileExtension($file); if ($extension == 'xml') { $basePath = $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'] . '/'; rename( $basePath . $file, $basePath . $zipPathParts['filename'] . '.xml' ); return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; return $basePath . $zipPathParts['filename'] . '.xml'; } } } else { throw new \Exception("Bad zip Submission file."); } } else { throw new \Exception("Bad zip Submission file."); } } else { return NULL; } } else return NULL; } Loading deploy-pp.shdeleted 100755 → 0 +0 −13 Changes for deploy-pp.sh: 0 added lines, 13 removed lines. Original line number Diff line number Diff line #!/bin/bash HOST=lpdn-pp.unicaen.fr rm -rf dist mkdir dist cp -r *.php *.xsl README.md resources templates version.xml dist/ read -p "Username: " USER scp -r dist $USER@$HOST:~ ssh $USER@$HOST sudo rm -rf /opt/ojs-3.3.0-10/plugins/generic/xml2html ssh $USER@$HOST sudo mv dist /opt/ojs-3.3.0-10/plugins/generic/xml2html Loading
XML2HTMLPlugin.php +7 −27 Changes for XML2HTMLPlugin.php: 7 added lines, 27 removed lines. Original line number Diff line number Diff line Loading @@ -244,55 +244,35 @@ class XML2HTMLPlugin extends GenericPlugin $zipPath = $filesDir . $path; $zipPathParts = pathinfo($zipPath); if (file_exists($zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'])) { return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; } if ($zip->open($zipPath) === TRUE) { $nbFiles = $zip->numFiles; if ($nbFiles > 0) { //a zipped file if ($nbFiles == 1 && str_ends_with($zip->getNameIndex(0), '.xml')) { if ($nbFiles > 0 && !str_ends_with($zip->getNameIndex(0), '/')) { $basePath = $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'] . '/'; $zip->extractTo($basePath); rename( $basePath . $zip->getNameIndex(0), $basePath . $zipPathParts['filename'] . '.xml' ); return $basePath . $zipPathParts['filename'] . '.xml'; } //a zipped folder else if (str_ends_with($zip->getNameIndex(0), '/')) { $archiveFolderName = $zip->getNameIndex(0); //gets root folder name $zip->extractTo($zipPathParts['dirname']); rename( $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $archiveFolderName, $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename']); $zip->close(); $files = scandir($zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename']); foreach ($files as $file) { $extension = $fileManager->parseFileExtension($file); if ($extension == 'xml') { $basePath = $zipPathParts['dirname'] . DIRECTORY_SEPARATOR . $zipPathParts['filename'] . '/'; rename( $basePath . $file, $basePath . $zipPathParts['filename'] . '.xml' ); return $filesDir . $fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . DIRECTORY_SEPARATOR . $fileInfo['filename'] . '.xml'; return $basePath . $zipPathParts['filename'] . '.xml'; } } } else { throw new \Exception("Bad zip Submission file."); } } else { throw new \Exception("Bad zip Submission file."); } } else { return NULL; } } else return NULL; } Loading
deploy-pp.shdeleted 100755 → 0 +0 −13 Changes for deploy-pp.sh: 0 added lines, 13 removed lines. Original line number Diff line number Diff line #!/bin/bash HOST=lpdn-pp.unicaen.fr rm -rf dist mkdir dist cp -r *.php *.xsl README.md resources templates version.xml dist/ read -p "Username: " USER scp -r dist $USER@$HOST:~ ssh $USER@$HOST sudo rm -rf /opt/ojs-3.3.0-10/plugins/generic/xml2html ssh $USER@$HOST sudo mv dist /opt/ojs-3.3.0-10/plugins/generic/xml2html