[Jaws-commits] r13490 - trunk/jaws/html/include/Jaws

afz at jaws-project.com afz at jaws-project.com
Mon Aug 20 12:10:54 UTC 2012


Author: afz
Date: 2012-08-20 12:10:54 +0000 (Mon, 20 Aug 2012)
New Revision: 13490

Modified:
   trunk/jaws/html/include/Jaws/Utils.php
Log:
[Jaws_Utils]: changed is_writable method, for more compatible with safe_mode and disabled_functions

Modified: trunk/jaws/html/include/Jaws/Utils.php
===================================================================
--- trunk/jaws/html/include/Jaws/Utils.php	2012-08-20 12:10:27 UTC (rev 13489)
+++ trunk/jaws/html/include/Jaws/Utils.php	2012-08-20 12:10:54 UTC (rev 13490)
@@ -145,27 +145,28 @@
     function is_writable($path)
     {
         clearstatcache();
+        $path = rtrim($path, "\\/");
         if (!file_exists($path)) {
             return false;
         }
 
         /* Take care of the safe mode limitations if safe_mode=1 */
         if (ini_get('safe_mode')) {
-            /* GID check */
-            if (ini_get('safe_mode_gid')) {
-                if (@filegroup($path) == getmygid()) {
-                    return (@fileperms($path) & 0020) ? is_writeable($path) : false;
+            if (is_dir($path)) {
+                $tmpdir = $path.'/'. uniqid(mt_rand());
+                if (!Jaws_Utils::mkdir($tmpdir)) {
+                    return false;
                 }
+                return Jaws_Utils::delete($tmpdir);
             } else {
-                if (@fileowner($path) == @getmyuid()) {
-                    return (@fileperms($path) & 0200) ? is_writeable($path) : false;
+                if (false === $file = @fopen($pat, 'r+')) {
+                    return false;
                 }
+                return fclose($file);
             }
-        } else {
-            return is_writeable($path);
         }
 
-        return false;
+        return is_writeable($path);
     }
 
     /**



More information about the Jaws-commits mailing list