Restructure web pages

This commit is contained in:
cytopia 2016-11-15 19:39:11 +01:00
parent bcfb2f6352
commit 086fd5bc50
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
16 changed files with 372 additions and 109 deletions

View File

@ -0,0 +1,19 @@
<?php
require '../config.php';
if (isset($_GET['database'])) {
if (isset($_GET['type']) && $_GET['type'] == 'mysql') {
echo json_encode(array(
'size' => (string)$MySQL->getDBSize($_GET['database']),
'table' => (string)$MySQL->getTableCount($_GET['database'])
));
} else if (isset($_GET['type']) && $_GET['type'] == 'postgres') {
$schema = isset($_GET['schema']) ? $_GET['schema'] : '';
echo json_encode(array(
'size' => (string)$Postgres->getSchemaSize($_GET['database'], $schema),
'table' => (string)$Postgres->getTableCount($_GET['database'], $schema)
));
}
} else if (isset($_GET['vhost'])) {
echo $Docker->PHP_checkVirtualHost($_GET['vhost']);
}

View File

@ -1,10 +0,0 @@
<?php
require '../config.php';
if (isset($_GET['size'])) {
echo $MySQL->getDBSize($_GET['size']);
} elseif (isset($_GET['table'])) {
echo $MySQL->getTableCount($_GET['table']);
} else {
echo '0';
}

View File

@ -1,10 +0,0 @@
<?php
require '../config.php';
if (isset($_GET['valid'])) {
echo $Docker->PHP_checkVirtualHost($_GET['valid']);
exit();
} else {
echo '';
exit();
}

View File

@ -26,6 +26,13 @@ body {
}
/* Generics
-------------------------------------------------- */
.font-small {
font-size: 12px;
}
/* Circle Box
-------------------------------------------------- */
@ -76,7 +83,7 @@ body {
@media (min-width: 801px)
{
.circles > div {padding: 40%;}
.circles > div {padding: 48%;}
}
@ -103,7 +110,7 @@ nav.navbar {
/* mailphp;
/* mail.php;
-------------------------------------------------- */
tr.subject {
cursor: pointer;
@ -111,4 +118,5 @@ tr.subject {
td.break-word {
word-break: break-word;
}
}

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">
@ -56,6 +56,11 @@
</tr>
</thead>
<tbody>
<tr>
<td>Adminer</td>
<td>Apache License 2.0 or GPL 2</td>
<td><i class="fa fa-github-alt" aria-hidden="true"></i> <a href="https://github.com/vrana/adminer">vrana/adminer</a></td>
</tr>
<tr>
<td>Bootstrap</td>
<td>MIT</td>

View File

@ -6,11 +6,11 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">
<h1>Databases</h1>
<h1>MySQL Databases</h1>
<br/>
<br/>
@ -28,13 +28,17 @@
</th>
</thead>
<tbody>
<?php
$len_table = 4;
$len_size = 9;
?>
<?php foreach ($MySQL->getDatabases() as $name => $keys): ?>
<tr>
<td><?php echo $name;?></td>
<td><?php echo $keys['charset'];?></td>
<td><?php echo $keys['collation'];?></td>
<td><code><span class="table" id="table-<?php echo $name;?>">&nbsp;&nbsp;&nbsp;&nbsp;</span></code></td>
<td><code><span class="size" id="size-<?php echo $name;?>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></code></td>
<td><code><span class="table" id="table-<?php echo $name;?>"><?php echo str_repeat('&nbsp;', $len_table);?></span></code></td>
<td><code><span class="size" id="size-<?php echo $name;?>"><?php echo str_repeat('&nbsp;', $len_size);?></span></code></td>
</tr>
<input type="hidden" name="database[]" class="database" value="<?php echo $name;?>" />
<?php endforeach; ?>
@ -53,51 +57,40 @@
// your page initialization code here
// the DOM will be available here
function updateSizes(database) {
function updateData(database) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
var fill = '';
var res = '';
var len;
var res = null;
var size = 0;
var tables = 0;
var i;
if (this.readyState == 4 && this.status == 200) {
res = (this.responseText) == 0 ? '0sss MB' : this.responseText+' MB';
len = res.length;
if (len < 9) {
for (i=len; i<9; i++) {
fill = '&nbsp;' + fill;
}
res = JSON.parse(this.response);
}
res = res.replace('sss', '&nbsp;&nbsp;&nbsp;');
res = fill + res;
document.getElementById('size-' + database).innerHTML = res;
}
};
xhttp.open('GET', '_ajax_db.php?size=' + database, true);
xhttp.send();
}
function updateCount(database) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
var fill = '';
var i;
if (this.readyState == 4 && this.status == 200) {
if (this.responseText.length < 4) {
for (i=this.responseText.length; i<4; i++) {
fill = '&nbsp;' + fill;
// Normalize size output
size = res.size == 0 ? '0sss MB' : res.size + ' MB';
if (size.length < <?php echo $len_size;?>) {
for (i = size.length; i < <?php echo $len_size;?>; ++i) {
size = '&nbsp;' + size;
}
}
document.getElementById('table-' + database).innerHTML = fill + this.responseText;
size = size.replace('sss', '&nbsp;&nbsp;&nbsp;');
// Normalize tables output
tables = res.table;
if (tables.length < <?php echo $len_table;?>) {
for (i = tables.length; i < <?php echo $len_table;?>; ++i) {
tables = '&nbsp;' + tables;
}
}
document.getElementById('size-' + database).innerHTML = size;
document.getElementById('table-' + database).innerHTML = tables;
}
};
xhttp.open('GET', '_ajax_db.php?table=' + database, true);
xhttp.open('GET', '_ajax_callback.php?type=mysql&database=' + database, true);
xhttp.send();
}
@ -106,8 +99,7 @@
for (i = 0; i < databases.length; i++) {
database = databases[i].value;
updateSizes(database);
updateCount(database);
updateData(database);
}
})();
</script>

View File

@ -0,0 +1,120 @@
<?php require '../config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php require '../include/head.php'; ?>
</head>
<body>
<?php require '../include/navbar.php'; ?>
<div class="container">
<h1>PostgreSQL Databases</h1>
<br/>
<br/>
<div class="row">
<div class="col-md-12">
<table class="table table-striped ">
<thead class="thead-inverse ">
<tr>
<th>Name</th>
<th>Charset</th>
<th>Collation</th>
<th>Tables</th>
<th>Size</th>
</th>
</thead>
<tbody>
<?php
$len_table = 4;
$len_size = 9;
?>
<?php foreach ($Postgres->getDatabases() as $name => $database): ?>
<tr class="table-info">
<th>
<?php echo $name;?>
</th>
<td><?php echo $database['charset'];?></td>
<td><?php echo $database['collation'];?></td>
<td colspan="2"></td>
</tr>
<?php foreach ($database['schemas'] as $schema => $data): ?>
<tr>
<td><?php echo $schema;?></td>
<td colspan="2"></td>
<td><code><span class="table" id="table-<?php echo $name.'-'.$schema;?>"><?php echo str_repeat('&nbsp;', $len_table);?></span></code></td>
<td><code><span class="size" id="size-<?php echo $name.'-'.$schema;?>"><?php echo str_repeat('&nbsp;', $len_size);?></span></code></td>
</tr>
<input type="hidden" name="schema[]" data-database="<?php echo $name;?>" class="schema" value="<?php echo $schema;?>" />
<?php endforeach; ?>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div><!-- /.container -->
<?php require '../include/footer.php'; ?>
<script>
// self executing function here
(function() {
// your page initialization code here
// the DOM will be available here
function updateData(database, schema) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
var res = null;
var size = 0;
var tables = 0;
var i;
if (this.readyState == 4 && this.status == 200) {
res = JSON.parse(this.response);
// Normalize size output
size = res.size == 0 ? '0sss MB' : res.size + ' MB';
if (size.length < <?php echo $len_size;?>) {
for (i = size.length; i < <?php echo $len_size;?>; ++i) {
size = '&nbsp;' + size;
}
}
size = size.replace('sss', '&nbsp;&nbsp;&nbsp;');
// Normalize tables output
tables = res.table;
if (tables.length < <?php echo $len_table;?>) {
for (i = tables.length; i < <?php echo $len_table;?>; ++i) {
tables = '&nbsp;' + tables;
}
}
document.getElementById('size-' + database + '-' + schema).innerHTML = size;
document.getElementById('table-' + database + '-' + schema).innerHTML = tables;
}
};
xhttp.open('GET', '_ajax_callback.php?type=postgres&database=' + database + '&schema=' + schema, true);
xhttp.send();
}
var schemas = document.getElementsByName('schema[]');
var schema;
var database;
for (i = 0; i < schemas.length; i++) {
schema = schemas[i].value;
database = schemas[i].getAttribute('data-database');
updateData(database, schema);
}
})();
</script>
</body>
</html>

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">
@ -33,7 +33,7 @@
<!-- ############################################################ -->
<!-- HTTPD Docker Circle -->
<!-- ############################################################ -->
<div class="col-md-4">
<div class="col-md-3">
<div class="circles">
<div>
<div class="bg-danger">
@ -50,7 +50,7 @@
<!-- ############################################################ -->
<!-- PHP Docker Circle -->
<!-- ############################################################ -->
<div class="col-md-4">
<div class="col-md-3">
<div class="circles">
<div>
<div class="bg-info">
@ -67,7 +67,7 @@
<!-- ############################################################ -->
<!-- MySQL Docker Circle-->
<!-- ############################################################ -->
<div class="col-md-4">
<div class="col-md-3">
<div class="circles">
<div>
<div class="bg-warning">
@ -80,6 +80,25 @@
</div>
</div>
</div>
<!-- ############################################################ -->
<!-- PostgreSQL Docker Circle-->
<!-- ############################################################ -->
<div class="col-md-3">
<div class="circles">
<div>
<div class="bg-success">
<div>
<div>
<h3><?php echo $Docker->Postgres_version();?></h3>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br/><br/>
@ -88,18 +107,22 @@
<!-- ############################################################ -->
<!-- HTTPD Docker -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">httpd docker</th>
<th colspan="2">HTTPD docker</th>
</tr>
</thead>
<tbody>
<tr>
<th>IP Address</th>
<th>IP</th>
<td><?php echo $HTTPD_HOST_ADDR;?></td>
</tr>
<tr>
<th>Hostname</th>
<td><?php echo $HTTPD_HOST_NAME;?></td>
</tr>
<tr>
<th>Document Root</th>
<td>/shared/httpd</td>
@ -111,19 +134,22 @@
<!-- ############################################################ -->
<!-- PHP Docker -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">php docker</th>
<th colspan="2">PHP docker</th>
</tr>
</thead>
<tbody>
<tr>
<th>IP Address</th>
<th>IP</th>
<td><?php echo $PHP_HOST_ADDR;?></td>
</tr>
<tr>
<th>Hostname</th>
<td><?php echo $PHP_HOST_NAME;?></td>
</tr> <tr>
<th>Document Root</th>
<td>/shared/httpd</td>
</tr>
@ -217,30 +243,74 @@
<!-- ############################################################ -->
<!-- MySQL Docker -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">db docker</th>
<th colspan="2">MySQL docker</th>
</tr>
</thead>
<tbody>
<tr>
<th>IP Address</th>
<th>IP</th>
<td><?php echo $MYSQL_HOST_ADDR;?></td>
</tr>
<tr>
<th>MySQL socket</th>
<th>Hostname</th>
<td><?php echo $MYSQL_HOST_NAME;?></td>
</tr>
<tr>
<th>socket</th>
<td><?php echo $Docker->MySQL_config('socket'); ?></td>
</tr>
<tr>
<th>MySQL datadir</th>
<th>datadir</th>
<td><?php echo $Docker->MySQL_config('datadir'); ?></td>
</tr>
</tbody>
</table>
</div>
<!-- ############################################################ -->
<!-- PostgreSQL Docker -->
<!-- ############################################################ -->
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th colspan="2">PostgreSQL docker</th>
</tr>
</thead>
<tbody>
<tr>
<th>IP</th>
<td><?php echo $POSTGRES_HOST_ADDR;?></td>
</tr>
<tr>
<th>Hostname</th>
<td><?php echo $POSTGRES_HOST_NAME;?></td>
</tr>
<tr>
<th>socket</th>
<td><?php
$dir = $Docker->Postgres_config('unix_socket_directory');
if (empty($dir)) {
// Postgres 9.6
$dir = $Docker->Postgres_config('unix_socket_directories');
}
echo $dir;
?></td>
</tr>
<tr>
<th>datadir</th>
<td><?php echo $Docker->Postgres_config('data_directory'); ?></td>
</tr>
</tbody>
</table>
</div>
</div>
@ -263,11 +333,11 @@
<!-- ############################################################ -->
<!-- HTTPD Docker Mounts -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th>httpd docker</th>
<th>HTTPD docker</th>
<th>host</th>
</tr>
</thead>
@ -287,11 +357,11 @@
<!-- ############################################################ -->
<!-- PHP Docker Mounts -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th>php docker</th>
<th>PHP docker</th>
<th>host</th>
</tr>
</thead>
@ -319,11 +389,11 @@
<!-- ############################################################ -->
<!-- MySQL Docker Mounts -->
<!-- ############################################################ -->
<div class="col-md-4">
<table class="table table-striped table-sm">
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th>db docker</th>
<th>MySQL docker</th>
<th>host</th>
</tr>
</thead>
@ -344,6 +414,31 @@
</table>
</div>
<!-- ############################################################ -->
<!-- PostgreSQL Docker Mounts -->
<!-- ############################################################ -->
<div class="col-md-3">
<table class="table table-striped table-sm font-small">
<thead class="thead-inverse">
<tr>
<th>Postgres docker</th>
<th>host</th>
</tr>
</thead>
<tbody>
<tr>
<th>Postgres datadir</th>
<td><?php echo $Docker->getEnv('HOST_PATH_TO_POSTGRES_DATADIR');?></td>
</tr>
<tr>
<th>Log directory</th>
<td>./log</td>
</tr>
</tbody>
</table>
</div>
</div>
</div><!-- /.container -->

View File

@ -37,27 +37,27 @@ $sort = $MySort->getSort();
$order = $MySort->getOrder();
// Evaluate Sorters/Orderers
$orderDate = '<a href="/mail.php?sort=date&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a>';
$orderTo = '<a href="/mail.php?sort=x-original-to&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a>';
$orderSubj = '<a href="/mail.php?sort=subject&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a>';
$orderDate = '<a href="/mail.php?sort=date&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a>';
$orderTo = '<a href="/mail.php?sort=x-original-to&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a>';
$orderSubj = '<a href="/mail.php?sort=subject&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a>';
if ($sort == 'date') {
if ($order == 'ASC') {
$orderDate = '<a href="/mail.php?sort=date&order=DESC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-numeric-asc" aria-hidden="true"></i>';
$orderDate = '<a href="/mail.php?sort=date&order=DESC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-numeric-asc" aria-hidden="true"></i>';
} else {
$orderDate = '<a href="/mail.php?sort=date&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-numeric-desc" aria-hidden="true"></i> ';
$orderDate = '<a href="/mail.php?sort=date&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-numeric-desc" aria-hidden="true"></i> ';
}
} else if ($sort == 'subject') {
if ($order == 'ASC') {
$orderSubj = '<a href="/mail.php?sort=subject&order=DESC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-asc" aria-hidden="true"></i>';
$orderSubj = '<a href="/mail.php?sort=subject&order=DESC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-asc" aria-hidden="true"></i>';
} else {
$orderSubj = '<a href="/mail.php?sort=subject&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-desc" aria-hidden="true"></i>';
$orderSubj = '<a href="/mail.php?sort=subject&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-desc" aria-hidden="true"></i>';
}
} else if ($sort == 'x-original-to') {
if ($order == 'ASC') {
$orderTo = '<a href="/mail.php?sort=x-original-to&order=DESC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-asc" aria-hidden="true"></i>';
$orderTo = '<a href="/mail.php?sort=x-original-to&order=DESC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-asc" aria-hidden="true"></i>';
} else {
$orderTo = '<a href="/mail.php?sort=x-original-to&order=ASC#received"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-desc" aria-hidden="true"></i>';
$orderTo = '<a href="/mail.php?sort=x-original-to&order=ASC"><i class="fa fa-sort" aria-hidden="true"></i></a> <i class="fa fa-sort-alpha-desc" aria-hidden="true"></i>';
}
}
@ -80,7 +80,7 @@ $messages = $MyMbox->get($sortOrderArr);
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">
<h1>Mail</h1>
@ -125,7 +125,7 @@ $messages = $MyMbox->get($sortOrderArr);
<div class="row">
<div class="col-md-12">
<h3 id="received">Received Emails</h3>
<h3>Received Emails</h3>
<br/>
</div>
</div>

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">

View File

@ -321,7 +321,7 @@ $opcache = OpCacheService::init($options);
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">

View File

@ -0,0 +1,44 @@
<?php require '../config.php'; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php require '../include/head.php'; ?>
</head>
<body>
<?php require '../include/navbar.php'; ?>
<div class="container">
<h1>PostgreSQL Info</h1>
<br/>
<br/>
<div class="row">
<div class="col-md-12">
<table class="table table-striped">
<thead class="thead-inverse">
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($Docker->Postgres_config() as $key => $val): ?>
<tr>
<td><?php echo $key;?></td>
<td class="break-word"><code><?php echo $val;?></code></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div><!-- /.container -->
<?php require '../include/footer.php'; ?>
</body>
</html>

View File

@ -28,7 +28,7 @@ $i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'mysql';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = true;

View File

@ -6,7 +6,7 @@
</head>
<body>
<?php require '../include/navigation.php'; ?>
<?php require '../include/navbar.php'; ?>
<div class="container">
@ -88,7 +88,7 @@
}
}
};
xhttp.open('GET', '_ajax_vhost.php?valid=' + vhost, true);
xhttp.open('GET', '_ajax_callback.php?vhost=' + vhost, true);
xhttp.send();
}