forked from causefx/Organizr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.php
executable file
·152 lines (148 loc) · 5.53 KB
/
check.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
if (file_exists('config/config.php')) {
require_once("user.php");
$db = DATABASE_LOCATION.'users.db';
$folder = USER_HOME;
$USER = new User("registration_callback");
qualifyUser("admin", true);
}
function check($extension) {
if (extension_loaded($extension)) {
echo '<div class="col-lg-2">';
echo '<div class="panel panel-success">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $extension . '</h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo 'Installed';
echo '</div></div></div>';
}else{
echo '<div class="col-lg-2">';
echo '<div class="panel panel-danger">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $extension . '</h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo 'Missing';
echo '</div></div></div>';
}
}
function checkFunction($function) {
if (function_exists($function)) {
echo '<div class="col-lg-2">';
echo '<div class="panel panel-success">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $function . '</h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo 'Installed';
echo '</div></div></div>';
}else{
echo '<div class="col-lg-2">';
echo '<div class="panel panel-danger">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $function . '</h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo 'Missing';
echo '</div></div></div>';
}
}
function getFilePermission($file) {
if (file_exists($file)) {
$length = strlen(decoct(fileperms($file)))-3;
if($file{strlen($file)-1}=='/') {
$name = "Folder";
}else{
$name = "File";
}
if (is_writable($file)) {
echo '<div class="col-lg-6">';
echo '<div class="panel panel-success">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $file . '<permissions style="float: right;">Permissions: ' . substr(decoct(fileperms($file)),$length) . '</permissions></h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo $file . ' is writable!';
echo '</div></div></div>';
}else{
echo '<div class="col-lg-6">';
echo '<div class="panel panel-danger">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">'. $file . '</h3>';
echo '</div>';
echo '<div style="color: gray" class="panel-body">';
echo $file . ' is NOT writable! Please change the permissions to make it writtable by the PHP User.';
echo '</div></div></div>';
}
}
}
?>
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="msapplication-tap-highlight" content="no" />
<title>Requirement Checker</title>
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script>
<script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script>
</head>
<body id="body-check" class="gray-bg" style="padding: 0;">
<div id="main-wrapper" class="main-wrapper">
<!--Content-->
<div id="content" style="margin:0 20px; overflow:hidden">
<h1><center>Check Requirements & Permissions</center></h1>
<div class="row">
<?php
check("PDO_SQLITE");
check("PDO");
check("SQLITE3");
check("Zip");
check("cURL");
check("openssl");
check("session");
check("simplexml");
check("json");
checkFunction("hash");
checkFunction("fopen");
checkFunction("fsockopen");
checkFunction("ob_start");
checkFunction("ob_get_contents");
checkFunction("ob_end_flush");
checkFunction("fwrite");
checkFunction("fclose");
checkFunction("readfile");
?>
</div>
<div class="row">
<?php
@getFilePermission($db);
@getFilePermission($folder);
getFilePermission((__DIR__));
getFilePermission(dirname(__DIR__));
echo '</div>';
//PHPINFO
echo '<div class="panel panel-success">';
echo '<div class="panel-heading">';
echo '<h3 class="panel-title">PHP Info</h3>';
echo '</div>';
echo '<div style="color: black" class="panel-body">';
echo phpinfo();
echo '</div></div>';
?>
</div>
</div>
<script>
$("body").niceScroll({
railpadding: {top:0,right:10,left:0,bottom:0},
scrollspeed: 30,
mousescrollstep: 60
});
</script>
</body>
</html>