-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsystem_check.php
More file actions
219 lines (205 loc) · 5.68 KB
/
Copy pathsystem_check.php
File metadata and controls
219 lines (205 loc) · 5.68 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
ini_set("memory_limit","256M");
$exif = "No";
$gd = "No";
$update = "No";
$sqlite = "No";
$database = "No";
$cache_dir = "No";
$db_table_result = "successfully created the database and tables!";
if (function_exists('exif_read_data')) $exif = "Yes";
if (extension_loaded('sqlite')) $sqlite = "Yes";
if (extension_loaded('gd') && function_exists('gd_info')) $gd = "Yes";
if (ini_get("allow_url_fopen") == 1) $update = "Yes";
if (!is_dir('cache') && is_writable(".")) {
mkdir('cache',0700);
$cache_dir = "Yes";
} elseif (is_writable("cache")){
$cache_dir = "Yes";
}
if($sqlite == "Yes") {
if(file_exists("minigal.sqlite")) {
if(is_writable("minigal.sqlite")) {
$db_table_result = "Database already set up!";
$database = "Yes";
} else
$db_table_result = "Database is not writeable!";
} else {
$db = NULL;
try {
$db = new PDO('sqlite:minigal.sqlite');
} catch (PDOException $e) {}
if (!$db) {
$create_error = TRUE;
} else {
$database = "Yes";
$query = $db->query("CREATE TABLE pictures(id INTEGER PRIMARY KEY, path LONGTEXT, name CHAR(256), isfile BOOLEAN, isPicture BOOLEAN, extension VARCHAR(5), size MEDIUMINT(9), date DATETIME, gps_lat NUMERIC, gps_lon NUMERIC)");
$query2 = $db->query("CREATE VIRTUAL TABLE exif USING FTS3(id INTEGER, words MEDIUMTEXT, FOREIGN KEY(id) REFERENCES pictures(id))");
$query3 = $db->query("CREATE TABLE users(id INTEGER PRIMARY KEY, username CHAR(256), password VARCHAR(40))");
$sql = <<<EOT
CREATE TRIGGER rec_delete
BEFORE DELETE ON pictures
FOR EACH ROW BEGIN
delete from exif where id = OLD.id;
END;
EOT;
$query5 = $db->query($sql);
$username = "admin";
$password = sha1("admin");
$query4 = $db->query("INSERT INTO users (username, password) VALUES ('$username', '$password')");
if (!$query || !$query2 || !$query4 || !$query3 || !$query5) {
$db_table_result = "ERROR: Failed during database query! (syntax error?). ".implode(", ", $db->errorInfo());
$database = "No";
unlink("minigal.sqlite");
}
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="robots" content="noindex, nofollow">
<title>MiniGal Nano system check</title>
<style type="text/css">
body {
background-color: #daddd8;
font: 12px Arial, Tahoma, "Times New Roman", serif;
}
h1 {
font-size: 30px;
margin: 20px 0 5px 0;
letter-spacing: -2px;
}
div {
line-height: 20px;
}
.left {
width: 300px;
display: inline-table;
background-color: #fdffbe;
padding: 2px;
}
.middle-neutral {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #fdffbe;
padding: 2px;
}
.middle-no {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #ff8181;
padding: 2px;
}
.middle-yes {
font-weight: bold;
text-align: center;
width: 100px;
display: inline-table;
background-color: #98ffad;
padding: 2px;
}
.right {
width: 600px;
display: inline-table;
background-color: #eaf1ea;
padding: 2px;
}
</style>
<body>
<h1>MiniGal Nano system check</h1>
<div class="left">
PHP Version
</div>
<div class="<?php if(version_compare(phpversion(), "4.0", '>')) echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo phpversion(); ?>
</div>
<div class="right">
<a href="http://www.php.net/" target="_blank">PHP</a> scripting language version 4.0 or greater is needed
</div>
<br />
<div class="left">
GD library support
</div>
<div class="<?php if($gd == "Yes") echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo $gd; ?>
</div>
<div class="right">
<a href="http://www.boutell.com/gd/" target="_blank">GD image manipulation</a> library is used to create output. Bundled since PHP 4.3
</div>
<br />
<div class="left">
EXIF support
</div>
<div class="<?php if($exif == "Yes") echo 'middle-yes'; else echo 'middle-neutral' ?>">
<?php echo $exif; ?>
</div>
<div class="right">
Ability to extract and display <a href="http://en.wikipedia.org/wiki/Exif" target="_blank">EXIF information</a>. The script will work without it, but not display image information
</div>
<br />
<div class="left">
SQLite support
</div>
<div class="<?php if($sqlite == "Yes") echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo $sqlite; ?>
</div>
<div class="right">
SQLite database support
</div>
<br />
<div class="left">
SQLite table created
</div>
<div class="<?php if($database == "Yes") echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo $database; ?>
</div>
<div class="right">
<?php
if(isset($create_error))
echo (file_exists("minigal.sqlite")) ? "Impossible to open, check permissions" : "Impossible to create, check permissions";
else
echo $db_table_result;
?>
</div>
<br />
<div class="left">
Thumbnail Cache directory
</div>
<div class="<?php if($cache_dir == "Yes") echo 'middle-yes'; else echo 'middle-no' ?>">
<?php echo $cache_dir; ?>
</div>
<div class="right">
Cache directory for storing output. Must be writeable! ( ./cache )
</div>
<br />
<div class="left">
PHP memory limit
</div>
<div class="middle-neutral">
<?php echo ini_get("memory_limit"); ?>
</div>
<div class="right">
Memory is needed to create output. Bigger images uses more memory
</div>
<br />
<div class="left">
New version check
</div>
<div class="middle-neutral">
<?php echo $update ?>
</div>
<div class="right">
The ability to check for new version and display this automatically. The script will work without it
</div>
<br /><br />
<a href="http://www.minigal.dk/minigal-nano.html" target="_blank">Support website</a>
| <a href="http://www.minigal.dk/forum" target="_blank">Support forum</a>
</body>
</html>