diff -ruN phpki.old/phpki-0.82/include/my_functions.php phpki/phpki-0.82/include/my_functions.php --- phpki.old/phpki-0.82/include/my_functions.php 2020-04-02 11:53:51.283314132 +0200 +++ phpki/phpki-0.82/include/my_functions.php 2020-04-02 11:49:42.266331853 +0200 @@ -73,9 +73,13 @@ # # Sort a two multidimensional array by one of it's columns # -function csort($array, $column, $ascdec=SORT_ASC){ +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); diff -ruN phpki.old/phpki-0.82/include/openssl_functions.php phpki/phpki-0.82/include/openssl_functions.php --- phpki.old/phpki-0.82/include/openssl_functions.php 2020-04-02 11:53:51.283314132 +0200 +++ phpki/phpki-0.82/include/openssl_functions.php 2020-04-02 11:47:38.353368886 +0200 @@ -322,11 +322,14 @@ // 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";