[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LCT chmod patch (was: Re: Uploading demos to the level comment tool)
From: |
Björn Fischer |
Subject: |
LCT chmod patch (was: Re: Uploading demos to the level comment tool) |
Date: |
Wed, 21 Apr 2004 08:07:07 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 |
David Philippi wrote:
On Mon, Apr 19, 2004 at 09:39:42AM +0200, Björn Fischer wrote:
Humm... I would have thought that all of them would have user/group
apache since they are being created by the PHP script.
The problem with them being user/group apache is, that I can't do anything
with those files other then reading anymore. If I want to delete one, I'd
have to write a script to do it and run it through apache. So it would be
better if the script would set the group to pingus as this would allow
anyone from this group to manually edit/delete files when necessary.
About the problems with uploading themself - I don't know PHP.
Ok, since I don't know how to change the group with PHP I simply changed
the mode of all created files and directories to 0777. The attached
patch achieves this by replacing the old if-structure that used to
create the dirs by a different method. I found that somehow
mkdir("directory", 0777) does not set the rights correctly to 0777.
That's why I put a chmod directly after the creation of the folder(s).
I also attached a file called chmod.php. This will recurse through the
comments folder and chmod all existing files and directories. Simply put
it in the LCT folder and open it with a browser. You should then see the
files and directories that were changed.
I hope this does also help with the demo upload problem.
Greetings
Björn
Index: Pingus/contrib/level_comment_tool/index.php
===================================================================
--- Pingus/contrib/level_comment_tool/index.php (revision 2296)
+++ Pingus/contrib/level_comment_tool/index.php (working copy)
@@ -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
read()))
{
if($FolderOrFile != "." && $FolderOrFile != "..")
{
if(is_dir("$dir/$FolderOrFile"))
{ echo "Moving into folder $dir/$FolderOrFile
";
changemod("$dir/$FolderOrFile");
} // recursive
else
{ echo "chmodding $dir/$FolderOrFile
";
chmod("$dir/$FolderOrFile", 0777);
}
}
}
echo "chmodding $dir
";
//if(rmdir($dir))
if (chmod($dir,0777))
{ $success = true; }
return $success;
}
$folder = dir("comments");
while (false!==($entry = $folder->read()))
{
if ($entry != "." && $entry != "..")
changemod("comments/$entry");
}
?>
- Re: Uploading demos to the level comment tool, (continued)
- Re: Uploading demos to the level comment tool, David Philippi, 2004/04/17
- Re: Uploading demos to the level comment tool, Björn Fischer, 2004/04/17
- Re: Uploading demos to the level comment tool, Jarno Elonen, 2004/04/18
- Re: Uploading demos to the level comment tool, David Philippi, 2004/04/18
- Re: Uploading demos to the level comment tool, Björn Fischer, 2004/04/19
- Re: Uploading demos to the level comment tool, David Philippi, 2004/04/19
- Re: Uploading demos to the level comment tool, Jarno Elonen, 2004/04/20
- Re: Uploading demos to the level comment tool, David Philippi, 2004/04/20
- Re: Uploading demos to the level comment tool, Björn Fischer, 2004/04/21
- LCT chmod patch (was: Re: Uploading demos to the level comment tool),
Björn Fischer <=