Installer angepasst für aktuelle Systeme
This commit is contained in:
@@ -8,9 +8,29 @@ const PICONTROL = true;
|
|||||||
(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();
|
||||||
|
|
||||||
@@ -57,7 +77,7 @@ if (isset($_POST['id'])) {
|
|||||||
$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:{}')));
|
||||||
|
|
||||||
@@ -75,6 +95,7 @@ if (isset($_POST['id'])) {
|
|||||||
|
|
||||||
$api->addData('statistics', $statistics);
|
$api->addData('statistics', $statistics);
|
||||||
$api->addData('hidden', $hiddenStatistics);
|
$api->addData('hidden', $hiddenStatistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
$api->display();
|
$api->display();
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ if (extension_loaded('ssh2'))
|
|||||||
#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' || $otherDistribution['version'] == 'Debian 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;
|
||||||
@@ -87,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');
|
||||||
?>
|
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
@@ -31,5 +31,5 @@ foreach ($fileArray as $file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '')
|
if (trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-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: ')) != '')
|
||||||
setConfig('cron:execution.cron', time());
|
setConfig('cron:execution.cron', time());
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ if (!isset($config))
|
|||||||
'ssh_ip' => '127.0.0.1'
|
'ssh_ip' => '127.0.0.1'
|
||||||
),
|
),
|
||||||
'version' => array(
|
'version' => array(
|
||||||
'version' => '2.3.1',
|
'version' => '2.3.2',
|
||||||
'versioncode' => 36,
|
'versioncode' => 37,
|
||||||
'android_comp_level' => 25
|
'android_comp_level' => 25
|
||||||
),
|
),
|
||||||
'url' => array(
|
'url' => array(
|
||||||
@@ -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();
|
||||||
|
|||||||
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 {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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,8 +825,7 @@ 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, 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);
|
||||||
@@ -859,13 +850,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 +890,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 +904,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 +940,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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user