Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7e0f37528 |
@@ -1,7 +0,0 @@
|
||||
# Pi Control
|
||||
|
||||
## Installation
|
||||
[Pi Control Installation](https://pi-control.de/install/)
|
||||
|
||||
## Bei Fragen oder Problemen
|
||||
Ü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,69 +0,0 @@
|
||||
<?php
|
||||
define('PICONTROL', true);
|
||||
|
||||
(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/rpi.function.php') or die('Error: 0x0002');
|
||||
(include_once LIBRARY_PATH . 'api/api.class.php') or die('Error: 0x0003');
|
||||
|
||||
$api = new API;
|
||||
|
||||
if (isset($_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.');
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
7
backend/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Pi Control
|
||||
|
||||
## Installation
|
||||
[Pi Control Installation](https://pi-control.de/install/)
|
||||
|
||||
## 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
|
||||
67
backend/api/v1/overview.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
define('PICONTROL', true);
|
||||
|
||||
(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/rpi.function.php') or die('Error: 0x0002');
|
||||
(include_once LIBRARY_PATH.'api/api.class.php') or die('Error: 0x0003');
|
||||
|
||||
$api = new API;
|
||||
|
||||
if (isset($_POST['data']))
|
||||
{
|
||||
$datas = explode(';', $_POST['data']);
|
||||
|
||||
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(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->display();
|
||||
?>
|
||||
@@ -111,3 +111,4 @@ if (isset($_POST['logout']))
|
||||
}
|
||||
|
||||
$api->display();
|
||||
?>
|
||||
@@ -7,3 +7,4 @@ $apiVersions[0] = array('versioncode' => 1,
|
||||
'date' => 1443909600);
|
||||
|
||||
echo json_encode(array('versions' => $apiVersions, 'latest' => $apiLatest));
|
||||
?>
|
||||
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 194 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 883 B After Width: | Height: | Size: 883 B |
|
Before Width: | Height: | Size: 993 B After Width: | Height: | Size: 993 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 911 B After Width: | Height: | Size: 911 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 446 B After Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 259 B After Width: | Height: | Size: 259 B |
|
Before Width: | Height: | Size: 897 B After Width: | Height: | Size: 897 B |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@@ -15,7 +15,7 @@ $phpZipArchive = array('status' => false);
|
||||
$phpAllowUrlFopen = array('status' => false);
|
||||
$filesFoldersExist = array('count' => 0, 'status' => true);
|
||||
$filesFoldersPermission = array('count' => 0, 'status' => true);
|
||||
$otherDistribution = array('version' => rpi_getDistribution(), 'status' => true);
|
||||
$otherDistribution = array('version' => rpi_getDistribution(), 'status' => false);
|
||||
$otherCookie = array('status' => false);
|
||||
$error = false;
|
||||
|
||||
@@ -28,7 +28,7 @@ if (extension_loaded('ssh2'))
|
||||
#if (function_exists('mcrypt_encrypt') !== false)
|
||||
# $phpMcrypt['status'] = true;
|
||||
|
||||
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: ')) != '')
|
||||
if (trim(exec('dpkg -s php7.3-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;
|
||||
|
||||
if (function_exists('curl_init') !== false)
|
||||
@@ -43,14 +43,18 @@ if (ini_get('allow_url_fopen') !== false)
|
||||
// Dateien und Ordner
|
||||
$filesFolders = fileFolderPermission();
|
||||
|
||||
foreach ($filesFolders as $file => $info) {
|
||||
if ($info['error'] === true) {
|
||||
if ($info['existsBool'] === false || $info['filesizeBool'] === false) {
|
||||
foreach ($filesFolders as $file => $info)
|
||||
{
|
||||
if ($info['error'] === true)
|
||||
{
|
||||
if ($info['existsBool'] === false || $info['filesizeBool'] === false)
|
||||
{
|
||||
$filesFoldersExist['count'] += 1;
|
||||
$filesFoldersExist['status'] = false;
|
||||
}
|
||||
|
||||
if ($info['permissionBool'] === false || $info['userGroupBool'] === false) {
|
||||
if ($info['permissionBool'] === false || $info['userGroupBool'] === false)
|
||||
{
|
||||
$filesFoldersPermission['count'] += 1;
|
||||
$filesFoldersPermission['status'] = false;
|
||||
}
|
||||
@@ -58,8 +62,8 @@ foreach ($filesFolders as $file => $info) {
|
||||
}
|
||||
|
||||
// Sonstiges
|
||||
//if ($otherDistribution['version'] == 'Raspbian GNU/Linux 10' || $otherDistribution['version'] == 'Raspbian GNU/Linux 11' || $otherDistribution['version'] == 'Debian GNU/Linux 11')
|
||||
// $otherDistribution['status'] = true;
|
||||
if ($otherDistribution['version'] == 'Raspbian GNU/Linux 10' || $otherDistribution['version'] == 'Raspbian GNU/Linux 11' || $otherDistribution['version'] == 'Debian GNU/Linux 11')
|
||||
$otherDistribution['status'] = true;
|
||||
|
||||
if (isset($_COOKIE['_pi-control_install_language']) && $_COOKIE['_pi-control_install_language'] != '')
|
||||
$otherCookie['status'] = true;
|
||||
@@ -87,3 +91,4 @@ $tpl->assign('langUrl', (isset($_GET['lang']) && $_GET['lang'] != '') ? '&la
|
||||
$tpl->assign('configHelp', $config['url']['help']);
|
||||
|
||||
$tpl->draw('install_requirement');
|
||||
?>
|
||||
@@ -650,7 +650,7 @@ class PiTpl
|
||||
* @return bool
|
||||
*/
|
||||
|
||||
public function msg($type, $msg, $title = NULL, $cancelable = true, $id = 0)
|
||||
public function msg($type, $title = NULL, $msg, $cancelable = true, $id = 0)
|
||||
{
|
||||
if (!strlen($type) > 0 || !is_string($type) ||
|
||||
!strlen($msg) > 0 || !is_string($msg)
|
||||
@@ -943,3 +943,4 @@ class PiTpl
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||