Skip to content

Commit

Permalink
Merge pull request #3 from Dereku/master
Browse files Browse the repository at this point in the history
Fixes[]
  • Loading branch information
osipxd committed Sep 6, 2015
2 parents d42ad3e + 248c9d0 commit 729f9e0
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 31 deletions.
12 changes: 12 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title></title>
<body>
<center>
<iframe src="monitor.php?demo=true&server=EndlessMonitor3&to=F3C64E" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
<iframe src="monitor.php?demo=true&server=Classic&to=85F418" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
<iframe src="monitor.php?demo=true&server=HiTech&to=18C3F4" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
<iframe src="monitor.php?demo=true&server=Mine&to=9918F4" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
<iframe src="monitor.php?demo=true&server=DreamLan&to=F418C3" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
<iframe src="monitor.php?demo=true&server=RPG&to=F41841" frameborder="no" height="60" width="240" scrolling="no"></iframe></br>
</center>
</body>
2 changes: 1 addition & 1 deletion helpers/Config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function get($section) {
die(Lang::getLocaledStringFromLocale('CONFIG_NOT_FOUND_ERROR', 'ru_RU'));
}

$config = parse_ini_file(ROOT . $file, true);
$config = parse_ini_file(/*ROOT . */$file, true);

// Prepare section
$sections = self::parse($section);
Expand Down
2 changes: 1 addition & 1 deletion helpers/SQL.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function __construct() {
$this->table = $opt['table'];

// Connect to MySQL
@$this->sql = new mysqli($opt['host'], $opt['user'], $opt['pass'], $opt['db'], $opt['port']);
$this->sql = new mysqli($opt['host'], $opt['user'], $opt['pass'], $opt['db'], $opt['port']);
unset($opt);

// Output error
Expand Down
14 changes: 14 additions & 0 deletions helpers/System.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ public static function getInfo($serverId) {

return $info;
}

/**
* Demo output.
*
* @param String $serverId
* @return string
*/
public static function getDemoInfo($serverId) {
$info['text'] = $serverId;
$info['percent'] = rand(0, 100);
$info['status'] = $info['percent'] . '%';
$info['style'] = 'online';
return $info;
}

/**
* Receiving information from the server
Expand Down
6 changes: 3 additions & 3 deletions installation/helpers/Parts.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function part1($data) {
'',
'[style]',
'; Настройки отображения мониторинга',
' status = ' . $data['view_type'] . ' ; 1 - проценты (Н: 42%), 2 - дробь (Н: 36/100), 3 - только онлайн (Н: 53)',
' status = ' . $data['view_type'] . ' ; 1 - проценты (Н: 42%), 2 - дробь (Н: 36/100), 3 - только онлайн (Н: 53)',
'',
);

Expand Down Expand Up @@ -66,9 +66,9 @@ public static function part2($data) {
' host = ' . $data['host'],
' port = ' . $data['port'],
' user = ' . $data['login'],
' pass = "' . $data['pass'] . '" ; Пароль лучше заключить в кавычки',
' pass = "' . $data['pass'] . '" ; Пароль лучше заключить в кавычки',
' db = ' . $data['db'],
' table = ' . $data['table'] . ' ; Таблица в которой хранится онлайн сервера(ов)',
' table = ' . $data['table'] . ' ; Таблица в которой хранится онлайн сервера(ов)',
'',
);

Expand Down
2 changes: 0 additions & 2 deletions installation/helpers/PrepareSQL.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class PrepareSQL {
* $param string $type Type of request (table or server)
*/
public static function prepare($type, $serverId = null) {
global $error;

$sql = new SQL();
$table = Config::get('mysql.table');

Expand Down
12 changes: 8 additions & 4 deletions installation/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package EndlessMonitor
* @version 1.0.1
Expand All @@ -7,7 +8,6 @@
* @link http://endlesscode.ru/
* @license GNU/GPLv2
*/

define('_EMINS', true);
define('DS', DIRECTORY_SEPARATOR);
define('INSTALL', dirname(__FILE__) . DS);
Expand All @@ -19,7 +19,9 @@
require_once(INSTALL . 'helpers/include.php');
defined('_IHINC') or die(' System files are missing! ');

if (!isset($_GET['s'])) $_GET['s'] = 'step1';
if (!isset($_GET['s'])) {
$_GET['s'] = 'step1';
}

$page = $_GET['s'] . '.php';

Expand All @@ -28,7 +30,9 @@
if (isset($_GET['er'])) {
$error = true;
Parts::delPart2();
} else Parts::part1($_POST);
} else {
Parts::part1($_POST);
}
} else if ($_GET['s'] == 'step3') {
Parts::part2($_POST);
PrepareSQL::prepare('table');
Expand All @@ -43,4 +47,4 @@
}

/** @noinspection PhpIncludeInspection */
include(INSTALL . 'view' . DS . 'index.php');
include(INSTALL . 'view' . DS . 'index.php');
25 changes: 18 additions & 7 deletions monitor.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @package EndlessMonitor
* @version 1.0
Expand All @@ -7,7 +8,6 @@
* @link http://endlesscode.ru/
* @license GNU/GPLv2
*/

if (empty($_GET['server'])) {
die(' Empty params! ');
}
Expand All @@ -16,15 +16,26 @@
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', dirname(__FILE__) . DS);

if (!file_exists('config.ini.php')) {
include(ROOT . 'installation/index.php');
die;
}

require_once(ROOT . 'helpers/include.php');
defined('_HINC') or die(' System files are missing! ');
$info = '';
$tmploptions = '';

if (!empty($_GET['to'])) {
$tmploptions = $_GET['to'];
}

if (!empty($_GET['demo'])) {
$info = System::getDemoInfo($_GET['server']);
include(ROOT . 'tmpl/default.php');
die;
}

if (!file_exists('config.ini.php')) {
echo('Configuration doesn\'t exists.');
die;
}
$info = System::getInfo(System::secureId($_GET['server']));

/** @noinspection PhpIncludeInspection */
include(ROOT . 'tmpl/' . Config::get('system.template') . '.php');
include(ROOT . 'tmpl/' . Config::get('system.template') . '.php');
4 changes: 0 additions & 4 deletions tmpl/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
transition: width .4s ease-in-out;
}

.online span {
background-color: #34c2e3;
}

.offline span {
background-color: #727272;
}
Expand Down
23 changes: 14 additions & 9 deletions tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@
?>

<html>
<head>
<link rel="stylesheet" href="tmpl/css/default.css">
</head>
<head>
<link rel="stylesheet" href="tmpl/css/default.css">
<style type="text/css">
.online span {
background-color: #<?php echo $tmploptions != '' ? $tmploptions : '34c2e3' ?>;
}
</style>
</head>

<div class="monitor <?php echo $info['style'] ?> stripes">
<span style="width: <?php echo $info['percent'], '%'; ?>"></span>
<div class="monitor <?php echo $info['style'] ?> stripes">
<span style="width: <?php echo $info['percent'], '%'; ?>"></span>

<div class="captions">
<div class="left"><?php echo $info['text'] ?></div>
<div class="right"><?php echo $info['status'] ?></div>
<div class="captions">
<div class="left"><?php echo $info['text'] ?></div>
<div class="right"><?php echo $info['status'] ?></div>
</div>
</div>
</div>
</html>

0 comments on commit 729f9e0

Please sign in to comment.