blob: 1d3404f46ca6afebf1f879c2d0dc741114522de8 (
plain)
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
|
<?php
#===============================================================================
# DEFINE: Administration
#===============================================================================
const ADMINISTRATION = TRUE;
const AUTHENTICATION = TRUE;
#===============================================================================
# INCLUDE: Initialization
#===============================================================================
require '../core/application.php';
#===============================================================================
# Execute database command(s)
#===============================================================================
if(HTTP::issetPOST('command')) {
if(HTTP::issetPOST(['token' => Application::getSecurityToken()])) {
try {
$Statement = $Database->query(HTTP::POST('command'));
do {
$result[] = print_r($Statement->fetchAll(), TRUE);
} while($Statement->nextRowset());
} catch(PDOException $Exception) {
$messages[] = $Exception->getMessage();
}
} else {
$messages[] = $Language->text('error_security_csrf');
}
}
#===============================================================================
# Build document
#===============================================================================
$DatabaseTemplate = Template\Factory::build('database');
$DatabaseTemplate->set('FORM', [
'INFO' => $messages ?? [],
'TOKEN' => Application::getSecurityToken(),
'RESULT' => implode(NULL, $result ?? []),
'COMMAND' => HTTP::POST('command'),
]);
$MainTemplate = Template\Factory::build('main');
$MainTemplate->set('NAME', 'SQL');
$MainTemplate->set('HTML', $DatabaseTemplate);
echo $MainTemplate;
|