diff --git a/admin/modify_ads.php b/admin/modify_ads.php index 8c6080d..7ee5362 100644 --- a/admin/modify_ads.php +++ b/admin/modify_ads.php @@ -45,13 +45,19 @@ function index() $photo_thumb_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/thumbs'; $photo_resized_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/midsize'; if (!is_dir($photo_dir)) { - mkdir($photo_dir); + if (!mkdir($photo_dir) && !is_dir($photo_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_dir)); + } } if (!is_dir($photo_thumb_dir)) { - mkdir($photo_thumb_dir); + if (!mkdir($photo_thumb_dir) && !is_dir($photo_thumb_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_thumb_dir)); + } } if (!is_dir($photo_resized_dir)) { - mkdir($photo_resized_dir); + if (!mkdir($photo_resized_dir) && !is_dir($photo_resized_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_resized_dir)); + } } if (!is_writable($photo_dir) || !is_readable($photo_dir)) { echo "
" . _AM_ADSLIGHT_CHECKER . '
'; diff --git a/admin/validate_ads.php b/admin/validate_ads.php index 0e765d0..e846424 100644 --- a/admin/validate_ads.php +++ b/admin/validate_ads.php @@ -47,13 +47,19 @@ function index() $photo_thumb_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/thumbs'; $photo_resized_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/midsize'; if (!is_dir($photo_dir)) { - mkdir($photo_dir); + if (!mkdir($photo_dir) && !is_dir($photo_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_dir)); + } } if (!is_dir($photo_thumb_dir)) { - mkdir($photo_thumb_dir); + if (!mkdir($photo_thumb_dir) && !is_dir($photo_thumb_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_thumb_dir)); + } } if (!is_dir($photo_resized_dir)) { - mkdir($photo_resized_dir); + if (!mkdir($photo_resized_dir) && !is_dir($photo_resized_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_resized_dir)); + } } if (!is_writable($photo_dir) || !is_readable($photo_dir)) { echo "
" . _AM_ADSLIGHT_CHECKER . '
'; diff --git a/admin/view_ads.php b/admin/view_ads.php index 5d72c26..755e077 100644 --- a/admin/view_ads.php +++ b/admin/view_ads.php @@ -44,13 +44,19 @@ function index() $photo_thumb_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/thumbs'; $photo_resized_dir = $GLOBALS['xoopsModuleConfig']['adslight_path_upload'] . '/midsize'; if (!is_dir($photo_dir)) { - mkdir($photo_dir); + if (!mkdir($photo_dir) && !is_dir($photo_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_dir)); + } } if (!is_dir($photo_thumb_dir)) { - mkdir($photo_thumb_dir); + if (!mkdir($photo_thumb_dir) && !is_dir($photo_thumb_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_thumb_dir)); + } } if (!is_dir($photo_resized_dir)) { - mkdir($photo_resized_dir); + if (!mkdir($photo_resized_dir) && !is_dir($photo_resized_dir)) { + throw new \RuntimeException(sprintf('Directory "%s" was not created', $photo_resized_dir)); + } } if (!is_writable($photo_dir) || !is_readable($photo_dir)) { echo "
" . _AM_ADSLIGHT_CHECKER . '
';