Author: uncleringo
Date: 2010-03-11 12:32:06 +0100 (Thu, 11 Mar 2010)
New Revision: 28480

Modified:
   plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
Log:
Fixed permissions checks for importing images from data/images dir



Modified: plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php
===================================================================
--- plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php        
2010-03-11 11:30:19 UTC (rev 28479)
+++ plugins/sfDoctrineJCroppablePlugin/trunk/lib/doctrine/JCroppable.php        
2010-03-11 11:32:06 UTC (rev 28480)
@@ -269,14 +269,14 @@
       if (!sfContext::hasInstance() && file_exists('data/images/' . $editable))
       {
         print('Found data/images/' . $editable . "... ");
-        if (is_writable('data/images/' . $to))
+        if (is_writable($dir) && (!file_exists($to) || is_writable($to)))
         {
           copy('data/images/' . $editable, $to);
           print("copied\n");
         }
         else
         {
-          print("Don't have permission to copy\n");
+          print("Don't have permission to copy to $to\n");
         }
       }
       /**
@@ -299,8 +299,9 @@
     /**
      * Check we have permission to save the images
      */
-    if (!is_writable($dir . DIRECTORY_SEPARATOR . $editable)
-          || !is_writable($dir . DIRECTORY_SEPARATOR . $original))
+    if (!is_writable($dir)
+          || (file_exists($dir . DIRECTORY_SEPARATOR . $editable) && 
!is_writable($dir . DIRECTORY_SEPARATOR . $editable))
+          || (file_exists($dir . DIRECTORY_SEPARATOR . $original) && 
!is_writable($dir . DIRECTORY_SEPARATOR . $original)))
     {
       if (sfContext::hasInstance())
       {
@@ -308,7 +309,7 @@
         " . $dir . DIRECTORY_SEPARATOR . $editable . "
         " . $dir . DIRECTORY_SEPARATOR . $original);
       }
-      
+      print("damn\n");
       return;
     }
     

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to