Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xml2html-pkp-plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FNSO
FAIREST
xml2html-pkp-plugin
Commits
8bccb61c
Commit
8bccb61c
authored
Jan 3, 2023
by
Jerome Chauveau
Browse files
Options
Downloads
Patches
Plain Diff
image file extension check bugfix
parent
83884c9d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+1
-0
1 addition, 0 deletions
README.md
XML2HTMLPlugin.php
+5
-8
5 additions, 8 deletions
XML2HTMLPlugin.php
with
6 additions
and
8 deletions
README.md
+
1
−
0
View file @
8bccb61c
...
@@ -33,4 +33,5 @@ Dans le second cas :
...
@@ -33,4 +33,5 @@ Dans le second cas :
-
l'archive est dézippée dans le dossier du zip
-
l'archive est dézippée dans le dossier du zip
-
le dossier décompressé est renommé avec l'id unique généré par ojs
-
le dossier décompressé est renommé avec l'id unique généré par ojs
-
le fichier xml est rennomé avec ce même identifiant :
`[id]/[id].xml`
-
le fichier xml est rennomé avec ce même identifiant :
`[id]/[id].xml`
-
les urls des images sont de la forme [idarticle]/zimage/[nom_image].[extension]
This diff is collapsed.
Click to expand it.
XML2HTMLPlugin.php
+
5
−
8
View file @
8bccb61c
...
@@ -161,7 +161,6 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -161,7 +161,6 @@ class XML2HTMLPlugin extends GenericPlugin
//$submission = $request->getContext(ASSOC_TYPE_SUBMISSION);
//$submission = $request->getContext(ASSOC_TYPE_SUBMISSION);
/**@var $submissionFile SubmissionFile**/
/**@var $submissionFile SubmissionFile**/
$submissionFile
=
$params
[
0
];
$submissionFile
=
$params
[
0
];
//var_dump($request);
$path
=
$submissionFile
->
getData
(
'path'
);
$path
=
$submissionFile
->
getData
(
'path'
);
$fileManager
=
new
FileManager
();
$fileManager
=
new
FileManager
();
$submissionFileExtension
=
$fileManager
->
parseFileExtension
(
$path
);
$submissionFileExtension
=
$fileManager
->
parseFileExtension
(
$path
);
...
@@ -174,9 +173,7 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -174,9 +173,7 @@ class XML2HTMLPlugin extends GenericPlugin
$zipPathParts
=
pathinfo
(
$zipPath
);
$zipPathParts
=
pathinfo
(
$zipPath
);
$archiveFolderName
=
NULL
;
$archiveFolderName
=
NULL
;
if
(
$zip
->
numFiles
>
0
)
{
//gets zip top folder name
if
(
$zip
->
numFiles
>
0
)
{
//gets zip top folder name
$fileName
=
$zip
->
getNameIndex
(
0
);
$archiveFolderName
=
$zip
->
getNameIndex
(
0
);
$fileInfo
=
pathinfo
(
$fileName
);
$archiveFolderName
=
$fileInfo
[
"dirname"
];
}
}
else
{
else
{
throw
new
\Exception
(
"Bad zip Submission file."
);
throw
new
\Exception
(
"Bad zip Submission file."
);
...
@@ -197,8 +194,7 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -197,8 +194,7 @@ class XML2HTMLPlugin extends GenericPlugin
$basePath
.
$zipPathParts
[
'filename'
]
.
'.xml'
$basePath
.
$zipPathParts
[
'filename'
]
.
'.xml'
);
);
}
}
//var_dump($file);
//var_dump($extension);
//$submissionDir = Services::get('submissionFile')->getSubmissionDir($request->getContext()->getId(), $submission->getId());
//$submissionDir = Services::get('submissionFile')->getSubmissionDir($request->getContext()->getId(), $submission->getId());
}
}
...
@@ -290,8 +286,9 @@ class XML2HTMLPlugin extends GenericPlugin
...
@@ -290,8 +286,9 @@ class XML2HTMLPlugin extends GenericPlugin
$extractedZipPath
=
$pathInfo
[
'dirname'
];
$extractedZipPath
=
$pathInfo
[
'dirname'
];
$files
=
scandir
(
$extractedZipPath
);
$files
=
scandir
(
$extractedZipPath
);
foreach
(
$files
as
$file
){
foreach
(
$files
as
$file
){
$mt
=
mime_content_type
(
$file
);
$info
=
pathinfo
(
$file
);
if
(
$mt
==
'image/jpeg'
||
$mt
==
'image/png'
){
if
(
$info
[
"extension"
]
==
'jpg'
||
$info
[
"extension"
]
==
'png'
){
$request
=
$this
->
getRequest
();
$request
=
$this
->
getRequest
();
$filePath
=
$request
->
url
(
$filePath
=
$request
->
url
(
null
,
'article'
,
null
,
'article'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment