File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed
Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -1781,6 +1781,12 @@ public function getArchive()
17811781 $ app = Factory::getApplication ();
17821782 $ path = $ this ->getBasePath () . base64_decode ($ app ->getInput ()->get ('file ' ));
17831783
1784+ // Check if the ZipArchive class exists
1785+ if (!class_exists ('ZipArchive ' )) {
1786+ $ app ->enqueueMessage (Text::_ ('COM_TEMPLATES_ERROR_ZIPARCHIVE_NOT_ENABLED ' ), 'error ' );
1787+ return false ;
1788+ }
1789+
17841790 if (file_exists (Path::clean ($ path ))) {
17851791 $ files = [];
17861792 $ zip = new \ZipArchive ();
Original file line number Diff line number Diff line change 173173 <legend><?php echo Text::_ ('COM_TEMPLATES_FILE_CONTENT_PREVIEW ' ); ?> </legend>
174174 <form action="<?php echo Route::_ ('index.php?option=com_templates&view=template&id= ' . $ input ->getInt ('id ' ) . '&file= ' . $ this ->file . '&isMedia= ' . $ input ->get ('isMedia ' , 0 )); ?> " method="post" name="adminForm" id="adminForm">
175175 <ul class="nav flex-column well">
176- <?php foreach ($ this ->archive as $ file ) : ?>
177- <li>
178- <?php if (substr ($ file , -1 ) === DIRECTORY_SEPARATOR ) : ?>
179- <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $ file ; ?>
180- <?php endif ; ?>
181- <?php if (substr ($ file , -1 ) != DIRECTORY_SEPARATOR ) : ?>
182- <span class="icon-file icon-fw" aria-hidden="true"></span> <?php echo $ file ; ?>
183- <?php endif ; ?>
184- </li>
185- <?php endforeach ; ?>
176+ <?php if (!empty ($ this ->archive ) && is_array ($ this ->archive )) : ?>
177+ <?php foreach ($ this ->archive as $ file ) : ?>
178+ <li>
179+ <?php if (substr ($ file , -1 ) === DIRECTORY_SEPARATOR ) : ?>
180+ <span class="icon-folder icon-fw" aria-hidden="true"></span> <?php echo $ file ; ?>
181+ <?php endif ; ?>
182+ <?php if (substr ($ file , -1 ) != DIRECTORY_SEPARATOR ) : ?>
183+ <span class="icon-file icon-fw" aria-hidden="true"></span> <?php echo $ file ; ?>
184+ <?php endif ; ?>
185+ </li>
186+ <?php endforeach ; ?>
187+ <?php endif ; ?>
186188 </ul>
187189 <input type="hidden" name="task" value="">
188190 <?php echo HTMLHelper::_ ('form.token ' ); ?>
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ COM_TEMPLATES_ERROR_WARNFILENAME="Invalid file name. Please correct the name of
9191COM_TEMPLATES_ERROR_WARNFILETOOLARGE =" This file is too large to upload."
9292COM_TEMPLATES_ERROR_WARNFILETYPE =" File format not supported."
9393COM_TEMPLATES_ERROR_WARNIEXSS =" Can't be uploaded. Has XSS."
94+ COM_TEMPLATES_ERROR_ZIPARCHIVE_NOT_ENABLED =" The PHP ZipArchive extension is not enabled."
9495COM_TEMPLATES_ERR_XML =" Template XML data not available"
9596COM_TEMPLATES_FIELD_CLIENT_LABEL =" Location"
9697COM_TEMPLATES_FIELD_HOME_LABEL =" Default"
You can’t perform that action at this time.
0 commit comments