Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db3d54a835 | |||
| 37e155a9b1 | |||
| 69e2ee972c |
@@ -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
|
||||||
Über das [Ticketsystem](https://bugs.die-schultes.eu/projects/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
|
Ü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,67 +1,69 @@
|
|||||||
<?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);
|
||||||
foreach ($datas as $data)
|
} elseif (isset($_GET['data'])) {
|
||||||
{
|
$datas = explode(';', $_GET['data']);
|
||||||
switch ($data)
|
setData($datas, $api);
|
||||||
{
|
} else
|
||||||
case 'startTime':
|
|
||||||
$api->addData('startTime', formatTime(time() - rpi_getRuntime()));
|
|
||||||
break;
|
|
||||||
case 'runtime':
|
|
||||||
$api->addData('runtime', getDateFormat(rpi_getRuntime()));
|
|
||||||
break;
|
|
||||||
case 'cpuClock':
|
|
||||||
$api->addData('cpuClock', rpi_getCpuClock());
|
|
||||||
break;
|
|
||||||
case 'cpuLoad':
|
|
||||||
$api->addData('cpuLoad', rpi_getCpuLoad(true));
|
|
||||||
break;
|
|
||||||
case 'cpuTemp':
|
|
||||||
$api->addData('cpuTemp', numberFormat(rpi_getCoreTemprature()));
|
|
||||||
break;
|
|
||||||
case 'ramPercentage':
|
|
||||||
$ram = rpi_getMemoryUsage();
|
|
||||||
$api->addData('ramPercentage', $ram['percent']);
|
|
||||||
break;
|
|
||||||
case 'memoryUsed':
|
|
||||||
$memory = rpi_getMemoryInfo();
|
|
||||||
$api->addData('memoryUsed', sizeUnit($memory[count($memory)-1]['used']));
|
|
||||||
break;
|
|
||||||
case 'memoryFree':
|
|
||||||
$memory = rpi_getMemoryInfo();
|
|
||||||
$api->addData('memoryFree', sizeUnit($memory[count($memory)-1]['free']));
|
|
||||||
break;
|
|
||||||
case 'memoryTotal':
|
|
||||||
$memory = rpi_getMemoryInfo();
|
|
||||||
$api->addData('memoryTotal', sizeUnit($memory[count($memory)-1]['total']));
|
|
||||||
break;
|
|
||||||
case 'memoryPercent':
|
|
||||||
$memory = rpi_getMemoryInfo();
|
|
||||||
$api->addData('memoryPercent', $memory[count($memory)-1]['percent']);
|
|
||||||
break;
|
|
||||||
case 'devices':
|
|
||||||
$api->addData('devices', rpi_getUsbDevices());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$api->setError('error', 'Data for "'.$data.'" are not available.');
|
|
||||||
break 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$api->setError('error', 'No data set.');
|
$api->setError('error', 'No data set.');
|
||||||
|
|
||||||
$api->display();
|
$api->display();
|
||||||
?>
|
|
||||||
|
function setData($datas, $api)
|
||||||
|
{
|
||||||
|
foreach ($datas as $data) {
|
||||||
|
switch ($data) {
|
||||||
|
case 'startTime':
|
||||||
|
$api->addData('startTime', formatTime(time() - rpi_getRuntime()));
|
||||||
|
break;
|
||||||
|
case 'runtime':
|
||||||
|
$api->addData('runtime', getDateFormat(rpi_getRuntime()));
|
||||||
|
break;
|
||||||
|
case 'cpuClock':
|
||||||
|
$api->addData('cpuClock', rpi_getCpuClock());
|
||||||
|
break;
|
||||||
|
case 'cpuLoad':
|
||||||
|
$api->addData('cpuLoad', rpi_getCpuLoad(false));
|
||||||
|
break;
|
||||||
|
case 'cpuTemp':
|
||||||
|
$api->addData('cpuTemp', numberFormat(rpi_getCoreTemprature()));
|
||||||
|
break;
|
||||||
|
case 'ramPercentage':
|
||||||
|
$ram = rpi_getMemoryUsage();
|
||||||
|
$api->addData('ramPercentage', $ram['percent']);
|
||||||
|
break;
|
||||||
|
case 'memoryUsed':
|
||||||
|
$memory = rpi_getMemoryInfo();
|
||||||
|
$api->addData('memoryUsed', sizeUnit($memory[count($memory) - 1]['used']));
|
||||||
|
break;
|
||||||
|
case 'memoryFree':
|
||||||
|
$memory = rpi_getMemoryInfo();
|
||||||
|
$api->addData('memoryFree', sizeUnit($memory[count($memory) - 1]['free']));
|
||||||
|
break;
|
||||||
|
case 'memoryTotal':
|
||||||
|
$memory = rpi_getMemoryInfo();
|
||||||
|
$api->addData('memoryTotal', sizeUnit($memory[count($memory) - 1]['total']));
|
||||||
|
break;
|
||||||
|
case 'memoryPercent':
|
||||||
|
$memory = rpi_getMemoryInfo();
|
||||||
|
$api->addData('memoryPercent', $memory[count($memory) - 1]['percent']);
|
||||||
|
break;
|
||||||
|
case 'devices':
|
||||||
|
$api->addData('devices', rpi_getUsbDevices());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$api->setError('error', 'Data for "' . $data . '" are not available.');
|
||||||
|
break 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -111,4 +111,3 @@ if (isset($_POST['logout']))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$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));
|
||||||
?>
|
|
||||||
@@ -1,138 +1,102 @@
|
|||||||
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);
|
||||||
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
||||||
|
|
||||||
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') {
|
||||||
{
|
overviewStatusRefreshEffect(cpuClock);
|
||||||
if (cpuClock.find('span').html() != data.data.cpuClock+' MHz')
|
cpuClock.find('span').html(data.data.cpuClock + ' MHz');
|
||||||
{
|
}
|
||||||
overviewStatusRefreshEffect(cpuClock);
|
|
||||||
cpuClock.find('span').html(data.data.cpuClock+' MHz');
|
this_.animate({ width: '66.6%' }, 300, 'linear');
|
||||||
}
|
if (cpuLoad.find('.progressbar div').html() != data.data.cpuLoad + '%') {
|
||||||
|
overviewStatusRefreshEffect(cpuLoad);
|
||||||
this_.animate({width: '66.6%'}, 300, 'linear');
|
cpuLoad.find('.progressbar').attr('data-text', data.data.cpuLoad + '%').find('div').css('width', data.data.cpuLoad + '%');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'cpuLoad' }, function(data)
|
}
|
||||||
{
|
|
||||||
if (cpuLoad.find('.progressbar div').html() != data.data.cpuLoad+'%')
|
this_.animate({ width: '55.5%' }, 300, 'linear');
|
||||||
{
|
if (cpuTemp.find('span').html() != data.data.cpuTemp + ' °C') {
|
||||||
overviewStatusRefreshEffect(cpuLoad);
|
overviewStatusRefreshEffect(cpuTemp);
|
||||||
cpuLoad.find('.progressbar').attr('data-text', data.data.cpuLoad+'%').find('div').css('width', data.data.cpuLoad+'%');
|
cpuTemp.find('span').html(data.data.cpuTemp + ' °C');
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '55.5%'}, 300, 'linear');
|
this_.animate({ width: '44.4%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'cpuTemp' }, function(data)
|
if (ramPercentage.find('.progressbar div').html() != data.data.ramPercentage + '%') {
|
||||||
{
|
overviewStatusRefreshEffect(ramPercentage);
|
||||||
if (cpuTemp.find('span').html() != data.data.cpuTemp+' °C')
|
ramPercentage.find('.progressbar').attr('data-text', data.data.ramPercentage + '%').find('div').css('width', data.data.ramPercentage + '%');
|
||||||
{
|
}
|
||||||
overviewStatusRefreshEffect(cpuTemp);
|
|
||||||
cpuTemp.find('span').html(data.data.cpuTemp+' °C');
|
this_.animate({ width: '33.3%' }, 300, 'linear');
|
||||||
}
|
if (memoryUsed.find('span').html() != data.data.memoryUsed) {
|
||||||
|
overviewStatusRefreshEffect(memoryUsed);
|
||||||
this_.animate({width: '44.4%'}, 300, 'linear');
|
memoryUsed.find('span').html(data.data.memoryUsed);
|
||||||
jQuery.post('api/v1/overview.php', { data: 'ramPercentage' }, function(data)
|
}
|
||||||
{
|
|
||||||
if (ramPercentage.find('.progressbar div').html() != data.data.ramPercentage+'%')
|
this_.animate({ width: '22.2%' }, 300, 'linear');
|
||||||
{
|
if (memoryFree.find('span').html() != data.data.memoryFree) {
|
||||||
overviewStatusRefreshEffect(ramPercentage);
|
overviewStatusRefreshEffect(memoryFree);
|
||||||
ramPercentage.find('.progressbar').attr('data-text', data.data.ramPercentage+'%').find('div').css('width', data.data.ramPercentage+'%');
|
memoryFree.find('span').html(data.data.memoryFree);
|
||||||
}
|
}
|
||||||
|
|
||||||
this_.animate({width: '33.3%'}, 300, 'linear');
|
this_.animate({ width: '11.1%' }, 300, 'linear');
|
||||||
jQuery.post('api/v1/overview.php', { data: 'memoryUsed' }, function(data)
|
if (memoryTotal.find('span').html() != data.data.memoryTotal) {
|
||||||
{
|
overviewStatusRefreshEffect(memoryTotal);
|
||||||
if (memoryUsed.find('span').html() != data.data.memoryUsed)
|
memoryTotal.find('span').html(data.data.memoryTotal);
|
||||||
{
|
}
|
||||||
overviewStatusRefreshEffect(memoryUsed);
|
|
||||||
memoryUsed.find('span').html(data.data.memoryUsed);
|
this_.animate({ width: '0%' }, 300, 'linear', function (e) {
|
||||||
}
|
is_loding = false;
|
||||||
|
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
||||||
this_.animate({width: '22.2%'}, 300, 'linear');
|
});
|
||||||
jQuery.post('api/v1/overview.php', { data: 'memoryFree' }, function(data)
|
|
||||||
{
|
overviewStatusRefresh();
|
||||||
if (memoryFree.find('span').html() != data.data.memoryFree)
|
}).fail(function (e) { showError(); });
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(memoryFree);
|
|
||||||
memoryFree.find('span').html(data.data.memoryFree);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
overviewStatusRefreshEffect(memoryTotal);
|
|
||||||
memoryTotal.find('span').html(data.data.memoryTotal);
|
|
||||||
}
|
|
||||||
|
|
||||||
this_.animate({width: '0%'}, 300, 'linear', function(e) {
|
|
||||||
is_loding = false;
|
|
||||||
jQuery('a[href=#refresh] img').removeClass('rotate-icon');
|
|
||||||
});
|
|
||||||
|
|
||||||
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(); });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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();
|
||||||
});
|
});
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<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.schultes.dev">Gregor Schulte</a> 2021-2022</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,50 +5,53 @@
|
|||||||
<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>
|
||||||
</div>
|
|
||||||
<input type="radio" id="ssh-login-passwd" name="ssh-login" value="password" checked="checked" />
|
|
||||||
<label for="ssh-login-passwd">
|
|
||||||
<div class="inner-table">
|
|
||||||
<div class="ssh-login-table-clickable-area"></div>
|
|
||||||
<table class="table table-borderless">
|
|
||||||
<tr>
|
|
||||||
<th colspan="2"><strong><?php _e('Anmeldung über ein Passwort'); ?></strong><span> [<?php _e('Klicken zum aktivieren'); ?>]</span></th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td style="width: 30%;"><strong><?php _e('SSH-Port'); ?></strong></td>
|
|
||||||
<td><input type="text" name="port" style="width: 50px;" value="<?php echo $data['ssh_info']['port']; ?>" maxlength="5" /> <span class="small-info"><?php _e('Standard: %d', 22); ?></span></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong><?php _e('SSH-Benutzername'); ?></strong></td>
|
|
||||||
<td><input type="text" name="username" style="width: 40%;" value="<?php echo $data['ssh_info']['username']; ?>" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong><?php _e('SSH-Passwort'); ?></strong></td>
|
|
||||||
<td><input type="password" name="password" style="width: 40%;" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><strong><?php _e('SSH-Login speichern?'); ?></strong></td>
|
|
||||||
<td><input type="checkbox" name="remember-me" value="checked" id="ssh-login-passwd-checkbox" /><label for="ssh-login-passwd-checkbox" class="checkbox only-checkbox"> </label> <span class="small_info"><?php _e('Speichert das Passwort, damit nicht nach jeder Session neu angemeldet werden muss.'); ?></span></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
</label>
|
<input type="radio" id="ssh-login-passwd" name="ssh-login" value="password" checked="checked" />
|
||||||
<div class="inner">
|
<label for="ssh-login-passwd">
|
||||||
<div class="divider"><div></div><div><?php _e('ODER'); ?></div></div>
|
<div class="inner-table">
|
||||||
</div>
|
<div class="ssh-login-table-clickable-area"></div>
|
||||||
<input type="radio" id="ssh-login-pubkey" name="ssh-login" value="publickey" />
|
<table class="table table-borderless">
|
||||||
<label for="ssh-login-pubkey">
|
<tr>
|
||||||
<div class="inner-table">
|
<th colspan="2"><strong><?php _e('Anmeldung über ein Passwort'); ?></strong><span> [<?php _e('Klicken zum aktivieren'); ?>]</span></th>
|
||||||
<div class="ssh-login-table-clickable-area"></div>
|
</tr>
|
||||||
<table class="table table-borderless">
|
<tr>
|
||||||
<tr>
|
<td style="width: 30%;"><strong><?php _e('SSH-Port'); ?></strong></td>
|
||||||
<th colspan="2"><strong><?php _e('Anmeldung über einen Publickey'); ?></strong><span> [<?php _e('Klicken zum aktivieren'); ?>]</span></th>
|
<td><input type="text" name="port" style="width: 50px;" value="<?php echo $data['ssh_info']['port']; ?>" maxlength="5" /> <span class="small-info"><?php _e('Standard: %d', 22); ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<td><strong><?php _e('SSH-Benutzername'); ?></strong></td>
|
||||||
|
<td><input type="text" name="username" style="width: 40%;" value="<?php echo $data['ssh_info']['username']; ?>" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php _e('SSH-Passwort'); ?></strong></td>
|
||||||
|
<td><input type="password" name="password" style="width: 40%;" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><strong><?php _e('SSH-Login speichern?'); ?></strong></td>
|
||||||
|
<td><input type="checkbox" name="remember-me" value="checked" id="ssh-login-passwd-checkbox" /><label for="ssh-login-passwd-checkbox" class="checkbox only-checkbox"> </label> <span class="small_info"><?php _e('Speichert das Passwort, damit nicht nach jeder Session neu angemeldet werden muss.'); ?></span></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<div class="inner">
|
||||||
|
<div class="divider">
|
||||||
|
<div></div>
|
||||||
|
<div><?php _e('ODER'); ?></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="radio" id="ssh-login-pubkey" name="ssh-login" value="publickey" />
|
||||||
|
<label for="ssh-login-pubkey">
|
||||||
|
<div class="inner-table">
|
||||||
|
<div class="ssh-login-table-clickable-area"></div>
|
||||||
|
<table class="table table-borderless">
|
||||||
|
<tr>
|
||||||
|
<th colspan="2"><strong><?php _e('Anmeldung über einen Publickey'); ?></strong><span> [<?php _e('Klicken zum aktivieren'); ?>]</span></th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<td style="width: 30%;"><strong><?php _e('SSH-Port'); ?></strong></td>
|
<td style="width: 30%;"><strong><?php _e('SSH-Port'); ?></strong></td>
|
||||||
<td><input type="text" name="port_" style="width: 50px;" value="<?php echo $data['ssh_info']['port']; ?>" maxlength="5" /> <span class="small-info"><?php _e('Standard: 22'); ?></span></td>
|
<td><input type="text" name="port_" style="width: 50px;" value="<?php echo $data['ssh_info']['port']; ?>" maxlength="5" /> <span class="small-info"><?php _e('Standard: 22'); ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -68,21 +71,21 @@
|
|||||||
<td><strong><?php _e('SSH-Login speichern?'); ?></strong></td>
|
<td><strong><?php _e('SSH-Login speichern?'); ?></strong></td>
|
||||||
<td><input type="checkbox" name="remember-me_" value="checked" id="ssh-login-pubkey-checkbox" /><label for="ssh-login-pubkey-checkbox" class="checkbox only-checkbox"> </label> <span class="small_info"><?php _e('Speichert das Passwort, damit nicht nach jeder Session neu angemeldet werden muss.'); ?></span></td>
|
<td><input type="checkbox" name="remember-me_" value="checked" id="ssh-login-pubkey-checkbox" /><label for="ssh-login-pubkey-checkbox" class="checkbox only-checkbox"> </label> <span class="small_info"><?php _e('Speichert das Passwort, damit nicht nach jeder Session neu angemeldet werden muss.'); ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<div class="inner-end">
|
||||||
|
<input type="submit" name="submit" value="<?php _e('Anmelden'); ?>" />
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</form>
|
||||||
<div class="inner-end">
|
<?php } else { ?>
|
||||||
<input type="submit" name="submit" value="<?php _e('Anmelden'); ?>" />
|
<div class="inner">
|
||||||
|
<strong class="green"><?php _e('Du bist bereits angemeldet mit dem Benutzer %s.', $data['ssh_info']['username']); ?></strong>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<div class="inner-end">
|
||||||
<?php } else { ?>
|
<a href="?s=ssh_login&logout"><button><?php _e('Abmelden'); ?></button></a>
|
||||||
<div class="inner">
|
</div>
|
||||||
<strong class="green"><?php _e('Du bist bereits angemeldet mit dem Benutzer %s.', $data['ssh_info']['username']); ?></strong>
|
<?php } ?>
|
||||||
</div>
|
|
||||||
<div class="inner-end">
|
|
||||||
<a href="?s=ssh_login&logout"><button><?php _e('Abmelden'); ?></button></a>
|
|
||||||
</div>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="clear_both"></div>
|
<div class="clear_both"></div>
|
||||||
@@ -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>
|
||||||
|
|||||||
@@ -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!');
|
||||||
?>
|
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -75,28 +73,27 @@ 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" | 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);
|
||||||
@@ -110,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];
|
||||||
@@ -124,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);
|
||||||
@@ -153,20 +150,17 @@ 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()
|
||||||
|
|||||||
@@ -827,8 +827,7 @@ class PiTpl
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user