/** * Check if directory exists. If it does not, attempt to create it. * */ function check_and_set($directory) { if (@file_exists($directory)) { if (@is__writable($directory)) { return "ok"; } else { if (@chmod($directory, 0777)) { return "ok"; } else { return "chmod"; } } } else { if (@mkdir($directory)) { return check_and_set($directory); } else { return "create"; } } }
$result['image_chmod'] = $lang_writable_no; } else { $passed['image_write'] = true; $result['image_chmod'] = $lang_writable; } if ($images == "create") { $result['image_create'] = $lang_not_found; } else { $passed['image_found'] = true; $result['image_create'] = $lang_found; } /** * Check if thumbnails/ directory exist and is writable * */ $thumbs = check_and_set("../thumbnails/"); if ($thumbs == "chmod" || $thumbs == "create") { $result['thumb_chmod'] = $lang_writable_no; } else { $passed['thumb_write'] = true; $result['thumb_chmod'] = $lang_writable; } if ($thumbs == "create") { $result['thumb_create'] = $lang_not_found; } else { $passed['thumb_found'] = true; $result['thumb_create'] = $lang_found; } /** * Apply correct class name *