093 sécurise la mise à jour de la couverture de la galerie

This commit is contained in:
Fred Tempez 2020-05-16 21:39:29 +02:00
parent 54ef6d95dd
commit 85423bbf2c

View File

@ -1264,12 +1264,13 @@ class common {
} }
// Image de couverture // Image de couverture
if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) { if ( $this->getdata(['module',$parent,$galleryKey,'config','homePicture']) === NULL) {
$iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory'])); if (is_dir($this->getdata(['module',$parent,$galleryKey,'config','directory']))) {
foreach($iterator as $fileInfos) { $iterator = new DirectoryIterator($this->getdata(['module',$parent,$galleryKey,'config','directory']));
if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { foreach($iterator as $fileInfos) {
$this->setdata(['module',$parent,$galleryKey,'config','homePicture',$fileInfos->getFilename()]); if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) {
break; $this->setdata(['module',$parent,$galleryKey,'config','homePicture',$fileInfos->getFilename()]);
break;
}
} }
} }
} }