File: genfiles.php

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (68 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

function chmod_R($path, $filemode) {
   if (!is_dir($path))
       return chmod($path, $filemode);

   $dh = opendir($path);
   while ($file = readdir($dh)) {
       if($file != '.' && $file != '..') {
           $fullpath = $path.'/'.$file;
           if(!is_dir($fullpath)) {
             if (!chmod($fullpath, $filemode))
                 return FALSE;
           } else {
             if (!chmod_R($fullpath, $filemode))
                 return FALSE;
           }
       }
   }

   closedir($dh);

   if(chmod($path, $filemode))
     return TRUE;
   else
     return FALSE;
}

function recurse_chown_chgrp($mypath, $uid, $gid)
{
	$d = opendir ($mypath);
	while(($file = readdir($d)) !== false) {
		if ($file != "." && $file != "..") {

			$typepath = $mypath . "/" . $file ;

			//print $typepath. " : " . filetype ($typepath). "<BR>" ;
			if (filetype ($typepath) == 'dir') {
				recurse_chown_chgrp ($typepath, $uid, $gid);
			}
			if (is_numeric($uid))
			{
				chown($typepath, intval($uid));
			} else {
				chown($typepath, $uid);
			}
			if (is_numeric($gid))
			{
				chgrp($typepath, intval($gid));
			}  else {
				chgrp($typepath, $gid);
			}
		}
	}
}

// require("genfiles/gen_perso_vhost.php");
require("genfiles/gen_pro_vhost.php");
require("genfiles/gen_email_account.php");
require("genfiles/gen_named_files.php");
require("genfiles/gen_backup_script.php");
require("genfiles/gen_webalizer_stat.php");
require("genfiles/gen_ssh_account.php");
require("genfiles/gen_nagios.php");
require("genfiles/gen_fetchmail.php");
require("genfiles/gen_user_cron.php");

?>