Fix Certificate date sorting
This commit is contained in:
@@ -74,8 +74,13 @@ function gpvar($v) {
|
||||
# Sort a two multidimensional array by one of it's columns
|
||||
#
|
||||
function csort($array, $column, $ascdec=SORT_ASC){
|
||||
|
||||
if (sizeof($array) == 0) return $array;
|
||||
|
||||
// Sort by digital date rather than text date
|
||||
if ($column == 'issued') $column = "issuedSort";
|
||||
if ($column == 'expires') $column = 'expiresSort';
|
||||
|
||||
foreach($array as $x) $sortarr[]=$x[$column];
|
||||
array_multisort($sortarr, $ascdec, $array);
|
||||
|
||||
|
@@ -362,11 +362,14 @@ function CAdb_explode_entry($dbentry) {
|
||||
// CA_cert_start/enddate
|
||||
// A date will be returned in this format
|
||||
// Feb 27 16:00:09 2020 GMT
|
||||
// Add a 'digital' sort key for digital date sorting later
|
||||
sscanf(CA_cert_startdate($a[3]),"%s%s%s%s", $mm,$dd,$tt,$yy);
|
||||
$db['issued'] = strftime("%Y-%b-%d", strtotime("$yy-$mm-$dd"));
|
||||
$db['issuedSort'] = strftime("%Y-%m-%d", strtotime("$yy-$mm-$dd"));
|
||||
|
||||
sscanf(CA_cert_enddate($a[3]), "%s%s%s%s",$mm,$dd,$tt,$yy);
|
||||
$db['expires'] = strftime("%Y-%b-%d", strtotime("$yy-$mm-$dd"));
|
||||
$db['expiresSort'] = strftime("%Y-%m-%d", strtotime("$yy-$mm-$dd"));
|
||||
|
||||
if (time() > strtotime("$yy-$mm-$dd")) {
|
||||
$db['status'] = "Expired";
|
||||
|
Reference in New Issue
Block a user