'Home', 'path' => '/index.php' ), array( 'name' => 'Virtual Hosts', 'path' => '/vhosts.php' ), array( 'name' => 'Emails', 'path' => '/mail.php' ) ), array( 'name' => 'Databases', 'menu' => array( array( 'name' => 'MySQL DB', 'path' => '/db_mysql.php' ), array( 'name' => 'PgSQL DB', 'path' => '/db_pgsql.php' ), array( 'name' => 'MongoDB DB', 'path' => '/db_mongo.php' ), array( 'name' => 'Redis DB', 'path' => '/db_redis.php' ), array( 'name' => 'Memcached DB', 'path' => '/db_memcd.php' ) ) ), array( 'name' => 'Info', 'menu' => array( array( 'name' => 'Httpd Info', 'path' => '/info_httpd.php' ), array( 'name' => 'PHP Info', 'path' => '/info_php.php' ), array( 'name' => 'MySQL Info', 'path' => '/info_mysql.php' ), array( 'name' => 'PgSQL Info', 'path' => '/info_pgsql.php' ), array( 'name' => 'MongoDB Info', 'path' => '/info_mongo.php' ), array( 'name' => 'Redis Info', 'path' => '/info_redis.php' ), array( 'name' => 'Memcached Info', 'path' => '/info_memcd.php' ) ) ), array( 'name' => 'Tools', 'menu' => array( array( 'name' => 'Adminer', 'path' => '__ADMINER__', 'target' => '_blank' ), array( 'name' => 'phpMyAdmin', 'path' => '__PHPMYADMIN__', 'target' => '_blank' ), array( 'name' => 'phpPgAdmin', 'path' => '__PHPPGADMIN__', 'target' => '_blank' ), array( 'name' => 'PHPRedMin', 'path' => '/vendor/phpredmin/public/index.php', 'target' => '_blank' ), array( 'name' => 'Opcache GUI', 'path' => '/opcache.php' ) ) ) ); /********************************************************************************* * * Statics * *********************************************************************************/ /** * $this Singleton instance * @var Object|null */ protected static $_instance = null; /** * Singleton Instance getter. * * @return object|null */ public static function getInstance() { if (self::$_instance === null) { self::$_instance = new self(); } return self::$_instance; } /********************************************************************************* * * Select functions * *********************************************************************************/ public function getHead($font_awesome = false) { $css_fa = ($font_awesome) ? '' : ''; $html = << {$css_fa} The DevilBox HTML; return $html; } public function getNavbar() { $menu = $this->_buildMenu(); $logout = ''; if (loadClass('Helper')->isLoginProtected()) { $logout = ''; } $html = << devilbox
HTML; return $html; } public function getFooter() { $render_time = round((microtime(true) - $GLOBALS['TIME_START']), 2); $errors = loadClass('Logger')->countErrors(); $html = <<
HTML; return $html; } public function getCirle($name) { switch ($name) { case 'dns': $class = 'bg-info'; $version = loadClass('Dns')->getVersion(); $available = loadClass('Dns')->isAvailable(); $name = loadClass('Dns')->getName(); break; case 'php': $class = 'bg-info'; $version = loadClass('Php')->getVersion(); $available = loadClass('Php')->isAvailable(); $name = loadClass('Php')->getName(); break; case 'httpd': $class = 'bg-info'; $version = loadClass('Httpd')->getVersion(); $available = loadClass('Httpd')->isAvailable(); $name = loadClass('Httpd')->getName(); break; case 'mysql': $class = 'bg-warning'; $version = loadClass('Mysql')->getVersion(); $available = loadClass('Mysql')->isAvailable(); $name = loadClass('Mysql')->getName(); break; case 'pgsql': $class = 'bg-warning'; $version = loadClass('Pgsql')->getVersion(); $available = loadClass('Pgsql')->isAvailable(); $name = loadClass('Pgsql')->getName(); break; case 'redis': $class = 'bg-danger'; $version = loadClass('Redis')->getVersion(); $available = loadClass('Redis')->isAvailable(); $name = loadClass('Redis')->getName(); break; case 'memcd': $class = 'bg-danger'; $version = loadClass('Memcd')->getVersion(); $available = loadClass('Memcd')->isAvailable(); $name = loadClass('Memcd')->getName(); break; case 'mongo': $class = 'bg-danger'; $version = loadClass('Mongo')->getVersion(); $available = loadClass('Mongo')->isAvailable(); $name = loadClass('Mongo')->getName(); break; default: $available = false; $version = ''; break; } $style = 'color:black;'; $version = '('.$version.')'; if (!$available) { $class = ''; $style = 'background-color:gray;'; $version = ' '; } $circle = '
'. '
'. '
'. '
'. '

'.$name.'
'.$version.'
'. '
'. '
'. '
'. '
'; return $circle; } /********************************************************************************* * * Private functions * *********************************************************************************/ private function _buildMenu() { $path = $_SERVER['PHP_SELF']; $html = ''; foreach ($this->_menu as $type => $elements) { // Menu if (!isset($elements['menu'])) { foreach ($elements as $el) { if ($path == $el['path']) { $class = 'active'; $span = '(current)'; } else { $class = ''; $span = ''; } $html .= ''; } // Submenu } else { $name = $elements['name']; $class = ''; $id = md5($name); // Make submenu active foreach ($elements['menu'] as $el) { if (strpos($path, $el['path']) !== false) { $class = 'active'; break; } } $html .= ''; } } return $html; } }