update libraries and run php-cs-fixer.
This commit is contained in:
		@@ -15,15 +15,15 @@
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    "require": {
 | 
			
		||||
        "php": ">=8.0",
 | 
			
		||||
        "php": ">=8.2",
 | 
			
		||||
        "ext-json": "*",
 | 
			
		||||
        "ext-mbstring": "*",
 | 
			
		||||
        "ext-rrd": "*",
 | 
			
		||||
        "phpmailer/phpmailer": "^6.6",
 | 
			
		||||
        "twig/twig": "^3.4"
 | 
			
		||||
        "phpmailer/phpmailer": "^6.9",
 | 
			
		||||
        "twig/twig": "^3.8"
 | 
			
		||||
    },
 | 
			
		||||
    "require-dev": {
 | 
			
		||||
        "friendsofphp/php-cs-fixer": "^3.8"
 | 
			
		||||
        "friendsofphp/php-cs-fixer": "^3.48"
 | 
			
		||||
    },
 | 
			
		||||
    "license": "MIT",
 | 
			
		||||
    "authors": [
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										967
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										967
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -97,32 +97,32 @@ class DigiTemp
 | 
			
		||||
            $key = array_shift($cols);
 | 
			
		||||
            $value = array_shift($cols);
 | 
			
		||||
            switch ($key) {
 | 
			
		||||
            case 'TTY':
 | 
			
		||||
                $this->config[$key] = $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'READ_TIME':
 | 
			
		||||
                $this->config[$key] = (int) $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'LOG_TYPE':
 | 
			
		||||
                $this->config[$key] = (int) $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'LOG_FORMAT':
 | 
			
		||||
                $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'CNT_FORMAT':
 | 
			
		||||
                $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'HUM_FORMAT':
 | 
			
		||||
                $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'SENSORS':
 | 
			
		||||
                $this->config[$key] = (int) $value;
 | 
			
		||||
                break;
 | 
			
		||||
            case 'ROM':
 | 
			
		||||
                $this->config[$key][(int) $value] = str_replace('0x', '', implode('', array_reverse($cols)));
 | 
			
		||||
                break;
 | 
			
		||||
            default:
 | 
			
		||||
                return false;
 | 
			
		||||
                case 'TTY':
 | 
			
		||||
                    $this->config[$key] = $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'READ_TIME':
 | 
			
		||||
                    $this->config[$key] = (int) $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'LOG_TYPE':
 | 
			
		||||
                    $this->config[$key] = (int) $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'LOG_FORMAT':
 | 
			
		||||
                    $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'CNT_FORMAT':
 | 
			
		||||
                    $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'HUM_FORMAT':
 | 
			
		||||
                    $this->config[$key] = '"' === substr($value, 0, 1) ? stripslashes(substr($value, 1, -1)) : $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'SENSORS':
 | 
			
		||||
                    $this->config[$key] = (int) $value;
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'ROM':
 | 
			
		||||
                    $this->config[$key][(int) $value] = str_replace('0x', '', implode('', array_reverse($cols)));
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -58,8 +58,6 @@ class Address
 | 
			
		||||
    /**
 | 
			
		||||
     * check wheter string is email.
 | 
			
		||||
     *
 | 
			
		||||
     * @param string $text email
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool false if not email string
 | 
			
		||||
     */
 | 
			
		||||
    public function validateEmail(string $email): bool
 | 
			
		||||
 
 | 
			
		||||
@@ -9,10 +9,9 @@ class UTF8_Mailer
 | 
			
		||||
    /**
 | 
			
		||||
     * send mail.
 | 
			
		||||
     *
 | 
			
		||||
     * @param Address $form    from email address
 | 
			
		||||
     * @param array   $tos     to email addresses
 | 
			
		||||
     * @param string  $subject subject
 | 
			
		||||
     * @param string  $body    mail body
 | 
			
		||||
     * @param array  $tos     to email addresses
 | 
			
		||||
     * @param string $subject subject
 | 
			
		||||
     * @param string $body    mail body
 | 
			
		||||
     *
 | 
			
		||||
     * @return bool false if failure
 | 
			
		||||
     */
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
 | 
			
		||||
 | 
			
		||||
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
 | 
			
		||||
 | 
			
		||||
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$num = $digitemp->getNumSensors();
 | 
			
		||||
$sensors = [];
 | 
			
		||||
for ($i = 0; $i < $num; ++$i) {
 | 
			
		||||
@@ -29,8 +29,8 @@ if ($do_send) {
 | 
			
		||||
    $from_name = $config['mail_from_name'];
 | 
			
		||||
    $to = $config['mail_alert_to'];
 | 
			
		||||
    $subject = $config['mail_alert_subject'];
 | 
			
		||||
    $loader = new \Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
 | 
			
		||||
    $twig = new \Twig\Environment($loader);
 | 
			
		||||
    $loader = new Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
 | 
			
		||||
    $twig = new Twig\Environment($loader);
 | 
			
		||||
    $data = [
 | 
			
		||||
        'range' => [
 | 
			
		||||
            'upper' => $upper,
 | 
			
		||||
@@ -45,7 +45,7 @@ if ($do_send) {
 | 
			
		||||
    ];
 | 
			
		||||
    $body = $twig->render($config['mail_alert_template'], $data);
 | 
			
		||||
 | 
			
		||||
    $from = new \Orrisroot\Mail\Address($from_name, $from);
 | 
			
		||||
    $tos = [new \Orrisroot\Mail\Address($to, $to)];
 | 
			
		||||
    \Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);
 | 
			
		||||
    $from = new Orrisroot\Mail\Address($from_name, $from);
 | 
			
		||||
    $tos = [new Orrisroot\Mail\Address($to, $to)];
 | 
			
		||||
    Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
 | 
			
		||||
 | 
			
		||||
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
 | 
			
		||||
 | 
			
		||||
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$num = $digitemp->getNumSensors();
 | 
			
		||||
$sensors = [];
 | 
			
		||||
for ($i = 0; $i < $num; ++$i) {
 | 
			
		||||
@@ -20,8 +20,8 @@ $from = $config['mail_from'];
 | 
			
		||||
$from_name = $config['mail_from_name'];
 | 
			
		||||
$to = $config['mail_info_to'];
 | 
			
		||||
$subject = $config['mail_info_subject'];
 | 
			
		||||
$loader = new \Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
 | 
			
		||||
$twig = new \Twig\Environment($loader);
 | 
			
		||||
$loader = new Twig\Loader\FilesystemLoader(APPDIR.'/'.$config['templates_dir']);
 | 
			
		||||
$twig = new Twig\Environment($loader);
 | 
			
		||||
$data = [
 | 
			
		||||
    'from' => [
 | 
			
		||||
        'name' => $from_name,
 | 
			
		||||
@@ -32,6 +32,6 @@ $data = [
 | 
			
		||||
];
 | 
			
		||||
$body = $twig->render($config['mail_info_template'], $data);
 | 
			
		||||
 | 
			
		||||
$from = new \Orrisroot\Mail\Address($from_name, $from);
 | 
			
		||||
$tos = [new \Orrisroot\Mail\Address($to, $to)];
 | 
			
		||||
\Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);
 | 
			
		||||
$from = new Orrisroot\Mail\Address($from_name, $from);
 | 
			
		||||
$tos = [new Orrisroot\Mail\Address($to, $to)];
 | 
			
		||||
Orrisroot\Mail\UTF8_Mailer::sendMail($from, $tos, $subject, $body);
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,8 @@ require_once APPDIR.'/vendor/autoload.php';
 | 
			
		||||
 | 
			
		||||
$config = json_decode(file_get_contents(APPDIR.'/etc/config.json'), true);
 | 
			
		||||
 | 
			
		||||
$digitemp = new \Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new \Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$digitemp = new Orrisroot\DigiTemp($config['digitemp'], APPDIR.'/'.$config['digitemp_config']);
 | 
			
		||||
$rrdtemp = new Orrisroot\Rrd\Temperature(APPDIR.'/'.$config['database_dir']);
 | 
			
		||||
$num = $digitemp->getNumSensors();
 | 
			
		||||
for ($i = 0; $i < $num; ++$i) {
 | 
			
		||||
    $id = $digitemp->getSensorId($i);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user