Rev Author Line No. Line
228 kaklik 1 <?php
2  
3 /**
4 * This file attempts to recursively make all files in the parent directory
5 * (i.e. the singapore root directory) writable. This will, in general, only
6 * succeed on server-owned content hence making it deletable by FTP users.
7 *
8 * @author Tamlyn Rhodes <tam at zenology dot co dot uk>
9 * @license http://opensource.org/licenses/gpl-license.php GNU General Public License
10 * @copyright (c)2004 Tamlyn Rhodes
11 * @version $Id: cleanup.php,v 1.4 2006/03/02 16:14:03 tamlyn Exp $
12 */
13  
14 /**
15 * Recursively attempts to make all files and directories in $dir writable
16 *
17 * @param string full directory name (must end with /)
18 */
19 function makeWritable($dir)
20 {
21 if (is_dir($dir)) {
22 $d = dir($dir);
23 while (($file = $d->read()) !== false) {
24 //ignore current and parent dirs and php files
25 if ($file == '.' || $file == '..' || substr($file, strlen($file)-4)=='.php') continue;
26 $fullfile = $d->path . $file;
27 if(@chmod($fullfile,0777))
28 echo "Made $fullfile writable.<br />";
29 if (is_dir($fullfile))
30 makeWritable($fullfile."/");
31 }
32 }
33 }
34  
35  
36  
37 ?>
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
39 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
40  
41 <html xmlns="http://www.w3.org/1999/xhtml">
42 <head>
43 <title>cleanup script</title>
44 <link rel="stylesheet" type="text/css" href="tools.css" />
45 </head>
46  
47 <body>
48  
49 <h1>Fixing file permissions</h1>
50  
51 <p><?php
52 //start with parent directory (singapore root)
53 makeWritable("../");
54 ?></p>
55  
56 <p>All done! <a href="index.html">Return</a> to tools.</p>
57  
58 </body>
59 </html>