pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] rev 2297 - trunk/contrib/level_comment_tool


From: address@hidden
Subject: [Pingus-CVS] rev 2297 - trunk/contrib/level_comment_tool
Date: Wed, 21 Apr 2004 20:43:26 +0200

Author: torangan
Date: 2004-04-21 20:43:26 +0200 (Wed, 21 Apr 2004)
New Revision: 2297

Modified:
   trunk/contrib/level_comment_tool/index.php
Log:
handle permissions better


Modified: trunk/contrib/level_comment_tool/index.php
===================================================================
--- trunk/contrib/level_comment_tool/index.php  2004-04-18 20:54:42 UTC (rev 
2296)
+++ trunk/contrib/level_comment_tool/index.php  2004-04-21 18:43:26 UTC (rev 
2297)
@@ -325,14 +325,19 @@
         exit;
       }
 
-      if ( !is_dir("comments/$c/$l") &&
-           (@mkdir("comments/$c", 0775) || True) &&
-           !(@mkdir("comments/$c/$l", 0775)))
+      if ( !is_dir("comments/$c/$l"))
       {
-        print ("<strong>ERROR: 'comments/$c/$l/' does not exist and ".
+        mkdir("comments/$c",0777);
+        mkdir("comments/$c/$l",0777);
+        chmod("comments/$c",0777);
+        chmod("comments/$c/$l",0777);
+        if ( !is_dir("comments/$c/$l"))
+        {
+          print ("<strong>ERROR: 'comments/$c/$l/' does not exist and ".
                "could not be created.</strong>\n");
-        exit;
-      }
+          exit;
+        }
+      }  
       sandbox_check("comments/$c/$l", "comments/" );
       $str =
         '<' . '?xml version="1.0"  encoding="ISO-8859-1"?' . ">\n" .
@@ -362,7 +367,7 @@
           exit;
         }
         fclose($fp);
-        chmod($filename, 0775);
+        chmod($filename, 0777);
 
         // Send email-notification
         if ( $mail_notify_enabled )
@@ -415,16 +420,21 @@
     if ( $_POST["adddemo"] == 1)
     {
       //create directory if necessary
-      if ( !is_dir("comments/$c/$l/demos") &&
-           (@mkdir("comments/$c", 0775) || True) &&
-           (@mkdir("comments/$c/$l", 0775) || True) &&
-           !(@mkdir("comments/$c/$l/demos", 0775)))
+      if ( !is_dir("comments/$c/$l/demos"))
       {
-        print ("<strong>ERROR: 'comments/$c/$l/demos' does not exist and ".
-               "could not be created.</strong>\n");
-        exit;
+        mkdir("comments/$c", 0777);
+        mkdir("comments/$c/$l", 0777);
+        mkdir("comments/$c/$l/demos", 0777);
+        chmod("comments/$c",0777);
+        chmod("comments/$c/$l",0777);
+        chmod("comments/$c/$l/demos",0777);
+        if ( !is_dir("comments/$c/$l/demos")) 
+        {
+          print ("<strong>ERROR: 'comments/$c/$l/demos' does not exist and ".
+                 "could not be created.</strong>\n");
+          exit;
+        }
       }
-      
       $uploaddir = sandbox_check( "comments/$c/$l/demos", "comments/" );
       
       if(!strpos( strtolower( $_FILES["demofile"]["name"] ), ".xml" ))
@@ -433,6 +443,7 @@
       {
         if (move_uploaded_file($_FILES['demofile']['tmp_name'], $uploaddir. 
'/' . $_FILES['demofile']['name']))
         {
+          chmod( "comments/$c/$l/demos/" . $_FILES['demofile']['name'], 0777 );
           print("<strong>File uploaded successfully</strong><hr/>");
           $str = '<' . '?xml version="1.0"  encoding="ISO-8859-1"?' . ">\n" .
                 "<pingus-demo-metafile>\n".
@@ -459,7 +470,7 @@
               exit;
             }
             fclose($fp);
-            chmod($filename, 0775);
+            chmod($filename, 0777);
          }
        }  
         else





reply via email to

[Prev in Thread] Current Thread [Next in Thread]