diff --git a/index.php b/index.php
old mode 100644
new mode 100755
index eceef16..0408ab0
--- a/index.php
+++ b/index.php
@@ -123,8 +123,13 @@ function readEXIF($file)
function checkpermissions($file)
{
global $messages;
- if (substr(decoct(fileperms($file)), -1, strlen(fileperms($file))) < 4 OR substr(decoct(fileperms($file)), -3, 1) < 4)
- $messages = "At least one file or folder has wrong permissions. Learn how to set file permissions";
+
+ if (!is_readable($file)) {
+ $messages = "At least one file or folder has wrong permissions. "
+ . "Learn how to "
+ . "set file permissions";
+ }
}
if (!defined("GALLERY_ROOT"))