Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db3d54a835 | |||
| 37e155a9b1 | |||
| 69e2ee972c | |||
| c6fb90e562 | |||
| 9f2d29c8fe | |||
| ec8a954b0b | |||
| f2938cf701 | |||
| f803effbbd | |||
| fcceec8545 | |||
| 130dee67ea | |||
| 79c7fbc841 | |||
|
|
57608f3b2f | ||
|
|
1e60371abe | ||
|
|
79fc07e010 | ||
|
|
db683a5b19 | ||
|
|
3ebc78f14d | ||
|
|
588c82f4e8 | ||
|
|
22fa53e3a3 | ||
|
|
1257825709 | ||
|
|
6f819ed9f5 | ||
|
|
6adb4fe93e | ||
|
|
97d666a794 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -10,6 +10,7 @@
|
|||||||
.idea/**/shelf
|
.idea/**/shelf
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
pack.sh
|
||||||
|
|
||||||
# Generated files
|
# Generated files
|
||||||
.idea/**/contentModel.xml
|
.idea/**/contentModel.xml
|
||||||
@@ -99,3 +100,5 @@ data/DoctrineORMModule/cache/
|
|||||||
demos/
|
demos/
|
||||||
extras/documentation
|
extras/documentation
|
||||||
|
|
||||||
|
*.zip
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -4,4 +4,4 @@
|
|||||||
[Pi Control Installation](https://pi-control.de/install/)
|
[Pi Control Installation](https://pi-control.de/install/)
|
||||||
|
|
||||||
## Bei Fragen oder Problemen
|
## Bei Fragen oder Problemen
|
||||||
Schreibe mir eine E-Mail an [support@pi-control.de](mailto:support@pi-control.de) oder nutze das Feedback in Pi Control.
|
Über das [Ticketsystem](https://git.schultes.dev/gregor/pi-control/issues) können Fehler gemeldet werden und im [Forum](https://bugs.die-schultes.eu/projects/pi-control/boards) gibt es Hilfe zu Fragen rund um Pi Control
|
||||||
@@ -1,21 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
define('PICONTROL', true);
|
define('PICONTROL', true);
|
||||||
|
|
||||||
(include_once realpath(dirname(__FILE__)).'/../../resources/init.php') or die('Error: 0x0000');
|
(include_once realpath(dirname(__FILE__)) . '/../../resources/init.php') or die('Error: 0x0000');
|
||||||
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
|
(include_once LIBRARY_PATH . 'main/main.function.php') or die('Error: 0x0001');
|
||||||
(include_once LIBRARY_PATH.'main/rpi.function.php') or die('Error: 0x0002');
|
(include_once LIBRARY_PATH . 'main/rpi.function.php') or die('Error: 0x0002');
|
||||||
(include_once LIBRARY_PATH.'api/api.class.php') or die('Error: 0x0003');
|
(include_once LIBRARY_PATH . 'api/api.class.php') or die('Error: 0x0003');
|
||||||
|
|
||||||
$api = new API;
|
$api = new API;
|
||||||
|
|
||||||
if (isset($_POST['data']))
|
if (isset($_POST['data'])) {
|
||||||
{
|
|
||||||
$datas = explode(';', $_POST['data']);
|
$datas = explode(';', $_POST['data']);
|
||||||
|
setData($datas, $api);
|
||||||
|
} elseif (isset($_GET['data'])) {
|
||||||
|
$datas = explode(';', $_GET['data']);
|
||||||
|
setData($datas, $api);
|
||||||
|
} else
|
||||||
|
$api->setError('error', 'No data set.');
|
||||||
|
|
||||||
foreach ($datas as $data)
|
$api->display();
|
||||||
{
|
|
||||||
switch ($data)
|
function setData($datas, $api)
|
||||||
{
|
{
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
switch ($data) {
|
||||||
case 'startTime':
|
case 'startTime':
|
||||||
$api->addData('startTime', formatTime(time() - rpi_getRuntime()));
|
$api->addData('startTime', formatTime(time() - rpi_getRuntime()));
|
||||||
break;
|
break;
|
||||||
@@ -26,7 +33,7 @@ if (isset($_POST['data']))
|
|||||||
$api->addData('cpuClock', rpi_getCpuClock());
|
$api->addData('cpuClock', rpi_getCpuClock());
|
||||||
break;
|
break;
|
||||||
case 'cpuLoad':
|
case 'cpuLoad':
|
||||||
$api->addData('cpuLoad', rpi_getCpuLoad(true));
|
$api->addData('cpuLoad', rpi_getCpuLoad(false));
|
||||||
break;
|
break;
|
||||||
case 'cpuTemp':
|
case 'cpuTemp':
|
||||||
$api->addData('cpuTemp', numberFormat(rpi_getCoreTemprature()));
|
$api->addData('cpuTemp', numberFormat(rpi_getCoreTemprature()));
|
||||||
@@ -37,31 +44,26 @@ if (isset($_POST['data']))
|
|||||||
break;
|
break;
|
||||||
case 'memoryUsed':
|
case 'memoryUsed':
|
||||||
$memory = rpi_getMemoryInfo();
|
$memory = rpi_getMemoryInfo();
|
||||||
$api->addData('memoryUsed', sizeUnit($memory[count($memory)-1]['used']));
|
$api->addData('memoryUsed', sizeUnit($memory[count($memory) - 1]['used']));
|
||||||
break;
|
break;
|
||||||
case 'memoryFree':
|
case 'memoryFree':
|
||||||
$memory = rpi_getMemoryInfo();
|
$memory = rpi_getMemoryInfo();
|
||||||
$api->addData('memoryFree', sizeUnit($memory[count($memory)-1]['free']));
|
$api->addData('memoryFree', sizeUnit($memory[count($memory) - 1]['free']));
|
||||||
break;
|
break;
|
||||||
case 'memoryTotal':
|
case 'memoryTotal':
|
||||||
$memory = rpi_getMemoryInfo();
|
$memory = rpi_getMemoryInfo();
|
||||||
$api->addData('memoryTotal', sizeUnit($memory[count($memory)-1]['total']));
|
$api->addData('memoryTotal', sizeUnit($memory[count($memory) - 1]['total']));
|
||||||
break;
|
break;
|
||||||
case 'memoryPercent':
|
case 'memoryPercent':
|
||||||
$memory = rpi_getMemoryInfo();
|
$memory = rpi_getMemoryInfo();
|
||||||
$api->addData('memoryPercent', $memory[count($memory)-1]['percent']);
|
$api->addData('memoryPercent', $memory[count($memory) - 1]['percent']);
|
||||||
break;
|
break;
|
||||||
case 'devices':
|
case 'devices':
|
||||||
$api->addData('devices', rpi_getUsbDevices());
|
$api->addData('devices', rpi_getUsbDevices());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$api->setError('error', 'Data for "'.$data.'" are not available.');
|
$api->setError('error', 'Data for "' . $data . '" are not available.');
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
$api->setError('error', 'No data set.');
|
|
||||||
|
|
||||||
$api->display();
|
|
||||||
?>
|
|
||||||
@@ -111,4 +111,3 @@ if (isset($_POST['logout']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$api->display();
|
$api->display();
|
||||||
?>
|
|
||||||
@@ -1,22 +1,40 @@
|
|||||||
<?php
|
<?php
|
||||||
const PICONTROL = true;
|
const PICONTROL = true;
|
||||||
|
|
||||||
(include_once realpath(dirname(__FILE__)).'/../../resources/init.php') or die('Error: 0x0000');
|
(include_once realpath(dirname(__FILE__)) . '/../../resources/init.php') or die('Error: 0x0000');
|
||||||
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
|
(include_once LIBRARY_PATH . 'main/main.function.php') or die('Error: 0x0001');
|
||||||
(include_once LIBRARY_PATH.'statistic/statistic.class.php') or die('Error: 0x0002');
|
(include_once LIBRARY_PATH . 'statistic/statistic.class.php') or die('Error: 0x0002');
|
||||||
(include_once LIBRARY_PATH.'statistic/statistic.function.php') or die('Error: 0x0003');
|
(include_once LIBRARY_PATH . 'statistic/statistic.function.php') or die('Error: 0x0003');
|
||||||
(include_once LIBRARY_PATH.'api/api.class.php') or die('Error: 0x0004');
|
(include_once LIBRARY_PATH . 'api/api.class.php') or die('Error: 0x0004');
|
||||||
(include_once LIBRARY_PATH.'plugin/plugin.function.php') or die('Error: 0x0005');
|
(include_once LIBRARY_PATH . 'plugin/plugin.function.php') or die('Error: 0x0005');
|
||||||
|
|
||||||
$api = new API;
|
$requestMethod = $_SERVER["REQUEST_METHOD"];
|
||||||
|
|
||||||
if (isset($_POST['id']))
|
if ($requestMethod == 'GET') {
|
||||||
{
|
$log = new LogStatistic();
|
||||||
|
$log->setFile(LOG_PATH . 'statistic/' . $_GET['statistic'] . '.csv');
|
||||||
|
$data = array();
|
||||||
|
$data['data'] = array();
|
||||||
|
$limit = 2016;
|
||||||
|
if (isset($_GET['limit'])) {
|
||||||
|
$limit = $_GET['limit'];
|
||||||
|
}
|
||||||
|
$i = 0;
|
||||||
|
foreach ($log->getAll() as $row) {
|
||||||
|
if ($i >= 2016 - $limit) {
|
||||||
|
array_push($data['data'], array('time' => (int)$row[0], 'value' => (float)$row[1]));
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
echo json_encode($data);
|
||||||
|
} else {
|
||||||
|
$api = new API;
|
||||||
|
|
||||||
|
if (isset($_POST['id'])) {
|
||||||
$controller = new StatisticController();
|
$controller = new StatisticController();
|
||||||
$controller->loadStatistics();
|
$controller->loadStatistics();
|
||||||
|
|
||||||
if (($name = $controller->getStatisticName($_POST['id'])) !== false)
|
if (($name = $controller->getStatisticName($_POST['id'])) !== false) {
|
||||||
{
|
|
||||||
if (isset($_POST['plugin']) && trim($_POST['plugin']) != '')
|
if (isset($_POST['plugin']) && trim($_POST['plugin']) != '')
|
||||||
pluginLanguage(trim($_POST['plugin']));
|
pluginLanguage(trim($_POST['plugin']));
|
||||||
|
|
||||||
@@ -25,29 +43,28 @@ if (isset($_POST['id']))
|
|||||||
$statistic = $builder->getArray();
|
$statistic = $builder->getArray();
|
||||||
|
|
||||||
$log = new LogStatistic();
|
$log = new LogStatistic();
|
||||||
$log->setFile(LOG_PATH.$statistic['raw'].'.csv');
|
$log->setFile(LOG_PATH . $statistic['raw'] . '.csv');
|
||||||
|
$logData = $log->getAll();
|
||||||
|
|
||||||
$arr = $info = array();
|
$arr = $info = array();
|
||||||
|
|
||||||
foreach ($statistic['columns'] as $column)
|
foreach ($statistic['columns'] as $column) {
|
||||||
$arr['cols'][] = array('id' => '', 'label' => _t($column['label']), 'type' => $column['type']);
|
$arr['cols'][] = array('id' => '', 'label' => _t($column['label']), 'type' => $column['type']);
|
||||||
|
}
|
||||||
|
|
||||||
getRowsFromLog($arr, $info, $log->getAll(), $statistic['columns'], $statistic['cycle']);
|
getRowsFromLog($arr, $info, $logData, $statistic['columns'], $statistic['cycle']);
|
||||||
|
|
||||||
if (isset($arr['rows']))
|
if (isset($arr['rows'])) {
|
||||||
{
|
|
||||||
if (isset($_POST['type']) && $_POST['type'] == 'googleChart')
|
if (isset($_POST['type']) && $_POST['type'] == 'googleChart')
|
||||||
$arr['rows'] = convertForGoogleChart($arr['rows']);
|
$arr['rows'] = convertForGoogleChart($arr['rows']);
|
||||||
|
|
||||||
$arr['rows'] = array_slice($arr['rows'], -2016);
|
$arr['rows'] = array_slice($arr['rows'], -2016);
|
||||||
$arr['periods'] = $info['periods'];
|
$arr['periods'] = $info['periods'];
|
||||||
|
|
||||||
foreach (array('min', 'max') as $type)
|
foreach (array('min', 'max') as $type) {
|
||||||
{
|
|
||||||
if ($statistic['limits'][$type]['use'] == 'multiply')
|
if ($statistic['limits'][$type]['use'] == 'multiply')
|
||||||
$arr[$type] = round($info[$type] * $statistic['limits'][$type]['value']);
|
$arr[$type] = round($info[$type] * $statistic['limits'][$type]['value']);
|
||||||
elseif ($statistic['limits'][$type]['use'] == 'fix')
|
elseif ($statistic['limits'][$type]['use'] == 'fix') {
|
||||||
{
|
|
||||||
if ($statistic['limits'][$type]['fix'] == true)
|
if ($statistic['limits'][$type]['fix'] == true)
|
||||||
$arr[$type] = $statistic['limits'][$type]['value'];
|
$arr[$type] = $statistic['limits'][$type]['value'];
|
||||||
else
|
else
|
||||||
@@ -56,23 +73,18 @@ if (isset($_POST['id']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$api->addData('statistic', $arr);
|
$api->addData('statistic', $arr);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$api->setError('error', 'Empty data.');
|
$api->setError('error', 'Empty data.');
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$api->setError('error', 'Data not found.');
|
$api->setError('error', 'Data not found.');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$statistics = array();
|
$statistics = array();
|
||||||
$hiddenStatistics = unserialize(htmlspecialchars_decode(getConfig('main:statistic.hidden', 'a:0:{}')));
|
$hiddenStatistics = unserialize(htmlspecialchars_decode(getConfig('main:statistic.hidden', 'a:0:{}')));
|
||||||
|
|
||||||
$controller = new StatisticController();
|
$controller = new StatisticController();
|
||||||
$controller->loadStatistics();
|
$controller->loadStatistics();
|
||||||
|
|
||||||
foreach ($controller->getStatistics() as $statistic)
|
foreach ($controller->getStatistics() as $statistic) {
|
||||||
{
|
|
||||||
$builder = new StatisticBuilder();
|
$builder = new StatisticBuilder();
|
||||||
$builder->loadFromFile($statistic);
|
$builder->loadFromFile($statistic);
|
||||||
|
|
||||||
@@ -83,6 +95,7 @@ else
|
|||||||
|
|
||||||
$api->addData('statistics', $statistics);
|
$api->addData('statistics', $statistics);
|
||||||
$api->addData('hidden', $hiddenStatistics);
|
$api->addData('hidden', $hiddenStatistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
$api->display();
|
$api->display();
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,4 +7,3 @@ $apiVersions[0] = array('versioncode' => 1,
|
|||||||
'date' => 1443909600);
|
'date' => 1443909600);
|
||||||
|
|
||||||
echo json_encode(array('versions' => $apiVersions, 'latest' => $apiLatest));
|
echo json_encode(array('versions' => $apiVersions, 'latest' => $apiLatest));
|
||||||
?>
|
|
||||||
@@ -48,10 +48,10 @@
|
|||||||
<td><?php _e('SSH2-Erweiterung installiert'); ?></td>
|
<td><?php _e('SSH2-Erweiterung installiert'); ?></td>
|
||||||
<td class="<?php echo ($data['phpSSH']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpSSH']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'#phpssh'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
<td class="<?php echo ($data['phpSSH']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpSSH']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'#phpssh'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<!--<tr>
|
||||||
<td><?php _e('Mcrypt-Erweiterung installiert'); ?></td>
|
<td><?php _e('Mcrypt-Erweiterung installiert'); ?></td>
|
||||||
<td class="<?php echo ($data['phpMcrypt']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpMcrypt']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&i=12'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
<td class="<?php echo ($data['phpMcrypt']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpMcrypt']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&i=12'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
||||||
</tr>
|
</tr>-->
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php _e('CLI-Erweiterung installiert'); ?></td>
|
<td><?php _e('CLI-Erweiterung installiert'); ?></td>
|
||||||
<td class="<?php echo ($data['phpCLI']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpCLI']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&i=13'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
<td class="<?php echo ($data['phpCLI']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpCLI']['status'] == true) ? '✔' : '✖ <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&i=13'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('PICONTROL')) exit();
|
if (!defined('PICONTROL')) exit();
|
||||||
|
|
||||||
(include_once LIBRARY_PATH.'main/rpi.function.php') or die('Error: 0x0010');
|
(include_once LIBRARY_PATH . 'main/rpi.function.php') or die('Error: 0x0010');
|
||||||
(include_once LIBRARY_PATH.'install/install.function.php') or die('Error: 0x0011');
|
(include_once LIBRARY_PATH . 'install/install.function.php') or die('Error: 0x0011');
|
||||||
$tpl->setHeaderTitle(_t('Anforderungen'));
|
$tpl->setHeaderTitle(_t('Anforderungen'));
|
||||||
|
|
||||||
// PHP
|
// PHP
|
||||||
$phpVersion = array('version' => PHP_VERSION, 'status' => false);
|
$phpVersion = array('version' => PHP_VERSION, 'status' => false);
|
||||||
$phpSSH = array('status' => false);
|
$phpSSH = array('status' => true);
|
||||||
$phpMcrypt = array('status' => false);
|
$phpMcrypt = array('status' => false);
|
||||||
$phpCLI = array('status' => false);
|
$phpCLI = array('status' => false);
|
||||||
$phpCURL = array('status' => false);
|
$phpCURL = array('status' => false);
|
||||||
@@ -15,7 +15,7 @@ $phpZipArchive = array('status' => false);
|
|||||||
$phpAllowUrlFopen = array('status' => false);
|
$phpAllowUrlFopen = array('status' => false);
|
||||||
$filesFoldersExist = array('count' => 0, 'status' => true);
|
$filesFoldersExist = array('count' => 0, 'status' => true);
|
||||||
$filesFoldersPermission = array('count' => 0, 'status' => true);
|
$filesFoldersPermission = array('count' => 0, 'status' => true);
|
||||||
$otherDistribution = array('version' => rpi_getDistribution(), 'status' => false);
|
$otherDistribution = array('version' => rpi_getDistribution(), 'status' => true);
|
||||||
$otherCookie = array('status' => false);
|
$otherCookie = array('status' => false);
|
||||||
$error = false;
|
$error = false;
|
||||||
|
|
||||||
@@ -25,10 +25,10 @@ if (version_compare(PHP_VERSION, '7.0.0') >= 0)
|
|||||||
if (extension_loaded('ssh2'))
|
if (extension_loaded('ssh2'))
|
||||||
$phpSSH['status'] = true;
|
$phpSSH['status'] = true;
|
||||||
|
|
||||||
//if (function_exists('mcrypt_encrypt') !== false)
|
#if (function_exists('mcrypt_encrypt') !== false)
|
||||||
$phpMcrypt['status'] = true;
|
# $phpMcrypt['status'] = true;
|
||||||
|
|
||||||
if (trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '')
|
if (trim(exec('dpkg -s php-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.1-cli | grep Status: ')) != '' || trim(exec('dpkg -s php8.2-cli | grep Status: ')) != '')
|
||||||
$phpCLI['status'] = true;
|
$phpCLI['status'] = true;
|
||||||
|
|
||||||
if (function_exists('curl_init') !== false)
|
if (function_exists('curl_init') !== false)
|
||||||
@@ -43,18 +43,14 @@ if (ini_get('allow_url_fopen') !== false)
|
|||||||
// Dateien und Ordner
|
// Dateien und Ordner
|
||||||
$filesFolders = fileFolderPermission();
|
$filesFolders = fileFolderPermission();
|
||||||
|
|
||||||
foreach ($filesFolders as $file => $info)
|
foreach ($filesFolders as $file => $info) {
|
||||||
{
|
if ($info['error'] === true) {
|
||||||
if ($info['error'] === true)
|
if ($info['existsBool'] === false || $info['filesizeBool'] === false) {
|
||||||
{
|
|
||||||
if ($info['existsBool'] === false || $info['filesizeBool'] === false)
|
|
||||||
{
|
|
||||||
$filesFoldersExist['count'] += 1;
|
$filesFoldersExist['count'] += 1;
|
||||||
$filesFoldersExist['status'] = false;
|
$filesFoldersExist['status'] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($info['permissionBool'] === false || $info['userGroupBool'] === false)
|
if ($info['permissionBool'] === false || $info['userGroupBool'] === false) {
|
||||||
{
|
|
||||||
$filesFoldersPermission['count'] += 1;
|
$filesFoldersPermission['count'] += 1;
|
||||||
$filesFoldersPermission['status'] = false;
|
$filesFoldersPermission['status'] = false;
|
||||||
}
|
}
|
||||||
@@ -62,8 +58,8 @@ foreach ($filesFolders as $file => $info)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sonstiges
|
// Sonstiges
|
||||||
if ($otherDistribution['version'] == 'Raspbian GNU/Linux 10' || $otherDistribution['version'] == 'Raspbian GNU/Linux 11')
|
//if ($otherDistribution['version'] == 'Raspbian GNU/Linux 10' || $otherDistribution['version'] == 'Raspbian GNU/Linux 11' || $otherDistribution['version'] == 'Debian GNU/Linux 11')
|
||||||
$otherDistribution['status'] = true;
|
// $otherDistribution['status'] = true;
|
||||||
|
|
||||||
if (isset($_COOKIE['_pi-control_install_language']) && $_COOKIE['_pi-control_install_language'] != '')
|
if (isset($_COOKIE['_pi-control_install_language']) && $_COOKIE['_pi-control_install_language'] != '')
|
||||||
$otherCookie['status'] = true;
|
$otherCookie['status'] = true;
|
||||||
@@ -71,7 +67,8 @@ else
|
|||||||
setCookie('_pi-control_install_language', $globalLanguage);
|
setCookie('_pi-control_install_language', $globalLanguage);
|
||||||
|
|
||||||
// Button
|
// Button
|
||||||
if ($phpVersion['status'] === false || $phpSSH['status'] === false || $phpMcrypt['status'] === false || $phpCLI['status'] === false || $phpCURL['status'] === false || $phpZipArchive['status'] === false || $phpAllowUrlFopen['status'] === false || $filesFoldersExist['status'] === false || $filesFoldersPermission['status'] === false || $otherDistribution['status'] === false || $otherCookie['status'] === false)
|
//if ($phpVersion['status'] === false || $phpSSH['status'] === false || $phpMcrypt['status'] === false || $phpCLI['status'] === false || $phpCURL['status'] === false || $phpZipArchive['status'] === false || $phpAllowUrlFopen['status'] === false || $filesFoldersExist['status'] === false || $filesFoldersPermission['status'] === false || $otherDistribution['status'] === false || $otherCookie['status'] === false)
|
||||||
|
if ($phpVersion['status'] === false || $phpSSH['status'] === false || $phpCLI['status'] === false || $phpCURL['status'] === false || $phpZipArchive['status'] === false || $phpAllowUrlFopen['status'] === false || $filesFoldersExist['status'] === false || $filesFoldersPermission['status'] === false || $otherDistribution['status'] === false || $otherCookie['status'] === false)
|
||||||
$error = true;
|
$error = true;
|
||||||
|
|
||||||
$tpl->assign('phpVersion', $phpVersion);
|
$tpl->assign('phpVersion', $phpVersion);
|
||||||
@@ -86,8 +83,7 @@ $tpl->assign('filesFoldersPermission', $filesFoldersPermission);
|
|||||||
$tpl->assign('otherDistribution', $otherDistribution);
|
$tpl->assign('otherDistribution', $otherDistribution);
|
||||||
$tpl->assign('otherCookie', $otherCookie);
|
$tpl->assign('otherCookie', $otherCookie);
|
||||||
$tpl->assign('error', $error);
|
$tpl->assign('error', $error);
|
||||||
$tpl->assign('langUrl', (isset($_GET['lang']) && $_GET['lang'] != '') ? '&lang='.$_GET['lang'] : '');
|
$tpl->assign('langUrl', (isset($_GET['lang']) && $_GET['lang'] != '') ? '&lang=' . $_GET['lang'] : '');
|
||||||
$tpl->assign('configHelp', $config['url']['help']);
|
$tpl->assign('configHelp', $config['url']['help']);
|
||||||
|
|
||||||
$tpl->draw('install_requirement');
|
$tpl->draw('install_requirement');
|
||||||
?>
|
|
||||||
|
|||||||
@@ -368,8 +368,15 @@ function urlIsPublic($url)
|
|||||||
$ip = gethostbyname($url);
|
$ip = gethostbyname($url);
|
||||||
$long = ip2long($ip);
|
$long = ip2long($ip);
|
||||||
|
|
||||||
if (($long >= 167772160 && $long <= 184549375) || ($long >= -1408237568 && $long <= -1407188993) || ($long >= -1062731776 && $long <= -1062666241) || ($long >= 2130706432 && $long <= 2147483647) || $long == -1)
|
if (PHP_INT_SIZE == 4) {
|
||||||
|
if (($long >= 167772160 && $long <= 184549375) || ($long >= -1408237568 && $long <= -1407188993) || ($long >= -1062731776 && $long <= -1062666241) || ($long >= 2130706432 && $long <= 2147483647) || $long == -1) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (($long >= 3232235520 && $long <= 3232301055) || ($long >= 2886729728 && $long <= 2887778303) || ($long >= 167772160 && $long <= 184549375) || $long == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -614,4 +621,3 @@ function getURLLangParam($echo = false, $html = true, $first = false)
|
|||||||
|
|
||||||
return $param;
|
return $param;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -650,7 +650,7 @@ class PiTpl
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function msg($type, $title = NULL, $msg, $cancelable = true, $id = 0)
|
public function msg($type, $msg, $title = NULL, $cancelable = true, $id = 0)
|
||||||
{
|
{
|
||||||
if (!strlen($type) > 0 || !is_string($type) ||
|
if (!strlen($type) > 0 || !is_string($type) ||
|
||||||
!strlen($msg) > 0 || !is_string($msg)
|
!strlen($msg) > 0 || !is_string($msg)
|
||||||
@@ -943,4 +943,3 @@ class PiTpl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
var is_loding = false;
|
var is_loding = false;
|
||||||
|
|
||||||
function overviewStatusRefreshEffect(element)
|
function overviewStatusRefreshEffect(element) {
|
||||||
{
|
element.css({ 'transition': 'background-color 0.5s', 'background-color': 'rgba(243, 255, 164, 1)' });
|
||||||
element.css({'transition': 'background-color 0.5s', 'background-color': 'rgba(243, 255, 164, 1)'});
|
setTimeout(function () {
|
||||||
setTimeout(function(){
|
element.css({ 'background-color': 'transparent' });
|
||||||
element.css({'background-color': 'transparent'});
|
|
||||||
}, 800);
|
}, 800);
|
||||||
}
|
}
|
||||||
|
|
||||||
function showError()
|
function showError() {
|
||||||
{
|
|
||||||
jQuery('.error-msg-refresh-bar').remove();
|
jQuery('.error-msg-refresh-bar').remove();
|
||||||
jQuery('.flex-box-refresh div:eq(0)').after('<div class="red error-msg-refresh-bar" style="vertical-align: bottom; font-weight: bold;">' + _t('Fehler!') + '</div>');
|
jQuery('.flex-box-refresh div:eq(0)').after('<div class="red error-msg-refresh-bar" style="vertical-align: bottom; font-weight: bold;">' + _t('Fehler!') + '</div>');
|
||||||
jQuery('.refresh-bar').stop(false, true).css('width', 0);
|
jQuery('.refresh-bar').stop(false, true).css('width', 0);
|
||||||
@@ -18,121 +16,87 @@ function showError()
|
|||||||
setTimeout('overviewStatusRefresh()', 3000);
|
setTimeout('overviewStatusRefresh()', 3000);
|
||||||
}
|
}
|
||||||
|
|
||||||
function overviewStatusRefresh()
|
function overviewStatusRefresh() {
|
||||||
{
|
|
||||||
jQuery('.error-msg-refresh-bar').remove();
|
jQuery('.error-msg-refresh-bar').remove();
|
||||||
jQuery('.refresh-bar').animate({width: '100%'}, reload_timeout, 'linear', function(e)
|
jQuery('.refresh-bar').animate({ width: '100%' }, reload_timeout, 'linear', function (e) {
|
||||||
{
|
let this_ = jQuery(this);
|
||||||
var this_ = jQuery(this);
|
let runtime = jQuery('.flex-container > div:eq(2)');
|
||||||
var runtime = jQuery('.flex-container > div:eq(2)');
|
let cpuClock = jQuery('.flex-container > div:eq(3)');
|
||||||
var cpuClock = jQuery('.flex-container > div:eq(3)');
|
let cpuLoad = jQuery('.flex-container > div:eq(4)');
|
||||||
var cpuLoad = jQuery('.flex-container > div:eq(4)');
|
let cpuTemp = jQuery('.flex-container > div:eq(5)');
|
||||||
var cpuTemp = jQuery('.flex-container > div:eq(5)');
|
let ramPercentage = jQuery('.flex-container > div:eq(6)');
|
||||||
var ramPercentage = jQuery('.flex-container > div:eq(6)');
|
let memoryUsed = jQuery('.flex-container > div:eq(7)');
|
||||||
var memoryUsed = jQuery('.flex-container > div:eq(7)');
|
let memoryFree = jQuery('.flex-container > div:eq(8)');
|
||||||
var memoryFree = jQuery('.flex-container > div:eq(8)');
|
let memoryTotal = jQuery('.flex-container > div:eq(9)');
|
||||||
var memoryTotal = jQuery('.flex-container > div:eq(9)');
|
|
||||||
|
|
||||||
jQuery('a[href=#refresh] img').addClass('rotate-icon');
|
jQuery('a[href=#refresh] img').addClass('rotate-icon');
|
||||||
|
|
||||||
this_.animate({width: '88.8%'}, 300, 'linear');
|
this_.animate({ width: '88.8%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'runtime' }, function(data)
|
jQuery.get('api/v1/overview.php', { data: 'runtime;cpuClock;cpuLoad;cpuTemp;ramPercentage;memoryUsed;memoryFree;memoryTotal' }, function (data) {
|
||||||
{
|
if (runtime.find('span').html() != data.data.runtime) {
|
||||||
if (runtime.find('span').html() != data.data.runtime)
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(runtime);
|
overviewStatusRefreshEffect(runtime);
|
||||||
runtime.find('span').html(data.data.runtime);
|
runtime.find('span').html(data.data.runtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '77.7%'}, 300, 'linear');
|
this_.animate({ width: '77.7%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'cpuClock' }, function(data)
|
if (cpuClock.find('span').html() != data.data.cpuClock + ' MHz') {
|
||||||
{
|
|
||||||
if (cpuClock.find('span').html() != data.data.cpuClock+' MHz')
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(cpuClock);
|
overviewStatusRefreshEffect(cpuClock);
|
||||||
cpuClock.find('span').html(data.data.cpuClock+' MHz');
|
cpuClock.find('span').html(data.data.cpuClock + ' MHz');
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '66.6%'}, 300, 'linear');
|
this_.animate({ width: '66.6%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'cpuLoad' }, function(data)
|
if (cpuLoad.find('.progressbar div').html() != data.data.cpuLoad + '%') {
|
||||||
{
|
|
||||||
if (cpuLoad.find('.progressbar div').html() != data.data.cpuLoad+'%')
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(cpuLoad);
|
overviewStatusRefreshEffect(cpuLoad);
|
||||||
cpuLoad.find('.progressbar').attr('data-text', data.data.cpuLoad+'%').find('div').css('width', data.data.cpuLoad+'%');
|
cpuLoad.find('.progressbar').attr('data-text', data.data.cpuLoad + '%').find('div').css('width', data.data.cpuLoad + '%');
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '55.5%'}, 300, 'linear');
|
this_.animate({ width: '55.5%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'cpuTemp' }, function(data)
|
if (cpuTemp.find('span').html() != data.data.cpuTemp + ' °C') {
|
||||||
{
|
|
||||||
if (cpuTemp.find('span').html() != data.data.cpuTemp+' °C')
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(cpuTemp);
|
overviewStatusRefreshEffect(cpuTemp);
|
||||||
cpuTemp.find('span').html(data.data.cpuTemp+' °C');
|
cpuTemp.find('span').html(data.data.cpuTemp + ' °C');
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '44.4%'}, 300, 'linear');
|
this_.animate({ width: '44.4%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'ramPercentage' }, function(data)
|
if (ramPercentage.find('.progressbar div').html() != data.data.ramPercentage + '%') {
|
||||||
{
|
|
||||||
if (ramPercentage.find('.progressbar div').html() != data.data.ramPercentage+'%')
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(ramPercentage);
|
overviewStatusRefreshEffect(ramPercentage);
|
||||||
ramPercentage.find('.progressbar').attr('data-text', data.data.ramPercentage+'%').find('div').css('width', data.data.ramPercentage+'%');
|
ramPercentage.find('.progressbar').attr('data-text', data.data.ramPercentage + '%').find('div').css('width', data.data.ramPercentage + '%');
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '33.3%'}, 300, 'linear');
|
this_.animate({ width: '33.3%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'memoryUsed' }, function(data)
|
if (memoryUsed.find('span').html() != data.data.memoryUsed) {
|
||||||
{
|
|
||||||
if (memoryUsed.find('span').html() != data.data.memoryUsed)
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(memoryUsed);
|
overviewStatusRefreshEffect(memoryUsed);
|
||||||
memoryUsed.find('span').html(data.data.memoryUsed);
|
memoryUsed.find('span').html(data.data.memoryUsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '22.2%'}, 300, 'linear');
|
this_.animate({ width: '22.2%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'memoryFree' }, function(data)
|
if (memoryFree.find('span').html() != data.data.memoryFree) {
|
||||||
{
|
|
||||||
if (memoryFree.find('span').html() != data.data.memoryFree)
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(memoryFree);
|
overviewStatusRefreshEffect(memoryFree);
|
||||||
memoryFree.find('span').html(data.data.memoryFree);
|
memoryFree.find('span').html(data.data.memoryFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '11.1%'}, 300, 'linear');
|
this_.animate({ width: '11.1%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'memoryTotal' }, function(data)
|
if (memoryTotal.find('span').html() != data.data.memoryTotal) {
|
||||||
{
|
|
||||||
if (memoryTotal.find('span').html() != data.data.memoryTotal)
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(memoryTotal);
|
overviewStatusRefreshEffect(memoryTotal);
|
||||||
memoryTotal.find('span').html(data.data.memoryTotal);
|
memoryTotal.find('span').html(data.data.memoryTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '0%'}, 300, 'linear', function(e) {
|
this_.animate({ width: '0%' }, 300, 'linear', function (e) {
|
||||||
is_loding = false;
|
is_loding = false;
|
||||||
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
||||||
});
|
});
|
||||||
|
|
||||||
overviewStatusRefresh();
|
overviewStatusRefresh();
|
||||||
}).fail(function(e) { showError(); });
|
}).fail(function (e) { showError(); });
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
}).fail(function(e) { showError(); });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
jQuery(document).on('click', 'a[href=#refresh]', function(e)
|
jQuery(document).on('click', 'a[href=#refresh]', function (e) {
|
||||||
{
|
|
||||||
if (is_loding == false)
|
if (is_loding == false)
|
||||||
jQuery('.refresh-bar').stop(false, true);
|
jQuery('.refresh-bar').stop(false, true);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery(document).ready(function(e)
|
jQuery(document).ready(function (e) {
|
||||||
{
|
|
||||||
overviewStatusRefresh();
|
overviewStatusRefresh();
|
||||||
});
|
});
|
||||||
@@ -1,22 +1,19 @@
|
|||||||
var dataSlider = [];
|
var dataSlider = [];
|
||||||
var dataPeriods = [];
|
var dataPeriods = [];
|
||||||
|
|
||||||
function statisticBuilder(builder, plugin)
|
function statisticBuilder(builder, plugin) {
|
||||||
{
|
jQuery.ajax({
|
||||||
var jsonData = jQuery.ajax({
|
|
||||||
url: 'api/v1/statistic.php',
|
url: 'api/v1/statistic.php',
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: { id: builder.id, plugin: plugin, type: 'googleChart' },
|
data: { id: builder.id, plugin: plugin, type: 'googleChart' },
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
async: true
|
async: true
|
||||||
}).done(function(data)
|
}).done(function (data) {
|
||||||
{
|
if (data.error != null) {
|
||||||
if (data.error != null)
|
|
||||||
{
|
|
||||||
if (data.error.message == 'Empty data.')
|
if (data.error.message == 'Empty data.')
|
||||||
jQuery('#chart_log_'+builder.id).html('<br /><br /><strong class="red">' + _t('Es sind noch keine Werte verfügbar. Werte werden alle %%s Minuten eingetragen.', builder.cycle) + '</strong>');
|
jQuery('#chart_log_' + builder.id).html('<br /><br /><strong class="red">' + _t('Es sind noch keine Werte verfügbar. Werte werden alle %%s Minuten eingetragen.', builder.cycle) + '</strong>');
|
||||||
else
|
else
|
||||||
jQuery('#chart_log_'+builder.id).html('<br /><br /><strong class="red">' + _t('Es ist ein Fehler aufgetreten! Fehler: %%s', data.error.message) + '</strong>');
|
jQuery('#chart_log_' + builder.id).html('<br /><br /><strong class="red">' + _t('Es ist ein Fehler aufgetreten! Fehler: %%s', data.error.message) + '</strong>');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -25,12 +22,12 @@ function statisticBuilder(builder, plugin)
|
|||||||
|
|
||||||
var myData = new google.visualization.DataTable(data.data.statistic);
|
var myData = new google.visualization.DataTable(data.data.statistic);
|
||||||
|
|
||||||
jQuery('#chart_log_'+builder.id).html('');
|
jQuery('#chart_log_' + builder.id).html('');
|
||||||
var myDashboard = new google.visualization.Dashboard(document.getElementById('dashboard_log_'+builder.id));
|
var myDashboard = new google.visualization.Dashboard(document.getElementById('dashboard_log_' + builder.id));
|
||||||
|
|
||||||
dataSlider[builder.id] = new google.visualization.ControlWrapper({
|
dataSlider[builder.id] = new google.visualization.ControlWrapper({
|
||||||
'controlType': 'DateRangeFilter',
|
'controlType': 'DateRangeFilter',
|
||||||
'containerId': 'chart_control_log_'+builder.id,
|
'containerId': 'chart_control_log_' + builder.id,
|
||||||
'options': {
|
'options': {
|
||||||
'filterColumnLabel': _t('Zeit'),
|
'filterColumnLabel': _t('Zeit'),
|
||||||
'ui': {
|
'ui': {
|
||||||
@@ -41,15 +38,13 @@ function statisticBuilder(builder, plugin)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var t = null;
|
|
||||||
|
|
||||||
var myLine = new google.visualization.ChartWrapper({
|
var myLine = new google.visualization.ChartWrapper({
|
||||||
'chartType' : 'AreaChart',
|
'chartType': 'AreaChart',
|
||||||
'containerId' : 'chart_log_'+builder.id,
|
'containerId': 'chart_log_' + builder.id,
|
||||||
'options': {
|
'options': {
|
||||||
vAxis: { title: builder.label, viewWindow: { max: data.data.statistic.max, min: data.data.statistic.min }, textPosition: 'in', textStyle: { fontSize: 11, color: '#AAAAAA' }, titleTextStyle: { fontSize: 11, color: '#AAAAAA' }, gridlines: { color: '#fff' } },
|
vAxis: { title: builder.label, viewWindow: { max: data.data.statistic.max, min: data.data.statistic.min }, textPosition: 'in', textStyle: { fontSize: 11, color: '#AAAAAA' }, titleTextStyle: { fontSize: 11, color: '#AAAAAA' }, gridlines: { color: '#fff' } },
|
||||||
dateFormat: 'dd.MM.yy HH:mm',
|
dateFormat: 'dd.MM.yy HH:mm',
|
||||||
hAxis: { format: 'dd.MM. HH:mm', textPosition: 'out', gridlines: { color: '#fff' } , textStyle: { fontSize: 11, color: '#AAAAAA' }},
|
hAxis: { format: 'dd.MM. HH:mm', textPosition: 'out', gridlines: { color: '#fff' }, textStyle: { fontSize: 11, color: '#AAAAAA' } },
|
||||||
focusTarget: 'category',
|
focusTarget: 'category',
|
||||||
crosshair: { orientation: 'vertical', trigger: 'both', color: '#AAAAAA', opacity: 0.4 },
|
crosshair: { orientation: 'vertical', trigger: 'both', color: '#AAAAAA', opacity: 0.4 },
|
||||||
chartArea: { width: '100%', height: '80%', top: 0 },
|
chartArea: { width: '100%', height: '80%', top: 0 },
|
||||||
@@ -84,33 +79,42 @@ function statisticBuilder(builder, plugin)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var formatter = new google.visualization.NumberFormat({ suffix: ' '+builder.unit });
|
var formatter = new google.visualization.NumberFormat({ suffix: ' ' + builder.unit });
|
||||||
|
|
||||||
for (var i = 1; i < builder.columns.length; i++)
|
for (var i = 1; i < builder.columns.length; i++)
|
||||||
formatter.format(myData, i);
|
formatter.format(myData, i);
|
||||||
|
|
||||||
myDashboard.bind(dataSlider[builder.id], myLine);
|
myDashboard.bind(dataSlider[builder.id], myLine);
|
||||||
myDashboard.draw(myData);
|
myDashboard.draw(myData);
|
||||||
}).fail(function(xhr, textStatus)
|
|
||||||
{
|
setRange();
|
||||||
jQuery('#chart_log_'+builder.id).html('<br /><br /><strong class="red">' + _t('Es ist ein Fehler aufgetreten! Fehlercode: %%s', xhr.status) + '</strong>');
|
}).fail(function (xhr, textStatus) {
|
||||||
|
jQuery('#chart_log_' + builder.id).html('<br /><br /><strong class="red">' + _t('Es ist ein Fehler aufgetreten! Fehlercode: %%s', xhr.status) + '</strong>');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeRange(dropdown)
|
function changeRange(dropdown) {
|
||||||
{
|
|
||||||
var days = Array('seven', 'six', 'five', 'four', 'three', 'two', 'one');
|
|
||||||
var day = dropdown.value;
|
var day = dropdown.value;
|
||||||
|
window.localStorage.setItem("days", day);
|
||||||
|
|
||||||
if (days.indexOf(day) > -1)
|
setRange();
|
||||||
{
|
}
|
||||||
for (var data in dataSlider)
|
|
||||||
{
|
function setRange() {
|
||||||
if (typeof dataSlider[data] != 'undefined')
|
var days = Array('seven', 'six', 'five', 'four', 'three', 'two', 'one');
|
||||||
{
|
var day = window.localStorage.getItem("days");
|
||||||
dataSlider[data].setState({'lowValue': new Date(dataPeriods[data][day])});
|
|
||||||
|
if (days.indexOf(day) > -1) {
|
||||||
|
for (var data in dataSlider) {
|
||||||
|
if (typeof dataSlider[data] != 'undefined') {
|
||||||
|
dataSlider[data].setState({ 'lowValue': new Date(dataPeriods[data][day]) });
|
||||||
dataSlider[data].draw();
|
dataSlider[data].draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener("DOMContentLoaded", function () {
|
||||||
|
if (window.localStorage.days)
|
||||||
|
document.getElementById("range").value = window.localStorage.days;
|
||||||
|
}, false);
|
||||||
@@ -14,15 +14,15 @@
|
|||||||
<a href="https://willy-tech.de/kontakt/" target="_blank" data-lang="<?php echo $data['language']; ?>"><?php _e('Feedback'); ?></a><br />
|
<a href="https://willy-tech.de/kontakt/" target="_blank" data-lang="<?php echo $data['language']; ?>"><?php _e('Feedback'); ?></a><br />
|
||||||
<a href="<?php echo $data['helpLink']; ?>" target="_blank"><?php _e('Hilfe'); ?></a><br />
|
<a href="<?php echo $data['helpLink']; ?>" target="_blank"><?php _e('Hilfe'); ?></a><br />
|
||||||
<a href="https://play.google.com/store/apps/details?id=de.willytech.picontrol" target="_blank" title="<?php _e('Öffne im Play Store'); ?>"><?php _e('App im Play Store'); ?></a><br />
|
<a href="https://play.google.com/store/apps/details?id=de.willytech.picontrol" target="_blank" title="<?php _e('Öffne im Play Store'); ?>"><?php _e('App im Play Store'); ?></a><br />
|
||||||
<a href="https://bitbucket.org/GSchulte/pi-control/" target="_blank"><?php _e('Git Repo'); ?></a></td>
|
<a href="https://bugs.schultes.dev/gregor/pi-control" target="_blank"><?php _e('Git Repo'); ?></a></td>
|
||||||
<td rowspan="2"><a href="https://www.die-schultes.eu/" target="_blank"><?php _e('Mein Blog'); ?></a><br />
|
<td rowspan="2"><a href="https://www.schultes.dev/" target="_blank"><?php _e('Mein Blog'); ?></a><br />
|
||||||
<td><?php echo $data['version']; ?></td>
|
<td><?php echo $data['version']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><strong><?php _e('LIZENZ'); ?></strong><span><?php _e('Raspberry Pi ist ein Markenzeichen<br />der %s.', '<a href="https://www.raspberrypi.org/" target="_blank">Raspberry Pi Foundation</a>'); ?></span></td>
|
<td><strong><?php _e('LIZENZ'); ?></strong><span><?php _e('Raspberry Pi ist ein Markenzeichen<br />der %s.', '<a href="https://www.raspberrypi.org/" target="_blank">Raspberry Pi Foundation</a>'); ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="footer-copyright"><?php _e('Mit %s entwickelt von %s.', '<span style="color: #F44336;">❤</span>', '<a href="https://willy-tech.de/" target="_blank">Willy Fritzsche</a>'); ?> 2013-2017 <br>Weiterentwickelt von <a href="https://www.die-schultes.eu">Gregor Schulte</a> 2021</div>
|
<div id="footer-copyright"><?php _e('Mit %s entwickelt von %s.', '<span style="color: #F44336;">❤</span>', '<a href="https://willy-tech.de/" target="_blank">Willy Fritzsche</a>'); ?> 2013-2017 <br>Weiterentwickelt von <a href="https://www.schultes.dev">Gregor Schulte</a> 2021-2023</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript">var errorHandler = '<?php echo $data['errorHandler']; ?>';</script>
|
<script type="text/javascript">var errorHandler = '<?php echo $data['errorHandler']; ?>';</script>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<div class="inner-header">
|
<div class="inner-header">
|
||||||
<span><?php _e('SSH-Login'); ?></span>
|
<span><?php _e('SSH-Login'); ?></span>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($data['logged_in'] === false) { ?>
|
<?php if ($data['logged_in'] === false) { ?>
|
||||||
<form action="?s=ssh_login" method="post">
|
<form action="?s=ssh_login" method="post">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<strong class="red"><?php _e('Du bist noch nicht angemeldet. Dadurch kannst du einige Funktionen nicht nutzen.'); ?></strong>
|
<strong class="red"><?php _e('Du bist noch nicht angemeldet. Dadurch kannst du einige Funktionen nicht nutzen.'); ?></strong>
|
||||||
@@ -38,7 +38,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="divider"><div></div><div><?php _e('ODER'); ?></div></div>
|
<div class="divider">
|
||||||
|
<div></div>
|
||||||
|
<div><?php _e('ODER'); ?></div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<input type="radio" id="ssh-login-pubkey" name="ssh-login" value="publickey" />
|
<input type="radio" id="ssh-login-pubkey" name="ssh-login" value="publickey" />
|
||||||
<label for="ssh-login-pubkey">
|
<label for="ssh-login-pubkey">
|
||||||
@@ -75,14 +78,14 @@
|
|||||||
<input type="submit" name="submit" value="<?php _e('Anmelden'); ?>" />
|
<input type="submit" name="submit" value="<?php _e('Anmelden'); ?>" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<strong class="green"><?php _e('Du bist bereits angemeldet mit dem Benutzer %s.', $data['ssh_info']['username']); ?></strong>
|
<strong class="green"><?php _e('Du bist bereits angemeldet mit dem Benutzer %s.', $data['ssh_info']['username']); ?></strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="inner-end">
|
<div class="inner-end">
|
||||||
<a href="?s=ssh_login&logout"><button><?php _e('Abmelden'); ?></button></a>
|
<a href="?s=ssh_login&logout"><button><?php _e('Abmelden'); ?></button></a>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
<span><?php _e('Zeitraum'); ?></span>
|
<span><?php _e('Zeitraum'); ?></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<select onchange="changeRange(this)">
|
<select id="range" onchange="changeRange(this)">
|
||||||
<option name="" value="seven"><?php _e('Alles (7 Tage)'); ?></option>
|
<option name="" value="seven"><?php _e('Alles (7 Tage)'); ?></option>
|
||||||
<option name="" value="six"><?php _e('Letzten 6 Tage'); ?></option>
|
<option name="" value="six"><?php _e('Letzten 6 Tage'); ?></option>
|
||||||
<option name="" value="five"><?php _e('Letzten 5 Tage'); ?></option>
|
<option name="" value="five"><?php _e('Letzten 5 Tage'); ?></option>
|
||||||
@@ -36,20 +36,20 @@
|
|||||||
<span><?php _e('Statistik'); ?></span>
|
<span><?php _e('Statistik'); ?></span>
|
||||||
<?php showSettingsIcon('?s=settings&do=statistic'); ?>
|
<?php showSettingsIcon('?s=settings&do=statistic'); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($data['msgInfo'] == 'invisible') { ?>
|
<?php if ($data['msgInfo'] == 'invisible') { ?>
|
||||||
<div class="inner-info">
|
<div class="inner-info">
|
||||||
<div><?php _e('Alle Statistiken sind ausgeblendet!'); ?></div>
|
<div><?php _e('Alle Statistiken sind ausgeblendet!'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } elseif ($data['msgInfo'] == 'empty') { ?>
|
<?php } elseif ($data['msgInfo'] == 'empty') { ?>
|
||||||
<div class="inner-info">
|
<div class="inner-info">
|
||||||
<div><?php _e('Es sind noch keine Statistiken verfügbar. Werte werden alle 5 Minuten eingetragen.'); ?></div>
|
<div><?php _e('Es sind noch keine Statistiken verfügbar. Werte werden alle 5 Minuten eingetragen.'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear-both"></div>
|
<div class="clear-both"></div>
|
||||||
<div class="order-3">
|
<div class="order-3">
|
||||||
<?php foreach ($data['statistics'] as $statistic) { ?>
|
<?php foreach ($data['statistics'] as $statistic) { ?>
|
||||||
<div class="box google-controls" id="dashboard_log_<?php echo $statistic['array']['id']; ?>">
|
<div class="box google-controls" id="dashboard_log_<?php echo $statistic['array']['id']; ?>">
|
||||||
<div class="inner-header">
|
<div class="inner-header">
|
||||||
<span><?php _e($statistic['array']['title']); ?></span>
|
<span><?php _e($statistic['array']['title']); ?></span>
|
||||||
@@ -60,18 +60,19 @@
|
|||||||
<div class="inner text-center" id="chart_control_log_<?php echo $statistic['array']['id']; ?>">
|
<div class="inner text-center" id="chart_control_log_<?php echo $statistic['array']['id']; ?>">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
|
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
||||||
<script type="text/javascript" src="public_html/js/statistic_builder.js"></script>
|
<script type="text/javascript" src="public_html/js/statistic_builder.js"></script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
google.load('visualization', '1', {packages:['controls']});
|
google.load('visualization', '51', {
|
||||||
|
packages: ['controls']
|
||||||
|
});
|
||||||
google.setOnLoadCallback(createTable);
|
google.setOnLoadCallback(createTable);
|
||||||
|
|
||||||
function createTable()
|
function createTable() {
|
||||||
{
|
<?php foreach ($data['statistics'] as $statistic) { ?>
|
||||||
<?php foreach ($data['statistics'] as $statistic) { ?>
|
|
||||||
statisticBuilder(<?php echo $statistic['json']; ?>, null);
|
statisticBuilder(<?php echo $statistic['json']; ?>, null);
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -1,14 +1,26 @@
|
|||||||
<?php if (!defined('PICONTROL')) exit(); ?>
|
<?php if (!defined('PICONTROL')) exit(); ?>
|
||||||
<style>
|
<style>
|
||||||
.system_msg{color: #01a7db; font-style: italic;}
|
.system_msg {
|
||||||
.user_name{font-weight:bold;}
|
color: #01a7db;
|
||||||
.user_message{color: #FFFFFF;}
|
font-style: italic;
|
||||||
pre { margin: 0; }
|
}
|
||||||
|
|
||||||
|
.user_name {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user_message {
|
||||||
|
color: #FFFFFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
var ip = '<?php echo $_SERVER['SERVER_ADDR']; ?>';
|
var ip = '<?php echo $_SERVER['SERVER_ADDR']; ?>';
|
||||||
var port = <?php echo $data['port']; ?>;
|
var port = <?php echo $data['port']; ?>;
|
||||||
var cookie = '<?php echo $data['cookie']; ?>';
|
var cookie = '<?php echo $data['cookie']; ?>';
|
||||||
</script>
|
</script>
|
||||||
<script language="javascript" type="text/javascript" src="public_html/js/terminal.websocket.js"></script>
|
<script language="javascript" type="text/javascript" src="public_html/js/terminal.websocket.js"></script>
|
||||||
<div class="sidebar">
|
<div class="sidebar">
|
||||||
@@ -19,9 +31,9 @@ var cookie = '<?php echo $data['cookie']; ?>';
|
|||||||
<div class="inner">
|
<div class="inner">
|
||||||
<strong id="status"><?php _e('Lade...'); ?></strong><br /><br />
|
<strong id="status"><?php _e('Lade...'); ?></strong><br /><br />
|
||||||
<select name="terminal">
|
<select name="terminal">
|
||||||
<?php foreach ($data['ports'] as $index => $port) { ?>
|
<?php foreach ($data['ports'] as $index => $port) { ?>
|
||||||
<option style="background: <?php echo ($port['active'] === true) ? '#73CA3C' : '#E9492E'; ?>;" value="<?php echo $port['port']; ?>"<?php if ($data['port'] == $port['port']) echo ' selected="selected"'; ?>><?php _e('Terminal %d (%s)', $index+1, ($port['active'] === true) ? _t('Online') : _t('Offline')); ?></option>
|
<option style="background: <?php echo ($port['active'] === true) ? '#73CA3C' : '#E9492E'; ?>;" value="<?php echo $port['port']; ?>" <?php if ($data['port'] == $port['port']) echo ' selected="selected"'; ?>><?php _e('Terminal %d (%s)', $index + 1, ($port['active'] === true) ? _t('Online') : _t('Offline')); ?></option>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</select>
|
</select>
|
||||||
<div id="frame"></div>
|
<div id="frame"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,24 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('PICONTROL')) exit();
|
if (!defined('PICONTROL')) exit();
|
||||||
|
|
||||||
(include_once LIBRARY_PATH.'main/rpi.function.php') or die('Error: 0x0010');
|
(include_once LIBRARY_PATH . 'main/rpi.function.php') or die('Error: 0x0010');
|
||||||
(include_once LIBRARY_PATH.'network/network.function.php') or die('Error: 0x0011');
|
(include_once LIBRARY_PATH . 'network/network.function.php') or die('Error: 0x0011');
|
||||||
$tpl->setHeaderTitle(_t('Netzwerk'));
|
$tpl->setHeaderTitle(_t('Netzwerk'));
|
||||||
|
|
||||||
if (isset($_GET['hostname']))
|
if (isset($_GET['hostname'])) {
|
||||||
{
|
if (isset($_POST['submit']) && $_POST['submit'] != '') {
|
||||||
if (isset($_POST['submit']) && $_POST['submit'] != '')
|
if (isset($_POST['hostname']) && trim($pHostname = trim($_POST['hostname'])) != '') {
|
||||||
{
|
if (preg_match('/^([a-z][a-z0-9\-\.]*[^\-]){1,24}$/im', $pHostname)) {
|
||||||
if (isset($_POST['hostname']) && trim($pHostname = trim($_POST['hostname'])) != '')
|
|
||||||
{
|
|
||||||
if (preg_match('/^([a-z][a-z0-9\-\.]*[^\-]){1,24}$/im', $pHostname))
|
|
||||||
{
|
|
||||||
if (($status = editHostname($pHostname)) === true)
|
if (($status = editHostname($pHostname)) === true)
|
||||||
$tpl->msg('success', _t('Hostname gespeichert'), _t('Damit die Änderung wirksam wird, muss dein Raspberry Pi neu gestartet werden. <a href="%s">Jetzt neu starten.</a>', '?s=shutdown&restart'));
|
$tpl->msg('success', _t('Hostname gespeichert'), _t('Damit die Änderung wirksam wird, muss dein Raspberry Pi neu gestartet werden. <a href="%s">Jetzt neu starten.</a>', '?s=shutdown&restart'));
|
||||||
else
|
else
|
||||||
$tpl->msg('error', _t('Fehler'), _t('Fehler beim Ändern des Hostname! Fehlercode: %s', $status));
|
$tpl->msg('error', _t('Fehler'), _t('Fehler beim Ändern des Hostname! Fehlercode: %s', $status));
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$tpl->msg('error', _t('Fehler'), _t('Der Hostname ist ungültig! Er muss aus mindestens 1 bis 24 Zeichen bestehen und darf nur folgende Zeichen enthalten: A-Z a-z 0-9 -<br />Der Hostname darf nicht mit einem Bindestrich Anfangen oder Enden.'));
|
$tpl->msg('error', _t('Fehler'), _t('Der Hostname ist ungültig! Er muss aus mindestens 1 bis 24 Zeichen bestehen und darf nur folgende Zeichen enthalten: A-Z a-z 0-9 -<br />Der Hostname darf nicht mit einem Bindestrich Anfangen oder Enden.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,16 +21,13 @@ if (isset($_GET['hostname']))
|
|||||||
$tpl->assign('hostname', rpi_getHostname());
|
$tpl->assign('hostname', rpi_getHostname());
|
||||||
|
|
||||||
$tpl->draw('network_hostname');
|
$tpl->draw('network_hostname');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$networkConnections = getAllNetworkConnections();
|
$networkConnections = getAllNetworkConnections();
|
||||||
|
|
||||||
$networkCounts = unserialize(htmlspecialchars_decode(getConfig('main:network.overflowCount', 'a:0:{}')));
|
$networkCounts = unserialize(htmlspecialchars_decode(getConfig('main:network.overflowCount', 'a:0:{}')));
|
||||||
$counter = 0;
|
$counter = 0;
|
||||||
|
|
||||||
foreach ($networkConnections as $network)
|
foreach ($networkConnections as $network) {
|
||||||
{
|
|
||||||
$countSent = 0;
|
$countSent = 0;
|
||||||
$countReceive = 0;
|
$countReceive = 0;
|
||||||
|
|
||||||
@@ -57,4 +49,3 @@ else
|
|||||||
|
|
||||||
$tpl->draw('network');
|
$tpl->draw('network');
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -38,7 +38,7 @@ $tpl->assign('configHelpFilesFolders', $config['url']['help'].'?s=view&i=1'.
|
|||||||
$tpl->assign('configHelpCron', $config['url']['help'].'?s=view&i=10'.getURLLangParam());
|
$tpl->assign('configHelpCron', $config['url']['help'].'?s=view&i=10'.getURLLangParam());
|
||||||
$tpl->assign('cronEntry', $cronEntry);
|
$tpl->assign('cronEntry', $cronEntry);
|
||||||
$tpl->assign('cronMatch', $cronMatch);
|
$tpl->assign('cronMatch', $cronMatch);
|
||||||
$tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') ? true : false));
|
$tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') ? true : false));
|
||||||
$tpl->assign('cronLastExecution', formatTime(getConfig('cron:execution.cron', 0)));
|
$tpl->assign('cronLastExecution', formatTime(getConfig('cron:execution.cron', 0)));
|
||||||
$tpl->assign('cronLastExecutionBool', ($cronLastExecutionBool = (getConfig('cron:execution.cron', 0) > time()-150) ? true : false));
|
$tpl->assign('cronLastExecutionBool', ($cronLastExecutionBool = (getConfig('cron:execution.cron', 0) > time()-150) ? true : false));
|
||||||
$tpl->assign('cronLastExecutionLog', formatTime($lastExecutionLog[0]));
|
$tpl->assign('cronLastExecutionLog', formatTime($lastExecutionLog[0]));
|
||||||
|
|||||||
@@ -3,33 +3,29 @@ if (PHP_SAPI != 'cli') exit();
|
|||||||
const PICONTROL = true;
|
const PICONTROL = true;
|
||||||
|
|
||||||
$doNotCheckForAuthentification = true;
|
$doNotCheckForAuthentification = true;
|
||||||
(include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000');
|
(include_once realpath(dirname(__FILE__)) . '/../init.php') or die('Error: 0x0000');
|
||||||
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
|
(include_once LIBRARY_PATH . 'main/main.function.php') or die('Error: 0x0001');
|
||||||
|
|
||||||
$folder = CRON_PATH;
|
$folder = CRON_PATH;
|
||||||
$fileArray = array();
|
$fileArray = array();
|
||||||
|
|
||||||
foreach (@scandir($folder) as $file)
|
foreach (@scandir($folder) as $file) {
|
||||||
{
|
if ($file[0] != '.') {
|
||||||
if ($file[0] != '.')
|
if (is_file($folder . '/' . $file) && $file != 'init.php')
|
||||||
{
|
|
||||||
if (is_file($folder.'/'.$file) && $file != 'init.php')
|
|
||||||
$fileArray[] = $file;
|
$fileArray[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($fileArray as $file)
|
foreach ($fileArray as $file) {
|
||||||
{
|
|
||||||
$timeOfFile = str_replace('-', '', substr($file, 0, 2));
|
$timeOfFile = str_replace('-', '', substr($file, 0, 2));
|
||||||
$rest = date('i', time()) % $timeOfFile;
|
$rest = date('i', time()) % $timeOfFile;
|
||||||
|
|
||||||
if (is_numeric($rest) && $rest == 0)
|
if (is_numeric($rest) && $rest == 0) {
|
||||||
{
|
exec('/usr/bin/php -f "' . CRON_PATH . $file . '"');
|
||||||
exec('/usr/bin/php -f "'.CRON_PATH.$file.'"');
|
|
||||||
set_time_limit(30);
|
set_time_limit(30);
|
||||||
usleep(500000);
|
usleep(500000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '')
|
if (trim(exec('dpkg -s php-cli | grep Status: ')) != '')
|
||||||
setConfig('cron:execution.cron', time());
|
setConfig('cron:execution.cron', time());
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ if (!isset($config))
|
|||||||
'ssh_ip' => '127.0.0.1'
|
'ssh_ip' => '127.0.0.1'
|
||||||
),
|
),
|
||||||
'version' => array(
|
'version' => array(
|
||||||
'version' => '2.2.0',
|
'version' => '2.3.3',
|
||||||
'versioncode' => 30,
|
'versioncode' => 38,
|
||||||
'android_comp_level' => 25
|
'android_comp_level' => 25
|
||||||
),
|
),
|
||||||
'url' => array(
|
'url' => array(
|
||||||
'update' => 'https://pic.die-schultes.eu/service/v1/update/',
|
'update' => 'https://pic.schultes.dev/api/service/v2/update/',
|
||||||
'updateDownload' => 'https://www.die-schultes.eu/wp-content/uploads/',
|
'updateDownload' => 'https://pic.schultes.dev/api/download/',
|
||||||
'updateNotification' => 'https://pi-control.de/?service=update_notification',
|
'updateNotification' => 'https://pi-control.de/?service=update_notification',
|
||||||
'plugin' => 'https://pi-control.de/service/v1/plugin/',
|
'plugin' => 'https://pi-control.de/service/v1/plugin/',
|
||||||
'pluginDownload' => 'https://pi-control.de/?service=plugin',
|
'pluginDownload' => 'https://pi-control.de/?service=plugin',
|
||||||
@@ -26,20 +26,20 @@ if (!isset($config))
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
defined('PICONTROL_PATH') or define('PICONTROL_PATH', realpath(dirname(__FILE__).'/../').'/');
|
defined('PICONTROL_PATH') || define('PICONTROL_PATH', realpath(dirname(__FILE__).'/../').'/');
|
||||||
defined('RESOURCE_PATH') or define('RESOURCE_PATH', realpath(dirname(__FILE__)).'/');
|
defined('RESOURCE_PATH') || define('RESOURCE_PATH', realpath(dirname(__FILE__)).'/');
|
||||||
defined('LIBRARY_PATH') or define('LIBRARY_PATH', realpath(dirname(__FILE__).'/library/').'/');
|
defined('LIBRARY_PATH') || define('LIBRARY_PATH', realpath(dirname(__FILE__).'/library/').'/');
|
||||||
defined('CONTENT_PATH') or define('CONTENT_PATH', realpath(dirname(__FILE__).'/content/').'/');
|
defined('CONTENT_PATH') || define('CONTENT_PATH', realpath(dirname(__FILE__).'/content/').'/');
|
||||||
defined('CONFIG_PATH') or define('CONFIG_PATH', realpath(dirname(__FILE__).'/config/').'/');
|
defined('CONFIG_PATH') || define('CONFIG_PATH', realpath(dirname(__FILE__).'/config/').'/');
|
||||||
defined('PLUGINS_PATH') or define('PLUGINS_PATH', realpath(dirname(__FILE__).'/plugins/').'/');
|
defined('PLUGINS_PATH') || define('PLUGINS_PATH', realpath(dirname(__FILE__).'/plugins/').'/');
|
||||||
defined('UPDATE_PATH') or define('UPDATE_PATH', realpath(dirname(__FILE__).'/update/').'/');
|
defined('UPDATE_PATH') || define('UPDATE_PATH', realpath(dirname(__FILE__).'/update/').'/');
|
||||||
defined('TEMPLATES_PATH') or define('TEMPLATES_PATH', realpath(dirname(__FILE__).'/../public_html/templates/').'/');
|
defined('TEMPLATES_PATH') || define('TEMPLATES_PATH', realpath(dirname(__FILE__).'/../public_html/templates/').'/');
|
||||||
defined('TEMPLATES2_PATH') or define('TEMPLATES2_PATH',realpath(dirname(__FILE__).'/templates/').'/');
|
defined('TEMPLATES2_PATH') || define('TEMPLATES2_PATH',realpath(dirname(__FILE__).'/templates/').'/');
|
||||||
defined('LOG_PATH') or define('LOG_PATH', realpath(dirname(__FILE__).'/log/').'/');
|
defined('LOG_PATH') || define('LOG_PATH', realpath(dirname(__FILE__).'/log/').'/');
|
||||||
defined('CRON_PATH') or define('CRON_PATH', realpath(dirname(__FILE__).'/cron/').'/');
|
defined('CRON_PATH') || define('CRON_PATH', realpath(dirname(__FILE__).'/cron/').'/');
|
||||||
defined('LANGUAGE_PATH') or define('LANGUAGE_PATH', realpath(dirname(__FILE__).'/languages/').'/');
|
defined('LANGUAGE_PATH') || define('LANGUAGE_PATH', realpath(dirname(__FILE__).'/languages/').'/');
|
||||||
defined('CACHE_PATH') or define('CACHE_PATH', realpath(dirname(__FILE__).'/cache/').'/');
|
defined('CACHE_PATH') || define('CACHE_PATH', realpath(dirname(__FILE__).'/cache/').'/');
|
||||||
defined('INSTALL_PATH') or define('INSTALL_PATH', realpath(dirname(__FILE__).'/../').'/install/');
|
defined('INSTALL_PATH') || define('INSTALL_PATH', realpath(dirname(__FILE__).'/../').'/install/');
|
||||||
|
|
||||||
$globalLanguage = isset($initConfig['language']) ? $initConfig['language'] : 'de';
|
$globalLanguage = isset($initConfig['language']) ? $initConfig['language'] : 'de';
|
||||||
$globalLanguageArray = array();
|
$globalLanguageArray = array();
|
||||||
@@ -81,4 +81,3 @@ if (isset($_COOKIE['debug'], $_GET['s']) && $_COOKIE['debug'] == 'debug_mode')
|
|||||||
|
|
||||||
if (!isset($doNotCheckForAuthentification))
|
if (!isset($doNotCheckForAuthentification))
|
||||||
(include LIBRARY_PATH.'main/authentification.php') or die('Nicht gefunden!');
|
(include LIBRARY_PATH.'main/authentification.php') or die('Nicht gefunden!');
|
||||||
?>
|
|
||||||
|
|||||||
6
resources/library/api/StatisticController.php
Normal file
6
resources/library/api/StatisticController.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?php
|
||||||
|
namespace resources\library\api;
|
||||||
|
|
||||||
|
class StatisticController {
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -3,14 +3,12 @@ if (!defined('PICONTROL')) exit();
|
|||||||
|
|
||||||
function rpi_getRuntime()
|
function rpi_getRuntime()
|
||||||
{
|
{
|
||||||
$runtime = trim(@shell_exec('cat /proc/uptime | awk -F \'.\' \'{print $1}\''));
|
return trim(@shell_exec('cat /proc/uptime | awk -F \'.\' \'{print $1}\''));
|
||||||
return $runtime;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getHostname()
|
function rpi_getHostname()
|
||||||
{
|
{
|
||||||
$host = trim(@shell_exec('cat /proc/sys/kernel/hostname'));
|
return trim(@shell_exec('cat /proc/sys/kernel/hostname'));
|
||||||
return $host;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getHostAddr()
|
function rpi_getHostAddr()
|
||||||
@@ -32,7 +30,7 @@ function rpi_getCoreTemprature()
|
|||||||
$file = @shell_exec('cat /sys/class/thermal/thermal_zone0/temp');
|
$file = @shell_exec('cat /sys/class/thermal/thermal_zone0/temp');
|
||||||
|
|
||||||
if ($file != false)
|
if ($file != false)
|
||||||
return round((trim($file)/1000), 2);
|
return round((trim($file) / 1000), 2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -42,7 +40,7 @@ function rpi_getCpuClock()
|
|||||||
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq');
|
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq');
|
||||||
|
|
||||||
if ($file !== false)
|
if ($file !== false)
|
||||||
return (int) round(trim($file)/1000);
|
return (int) round(trim($file) / 1000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -52,7 +50,7 @@ function rpi_getCpuMinClock()
|
|||||||
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq');
|
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq');
|
||||||
|
|
||||||
if ($file !== false)
|
if ($file !== false)
|
||||||
return (int) round(trim($file)/1000);
|
return (int) round(trim($file) / 1000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -62,7 +60,7 @@ function rpi_getCpuMaxClock()
|
|||||||
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq');
|
$file = shell_exec('cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq');
|
||||||
|
|
||||||
if ($file !== false)
|
if ($file !== false)
|
||||||
return (int) round(trim($file)/1000);
|
return (int) round(trim($file) / 1000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -75,34 +73,32 @@ function rpi_getCPUType()
|
|||||||
if (isset($match[1]))
|
if (isset($match[1]))
|
||||||
return $match[1];
|
return $match[1];
|
||||||
|
|
||||||
return NULL;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getCpuModel()
|
function rpi_getCpuModel()
|
||||||
{
|
{
|
||||||
$model = trim(@shell_exec('cat /proc/cpuinfo | grep -m 1 "model name" | tr -d " " | cut -d ":" -f 2'));
|
return trim(@shell_exec('cat /proc/cpuinfo | grep -m 1 "Model" | cut -d ":" -f 2'));
|
||||||
return $model;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getCPULoad($accurate = false, $mulitcore = false)
|
function rpi_getCPULoad($accurate = false, $mulitcore = false)
|
||||||
{
|
{
|
||||||
$return = NULL;
|
$return = null;
|
||||||
|
|
||||||
if ($accurate === true)
|
if ($accurate === true)
|
||||||
$file = shell_exec('cat /proc/stat; sleep 2; echo "##--##"; cat /proc/stat');
|
$file = shell_exec('cat /proc/stat; sleep 2; echo "##--##"; cat /proc/stat');
|
||||||
else
|
else
|
||||||
$file = shell_exec('cat /proc/stat; sleep 0.5; echo "##--##"; cat /proc/stat');
|
$file = shell_exec('cat /proc/stat; echo "##--##"; cat /proc/stat');
|
||||||
|
|
||||||
$file = explode('##--##', $file);
|
$file = explode('##--##', $file);
|
||||||
|
|
||||||
if (!isset($file[0], $file[1]))
|
if (!isset($file[0], $file[1]))
|
||||||
return NULL;
|
return null;
|
||||||
|
|
||||||
preg_match_all('/^cpu[0-9]?(.*)$/im', $file[0], $prevCPUStrings);
|
preg_match_all('/^cpu[0-9]?(.*)$/im', $file[0], $prevCPUStrings);
|
||||||
preg_match_all('/^cpu[0-9]?(.*)$/im', $file[1], $curCPUStrings);
|
preg_match_all('/^cpu[0-9]?(.*)$/im', $file[1], $curCPUStrings);
|
||||||
|
|
||||||
for ($i = 0; $i < count($prevCPUStrings[0]); $i++)
|
for ($i = 0; $i < count($prevCPUStrings[0]); $i++) {
|
||||||
{
|
|
||||||
$prevCPU = preg_split('/\s+/', $prevCPUStrings[0][$i]);
|
$prevCPU = preg_split('/\s+/', $prevCPUStrings[0][$i]);
|
||||||
$curCPU = preg_split('/\s+/', $curCPUStrings[0][$i]);
|
$curCPU = preg_split('/\s+/', $curCPUStrings[0][$i]);
|
||||||
|
|
||||||
@@ -111,7 +107,7 @@ function rpi_getCPULoad($accurate = false, $mulitcore = false)
|
|||||||
|
|
||||||
|
|
||||||
if (!isset($prevCPU[0], $curCPU[1]) || count($prevCPU) != 11 || count($curCPU) != 11)
|
if (!isset($prevCPU[0], $curCPU[1]) || count($prevCPU) != 11 || count($curCPU) != 11)
|
||||||
return NULL;
|
return null;
|
||||||
|
|
||||||
$prevIdle = $prevCPU[4] + $prevCPU[5];
|
$prevIdle = $prevCPU[4] + $prevCPU[5];
|
||||||
$curIdle = $curCPU[4] + $curCPU[5];
|
$curIdle = $curCPU[4] + $curCPU[5];
|
||||||
@@ -125,7 +121,7 @@ function rpi_getCPULoad($accurate = false, $mulitcore = false)
|
|||||||
$total = $curTotal - $prevTotal;
|
$total = $curTotal - $prevTotal;
|
||||||
$idle = $curIdle - $prevIdle;
|
$idle = $curIdle - $prevIdle;
|
||||||
|
|
||||||
if ($mulitcore == true)
|
if ($mulitcore)
|
||||||
$return[$prevCPU[0]] = (int) round(($total - $idle) / $total * 100);
|
$return[$prevCPU[0]] = (int) round(($total - $idle) / $total * 100);
|
||||||
else
|
else
|
||||||
$return = (int) round(($total - $idle) / $total * 100);
|
$return = (int) round(($total - $idle) / $total * 100);
|
||||||
@@ -138,8 +134,7 @@ function rpi_getDistribution()
|
|||||||
{
|
{
|
||||||
$distribution = trim(@shell_exec('cat /etc/issue | cut -d " " -f 1-3'));
|
$distribution = trim(@shell_exec('cat /etc/issue | cut -d " " -f 1-3'));
|
||||||
|
|
||||||
if ($distribution == '')
|
if ($distribution == '') {
|
||||||
{
|
|
||||||
$distributionString = @shell_exec('cat /etc/*-release | grep PRETTY_NAME');
|
$distributionString = @shell_exec('cat /etc/*-release | grep PRETTY_NAME');
|
||||||
|
|
||||||
preg_match('/.*="([\w\s\d\/]*).*"/i', $distributionString, $match);
|
preg_match('/.*="([\w\s\d\/]*).*"/i', $distributionString, $match);
|
||||||
@@ -155,27 +150,26 @@ function rpi_getDistribution()
|
|||||||
|
|
||||||
function rpi_getKernelVersion()
|
function rpi_getKernelVersion()
|
||||||
{
|
{
|
||||||
$kernel = trim(@shell_exec('cat /proc/version | cut -d " " -f 1,3'));
|
return trim(@shell_exec('cat /proc/version | cut -d " " -f 1,3'));
|
||||||
return $kernel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getCountRunningTasks()
|
function rpi_getCountRunningTasks()
|
||||||
{
|
{
|
||||||
$tasks = trim(@shell_exec('ps -auxeaf| wc -l'));
|
return trim(@shell_exec('ps -auxeaf| wc -l'));
|
||||||
return $tasks;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getCountInstalledPackages()
|
function rpi_getCountInstalledPackages()
|
||||||
{
|
{
|
||||||
$packages = trim(@shell_exec('dpkg --get-selections | grep -v deinstall | wc -l'));
|
return trim(@shell_exec('dpkg --get-selections | grep -v deinstall | wc -l'));
|
||||||
return $packages;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getInstalledPackages()
|
function rpi_getInstalledPackages()
|
||||||
{
|
{
|
||||||
@exec('dpkg -l | grep ^ii', $packages);
|
@exec('dpkg -l | grep ^ii', $packages);
|
||||||
|
|
||||||
$packages = array_map(function($package) { return preg_split('/[\s]+/', $package, 5); }, $packages);
|
$packages = array_map(function ($package) {
|
||||||
|
return preg_split('/[\s]+/', $package, 5);
|
||||||
|
}, $packages);
|
||||||
return $packages;
|
return $packages;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,8 +211,7 @@ function rpi_getRpiRevision()
|
|||||||
* +- Memory
|
* +- Memory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (isset($match[1]))
|
if (isset($match[1])) {
|
||||||
{
|
|
||||||
if ($match[1][0] == '1' || $match[1][0] == '2')
|
if ($match[1][0] == '1' || $match[1][0] == '2')
|
||||||
$match[1] = substr($match[1], 1);
|
$match[1] = substr($match[1], 1);
|
||||||
|
|
||||||
@@ -226,13 +219,14 @@ function rpi_getRpiRevision()
|
|||||||
return $revision[hexdec($match[1])];
|
return $revision[hexdec($match[1])];
|
||||||
elseif (strlen($match[1]) == 6 && $match[1][0] != 'a' && $match[1][0] != '9')
|
elseif (strlen($match[1]) == 6 && $match[1][0] != 'a' && $match[1][0] != '9')
|
||||||
return $revision[hexdec(substr($match[1], -4))];
|
return $revision[hexdec(substr($match[1], -4))];
|
||||||
elseif (strlen($match[1]) == 6)
|
elseif (strlen($match[1]) == 6) {
|
||||||
{
|
return array(
|
||||||
return array('revision' => $match[1],
|
'revision' => $match[1],
|
||||||
'model' => $revision_model[hexdec(substr($match[1], 3, 2))],
|
'model' => $revision_model[hexdec(substr($match[1], 3, 2))],
|
||||||
'pcb' => '1.'.hexdec(substr($match[1], -1)),
|
'pcb' => '1.' . hexdec(substr($match[1], -1)),
|
||||||
'memory' => $revision_memory[bindec(substr(decbin(hexdec(substr($match[1], 0, 1))), 1))],
|
'memory' => $revision_memory[bindec(substr(decbin(hexdec(substr($match[1], 0, 1))), 1))],
|
||||||
'manufacturer' => $revision_manufacturer[hexdec(substr($match[1], 1, 1))]);
|
'manufacturer' => $revision_manufacturer[hexdec(substr($match[1], 1, 1))]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,15 +244,14 @@ function rpi_getRpiSerial()
|
|||||||
function rpi_getMemorySplit()
|
function rpi_getMemorySplit()
|
||||||
{
|
{
|
||||||
$rev = $this->getRpiRevision();
|
$rev = $this->getRpiRevision();
|
||||||
if ($rev >= 7)
|
if ($rev >= 7) {
|
||||||
{
|
|
||||||
// 512 MB
|
// 512 MB
|
||||||
$config = @shell_exec('cat /boot/config.txt');
|
$config = @shell_exec('cat /boot/config.txt');
|
||||||
preg_match('#gpu_mem=([0-9]+)#i', $config, $match);
|
preg_match('#gpu_mem=([0-9]+)#i', $config, $match);
|
||||||
$total = intval($match[1]);
|
$total = intval($match[1]);
|
||||||
|
|
||||||
if ($total == 16)
|
if ($total == 16)
|
||||||
return array('system' => '496 MiB', 'video' => '16 MiB');
|
return array('system' => '1991 MiB', 'video' => '16 MiB');
|
||||||
elseif ($total == 32)
|
elseif ($total == 32)
|
||||||
return array('system' => '480 MiB', 'video' => '32 MiB');
|
return array('system' => '480 MiB', 'video' => '32 MiB');
|
||||||
elseif ($total == 64)
|
elseif ($total == 64)
|
||||||
@@ -280,29 +273,21 @@ function rpi_getMemorySplit()
|
|||||||
elseif ($total > 192 && $total <= 224)
|
elseif ($total > 192 && $total <= 224)
|
||||||
return array('system' => '224 MiB', 'video' => '32 MiB');
|
return array('system' => '224 MiB', 'video' => '32 MiB');
|
||||||
|
|
||||||
return array('system' => '240 MiB', 'video' => '16 MiB');
|
return array('system' => '1991 MiB', 'video' => '16 MiB');
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getMemoryUsage()
|
function rpi_getMemoryUsage()
|
||||||
{
|
{
|
||||||
exec('free -bo 2>/dev/null || free -b', $data);
|
exec('free -b', $data);
|
||||||
|
|
||||||
if (strpos($data[0], 'available') !== false) {
|
|
||||||
list($type, $total, $used, $free, $shared, $buffers, $available) = preg_split('#\s+#', $data[1]);
|
list($type, $total, $used, $free, $shared, $buffers, $available) = preg_split('#\s+#', $data[1]);
|
||||||
$usage = (int) round(($total - $available) / $total * 100);
|
$usage = (int) round(($total - $available) / $total * 100);
|
||||||
|
|
||||||
return array('percent' => $usage, 'total' => $total, 'free' => $available, 'used' => ($total - $available));
|
return array('percent' => $usage, 'total' => $total, 'free' => $available, 'used' => ($total - $available));
|
||||||
}
|
|
||||||
|
|
||||||
list($type, $total, $used, $free, $shared, $buffers, $cached) = preg_split('#\s+#', $data[1]);
|
|
||||||
$usage = (int) round(($used - $buffers - $cached) / $total * 100);
|
|
||||||
|
|
||||||
return array('percent' => $usage, 'total' => $total, 'free' => ($free + $buffers + $cached), 'used' => ($used - $buffers - $cached));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function rpi_getSwapUsage()
|
function rpi_getSwapUsage()
|
||||||
{
|
{
|
||||||
exec('free -bo 2>/dev/null || free -b', $data);
|
exec('free -b', $data);
|
||||||
list($type, $total, $used, $free) = preg_split('#\s+#', $data[2]);
|
list($type, $total, $used, $free) = preg_split('#\s+#', $data[2]);
|
||||||
$usage = (int) round($used / $total * 100);
|
$usage = (int) round($used / $total * 100);
|
||||||
|
|
||||||
@@ -326,12 +311,10 @@ function rpi_getMemoryInfo()
|
|||||||
$totalSize = 0;
|
$totalSize = 0;
|
||||||
$usedSize = 0;
|
$usedSize = 0;
|
||||||
|
|
||||||
foreach ($data as $row)
|
foreach ($data as $row) {
|
||||||
{
|
|
||||||
list($device, $type, $blocks, $use, $available, $used, $mountpoint) = preg_split('#[\s%]+#i', $row);
|
list($device, $type, $blocks, $use, $available, $used, $mountpoint) = preg_split('#[\s%]+#i', $row);
|
||||||
|
|
||||||
if (multiArraySearch($devices, 'device', $device) === false)
|
if (multiArraySearch($devices, 'device', $device) === false) {
|
||||||
{
|
|
||||||
$totalSize += $blocks * 1024;
|
$totalSize += $blocks * 1024;
|
||||||
$usedSize += $use * 1024;
|
$usedSize += $use * 1024;
|
||||||
}
|
}
|
||||||
@@ -347,8 +330,7 @@ function rpi_getMemoryInfo()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($devices, function($a, $b)
|
usort($devices, function ($a, $b) {
|
||||||
{
|
|
||||||
return strcasecmp($a['device'], $b['device']);
|
return strcasecmp($a['device'], $b['device']);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -362,14 +344,13 @@ function rpi_getUsbDevices()
|
|||||||
exec('lsusb', $data);
|
exec('lsusb', $data);
|
||||||
$devices = array();
|
$devices = array();
|
||||||
|
|
||||||
foreach ($data as $row)
|
foreach ($data as $row) {
|
||||||
{
|
|
||||||
preg_match('#[0-9a-f]{4}:[0-9a-f]{4}\s+(.+)#i', $row, $match);
|
preg_match('#[0-9a-f]{4}:[0-9a-f]{4}\s+(.+)#i', $row, $match);
|
||||||
|
|
||||||
if (count($match) == 2)
|
if (count($match) == 2)
|
||||||
$devices[] = trim($match[1]);
|
$devices[] = trim($match[1]);
|
||||||
else
|
else
|
||||||
$devices[] = '<'._t('Unbekannt').'>';
|
$devices[] = '<' . _t('Unbekannt') . '>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $devices;
|
return $devices;
|
||||||
@@ -400,44 +381,43 @@ function rpi_getAllUsers()
|
|||||||
$usersLoggedIn = array();
|
$usersLoggedIn = array();
|
||||||
$usersAll = array();
|
$usersAll = array();
|
||||||
|
|
||||||
foreach ($dataLoggedIn as $row)
|
foreach ($dataLoggedIn as $row) {
|
||||||
{
|
|
||||||
$split = preg_split('/\s+/i', $row);
|
$split = preg_split('/\s+/i', $row);
|
||||||
|
|
||||||
if (count($split) == 6)
|
if (count($split) == 6)
|
||||||
$usersLoggedIn[$split[0]][] = array('port' => $split[1], 'lastLogin' => strtotime($split[2].' '.$split[3].' '.$split[4]), 'lastLoginAddress' => $split[5]);
|
$usersLoggedIn[$split[0]][] = array('port' => $split[1], 'lastLogin' => strtotime($split[2] . ' ' . $split[3] . ' ' . $split[4]), 'lastLoginAddress' => $split[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($dataAllUsers as $row)
|
foreach ($dataAllUsers as $row) {
|
||||||
{
|
|
||||||
$userLastLoginInformation = '';
|
$userLastLoginInformation = '';
|
||||||
$userLastLoginInformation = shell_exec('/usr/bin/last -i -f /var/log/wtmp | grep -m 1 "^'.$row.' "');
|
$userLastLoginInformation = shell_exec('/usr/bin/last -i -f /var/log/wtmp | grep -m 1 "^' . $row . ' "');
|
||||||
|
|
||||||
if ($userLastLoginInformation == '')
|
if ($userLastLoginInformation == '')
|
||||||
$userLastLoginInformation = shell_exec('/usr/bin/last -i -f /var/log/wtmp.1 | grep -m 1 "^'.$row.' "');
|
$userLastLoginInformation = shell_exec('/usr/bin/last -i -f /var/log/wtmp.1 | grep -m 1 "^' . $row . ' "');
|
||||||
|
|
||||||
if ($userLastLoginInformation != '')
|
if ($userLastLoginInformation != '') {
|
||||||
{
|
|
||||||
$split = preg_split('/\s+/i', $userLastLoginInformation);
|
$split = preg_split('/\s+/i', $userLastLoginInformation);
|
||||||
|
|
||||||
$usersAll[] = array('username' => $row,
|
$usersAll[] = array(
|
||||||
'userId' => exec('id -u '.escapeshellarg($row)),
|
'username' => $row,
|
||||||
'groupId' => exec('id -g '.escapeshellarg($row)),
|
'userId' => exec('id -u ' . escapeshellarg($row)),
|
||||||
|
'groupId' => exec('id -g ' . escapeshellarg($row)),
|
||||||
'port' => $split[1],
|
'port' => $split[1],
|
||||||
'lastLoginAddress' => $split[2],
|
'lastLoginAddress' => $split[2],
|
||||||
'lastLogin' => strtotime($split[4].' '.$split[5].' '.$split[6]),
|
'lastLogin' => strtotime($split[4] . ' ' . $split[5] . ' ' . $split[6]),
|
||||||
'isLoggedIn' => isset($usersLoggedIn[$row]) ? true : false,
|
'isLoggedIn' => isset($usersLoggedIn[$row]) ? true : false,
|
||||||
'loggedIn' => isset($usersLoggedIn[$row]) ? $usersLoggedIn[$row] : array());
|
'loggedIn' => isset($usersLoggedIn[$row]) ? $usersLoggedIn[$row] : array()
|
||||||
}
|
);
|
||||||
else
|
} else {
|
||||||
{
|
$usersAll[] = array(
|
||||||
$usersAll[] = array('username' => $row,
|
'username' => $row,
|
||||||
'userId' => exec('id -u '.escapeshellarg($row)),
|
'userId' => exec('id -u ' . escapeshellarg($row)),
|
||||||
'groupId' => exec('id -g '.escapeshellarg($row)),
|
'groupId' => exec('id -g ' . escapeshellarg($row)),
|
||||||
'port' => '',
|
'port' => '',
|
||||||
'lastLoginAddress' => '',
|
'lastLoginAddress' => '',
|
||||||
'lastLogin' => 0,
|
'lastLogin' => 0,
|
||||||
'isLoggedIn' => isset($usersLoggedIn[$row]) ? true : false);
|
'isLoggedIn' => isset($usersLoggedIn[$row]) ? true : false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,4 +425,3 @@ function rpi_getAllUsers()
|
|||||||
|
|
||||||
return $usersAll;
|
return $usersAll;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ if (!defined('PICONTROL')) exit();
|
|||||||
* Beschreibung. Mehr unter: http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.pkg.html
|
* Beschreibung. Mehr unter: http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.pkg.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FileException extends Exception { }
|
class FileException extends Exception
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
class PiTpl
|
class PiTpl
|
||||||
{
|
{
|
||||||
@@ -61,18 +63,16 @@ class PiTpl
|
|||||||
$this->runtimeStart = microtime(true);
|
$this->runtimeStart = microtime(true);
|
||||||
|
|
||||||
$lang = $globalLanguage;
|
$lang = $globalLanguage;
|
||||||
$langFile = LANGUAGE_PATH.$lang.'.php';
|
$langFile = LANGUAGE_PATH . $lang . '.php';
|
||||||
|
|
||||||
if (empty($globalLanguageArray) && file_exists($langFile) === true && is_file($langFile) === true)
|
if (empty($globalLanguageArray) && file_exists($langFile) === true && is_file($langFile) === true) {
|
||||||
{
|
|
||||||
include $langFile;
|
include $langFile;
|
||||||
$globalLanguageArray = $langArray;
|
$globalLanguageArray = $langArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->tplConfigs as $configFile)
|
foreach ($this->tplConfigs as $configFile) {
|
||||||
{
|
if (file_exists(CONFIG_PATH . $configFile . $this->tplConfigSuffix) === true && is_file(CONFIG_PATH . $configFile . $this->tplConfigSuffix) === true)
|
||||||
if (file_exists(CONFIG_PATH.$configFile.$this->tplConfigSuffix) === true && is_file(CONFIG_PATH.$configFile.$this->tplConfigSuffix) === true)
|
$this->tplConfigArray[$configFile] = parse_ini_file(CONFIG_PATH . $configFile . $this->tplConfigSuffix, true);
|
||||||
$this->tplConfigArray[$configFile] = parse_ini_file(CONFIG_PATH.$configFile.$this->tplConfigSuffix, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +173,7 @@ class PiTpl
|
|||||||
$configPath = CONFIG_PATH;
|
$configPath = CONFIG_PATH;
|
||||||
|
|
||||||
if ($this->tplFolderPathPlugin != '')
|
if ($this->tplFolderPathPlugin != '')
|
||||||
$configPath = $this->tplFolderPathPlugin.'/resources/config/';
|
$configPath = $this->tplFolderPathPlugin . '/resources/config/';
|
||||||
|
|
||||||
if ($customFile !== NULL)
|
if ($customFile !== NULL)
|
||||||
$configPath = $customFile;
|
$configPath = $customFile;
|
||||||
@@ -183,11 +183,10 @@ class PiTpl
|
|||||||
if (count($file) != 2)
|
if (count($file) != 2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$configFile = $configPath.$file[0].$this->tplConfigSuffix;
|
$configFile = $configPath . $file[0] . $this->tplConfigSuffix;
|
||||||
$md5 = substr(md5($configFile), 0, 6);
|
$md5 = substr(md5($configFile), 0, 6);
|
||||||
|
|
||||||
if (!isset($this->tplConfigArray[$md5]))
|
if (!isset($this->tplConfigArray[$md5])) {
|
||||||
{
|
|
||||||
if (file_exists($configFile) === true && is_file($configFile) === true)
|
if (file_exists($configFile) === true && is_file($configFile) === true)
|
||||||
$this->tplConfigArray[$md5] = parse_ini_file($configFile, true);
|
$this->tplConfigArray[$md5] = parse_ini_file($configFile, true);
|
||||||
else
|
else
|
||||||
@@ -222,7 +221,7 @@ class PiTpl
|
|||||||
$configPath = CONFIG_PATH;
|
$configPath = CONFIG_PATH;
|
||||||
|
|
||||||
if ($this->tplFolderPathPlugin != '')
|
if ($this->tplFolderPathPlugin != '')
|
||||||
$configPath = $this->tplFolderPathPlugin.'/resources/config/';
|
$configPath = $this->tplFolderPathPlugin . '/resources/config/';
|
||||||
|
|
||||||
if ($customFile !== NULL)
|
if ($customFile !== NULL)
|
||||||
$configPath = $customFile;
|
$configPath = $customFile;
|
||||||
@@ -232,11 +231,10 @@ class PiTpl
|
|||||||
if (count($file) != 2)
|
if (count($file) != 2)
|
||||||
return $default;
|
return $default;
|
||||||
|
|
||||||
$configFile = $configPath.$file[0].$this->tplConfigSuffix;
|
$configFile = $configPath . $file[0] . $this->tplConfigSuffix;
|
||||||
$md5 = substr(md5($configFile), 0, 6);
|
$md5 = substr(md5($configFile), 0, 6);
|
||||||
|
|
||||||
if (!isset($this->tplConfigArray[$md5]))
|
if (!isset($this->tplConfigArray[$md5])) {
|
||||||
{
|
|
||||||
if (file_exists($configFile) === true && is_file($configFile) === true)
|
if (file_exists($configFile) === true && is_file($configFile) === true)
|
||||||
$this->tplConfigArray[$md5] = parse_ini_file($configFile, true);
|
$this->tplConfigArray[$md5] = parse_ini_file($configFile, true);
|
||||||
else
|
else
|
||||||
@@ -278,7 +276,7 @@ class PiTpl
|
|||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return writeConfig($this->tplConfigArray[$file[0]], CONFIG_PATH.$file[0].$this->tplConfigSuffix);
|
return writeConfig($this->tplConfigArray[$file[0]], CONFIG_PATH . $file[0] . $this->tplConfigSuffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -416,7 +414,7 @@ class PiTpl
|
|||||||
if ($this->tplLoadHeader !== true)
|
if ($this->tplLoadHeader !== true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$fileName = CONTENT_PATH.'html_header.php';
|
$fileName = CONTENT_PATH . 'html_header.php';
|
||||||
|
|
||||||
$this->tplLoadedHeader = true;
|
$this->tplLoadedHeader = true;
|
||||||
|
|
||||||
@@ -470,7 +468,7 @@ class PiTpl
|
|||||||
if ($this->tplLoadFooter !== true)
|
if ($this->tplLoadFooter !== true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$fileName = CONTENT_PATH.'html_footer.php';
|
$fileName = CONTENT_PATH . 'html_footer.php';
|
||||||
|
|
||||||
$this->tplLoadedFooter = true;
|
$this->tplLoadedFooter = true;
|
||||||
|
|
||||||
@@ -506,20 +504,18 @@ class PiTpl
|
|||||||
$folderPath = $this->tplFolderPath;
|
$folderPath = $this->tplFolderPath;
|
||||||
|
|
||||||
if ($this->tplFolderPathPlugin != '')
|
if ($this->tplFolderPathPlugin != '')
|
||||||
$folderPath = $this->tplFolderPathPlugin.'/public_html/templates/';
|
$folderPath = $this->tplFolderPathPlugin . '/public_html/templates/';
|
||||||
|
|
||||||
if (strlen($tplFileName) >= 1 && is_string($tplFileName))
|
if (strlen($tplFileName) >= 1 && is_string($tplFileName)) {
|
||||||
{
|
if (file_exists($folderPath . $tplFileName . $this->tplFileSuffix) !== true || is_file($folderPath . $tplFileName . $this->tplFileSuffix) !== true)
|
||||||
if (file_exists($folderPath.$tplFileName.$this->tplFileSuffix) !== true || is_file($folderPath.$tplFileName.$this->tplFileSuffix) !== true)
|
return self::tplError(self::_t('Datei "%s" existiert nicht oder ist keine gültige Datei.', $tplFileName), __LINE__ - 1);
|
||||||
return self::tplError(self::_t('Datei "%s" existiert nicht oder ist keine gültige Datei.', $tplFileName), __LINE__-1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self::drawMsg();
|
self::drawMsg();
|
||||||
|
|
||||||
$data = $this->tplVariables;
|
$data = $this->tplVariables;
|
||||||
|
|
||||||
if (strlen($tplFileName) >= 1 && is_string($tplFileName))
|
if (strlen($tplFileName) >= 1 && is_string($tplFileName)) (include_once $folderPath . $tplFileName . $this->tplFileSuffix) or self::error(self::_t('Konnte Datei "%s" nicht öffnen und auslesen.', $tplFileName), __LINE__);
|
||||||
(include_once $folderPath.$tplFileName.$this->tplFileSuffix) or self::error(self::_t('Konnte Datei "%s" nicht öffnen und auslesen.', $tplFileName), __LINE__);
|
|
||||||
|
|
||||||
// Optisch schöner
|
// Optisch schöner
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
@@ -545,7 +541,7 @@ class PiTpl
|
|||||||
if (!strlen($errorMsg) > 0 || !is_string($errorMsg))
|
if (!strlen($errorMsg) > 0 || !is_string($errorMsg))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (file_exists($this->tplFolderPath.'error'.$this->tplFileSuffix) !== true || is_file($this->tplFolderPath.'error'.$this->tplFileSuffix) !== true)
|
if (file_exists($this->tplFolderPath . 'error' . $this->tplFileSuffix) !== true || is_file($this->tplFolderPath . 'error' . $this->tplFileSuffix) !== true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($errorCancel === true)
|
if ($errorCancel === true)
|
||||||
@@ -555,7 +551,7 @@ class PiTpl
|
|||||||
$data['title'] = $errorTitle;
|
$data['title'] = $errorTitle;
|
||||||
$data['msg'] = $errorMsg;
|
$data['msg'] = $errorMsg;
|
||||||
|
|
||||||
include $this->tplFolderPath.'error'.$this->tplFileSuffix;
|
include $this->tplFolderPath . 'error' . $this->tplFileSuffix;
|
||||||
|
|
||||||
if ($errorCancel === true)
|
if ($errorCancel === true)
|
||||||
if (self::drawFooter() === false)
|
if (self::drawFooter() === false)
|
||||||
@@ -623,12 +619,13 @@ class PiTpl
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!headers_sent($filename, $linenum))
|
if (!headers_sent($filename, $linenum))
|
||||||
exit(header('Location: '.$url));
|
exit(header('Location: ' . $url));
|
||||||
else
|
else {
|
||||||
{
|
self::error(
|
||||||
self::error(self::_t('Weiterleitung'),
|
self::_t('Weiterleitung'),
|
||||||
'<strong class="red">'.self::_t('Header bereits gesendet. Redirect nicht möglich, klicke daher stattdessen <a href="%s">diesen Link</a> an.', $url).'</strong>',
|
'<strong class="red">' . self::_t('Header bereits gesendet. Redirect nicht möglich, klicke daher stattdessen <a href="%s">diesen Link</a> an.', $url) . '</strong>',
|
||||||
true);
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -644,7 +641,7 @@ class PiTpl
|
|||||||
|
|
||||||
public function showDebug()
|
public function showDebug()
|
||||||
{
|
{
|
||||||
printf(PHP_EOL.'<!-- DEBUG - Start -->'.PHP_EOL.' <hr /><p>Ladezeit: %f<br />Fehler: %s</p>'.PHP_EOL.'<!-- DEBUG - End -->'.PHP_EOL, round(microtime(true)-$this->runtimeStart, 5), ($this->ifError) ? 'true' : 'false');
|
printf(PHP_EOL . '<!-- DEBUG - Start -->' . PHP_EOL . ' <hr /><p>Ladezeit: %f<br />Fehler: %s</p>' . PHP_EOL . '<!-- DEBUG - End -->' . PHP_EOL, round(microtime(true) - $this->runtimeStart, 5), ($this->ifError) ? 'true' : 'false');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -661,18 +658,17 @@ class PiTpl
|
|||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function msg($type, $title = NULL, $msg, $cancelable = true, $id = 0)
|
public function msg($type, $msg, $title = NULL, $cancelable = true, $id = 0)
|
||||||
{
|
{
|
||||||
if (!strlen($type) > 0 || !is_string($type) ||
|
if (
|
||||||
|
!strlen($type) > 0 || !is_string($type) ||
|
||||||
!strlen($msg) > 0 || !is_string($msg)
|
!strlen($msg) > 0 || !is_string($msg)
|
||||||
)
|
)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0) {
|
||||||
{
|
|
||||||
$this->tplMsg[$id + 100] = array($type, $title, $msg, $cancelable);
|
$this->tplMsg[$id + 100] = array($type, $title, $msg, $cancelable);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
$this->tplMsg[] = array($type, $title, $msg, $cancelable);
|
$this->tplMsg[] = array($type, $title, $msg, $cancelable);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -699,18 +695,17 @@ class PiTpl
|
|||||||
if (is_array($this->tplMsg) !== true || count($this->tplMsg) == 0)
|
if (is_array($this->tplMsg) !== true || count($this->tplMsg) == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (file_exists($this->tplFolderPath.'msg'.$this->tplFileSuffix) !== true || is_file($this->tplFolderPath.'msg'.$this->tplFileSuffix) !== true)
|
if (file_exists($this->tplFolderPath . 'msg' . $this->tplFileSuffix) !== true || is_file($this->tplFolderPath . 'msg' . $this->tplFileSuffix) !== true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach ($this->tplMsg as $key => $msg)
|
foreach ($this->tplMsg as $key => $msg) {
|
||||||
{
|
|
||||||
$data['id'] = $key;
|
$data['id'] = $key;
|
||||||
$data['type'] = $msg[0];
|
$data['type'] = $msg[0];
|
||||||
$data['title'] = $msg[1];
|
$data['title'] = $msg[1];
|
||||||
$data['msg'] = $msg[2];
|
$data['msg'] = $msg[2];
|
||||||
$data['cancelable'] = $msg[3];
|
$data['cancelable'] = $msg[3];
|
||||||
|
|
||||||
(include $this->tplFolderPath.'msg'.$this->tplFileSuffix) or self::tplError(self::_t('Konnte Datei "%s" nicht öffnen und auslesen.', $this->tplFolderPath.'msg'.$this->tplFileSuffix), __LINE__);
|
(include $this->tplFolderPath . 'msg' . $this->tplFileSuffix) or self::tplError(self::_t('Konnte Datei "%s" nicht öffnen und auslesen.', $this->tplFolderPath . 'msg' . $this->tplFileSuffix), __LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -726,13 +721,12 @@ class PiTpl
|
|||||||
|
|
||||||
private function loadSSH()
|
private function loadSSH()
|
||||||
{
|
{
|
||||||
set_include_path(LIBRARY_PATH.'terminal');
|
set_include_path(LIBRARY_PATH . 'terminal');
|
||||||
|
|
||||||
if (!class_exists('Net_SSH2'))
|
if (!class_exists('Net_SSH2')) {
|
||||||
{
|
include(LIBRARY_PATH . 'terminal/Net/SSH2.php');
|
||||||
include(LIBRARY_PATH.'terminal/Net/SSH2.php');
|
include(LIBRARY_PATH . 'terminal/File/ANSI.php');
|
||||||
include(LIBRARY_PATH.'terminal/File/ANSI.php');
|
include(LIBRARY_PATH . 'terminal/Crypt/RSA.php');
|
||||||
include(LIBRARY_PATH.'terminal/Crypt/RSA.php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$ssh = NULL;
|
$ssh = NULL;
|
||||||
@@ -741,13 +735,13 @@ class PiTpl
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
$token = $_COOKIE['_pi-control_ssh'];
|
$token = $_COOKIE['_pi-control_ssh'];
|
||||||
$token2 = $_COOKIE['_pi-control_ssh_'.$token];
|
$token2 = $_COOKIE['_pi-control_ssh_' . $token];
|
||||||
|
|
||||||
$sshType = getConfig('ssh:token_'.$token.'.type', 'password');
|
$sshType = getConfig('ssh:token_' . $token . '.type', 'password');
|
||||||
$sshPort = getConfig('ssh:token_'.$token.'.port', 22);
|
$sshPort = getConfig('ssh:token_' . $token . '.port', 22);
|
||||||
$sshUsername = getConfig('ssh:token_'.$token.'.username', 'root');
|
$sshUsername = getConfig('ssh:token_' . $token . '.username', 'root');
|
||||||
$sshPassword = getConfig('ssh:token_'.$token.'.password', '');
|
$sshPassword = getConfig('ssh:token_' . $token . '.password', '');
|
||||||
$sshPrivateKey = base64_decode(getConfig('ssh:token_'.$token.'.privateKey', ''));
|
$sshPrivateKey = base64_decode(getConfig('ssh:token_' . $token . '.privateKey', ''));
|
||||||
|
|
||||||
#$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
#$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND);
|
||||||
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
|
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
|
||||||
@@ -757,14 +751,12 @@ class PiTpl
|
|||||||
|
|
||||||
$ssh = new Net_SSH2('127.0.0.1', $sshPort);
|
$ssh = new Net_SSH2('127.0.0.1', $sshPort);
|
||||||
|
|
||||||
if ($sshType == 'password')
|
if ($sshType == 'password') {
|
||||||
{
|
|
||||||
if (!$ssh->login($sshUsername, $sshPassword))
|
if (!$ssh->login($sshUsername, $sshPassword))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($sshType == 'publickey')
|
if ($sshType == 'publickey') {
|
||||||
{
|
|
||||||
$sshKey = new Crypt_RSA();
|
$sshKey = new Crypt_RSA();
|
||||||
|
|
||||||
if ($sshPassword != '')
|
if ($sshPassword != '')
|
||||||
@@ -833,11 +825,9 @@ class PiTpl
|
|||||||
public function getSSHResource($cancelIfError = 0)
|
public function getSSHResource($cancelIfError = 0)
|
||||||
{
|
{
|
||||||
if ($this->tplSSH === NULL)
|
if ($this->tplSSH === NULL)
|
||||||
if (self::loadSSH() !== true)
|
if (self::loadSSH() !== true) {
|
||||||
{
|
|
||||||
if ($cancelIfError !== 0)
|
if ($cancelIfError !== 0)
|
||||||
self::error(_t('SSH-Zugriffsfehler'), _t('Kein SSH-Zugriff, diese Funktion steht aktuell nicht zur Verfügung!'), ($cancelIfError === 1) ? true : false);
|
self::error(_t('SSH-Zugriffsfehler'), _t('Kein SSH-Zugriff, bitte anmelden! <a href="%s">Jetzt anmelden.</a>', '?s=ssh_login'), ($cancelIfError === 1) ? true : false);
|
||||||
#self::error(_t('SSH-Zugriffsfehler'), _t('Kein SSH-Zugriff, bitte anmelden! <a href="%s">Jetzt anmelden.</a>', '?s=ssh_login'), ($cancelIfError === 1) ? true : false);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -859,13 +849,12 @@ class PiTpl
|
|||||||
$sshPort = getConfig('ssh:latest.port', 22);
|
$sshPort = getConfig('ssh:latest.port', 22);
|
||||||
$sshUsername = getConfig('ssh:latest.username', '');
|
$sshUsername = getConfig('ssh:latest.username', '');
|
||||||
|
|
||||||
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '')
|
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '') {
|
||||||
{
|
|
||||||
$token = $_COOKIE['_pi-control_ssh'];
|
$token = $_COOKIE['_pi-control_ssh'];
|
||||||
|
|
||||||
$sshType = getConfig('ssh:token_'.$token.'.type', $sshType);
|
$sshType = getConfig('ssh:token_' . $token . '.type', $sshType);
|
||||||
$sshPort = getConfig('ssh:token_'.$token.'.port', $sshPort);
|
$sshPort = getConfig('ssh:token_' . $token . '.port', $sshPort);
|
||||||
$sshUsername = getConfig('ssh:token_'.$token.'.username', $sshUsername);
|
$sshUsername = getConfig('ssh:token_' . $token . '.username', $sshUsername);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array('type' => $sshType, 'port' => $sshPort, 'username' => $sshUsername);
|
return array('type' => $sshType, 'port' => $sshPort, 'username' => $sshUsername);
|
||||||
@@ -900,8 +889,7 @@ class PiTpl
|
|||||||
if ($privateKey != '' && is_string($privateKey))
|
if ($privateKey != '' && is_string($privateKey))
|
||||||
$SSHInfo['privateKey'] = $privateKey;
|
$SSHInfo['privateKey'] = $privateKey;
|
||||||
|
|
||||||
if ($password != '')
|
if ($password != '') {
|
||||||
{
|
|
||||||
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '')
|
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '')
|
||||||
$this->logoutSSH();
|
$this->logoutSSH();
|
||||||
|
|
||||||
@@ -915,30 +903,27 @@ class PiTpl
|
|||||||
|
|
||||||
$SSHInfo['privateKey'] = $privateKey;
|
$SSHInfo['privateKey'] = $privateKey;
|
||||||
|
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.created', time()) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.created', time()) !== true) return false;
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.type', $SSHInfo['type']) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.type', $SSHInfo['type']) !== true) return false;
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.port', $SSHInfo['port']) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.port', $SSHInfo['port']) !== true) return false;
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.username', $SSHInfo['username']) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.username', $SSHInfo['username']) !== true) return false;
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.password', $SSHInfo['password']) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.password', $SSHInfo['password']) !== true) return false;
|
||||||
if (setConfig('ssh:token_'.$uniqid.'.privateKey', base64_encode($SSHInfo['privateKey'])) !== true) return false;
|
if (setConfig('ssh:token_' . $uniqid . '.privateKey', base64_encode($SSHInfo['privateKey'])) !== true) return false;
|
||||||
|
|
||||||
setConfig('ssh:latest.type', $SSHInfo['type']);
|
setConfig('ssh:latest.type', $SSHInfo['type']);
|
||||||
setConfig('ssh:latest.port', $SSHInfo['port']);
|
setConfig('ssh:latest.port', $SSHInfo['port']);
|
||||||
setConfig('ssh:latest.username', $SSHInfo['username']);
|
setConfig('ssh:latest.username', $SSHInfo['username']);
|
||||||
|
|
||||||
if ($rememberMe == false)
|
if ($rememberMe == false) {
|
||||||
{
|
setcookie('_pi-control_ssh', $uniqid, time() + 60 * 60 * 12);
|
||||||
setcookie('_pi-control_ssh', $uniqid, time()+60*60*12);
|
setcookie('_pi-control_ssh_' . $uniqid, $uniqid2, time() + 60 * 60 * 12);
|
||||||
setcookie('_pi-control_ssh_'.$uniqid, $uniqid2, time()+60*60*12);
|
} else {
|
||||||
}
|
setcookie('_pi-control_ssh', $uniqid, time() + 60 * 60 * 24 * 30);
|
||||||
else
|
setcookie('_pi-control_ssh_' . $uniqid, $uniqid2, time() + 60 * 60 * 24 * 30);
|
||||||
{
|
|
||||||
setcookie('_pi-control_ssh', $uniqid, time()+60*60*24*30);
|
|
||||||
setcookie('_pi-control_ssh_'.$uniqid, $uniqid2, time()+60*60*24*30);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$_COOKIE['_pi-control_ssh'] = $uniqid;
|
$_COOKIE['_pi-control_ssh'] = $uniqid;
|
||||||
$_COOKIE['_pi-control_ssh_'.$uniqid] = $uniqid2;
|
$_COOKIE['_pi-control_ssh_' . $uniqid] = $uniqid2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -954,18 +939,16 @@ class PiTpl
|
|||||||
|
|
||||||
public function logoutSSH()
|
public function logoutSSH()
|
||||||
{
|
{
|
||||||
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '')
|
if (isset($_COOKIE['_pi-control_ssh']) && $_COOKIE['_pi-control_ssh'] != '') {
|
||||||
{
|
|
||||||
$token = $_COOKIE['_pi-control_ssh'];
|
$token = $_COOKIE['_pi-control_ssh'];
|
||||||
|
|
||||||
removeConfig('ssh:token_'.$token);
|
removeConfig('ssh:token_' . $token);
|
||||||
setcookie('_pi-control_ssh', '', time()-60);
|
setcookie('_pi-control_ssh', '', time() - 60);
|
||||||
setcookie('_pi-control_ssh_'.$token, '', time()-60);
|
setcookie('_pi-control_ssh_' . $token, '', time() - 60);
|
||||||
$_COOKIE['_pi-control_ssh'] = '';
|
$_COOKIE['_pi-control_ssh'] = '';
|
||||||
$_COOKIE['_pi-control_ssh_'.$token] = '';
|
$_COOKIE['_pi-control_ssh_' . $token] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
@@ -11,44 +11,35 @@ function checkTemperatureMonitoringEmailStatus()
|
|||||||
|
|
||||||
$data = NULL;
|
$data = NULL;
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_URL, $config['url']['temperatureMonitoring'].'?'.http_build_query(array('id' => $id, 'code' => $code, 'email' => $email)));
|
curl_setopt($curl, CURLOPT_URL, $config['url']['temperatureMonitoring'] . '?' . http_build_query(array('id' => $id, 'code' => $code, 'email' => $email)));
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (($data = curl_exec($curl)) === false) {
|
||||||
if (($data = curl_exec($curl)) === false)
|
|
||||||
{
|
|
||||||
$info = curl_getinfo($curl);
|
$info = curl_getinfo($curl);
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d (%s)', $info['http_code'], curl_error($curl)), true, 12);
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d (%s)', _t('Verbindungsfehler'), $info['http_code'], curl_error($curl)), true, 12);
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$info = curl_getinfo($curl);
|
$info = curl_getinfo($curl);
|
||||||
|
|
||||||
if ($info['http_code'] == 404)
|
if ($info['http_code'] == 404) {
|
||||||
{
|
$tpl->msg('error', _t('Leider konnte keine Verbindung zum Server hergestellt werden, da dieser momentan vermutlich nicht erreichbar ist. Fehlercode: %d', _t('Verbindungsfehler'), $info['http_code']), true, 12);
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Leider konnte keine Verbindung zum Server hergestellt werden, da dieser momentan vermutlich nicht erreichbar ist. Fehlercode: %d', $info['http_code']), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
} elseif ($info['http_code'] != 200) {
|
||||||
elseif ($info['http_code'] != 200)
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d', $info['http_code']), _t('Verbindungsfehler'), true, 12);
|
||||||
{
|
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d', $info['http_code']), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data == '')
|
if ($data == '') {
|
||||||
{
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine leere Antwort.'), _t('Serverfehler'), true, 12);
|
||||||
$tpl->msg('error', _t('Serverfehler'), _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine leere Antwort.'), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verarbeite Datenstring
|
// Verarbeite Datenstring
|
||||||
$json = json_decode($data, true);
|
$json = json_decode($data, true);
|
||||||
|
|
||||||
if (json_last_error() != JSON_ERROR_NONE || !isset($json['existing'], $json['email'], $json['code']))
|
if (json_last_error() != JSON_ERROR_NONE || !isset($json['existing'], $json['email'], $json['code'])) {
|
||||||
{
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine fehlerhafte Antwort.'), _t('Verarbeitungsfehler'), true, 12);
|
||||||
$tpl->msg('error', _t('Verarbeitungsfehler'), _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine fehlerhafte Antwort.'), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +47,7 @@ function checkTemperatureMonitoringEmailStatus()
|
|||||||
if ($json['existing'] == false || $json['email'] == false || $json['code'] == false)
|
if ($json['existing'] == false || $json['email'] == false || $json['code'] == false)
|
||||||
setConfig('main:monitoringCpuTemp.code', '');
|
setConfig('main:monitoringCpuTemp.code', '');
|
||||||
}
|
}
|
||||||
}
|
} while (false);
|
||||||
while (false);
|
|
||||||
|
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
}
|
}
|
||||||
@@ -71,59 +61,46 @@ function checkTemperatureMonitoringEmailCode()
|
|||||||
|
|
||||||
$data = NULL;
|
$data = NULL;
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
curl_setopt($curl, CURLOPT_URL, $config['url']['temperatureMonitoring'].'?'.http_build_query(array('id' => $id, 'code' => true, 'email' => $email)));
|
curl_setopt($curl, CURLOPT_URL, $config['url']['temperatureMonitoring'] . '?' . http_build_query(array('id' => $id, 'code' => true, 'email' => $email)));
|
||||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
if (($data = curl_exec($curl)) === false) {
|
||||||
if (($data = curl_exec($curl)) === false)
|
|
||||||
{
|
|
||||||
$info = curl_getinfo($curl);
|
$info = curl_getinfo($curl);
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d (%s)', $info['http_code'], curl_error($curl)), true, 12);
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d (%s)', _t('Verbindungsfehler'), $info['http_code'], curl_error($curl)), true, 12);
|
||||||
break;
|
break;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$info = curl_getinfo($curl);
|
$info = curl_getinfo($curl);
|
||||||
|
|
||||||
if ($info['http_code'] == 404)
|
if ($info['http_code'] == 404) {
|
||||||
{
|
$tpl->msg('error', _t('Leider konnte keine Verbindung zum Server hergestellt werden, da dieser momentan vermutlich nicht erreichbar ist. Fehlercode: %d', _t('Verbindungsfehler'), $info['http_code']), true, 12);
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Leider konnte keine Verbindung zum Server hergestellt werden, da dieser momentan vermutlich nicht erreichbar ist. Fehlercode: %d', $info['http_code']), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
} elseif ($info['http_code'] != 200) {
|
||||||
elseif ($info['http_code'] != 200)
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d', $info['http_code']), _t('Verbindungsfehler'), true, 12);
|
||||||
{
|
|
||||||
$tpl->msg('error', _t('Verbindungsfehler'), _t('Bei der Verbindung zum Server ist ein unerwarteter Fehler aufgetreten. Fehlercode: %d', $info['http_code']), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data == '')
|
if ($data == '') {
|
||||||
{
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine leere Antwort.'), _t('Serverfehler'), true, 12);
|
||||||
$tpl->msg('error', _t('Serverfehler'), _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine leere Antwort.'), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verarbeite Datenstring
|
// Verarbeite Datenstring
|
||||||
$json = json_decode($data, true);
|
$json = json_decode($data, true);
|
||||||
|
|
||||||
if (json_last_error() != JSON_ERROR_NONE || !isset($json['existing'], $json['email'], $json['code']))
|
if (json_last_error() != JSON_ERROR_NONE || !isset($json['existing'], $json['email'], $json['code'])) {
|
||||||
{
|
$tpl->msg('error', _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine fehlerhafte Antwort.'), _t('Verarbeitungsfehler'), true, 12);
|
||||||
$tpl->msg('error', _t('Verarbeitungsfehler'), _t('Bei der Verbindung zum Server ist ein Fehler aufgetreten. Der Server sendet eine fehlerhafte Antwort.'), true, 12);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Antwort in Ordnung
|
// Antwort in Ordnung
|
||||||
if ($json['code'] != false && strlen($json['code']) == 16)
|
if ($json['code'] != false && strlen($json['code']) == 16) {
|
||||||
{
|
|
||||||
setConfig('main:monitoringCpuTemp.code', $json['code']);
|
setConfig('main:monitoringCpuTemp.code', $json['code']);
|
||||||
$tpl->msg('success', _t('E-Mail bestätigt'), _t('Deine E-Mail wurde erfolgreich bestätigt.'));
|
$tpl->msg('success', _t('Deine E-Mail wurde erfolgreich bestätigt.'), _t('E-Mail bestätigt'));
|
||||||
|
} else
|
||||||
|
$tpl->msg('error', _t('Der Server konnte zugehörige Daten nicht finden. Versichere, dass du die E-Mail bestätigt hast.'), _t('Verarbeitungsfehler'), true, 12);
|
||||||
}
|
}
|
||||||
else
|
} while (false);
|
||||||
$tpl->msg('error', _t('Verarbeitungsfehler'), _t('Der Server konnte zugehörige Daten nicht finden. Versichere, dass du die E-Mail bestätigt hast.'), true, 12);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (false);
|
|
||||||
|
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -127,7 +127,7 @@ class LogStatistic
|
|||||||
if (!file_exists($this->file) || !is_file($this->file))
|
if (!file_exists($this->file) || !is_file($this->file))
|
||||||
touch($this->file);
|
touch($this->file);
|
||||||
|
|
||||||
$this->stream = fopen($this->file, 'r+') or exit(_t('Konnte Log-Datei nicht öffnen: %s', $this->file));
|
$this->stream = fopen($this->file, 'r+');# || exit(_t('Konnte Log-Datei nicht öffnen: %s', $this->file));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,6 +282,17 @@ class StatisticBuilder
|
|||||||
$this->suffix = isset($suffix) ? $suffix : NULL;
|
$this->suffix = isset($suffix) ? $suffix : NULL;
|
||||||
$this->label = _t($statistic['label']);
|
$this->label = _t($statistic['label']);
|
||||||
$this->unit = $statistic['unit'];
|
$this->unit = $statistic['unit'];
|
||||||
|
if ($statistic['unit'] == 'MB') {
|
||||||
|
$log = new LogStatistic();
|
||||||
|
$log->setFile(LOG_PATH . $this->raw . '.csv');
|
||||||
|
$lastValue = $log->getLast();
|
||||||
|
$log->close();
|
||||||
|
|
||||||
|
if ($lastValue && $lastValue[1] > 999999999) {
|
||||||
|
$this->unit = 'GB';
|
||||||
|
$this->label = 'GB';
|
||||||
|
}
|
||||||
|
}
|
||||||
$this->cycle = $statistic['cycle'];
|
$this->cycle = $statistic['cycle'];
|
||||||
$this->limits = $statistic['limits'];
|
$this->limits = $statistic['limits'];
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ $statisticConfig = array(
|
|||||||
'fix' => true
|
'fix' => true
|
||||||
),
|
),
|
||||||
'max' => array(
|
'max' => array(
|
||||||
'value' => 1200,
|
'value' => 2100,
|
||||||
'use' => 'fix',
|
'use' => 'fix',
|
||||||
'fix' => true
|
'fix' => true
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,10 +25,8 @@ function calculateEmptyRows(&$arr, $columns, $firstTime, $lastTime, $cycle)
|
|||||||
{
|
{
|
||||||
$buffer = array();
|
$buffer = array();
|
||||||
|
|
||||||
if ($lastTime < (time() - ($cycle * 60)))
|
if ($lastTime < (time() - ($cycle * 60))) {
|
||||||
{
|
for ($i = 0; $i < ceil(((time() - ($cycle * 60)) - $lastTime) / ($cycle * 60)); $i++) {
|
||||||
for ($i = 0; $i < ceil(((time() - ($cycle * 60)) - $lastTime) / ($cycle * 60)); $i++)
|
|
||||||
{
|
|
||||||
$dummy = array($lastTime + (($i + 1) * ($cycle * 60)));
|
$dummy = array($lastTime + (($i + 1) * ($cycle * 60)));
|
||||||
|
|
||||||
for ($j = 1; $j < count($columns); $j++)
|
for ($j = 1; $j < count($columns); $j++)
|
||||||
@@ -41,10 +39,8 @@ function calculateEmptyRows(&$arr, $columns, $firstTime, $lastTime, $cycle)
|
|||||||
|
|
||||||
$buffer = array();
|
$buffer = array();
|
||||||
|
|
||||||
if (isset($arr['rows']) && count($arr['rows']) < (604800 / ($cycle * 60)))
|
if (isset($arr['rows']) && count($arr['rows']) < (604800 / ($cycle * 60))) {
|
||||||
{
|
for ($i = 0; $i < ((604800 / ($cycle * 60)) - count($arr['rows'])); $i++) {
|
||||||
for ($i = 0; $i < ((604800 / ($cycle * 60)) - count($arr['rows'])); $i++)
|
|
||||||
{
|
|
||||||
$dummy = array($firstTime - (($i + 1) * ($cycle * 60)));
|
$dummy = array($firstTime - (($i + 1) * ($cycle * 60)));
|
||||||
|
|
||||||
for ($j = 1; $j < count($columns); $j++)
|
for ($j = 1; $j < count($columns); $j++)
|
||||||
@@ -63,31 +59,26 @@ function getRowsFromLog(&$arr, &$info, $log, $columns, $cycle)
|
|||||||
$leapyear = -1;
|
$leapyear = -1;
|
||||||
$leapyearSkip = 0;
|
$leapyearSkip = 0;
|
||||||
|
|
||||||
foreach ($log as $row)
|
foreach ($log as $row) {
|
||||||
{
|
|
||||||
foreach ($row as &$data)
|
foreach ($row as &$data)
|
||||||
$data = trim($data);
|
$data = trim($data);
|
||||||
|
|
||||||
if ($leapyearSkip != 0)
|
if ($leapyearSkip != 0) {
|
||||||
{
|
|
||||||
$leapyearSkip--;
|
$leapyearSkip--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($leapyear != -1 && $leapyear > date('I', $row[0]))
|
if ($leapyear != -1 && $leapyear > date('I', $row[0])) {
|
||||||
{
|
|
||||||
$leapyear = 0;
|
$leapyear = 0;
|
||||||
$leapyearSkip = (60/$cycle)-1;
|
$leapyearSkip = (60 / $cycle) - 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$leapyear = date('I', $row[0]);
|
$leapyear = date('I', $row[0]);
|
||||||
|
|
||||||
if ($lastTime !== NULL && ($lastTime + ($cycle * 60) + 100) < $row[0])
|
if ($lastTime !== NULL && ($lastTime + ($cycle * 60) + 100) < $row[0]) {
|
||||||
{
|
|
||||||
$skipped = round(($row[0] - ($lastTime + ($cycle * 60))) / ($cycle * 60));
|
$skipped = round(($row[0] - ($lastTime + ($cycle * 60))) / ($cycle * 60));
|
||||||
for ($i = 0; $i < $skipped; $i++)
|
for ($i = 0; $i < $skipped; $i++) {
|
||||||
{
|
|
||||||
$dummy = array($lastTime + (($i + 1) * ($cycle * 60)));
|
$dummy = array($lastTime + (($i + 1) * ($cycle * 60)));
|
||||||
|
|
||||||
for ($j = 1; $j < count($columns); $j++)
|
for ($j = 1; $j < count($columns); $j++)
|
||||||
@@ -99,13 +90,15 @@ function getRowsFromLog(&$arr, &$info, $log, $columns, $cycle)
|
|||||||
|
|
||||||
$dummy = array((int) $row[0]);
|
$dummy = array((int) $row[0]);
|
||||||
|
|
||||||
for ($i = 1; $i < count($columns); $i++)
|
for ($i = 1; $i < count($columns); $i++) {
|
||||||
{
|
|
||||||
$rowFloat = 0;
|
$rowFloat = 0;
|
||||||
|
|
||||||
if (isset($columns[$i]['division']))
|
if (isset($columns[$i]['division'])) {
|
||||||
|
if ((float)$log[count($log) - 1][1] > 999999999)
|
||||||
|
$rowFloat = (float) round(str_replace(array("\n", ','), array('', '.'), $row[$i]) / $columns[$i]['division'] / 1024, 2);
|
||||||
|
else
|
||||||
$rowFloat = (float) round(str_replace(array("\n", ','), array('', '.'), $row[$i]) / $columns[$i]['division'], 2);
|
$rowFloat = (float) round(str_replace(array("\n", ','), array('', '.'), $row[$i]) / $columns[$i]['division'], 2);
|
||||||
elseif (isset($columns[$i]['multiplication']))
|
} elseif (isset($columns[$i]['multiplication']))
|
||||||
$rowFloat = (float) round(str_replace(array("\n", ','), array('', '.'), $row[$i]) * $columns[$i]['multiplication'], 2);
|
$rowFloat = (float) round(str_replace(array("\n", ','), array('', '.'), $row[$i]) * $columns[$i]['multiplication'], 2);
|
||||||
else
|
else
|
||||||
$rowFloat = (float) $row[$i];
|
$rowFloat = (float) $row[$i];
|
||||||
@@ -133,9 +126,8 @@ function getRowsFromLog(&$arr, &$info, $log, $columns, $cycle)
|
|||||||
|
|
||||||
function convertForGoogleChart($rows)
|
function convertForGoogleChart($rows)
|
||||||
{
|
{
|
||||||
foreach ($rows as $index => $row)
|
foreach ($rows as $index => $row) {
|
||||||
{
|
$dummy = array('c' => array(array('v' => 'Date(' . date('Y,' . (date('m', $row[0]) - 1) . ',d,H,i', $row[0]) . ')')));
|
||||||
$dummy = array('c' => array(array('v' => 'Date('.date('Y,'.(date('m', $row[0])-1).',d,H,i', $row[0]).')')));
|
|
||||||
|
|
||||||
unset($row[0]);
|
unset($row[0]);
|
||||||
|
|
||||||
@@ -147,4 +139,3 @@ function convertForGoogleChart($rows)
|
|||||||
|
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -253,7 +253,8 @@ class UpdateController
|
|||||||
|
|
||||||
if (!class_exists('cURL'))
|
if (!class_exists('cURL'))
|
||||||
(include LIBRARY_PATH.'curl/curl.class.php');
|
(include LIBRARY_PATH.'curl/curl.class.php');
|
||||||
$curl = new cURL($this->updateDownloadURL.'&'.http_build_query(array('file' => $version->getFilename())));
|
|
||||||
|
$curl = new cURL($this->updateDownloadURL . $version->getFilename());
|
||||||
$curlStatus = $curl->downloadFile(UPDATE_PATH.'update.zip');
|
$curlStatus = $curl->downloadFile(UPDATE_PATH.'update.zip');
|
||||||
|
|
||||||
if (!is_bool($curlStatus))
|
if (!is_bool($curlStatus))
|
||||||
@@ -268,7 +269,7 @@ class UpdateController
|
|||||||
return $curl->getStatusCode();
|
return $curl->getStatusCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md5_file(UPDATE_PATH.'update.zip') !== $version->getChecksum())
|
if (hash_file('sha256', UPDATE_PATH.'update.zip') !== $version->getChecksum())
|
||||||
{
|
{
|
||||||
unlink(UPDATE_PATH.'update.zip');
|
unlink(UPDATE_PATH.'update.zip');
|
||||||
return 1;
|
return 1;
|
||||||
@@ -439,4 +440,3 @@ class Update
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
Reference in New Issue
Block a user