forked from Project-Pier/ProjectPier-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.php
95 lines (87 loc) · 3.63 KB
/
help.php
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
echo '<xmp>';
function check_directory($d) {
echo "\nDirectory $d\n";
echo '1.' . ( file_exists($d) ? ' exists' : ' does NOT exist' ) . " \n";
if (!file_exists($d)) {
echo 'Remaining checks skipped' . " \n";
return;
}
echo '2. is' . ( is_dir($d) ? '' : ' NOT' ) . " a directory\n";
echo '3. is' . ( is_readable($d) ? '' : ' NOT' ) . " readable\n";
echo '4. is' . ( is_writable($d) ? '' : ' NOT' ) . " writable\n";
echo '5. has permissions ' . substr(sprintf('%o', fileperms($d)), -4) . "\n";
echo '6. owner id ' . fileowner($d) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_geteuid')) {
$details = posix_getpwuid( posix_geteuid() );
echo '6. owner name ' . $details['name'] . " \n";
echo '6. owner gid ' . $details['gid'] . " \n";
$details = posix_getgrgid( $details['gid'] );
echo '6. group name ' . $details['name'] . " \n";
}
echo '7. group id ' . filegroup($d) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_getegid')) {
$details = posix_getgrgid( posix_getegid() );
echo '7. group name ' . $details['name'] . " \n";
}
}
function check_file($f) {
echo "\nFile $f\n";
echo '1.' . ( file_exists($f) ? ' exists' : ' does NOT exist' ) . " \n";
if (!file_exists($f)) {
echo 'Remaining checks skipped' . " \n";
return;
}
echo '2. is' . ( is_file($f) ? '' : ' NOT' ) . " a file\n";
echo '3. is' . ( is_readable($f) ? '' : ' NOT' ) . " readable\n";
echo '4. is' . ( is_writable($f) ? '' : ' NOT' ) . " writable\n";
echo '5. has permissions ' . substr(sprintf('%o', fileperms($f)), -4) . "\n";
echo '6. owner id ' . fileowner($f) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_geteuid')) {
$details = posix_getpwuid( posix_geteuid() );
echo '6. owner name ' . $details['name'] . " \n";
echo '6. owner gid ' . $details['gid'] . " \n";
$details = posix_getgrgid( $details['gid'] );
echo '6. group name ' . $details['name'] . " \n";
}
echo '7. group id ' . filegroup($f) . " (0 on Windows, blank if not permitted)\n";
if (function_exists('posix_getegid')) {
$details = posix_getgrgid( posix_getegid() );
echo '7. group name ' . $details['name'] . " \n";
}
}
if (function_exists('posix_getuid')) {
echo 'A. user id ' . posix_getuid() . " \n";
} else {
echo 'A. user id ' . 'NOT available' . " \n";
}
if (function_exists('get_current_user')) {
echo 'B. running user ' . get_current_user() . " \n";
} else {
echo 'B. running user ' . 'NOT available' . " \n";
}
if (function_exists('getmyuid')) {
echo 'C. script owner ' . getmyuid() . " \n";
} else {
echo 'C. script owner ' . 'NOT available' . " \n";
}
define('ROOT', dirname(__FILE__));
define('APPLICATION_PATH', ROOT . '/application');
define('LIBRARY_PATH', ROOT . '/library');
define('FILES_DIR', ROOT . '/upload'); // place where we will upload project files
define('CACHE_DIR', ROOT . '/cache');
define('THEMES_DIR', ROOT . '/public/assets/themes');
define('PLUGINS_DIR', APPLICATION_PATH . '/plugins');
check_directory( ROOT );
check_directory( APPLICATION_PATH );
check_directory( LIBRARY_PATH );
check_directory( FILES_DIR );
check_directory( CACHE_DIR );
check_directory( PLUGINS_DIR );
check_directory( ROOT . '/config' );
check_directory( ROOT . '/public' );
check_file( ROOT . '/config/config.php' );
check_file( ROOT . '/cache/autoloader.php' );
check_file( ROOT . '/cache/trace.txt' );
check_file( ROOT . '/cache/log.php' );
?>