Fixed Color Logic

This commit is contained in:
2026-02-12 21:33:15 +00:00
parent 4864cd6a3e
commit ccc0720cfc
4 changed files with 47 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ use function PHPSTORM_META\type;
}
}
function status_class_bg($ssl, $word, $expiry, $retcol=null){
function status_class_bg($ssl, $word, $expiry, $retcol=null, $showday="null"){
// CSS CLASS
$red = "alert_red";
@@ -38,13 +38,16 @@ function status_class_bg($ssl, $word, $expiry, $retcol=null){
$days = ssl_days_left($expiry);
if ($showday == "on"){
return $days;
}
if ($ssl != 1 || $word != 1) {
echo $red;
return;
}
if ($days !== null) {
@@ -53,7 +56,7 @@ function status_class_bg($ssl, $word, $expiry, $retcol=null){
if ($retcol){ // CRITICAL
echo $style . $col_orange . ";'";
}else{
echo $red;
echo $orange;
return;
}
}elseif ($days <= SSL_WARNING_DAYS) {
@@ -123,6 +126,21 @@ function status_class_bg($ssl, $word, $expiry, $retcol=null){
$ssl_expiry=$check_element['ssl-expiry'];
$ssl_company=$check_element['ssl-company'];
$http_error=$check_element['content_http_code'];
$expirying_days=status_class_bg($sslcheck_ok, $checkword_ok, $ssl_expiry, false, 'on');
$col_red = "#ff4747";
$col_orange = "#ff830f";
$col_yellow = "#ffd70f";
$col_green = "#42c500";
if($expirying_days < 0){
$expiry_col='style="font-weight:bold; color:' . $col_red . ';"';
}elseif($expirying_days <= SSL_CRITICAL_DAYS ){
$expiry_col='style="font-weight:bold; color:' . $col_orange . ';"';
}elseif($expirying_days <= SSL_WARNING_DAYS){
$expiry_col='style="font-weight:bold; color:' . $col_yellow . ';"';
}else{
$expiry_col='style="font-weight:bold; color:' . $col_green . ';"';
}
if ($path == ""){
$path = "/";
@@ -139,12 +157,13 @@ function status_class_bg($ssl, $word, $expiry, $retcol=null){
<div class="alert-details">
<div><b>WORD TO CHECK: </b> <span><?= $wordtocheck ?></span></div>
<div><b>SSL RELEASED: </b> <span><?= $ssl_released ?></span></div>
<div><b>SSL EXPIRY: </b> <span <?php echo status_class_bg($sslcheck_ok, $checkword_ok, $ssl_expiry, true)?>> <?= $ssl_expiry ?></span></div>
<div><b>SSL COMPANY: </b> <span><?= $ssl_company ?></span></div>
<div><b>SSL EXPIRY: </b> <span <?= $expiry_col ?>> <?= $ssl_expiry ?></span></div>
<div><b>SSL DAYS LEFT: </b> <span <?= $expiry_col ?>><?= $expirying_days ?></span></div>
<div><b>SSL COMPANY: </b> <span> <?= $ssl_company ?></span></div>
<div><b>PATH: </b> <span><?= $path ?></span></div>
<div><b>ERROR CODE: </b> <span><?= $http_error ?></span></div>
</div>
</div>
<?php