mirror of
https://github.com/cytopia/devilbox.git
synced 2025-04-13 22:03:08 +00:00
REL-0.9 Updating Intranet
This commit is contained in:
parent
a5cf4f9483
commit
ff39de09ef
@ -2,104 +2,141 @@
|
||||
// Measure time
|
||||
$TIME_START = microtime(true);
|
||||
|
||||
// PHP Error reporting
|
||||
// Turn on all PHP errors
|
||||
error_reporting(-1);
|
||||
|
||||
|
||||
// Shorten DNS timeouts for gethostbyname in case DNS server is down
|
||||
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
|
||||
|
||||
|
||||
$DEVILBOX_VERSION = 'v0.9';
|
||||
$DEVILBOX_DATE = '2017-05-15';
|
||||
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';
|
||||
|
||||
//
|
||||
// Set Directories
|
||||
//
|
||||
$CONF_DIR = dirname(__FILE__);
|
||||
$INCL_DIR = $CONF_DIR . DIRECTORY_SEPARATOR . 'include';
|
||||
$LIB_DIR = $INCL_DIR . DIRECTORY_SEPARATOR . 'lib';
|
||||
$VEN_DIR = $INCL_DIR . DIRECTORY_SEPARATOR . 'vendor';
|
||||
$LIB_DIR = $CONF_DIR . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR .'lib';
|
||||
$VEN_DIR = $CONF_DIR . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR .'vendor';
|
||||
$LOG_DIR = dirname(dirname($CONF_DIR)) . DIRECTORY_SEPARATOR . 'log' . DIRECTORY_SEPARATOR . 'devilbox';
|
||||
|
||||
|
||||
//
|
||||
// Load Base classes
|
||||
//
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'container' . DIRECTORY_SEPARATOR .'BaseClass.php';
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . 'container' . DIRECTORY_SEPARATOR .'BaseInterface.php';
|
||||
|
||||
/**
|
||||
* TLD suffix for mass virtual hosts.
|
||||
*
|
||||
* This is currently hardcoded and must be changed here
|
||||
* as well as in the webserver config.
|
||||
* @var string
|
||||
*/
|
||||
$TLD_SUFFIX = 'loc';
|
||||
|
||||
|
||||
//
|
||||
// Set Docker addresses
|
||||
//
|
||||
$HTTPD_HOST_NAME = 'httpd';
|
||||
$HTTPD_HOST_ADDR = gethostbyname($HTTPD_HOST_NAME);
|
||||
|
||||
$DNS_HOST_NAME = 'bind';
|
||||
$PHP_HOST_NAME = 'php';
|
||||
$PHP_HOST_ADDR = gethostbyname($PHP_HOST_NAME);
|
||||
|
||||
$HTTPD_HOST_NAME = 'httpd';
|
||||
$MYSQL_HOST_NAME = 'mysql';
|
||||
$MYSQL_HOST_ADDR = gethostbyname($MYSQL_HOST_NAME);
|
||||
$PGSQL_HOST_NAME = 'pgsql';
|
||||
$REDIS_HOST_NAME = 'redis';
|
||||
$MEMCD_HOST_NAME = 'memcached';
|
||||
|
||||
$POSTGRES_HOST_NAME = 'postgres';
|
||||
$POSTGRES_HOST_ADDR = gethostbyname($POSTGRES_HOST_NAME);
|
||||
|
||||
//
|
||||
// Lazy Loader
|
||||
// Lazy Container Loader
|
||||
//
|
||||
function loadFile($class, $base_path) {
|
||||
static $_LOADED_FILE;
|
||||
|
||||
if (isset($_LOADED_FILE[$class])) {
|
||||
return;
|
||||
}
|
||||
|
||||
require $base_path . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
$_LOADED_FILE[$class] = true;
|
||||
return;
|
||||
}
|
||||
function loadClass($class) {
|
||||
|
||||
global $MYSQL_HOST_ADDR;
|
||||
global $POSTGRES_HOST_ADDR;
|
||||
|
||||
static $_LOADED_LIBS;
|
||||
$LIB_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'include' . DIRECTORY_SEPARATOR . 'lib';
|
||||
|
||||
|
||||
if (isset($_LOADED_LIBS[$class])) {
|
||||
return $_LOADED_LIBS[$class];
|
||||
} else {
|
||||
switch($class) {
|
||||
|
||||
$lib_dir = $GLOBALS['LIB_DIR'];
|
||||
$cnt_dir = $GLOBALS['LIB_DIR'] . DIRECTORY_SEPARATOR . 'container';
|
||||
|
||||
switch($class) {
|
||||
//
|
||||
// Lib Classes
|
||||
//
|
||||
case 'Logger':
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
loadFile($class, $lib_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Logger::getInstance();
|
||||
break;
|
||||
|
||||
case 'Docker':
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
$_LOADED_LIBS[$class] = \devilbox\Docker::getInstance();
|
||||
case 'Html':
|
||||
loadFile($class, $lib_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Html::getInstance();
|
||||
break;
|
||||
|
||||
case 'Helper':
|
||||
loadFile($class, $lib_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Helper::getInstance();
|
||||
break;
|
||||
|
||||
//
|
||||
// Docker Container Classes
|
||||
//
|
||||
case 'Php':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Php::getInstance($GLOBALS['PHP_HOST_NAME']);
|
||||
break;
|
||||
|
||||
case 'Dns':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Dns::getInstance($GLOBALS['DNS_HOST_NAME']);
|
||||
break;
|
||||
|
||||
case 'Httpd':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Httpd::getInstance($GLOBALS['HTTPD_HOST_NAME']);
|
||||
break;
|
||||
|
||||
case 'Mysql':
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
$Docker = loadClass('Docker');
|
||||
$_LOADED_LIBS[$class] = \devilbox\Mysql::getInstance('root', $Docker->getEnv('MYSQL_ROOT_PASSWORD'), $MYSQL_HOST_ADDR);
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Mysql::getInstance($GLOBALS['MYSQL_HOST_NAME'], array(
|
||||
'user' => 'root',
|
||||
'pass' => loadClass('Helper')->getEnv('MYSQL_ROOT_PASSWORD')
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Postgres':
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
$Docker = loadClass('Docker');
|
||||
$_LOADED_LIBS[$class] = \devilbox\Postgres::getInstance($Docker->getEnv('POSTGRES_USER'), $Docker->getEnv('POSTGRES_PASSWORD'), $POSTGRES_HOST_ADDR);
|
||||
case 'Pgsql':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Pgsql::getInstance($GLOBALS['PGSQL_HOST_NAME'], array(
|
||||
'user' => loadClass('Helper')->getEnv('PGSQL_ROOT_USER'),
|
||||
'pass' => loadClass('Helper')->getEnv('PGSQL_ROOT_PASSWORD'),
|
||||
'db' => 'postgres'
|
||||
));
|
||||
break;
|
||||
|
||||
case 'Redis':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Redis::getInstance($GLOBALS['REDIS_HOST_NAME']);
|
||||
break;
|
||||
|
||||
case 'Memcd':
|
||||
loadFile($class, $cnt_dir);
|
||||
$_LOADED_LIBS[$class] = \devilbox\Memcd::getInstance($GLOBALS['MEMCD_HOST_NAME']);
|
||||
break;
|
||||
|
||||
// Get optional docker classes
|
||||
default:
|
||||
// Redis
|
||||
if ($class == 'Redis' && loadClass('Docker')->getEnv('COMPOSE_OPTIONAL') == 1) {
|
||||
require $LIB_DIR . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
$_LOADED_LIBS[$class] = \devilbox\Redis::getInstance('redis');
|
||||
break;
|
||||
|
||||
} else {
|
||||
exit('Class does not exist: '.$class);
|
||||
}
|
||||
exit('Class does not exist: '.$class);
|
||||
}
|
||||
return $_LOADED_LIBS[$class];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// VirtualHost DNS check
|
||||
// Temporarily disable due to:
|
||||
// https://github.com/cytopia/devilbox/issues/8
|
||||
$ENABLE_VHOST_DNS_CHECK = false;
|
||||
|
@ -1,3 +1,60 @@
|
||||
.meter {
|
||||
height: 20px; /* Can be anything */
|
||||
position: relative;
|
||||
background: #555;
|
||||
-moz-border-radius: 25px;
|
||||
-webkit-border-radius: 25px;
|
||||
border-radius: 25px;
|
||||
box-shadow: inset 0 -1px 1px rgba(255,255,255,0.3);
|
||||
}
|
||||
.meter > span {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-top-right-radius: 20px;
|
||||
border-bottom-right-radius: 20px;
|
||||
border-top-left-radius: 20px;
|
||||
border-bottom-left-radius: 20px;
|
||||
background-color: rgb(43,194,83);
|
||||
background-image: linear-gradient(
|
||||
center bottom,
|
||||
rgb(43,194,83) 37%,
|
||||
rgb(84,240,84) 69%
|
||||
);
|
||||
box-shadow:
|
||||
inset 0 2px 9px rgba(255,255,255,0.3),
|
||||
inset 0 -2px 6px rgba(0,0,0,0.4);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
.dash-box {
|
||||
border: 1px solid #383737;
|
||||
background-color: #3d3d3d;
|
||||
color: #999999;
|
||||
height:100%;
|
||||
}
|
||||
.dash-box-head {
|
||||
background-color: #383737;
|
||||
color: #999999;
|
||||
width:100%;
|
||||
display: inline-block;
|
||||
padding:10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.dash-box-body {
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
|
||||
.row-margin {
|
||||
margin-bottom:20px;
|
||||
}
|
||||
.col-margin {
|
||||
margin-bottom:20px;
|
||||
}
|
||||
|
||||
|
||||
/* Bootstrap overwrites
|
||||
-------------------------------------------------- */
|
||||
html, body {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -67,7 +67,7 @@ if ($sort == 'date') {
|
||||
//
|
||||
// Mbox Reader
|
||||
//
|
||||
$MyMbox = new \devilbox\Mail('/var/mail/mailtrap');
|
||||
$MyMbox = new \devilbox\Mail('/var/mail/devilbox');
|
||||
|
||||
// If default sort is on, use NULL, so we do not have to sort the mails after retrieval,
|
||||
// because they are being read in the default sort/order anyway
|
||||
|
@ -1,20 +1,14 @@
|
||||
<nav class="navbar navbar-full footer navbar-dark bg-inverse">
|
||||
<div class="container">
|
||||
<nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse footer">
|
||||
<div class="container justify-content-end">
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="nav-item nav-link">Render time: <?php echo round((microtime(true) - $TIME_START), 2); ?> sec</li>
|
||||
<li class="nav-item float-xs-right"><a class="nav-link" href="https://github.com/cytopia/devilbox"><code>Github</code></a></li>
|
||||
<li class="nav-item float-xs-right"><a class="nav-link" href="/credits.php"><code>Credits</code></a></li>
|
||||
<li class="nav-item float-xs-right"><a class="nav-link" href="/debug.php"><code>Debug</code></a></li>
|
||||
<li class="nav-item nav-link">Render time: <?php echo round((microtime(true) - $TIME_START), 2); ?> sec</li>
|
||||
<li class="nav-item"><a class="nav-link" href="https://github.com/cytopia/devilbox"><code>Github</code></a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/credits.php"><code>Credits</code></a></li>
|
||||
<li class="nav-item"><a class="nav-link" href="/debug.php"><code>Debug</code></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<script src="/vendor/jquery/jquery.min.js"></script>
|
||||
<script src="/vendor/jquery/jquery-3.1.1.slim.min.js"></script>
|
||||
<script src="/vendor/tether/tether.min.js"></script>
|
||||
<script src="/vendor/bootstrap/bootstrap.min.js"></script>
|
||||
|
||||
<?php /*
|
||||
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
|
||||
<script src="/vendor/jquery/jquery.min.js"></script>
|
||||
<!-- Include all compiled plugins (below), or include individual files as needed -->
|
||||
<script src="/vendor/bootstrap/bootstrap.min.js"></script>
|
||||
*/
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
|
||||
<!-- Meta -->
|
||||
<meta name="description" content="The devilbox - your customizable LAMP/LEMP stack.">
|
||||
|
@ -1,12 +1,16 @@
|
||||
<?php $current = basename($_SERVER['SCRIPT_FILENAME']);?>
|
||||
|
||||
<nav class="navbar navbar-full navbar-dark bg-inverse">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" href="/index.php">
|
||||
<img src="/assets/img/logo_30.png" width="30" height="30" class="d-inline-block align-top" alt="">
|
||||
devilbox
|
||||
</a>
|
||||
<ul class="nav navbar-nav">
|
||||
|
||||
<nav class="navbar navbar-toggleable-md navbar-inverse bg-inverse">
|
||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="/index.php">
|
||||
<img src="/assets/img/logo_30.png" width="30" height="30" class="d-inline-block align-top" alt="">devilbox
|
||||
</a>
|
||||
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
|
||||
<?php $file = 'index.php'; $name = 'Home';?>
|
||||
<li class="nav-item <?php echo $file == $current ? 'active' : '';?>">
|
||||
@ -28,13 +32,10 @@
|
||||
<a class="nav-link" href="<?php echo $file == $current ? '#' : '/'.$file;?>"><?php echo $name;?><?php echo $file == $current ? ' <span class="sr-only">(current)</span>' : '';?></a>
|
||||
</li>
|
||||
|
||||
<?php if (loadClass('Docker')->getEnv('COMPOSE_OPTIONAL') == 1): ?>
|
||||
<?php $file = 'db_redis.php'; $name = 'Redis DB';?>
|
||||
<li class="nav-item <?php echo $file == $current ? 'active' : '';?>">
|
||||
<a class="nav-link" href="<?php echo $file == $current ? '#' : '/'.$file;?>"><?php echo $name;?><?php echo $file == $current ? ' <span class="sr-only">(current)</span>' : '';?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $file = 'db_redis.php'; $name = 'Redis DB';?>
|
||||
<li class="nav-item <?php echo $file == $current ? 'active' : '';?>">
|
||||
<a class="nav-link" href="<?php echo $file == $current ? '#' : '/'.$file;?>"><?php echo $name;?><?php echo $file == $current ? ' <span class="sr-only">(current)</span>' : '';?></a>
|
||||
</li>
|
||||
|
||||
<?php $file = 'mail.php'; $name = 'Emails';?>
|
||||
<li class="nav-item <?php echo $file == $current ? 'active' : '';?>">
|
||||
@ -47,11 +48,9 @@
|
||||
$files = array(
|
||||
'phpinfo.php' => 'PHP info',
|
||||
'mysqlinfo.php' => 'MySQL info',
|
||||
'postgresinfo.php' => 'PostgreSQL info'
|
||||
'postgresinfo.php' => 'PostgreSQL info',
|
||||
'redisinfo.php' => 'Redis info'
|
||||
);
|
||||
if (loadClass('Docker')->getEnv('COMPOSE_OPTIONAL') == 1) {
|
||||
$files['redisinfo.php'] = 'Redis info';
|
||||
}
|
||||
$active = (in_array($script, array_keys($files))) ? 'active' : '';
|
||||
?>
|
||||
<li class="nav-item dropdown <?php echo $active;?>">
|
||||
@ -65,7 +64,7 @@
|
||||
|
||||
<?php
|
||||
// ---- Tools ---- //
|
||||
if (strpos(loadClass('Docker')->PHP_version(), 'PHP 5.4') !== false) {
|
||||
if (strpos(loadClass('Php')->getVersion(), '5.4') !== false) {
|
||||
// Support for PHP 5.4
|
||||
$phpmyadmin = '4.0';
|
||||
} else {
|
||||
@ -89,7 +88,10 @@
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<?php $errors = loadClass('Logger')->countErrors(); ?>
|
||||
<div class="form-inline my-2 my-lg-0">Errors: <?php echo $errors; ?></div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
<br/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user