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 14:27:14.041463385 +0200 +++ phpki/phpki-0.82/include/my_functions.php 2020-04-02 14:28:41.770684362 +0200 @@ -73,17 +73,25 @@ # # Sort a two multidimensional array by one of it's columns # -function csort($array, $column, $ascdec=SORT_ASC){ - if (sizeof($array) == 0) return $array; +function csort($array, $column, $ascdec=SORT_ASC){ - // Sort by digital date rather than text date - if ($column == 'issued') $column = "issuedSort"; - if ($column == 'expires') $column = 'expiresSort'; + if (sizeof($array) == 0) return $array; - foreach($array as $x) $sortarr[]=$x[$column]; - array_multisort($sortarr, $ascdec, $array); - - return $array; + // Sort by digital date rather than text date + if ($column == 'issued') $column = "issuedSort"; + if ($column == 'expires') $column = 'expiresSort'; + + if ($column == 'status') { + foreach($array as $x) { + $sortarr[]=$x[$column]; + $sortdate[] = $x['expiresSort']; + } + array_multisort($sortarr, $ascdec, $sortdate, SORT_ASC, $array); + } else { + foreach($array as $x) $sortarr[]=$x[$column]; + array_multisort($sortarr, $ascdec, $array); + } + return $array; }