Umbau der Statistik Ausgabe (each enfernt)

Optimierungen
This commit is contained in:
Gregor Schulte
2021-11-29 15:23:19 +01:00
parent b303dd00d6
commit c464f9e3a3
18 changed files with 580 additions and 545 deletions

124
.gitignore vendored
View File

@@ -1,50 +1,100 @@
# These are some examples of commonly ignored file patterns. ### JetBrains template
# You should customize this list as applicable to your project. # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Learn more about .gitignore: # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# https://www.atlassian.com/git/tutorials/saving-changes/gitignore
# Node artifact files # User-specific stuff
node_modules/ .idea/**/workspace.xml
dist/ .idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
.idea
# Compiled Java class files # Generated files
*.class .idea/**/contentModel.xml
# Compiled Python bytecode # Sensitive or high-churn files
*.py[cod] .idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Log files # Gradle
*.log .idea/**/gradle.xml
.idea/**/libraries
Pi Control.iml
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# Package files # CMake
*.jar cmake-build-*/
# Maven # Mongo Explorer plugin
target/ .idea/**/mongoSettings.xml
dist/
# JetBrains IDE # File-based project format
.idea/ *.iws
# Unit test reports # IntelliJ
TEST*.xml out/
# Generated by MacOS # mpeltonen/sbt-idea plugin
.DS_Store .idea_modules/
# Generated by Windows # JIRA plugin
Thumbs.db atlassian-ide-plugin.xml
# Applications # Cursive Clojure plugin
*.app .idea/replstate.xml
*.exe
*.war
# Large media files # Crashlytics plugin (for Android Studio and IntelliJ)
*.mp4 com_crashlytics_export_strings.xml
*.tiff crashlytics.properties
*.avi crashlytics-build.properties
*.flv fabric.properties
*.mov
*.wmv # Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### ZendFramework template
# Composer files
composer.phar
vendor/
# Local configs
config/autoload/*.local.php
# Binary gettext files
*.mo
# Data
data/logs/
data/cache/
data/sessions/
data/tmp/
temp/
#Doctrine 2
data/DoctrineORMModule/Proxy/
data/DoctrineORMModule/cache/
# Legacy ZF1
demos/
extras/documentation

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PICONTROL', true); const PICONTROL = true;
(include_once realpath(dirname(__FILE__)).'/../../resources/init.php') or die('Error: 0x0000'); (include_once realpath(dirname(__FILE__)).'/../../resources/init.php') or die('Error: 0x0000');
(include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001'); (include_once LIBRARY_PATH.'main/main.function.php') or die('Error: 0x0001');
@@ -86,4 +86,3 @@ else
} }
$api->display(); $api->display();
?>

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PICONTROL', true); const PICONTROL = true;
$doNotCheckForAuthentification = true; $doNotCheckForAuthentification = 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');

View File

@@ -41,12 +41,12 @@
<div class="inner-table"> <div class="inner-table">
<table class="table table-borderless table-form"> <table class="table table-borderless table-form">
<tr> <tr>
<td style="width: 50%;"><?php _e('Version %s', '>= 5.5'); ?></td> <td style="width: 50%;"><?php _e('Version %s', '>= 7.0'); ?></td>
<td class="<?php echo ($data['phpVersion']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpVersion']['status'] == true) ? '&#10004;' : '&#10006;'; echo ' '.$data['phpVersion']['version']; ?></td> <td class="<?php echo ($data['phpVersion']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpVersion']['status'] == true) ? '&#10004;' : '&#10006;'; echo ' '.$data['phpVersion']['version']; ?></td>
</tr> </tr>
<tr> <tr>
<td><?php _e('SSH2-Erweiterung installiert'); ?></td> <td><?php _e('SSH2-Erweiterung installiert'); ?></td>
<td class="<?php echo ($data['phpSSH']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpSSH']['status'] == true) ? '&#10004;' : '&#10006; <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&amp;i=11'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td> <td class="<?php echo ($data['phpSSH']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpSSH']['status'] == true) ? '&#10004;' : '&#10006; <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'#phpssh'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
</tr> </tr>
<tr> <tr>
<td><?php _e('Mcrypt-Erweiterung installiert'); ?></td> <td><?php _e('Mcrypt-Erweiterung installiert'); ?></td>
@@ -58,7 +58,7 @@
</tr> </tr>
<tr> <tr>
<td><?php _e('cURL-Erweiterung installiert'); ?></td> <td><?php _e('cURL-Erweiterung installiert'); ?></td>
<td class="<?php echo ($data['phpCURL']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpCURL']['status'] == true) ? '&#10004;' : '&#10006; <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'?s=view&amp;i=14'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td> <td class="<?php echo ($data['phpCURL']['status'] == true) ? 'green' : 'red'; ?>"><?php echo ($data['phpCURL']['status'] == true) ? '&#10004;' : '&#10006; <a style="color: inherit; text-decoration: underline" href="'.$data['configHelp'].'#phpcurl'.getURLLangParam().'" target="_blank">'._t('Anleitung zur Installation').'</a>'; ?></td>
</tr> </tr>
<tr> <tr>
<td><?php _e('ZipArchive-Erweiterung installiert'); ?></td> <td><?php _e('ZipArchive-Erweiterung installiert'); ?></td>

View File

@@ -19,7 +19,7 @@ $otherDistribution = array('version' => rpi_getDistribution(), 'status' => false
$otherCookie = array('status' => false); $otherCookie = array('status' => false);
$error = false; $error = false;
if (version_compare(PHP_VERSION, '5.5.0') >= 0) if (version_compare(PHP_VERSION, '7.0.0') >= 0)
$phpVersion['status'] = true; $phpVersion['status'] = true;
if (extension_loaded('ssh2')) if (extension_loaded('ssh2'))
@@ -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 php5-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.0-cli | grep Status: ')) || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') if (trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.4-cli | grep Status: ')) != '')
$phpCLI['status'] = true; $phpCLI['status'] = true;
if (function_exists('curl_init') !== false) if (function_exists('curl_init') !== false)
@@ -62,7 +62,7 @@ foreach ($filesFolders as $file => $info)
} }
// Sonstiges // Sonstiges
if ($otherDistribution['version'] == 'Raspbian GNU/Linux 7' || $otherDistribution['version'] == 'Raspbian GNU/Linux 8' || $otherDistribution['version'] == 'Raspbian GNU/Linux 9' || $otherDistribution['version'] == 'Raspbian GNU/Linux 10') if ($otherDistribution['version'] == 'Raspbian GNU/Linux 10' || $otherDistribution['version'] == 'Raspbian 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'] != '')

View File

@@ -16,7 +16,7 @@ if (!isset($config))
'update' => 'https://pi-control.de/service/v1/update/', 'update' => 'https://pi-control.de/service/v1/update/',
'updateDownload' => 'https://pi-control.de/?service=update', 'updateDownload' => 'https://pi-control.de/?service=update',
'updateNotification' => 'https://pi-control.de/?service=update_notification', 'updateNotification' => 'https://pi-control.de/?service=update_notification',
'help' => 'https://pi-control.de/help/' 'help' => 'https://www.die-schultes.eu/pi-control-hilfe/'
) )
); );
} }

View File

@@ -14,17 +14,15 @@
<a href="https://willy-tech.de/kontakt/" target="_blank" data-lang="<?php echo $data['language']; ?>"><?php _e('Feedback'); ?></a><br /> <a href="https://willy-tech.de/kontakt/" target="_blank" data-lang="<?php echo $data['language']; ?>"><?php _e('Feedback'); ?></a><br />
<a href="<?php echo $data['helpLink']; ?>" target="_blank"><?php _e('Hilfe'); ?></a><br /> <a href="<?php echo $data['helpLink']; ?>" target="_blank"><?php _e('Hilfe'); ?></a><br />
<a href="https://play.google.com/store/apps/details?id=de.willytech.picontrol" target="_blank" title="<?php _e('&Ouml;ffne im Play Store'); ?>"><?php _e('App im Play Store'); ?></a><br /> <a href="https://play.google.com/store/apps/details?id=de.willytech.picontrol" target="_blank" title="<?php _e('&Ouml;ffne im Play Store'); ?>"><?php _e('App im Play Store'); ?></a><br />
<a href="https://gitlab.com/pi-control" target="_blank"><?php _e('GitLab'); ?></a></td> <a href="https://bitbucket.org/GSchulte/pi-control/" target="_blank"><?php _e('Git Repo'); ?></a></td>
<td rowspan="2"><a href="https://willy-tech.de/" target="_blank"><?php _e('Mein Blog'); ?></a><br /> <td rowspan="2"><a href="https://www.die-schultes.eu/" target="_blank"><?php _e('Mein Blog'); ?></a><br />
<a href="https://twitter.com/Willys_TechBlog" target="_blank"><?php _e('Twitter'); ?></a><br />
<a href="https://www.paypal.me/fritzsche" target="_blank"><?php _e('Spenden'); ?></a></td>
<td><?php echo $data['version']; ?></td> <td><?php echo $data['version']; ?></td>
</tr> </tr>
<tr> <tr>
<td><strong><?php _e('LIZENZ'); ?></strong><span><?php _e('Raspberry Pi ist ein Markenzeichen<br />der %s.', '<a href="https://www.raspberrypi.org/" target="_blank">Raspberry Pi Foundation</a>'); ?></span></td> <td><strong><?php _e('LIZENZ'); ?></strong><span><?php _e('Raspberry Pi ist ein Markenzeichen<br />der %s.', '<a href="https://www.raspberrypi.org/" target="_blank">Raspberry Pi Foundation</a>'); ?></span></td>
</tr> </tr>
</table> </table>
<div id="footer-copyright"><?php _e('Mit %s entwickelt von %s.', '<span style="color: #F44336;">&#10084;</span>', '<a href="https://willy-tech.de/" target="_blank">Willy Fritzsche</a>'); ?> 2013-2017</div> <div id="footer-copyright"><?php _e('Mit %s entwickelt von %s.', '<span style="color: #F44336;">&#10084;</span>', '<a href="https://willy-tech.de/" target="_blank">Willy Fritzsche</a>'); ?> 2013-2017 <br>Weiterentwickelt von <a href="https://www.die-schultes.eu">Gregor Schulte</a> 2021</div>
</div> </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>

View File

@@ -38,7 +38,7 @@ $tpl->assign('configHelpFilesFolders', $config['url']['help'].'?s=view&amp;i=1'.
$tpl->assign('configHelpCron', $config['url']['help'].'?s=view&amp;i=10'.getURLLangParam()); $tpl->assign('configHelpCron', $config['url']['help'].'?s=view&amp;i=10'.getURLLangParam());
$tpl->assign('cronEntry', $cronEntry); $tpl->assign('cronEntry', $cronEntry);
$tpl->assign('cronMatch', $cronMatch); $tpl->assign('cronMatch', $cronMatch);
$tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php5-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '') ? true : false)); $tpl->assign('cronPHPCLI', ($cronPHPCLI = (trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') ? true : false));
$tpl->assign('cronLastExecution', formatTime(getConfig('cron:execution.cron', 0))); $tpl->assign('cronLastExecution', formatTime(getConfig('cron:execution.cron', 0)));
$tpl->assign('cronLastExecutionBool', ($cronLastExecutionBool = (getConfig('cron:execution.cron', 0) > time()-150) ? true : false)); $tpl->assign('cronLastExecutionBool', ($cronLastExecutionBool = (getConfig('cron:execution.cron', 0) > time()-150) ? true : false));
$tpl->assign('cronLastExecutionLog', formatTime($lastExecutionLog[0])); $tpl->assign('cronLastExecutionLog', formatTime($lastExecutionLog[0]));

View File

@@ -1,6 +1,6 @@
<?php <?php
if (PHP_SAPI != 'cli') exit(); if (PHP_SAPI != 'cli') exit();
define('PICONTROL', true); const PICONTROL = true;
$doNotCheckForAuthentification = true; $doNotCheckForAuthentification = true;
(include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000'); (include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000');
@@ -13,4 +13,3 @@ $log->setFile(LOG_PATH.'statistic/coretemp.csv');
$log->setLimit(2016); $log->setLimit(2016);
$log->add(array(time(), rpi_getCoreTemprature())); $log->add(array(time(), rpi_getCoreTemprature()));
$log->close(); $log->close();
?>

View File

@@ -1,6 +1,6 @@
<?php <?php
if (PHP_SAPI != 'cli') exit(); if (PHP_SAPI != 'cli') exit();
define('PICONTROL', true); const PICONTROL = true;
$doNotCheckForAuthentification = true; $doNotCheckForAuthentification = true;
(include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000'); (include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000');
@@ -31,6 +31,5 @@ foreach ($fileArray as $file)
} }
} }
if (trim(exec('dpkg -s php5-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.0-cli | grep Status: ')) || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '') if (trim(exec('dpkg -s php7.0-cli | grep Status: ')) != '' || trim(exec('dpkg -s php7.3-cli | grep Status: ')) != '')
setConfig('cron:execution.cron', time()); setConfig('cron:execution.cron', time());
?>

View File

@@ -10,7 +10,7 @@ if (!isset($config))
'ssh_ip' => '127.0.0.1' 'ssh_ip' => '127.0.0.1'
), ),
'version' => array( 'version' => array(
'version' => '2.1.2', 'version' => '2.2.0beta',
'versioncode' => 29, 'versioncode' => 29,
'android_comp_level' => 25 'android_comp_level' => 25
), ),

View File

@@ -147,4 +147,3 @@ class API
return true; return true;
} }
} }
?>

View File

@@ -35,4 +35,3 @@ function getCacheName($file)
return $file; return $file;
} }
} }
?>

View File

@@ -749,8 +749,10 @@ class PiTpl
$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);
$sshPassword = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $token2, base64_decode($sshPassword), MCRYPT_MODE_ECB, $iv); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
#$sshPassword = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $token2, base64_decode($sshPassword), MCRYPT_MODE_ECB, $iv);
$sshPassword = openssl_encrypt(base64_decode($sshPassword), 'aes-256-cbc', $token2, 0, $iv);
$sshPassword = rtrim($sshPassword, "\0"); $sshPassword = rtrim($sshPassword, "\0");
$ssh = new Net_SSH2('127.0.0.1', $sshPort); $ssh = new Net_SSH2('127.0.0.1', $sshPort);
@@ -904,8 +906,10 @@ class PiTpl
$uniqid = generateUniqId(16, false); $uniqid = generateUniqId(16, false);
$uniqid2 = generateUniqId(32, false); $uniqid2 = generateUniqId(32, false);
$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);
$SSHInfo['password'] = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $uniqid2, $password, MCRYPT_MODE_ECB, $iv)); $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
#$SSHInfo['password'] = base64_encode(openssl_encrypt(MCRYPT_RIJNDAEL_256, $uniqid2, $password, MCRYPT_MODE_ECB, $iv));
$SSHInfo['password'] = openssl_encrypt($password, 'aes-256-cbc', $uniqid, 0, $iv);
$SSHInfo['privateKey'] = $privateKey; $SSHInfo['privateKey'] = $privateKey;

View File

@@ -41,8 +41,7 @@ class LogStatistic
if ($moreThanOne === false) if ($moreThanOne === false)
fputcsv($this->stream, $entry); fputcsv($this->stream, $entry);
else else {
{
foreach ($entry as $item) foreach ($entry as $item)
fputcsv($this->stream, $item); fputcsv($this->stream, $item);
} }
@@ -84,8 +83,7 @@ class LogStatistic
if (!is_array(($entries = $this->getAll()))) if (!is_array(($entries = $this->getAll())))
return false; return false;
if (count($entries) >= $this->limit) if (count($entries) >= $this->limit) {
{
$unsetLineCount = count($entries) - $this->limit; $unsetLineCount = count($entries) - $this->limit;
for ($i = 0; $i <= $unsetLineCount; $i++) for ($i = 0; $i <= $unsetLineCount; $i++)
@@ -103,12 +101,10 @@ class LogStatistic
public function deleteLog() public function deleteLog()
{ {
if (is_file($this->file)) if (is_file($this->file)) {
{
if (unlink($this->file) or exit(_t('Konnte Log-Datei nicht l&ouml;schen: %s', $this->file))) if (unlink($this->file) or exit(_t('Konnte Log-Datei nicht l&ouml;schen: %s', $this->file)))
return true; return true;
} } else
else
return false; return false;
} }
@@ -155,29 +151,29 @@ class StatisticController
public function loadStatistics($folder = NULL) public function loadStatistics($folder = NULL)
{ {
$files = array();
if ($folder == NULL) if ($folder == NULL)
$possibleFolders = array(LOG_PATH); $possibleFolders = array(LOG_PATH);
else else
$possibleFolders = array(LOG_PATH . $folder); $possibleFolders = array(LOG_PATH . $folder);
while (list($key, $folder) = each($possibleFolders)) foreach ($possibleFolders as $folder) {
{ $this->statistics = array_merge($this->statistics, $this->loadStatisticsIterator($folder));
foreach (@scandir($folder) as $file) }
{ }
if ($file[0] != '.')
{ private function loadStatisticsIterator($folder)
if (is_file($folder.'/'.$file) && substr($file, -4) == '.csv')
{ {
$fileNames = array();
$files = array_diff(@scandir($folder), array('..', '.'));
foreach ($files as $file) {
$absolutePath = $folder . '/' . $file;
if (is_file($absolutePath) && substr($file, -4) == '.csv') {
$fileName = str_replace(LOG_PATH, '', $folder) . substr($file, 0, -4); $fileName = str_replace(LOG_PATH, '', $folder) . substr($file, 0, -4);
$this->statistics[substr(md5($fileName), 0, 8)] = $fileName; $fileNames[substr(md5($fileName), 0, 8)] = $fileName;
} } elseif (is_dir($absolutePath))
elseif (is_dir($folder.$file)) $fileNames = array_merge($fileNames, $this->loadStatisticsIterator($folder . $file . '/'));
$possibleFolders[] = $folder.$file.'/';
}
}
} }
return $fileNames;
} }
public function getStatisticID($name) public function getStatisticID($name)
@@ -216,15 +212,12 @@ class StatisticController
if (!is_bool($isID)) if (!is_bool($isID))
return false; return false;
if ($isID === true) if ($isID === true) {
{
if ($this->getStatisticName($value) !== false) if ($this->getStatisticName($value) !== false)
return true; return true;
else else
return false; return false;
} } elseif ($isID === false) {
elseif ($isID === false)
{
if ($this->getStatisticID($value) !== false) if ($this->getStatisticID($value) !== false)
return true; return true;
else else
@@ -264,17 +257,14 @@ class StatisticBuilder
$this->raw = $name; $this->raw = $name;
if (strpos($name, '/') !== false) if (strpos($name, '/') !== false) {
{
$explodes = explode('/', strrev($name), 2); $explodes = explode('/', strrev($name), 2);
$name = strrev($explodes[0]); $name = strrev($explodes[0]);
$prefix = strrev($explodes[1]) . '/'; $prefix = strrev($explodes[1]) . '/';
} }
if (!isset($statisticConfig[$name]) && isset($statisticConfig[substr($name, 0, strpos($name, '_'))])) if (!isset($statisticConfig[$name]) && isset($statisticConfig[substr($name, 0, strpos($name, '_'))])) {
{ if (strpos($name, '_') !== false) {
if (strpos($name, '_') !== false)
{
$explodes = explode('_', strrev($name), 2); $explodes = explode('_', strrev($name), 2);
$suffix = strrev($explodes[0]); $suffix = strrev($explodes[0]);
$name = strrev($explodes[1]); $name = strrev($explodes[1]);
@@ -295,10 +285,8 @@ class StatisticBuilder
$this->cycle = $statistic['cycle']; $this->cycle = $statistic['cycle'];
$this->limits = $statistic['limits']; $this->limits = $statistic['limits'];
foreach ($statistic['columns'] as $column) foreach ($statistic['columns'] as $column) {
{ foreach ($column as &$values) {
foreach ($column as &$values)
{
if (is_string($values)) if (is_string($values))
$values = _t($values); $values = _t($values);
} }
@@ -348,7 +336,8 @@ class StatisticBuilder
public function getJSON() public function getJSON()
{ {
$json = json_encode(array( $json = json_encode(
array(
'id' => $this->getId(), 'id' => $this->getId(),
'label' => $this->label, 'label' => $this->label,
'unit' => $this->unit, 'unit' => $this->unit,
@@ -360,4 +349,3 @@ class StatisticBuilder
return $json; return $json;
} }
} }
?>

View File

@@ -1,5 +1,5 @@
<?php <?php
define('PICONTROL', true); const PICONTROL = true;
(include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000'); (include_once realpath(dirname(__FILE__)).'/../init.php') or die('Error: 0x0000');
(include_once LIBRARY_PATH.'main/tpl.class.php') or die('Error: 0x0001'); (include_once LIBRARY_PATH.'main/tpl.class.php') or die('Error: 0x0001');