2016-08-08 12:31:19 +00:00
|
|
|
<?php
|
2018-05-29 19:16:40 +00:00
|
|
|
|
2019-04-10 08:37:35 +00:00
|
|
|
include_once('includes/status_messages.php');
|
2019-10-08 18:10:18 +00:00
|
|
|
include_once('app/lib/system.php');
|
2018-05-29 19:16:40 +00:00
|
|
|
|
2016-08-08 12:38:15 +00:00
|
|
|
/**
|
2018-05-29 19:16:40 +00:00
|
|
|
*
|
|
|
|
* Find the version of the Raspberry Pi
|
|
|
|
* Currently only used for the system information page but may useful elsewhere
|
|
|
|
*
|
|
|
|
*/
|
2016-08-08 12:38:15 +00:00
|
|
|
|
2019-04-10 08:37:35 +00:00
|
|
|
function RPiVersion()
|
|
|
|
{
|
|
|
|
// Lookup table from http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/
|
|
|
|
$revisions = array(
|
2016-08-08 12:38:15 +00:00
|
|
|
'0002' => 'Model B Revision 1.0',
|
|
|
|
'0003' => 'Model B Revision 1.0 + ECN0001',
|
|
|
|
'0004' => 'Model B Revision 2.0 (256 MB)',
|
|
|
|
'0005' => 'Model B Revision 2.0 (256 MB)',
|
|
|
|
'0006' => 'Model B Revision 2.0 (256 MB)',
|
|
|
|
'0007' => 'Model A',
|
|
|
|
'0008' => 'Model A',
|
|
|
|
'0009' => 'Model A',
|
|
|
|
'000d' => 'Model B Revision 2.0 (512 MB)',
|
|
|
|
'000e' => 'Model B Revision 2.0 (512 MB)',
|
|
|
|
'000f' => 'Model B Revision 2.0 (512 MB)',
|
|
|
|
'0010' => 'Model B+',
|
|
|
|
'0013' => 'Model B+',
|
|
|
|
'0011' => 'Compute Module',
|
|
|
|
'0012' => 'Model A+',
|
|
|
|
'a01041' => 'a01041',
|
|
|
|
'a21041' => 'a21041',
|
2017-03-08 21:24:42 +00:00
|
|
|
'900092' => 'PiZero 1.2',
|
|
|
|
'900093' => 'PiZero 1.3',
|
2017-05-19 13:44:51 +00:00
|
|
|
'9000c1' => 'PiZero W',
|
2016-08-08 12:38:15 +00:00
|
|
|
'a02082' => 'Pi 3 Model B',
|
2019-02-04 17:08:10 +00:00
|
|
|
'a22082' => 'Pi 3 Model B',
|
|
|
|
'a32082' => 'Pi 3 Model B',
|
|
|
|
'a52082' => 'Pi 3 Model B',
|
|
|
|
'a020d3' => 'Pi 3 Model B+',
|
|
|
|
'a220a0' => 'Compute Module 3',
|
|
|
|
'a020a0' => 'Compute Module 3',
|
|
|
|
'a02100' => 'Compute Module 3+',
|
2019-08-12 09:22:06 +00:00
|
|
|
'c03111' => 'Model 4B v1.1'
|
2019-04-10 08:37:35 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$cpuinfo_array = '';
|
|
|
|
exec('cat /proc/cpuinfo', $cpuinfo_array);
|
|
|
|
$rev = trim(array_pop(explode(':', array_pop(preg_grep("/^Revision/", $cpuinfo_array)))));
|
|
|
|
if (array_key_exists($rev, $revisions)) {
|
|
|
|
return $revisions[$rev];
|
|
|
|
} else {
|
|
|
|
return 'Unknown Pi';
|
|
|
|
}
|
2016-08-08 12:38:15 +00:00
|
|
|
}
|
|
|
|
|
2016-08-08 12:31:19 +00:00
|
|
|
/**
|
2018-05-29 19:16:40 +00:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
2019-04-10 08:37:35 +00:00
|
|
|
function DisplaySystem()
|
|
|
|
{
|
|
|
|
|
|
|
|
$status = new StatusMessages();
|
2019-08-18 22:29:46 +00:00
|
|
|
$system = new System();
|
|
|
|
|
2019-04-10 08:37:35 +00:00
|
|
|
|
|
|
|
if (isset($_POST['SaveLanguage'])) {
|
2019-07-30 15:05:41 +00:00
|
|
|
if (isset($_POST['locale'])) {
|
|
|
|
$_SESSION['locale'] = $_POST['locale'];
|
|
|
|
$status->addMessage('Language setting saved', 'success');
|
2019-04-10 08:37:35 +00:00
|
|
|
}
|
2018-05-29 19:16:40 +00:00
|
|
|
}
|
|
|
|
|
2019-04-10 08:37:35 +00:00
|
|
|
// define locales
|
|
|
|
$arrLocales = array(
|
2018-05-29 19:16:40 +00:00
|
|
|
'en_GB.UTF-8' => 'English',
|
2018-06-16 21:55:12 +00:00
|
|
|
'de_DE.UTF-8' => 'Deutsch',
|
2018-06-12 16:45:11 +00:00
|
|
|
'fr_FR.UTF-8' => 'Français',
|
|
|
|
'it_IT.UTF-8' => 'Italiano',
|
2018-05-29 22:20:08 +00:00
|
|
|
'pt_BR.UTF-8' => 'Português',
|
2018-09-12 14:43:23 +00:00
|
|
|
'sv_SE.UTF-8' => 'Svenska',
|
2018-10-17 15:51:59 +00:00
|
|
|
'nl_NL.UTF-8' => 'Nederlands',
|
2018-11-04 08:59:01 +00:00
|
|
|
'zh_CN.UTF-8' => '简体中文 (Chinese simplified)',
|
2018-11-19 16:44:44 +00:00
|
|
|
'cs_CZ.UTF-8' => 'Čeština',
|
2019-01-13 08:53:16 +00:00
|
|
|
'ru_RU.UTF-8' => 'Русский',
|
2019-03-04 23:12:01 +00:00
|
|
|
'es_MX.UTF-8' => 'Español',
|
|
|
|
'fi_FI.UTF-8' => 'Finnish',
|
2019-06-10 09:27:42 +00:00
|
|
|
'si_LK.UTF-8' => 'Sinhala',
|
|
|
|
'tr_TR.UTF-8' => 'Türkçe'
|
2019-04-10 08:37:35 +00:00
|
|
|
);
|
|
|
|
|
2019-08-19 00:10:28 +00:00
|
|
|
if (isset($_POST['system_reboot'])) {
|
|
|
|
$status->addMessage("System Rebooting Now!", "warning", false);
|
|
|
|
$result = shell_exec("sudo /sbin/reboot");
|
|
|
|
}
|
|
|
|
if (isset($_POST['system_shutdown'])) {
|
|
|
|
$status->addMessage("System Shutting Down Now!", "warning", false);
|
|
|
|
$result = shell_exec("sudo /sbin/shutdown -h now");
|
|
|
|
}
|
|
|
|
|
2019-08-18 22:29:46 +00:00
|
|
|
echo renderTemplate("system", compact("arrLocales", "status", "system"));
|
2016-08-08 12:31:19 +00:00
|
|
|
}
|