1 |
jcrisp |
1.1 |
diff -ruN phpki.old/phpki-0.82/include/my_functions.php phpki/phpki-0.82/include/my_functions.php |
2 |
|
|
--- phpki.old/phpki-0.82/include/my_functions.php 2020-04-02 14:27:14.041463385 +0200 |
3 |
|
|
+++ phpki/phpki-0.82/include/my_functions.php 2020-04-02 14:28:41.770684362 +0200 |
4 |
|
|
@@ -73,17 +73,25 @@ |
5 |
|
|
# |
6 |
|
|
# Sort a two multidimensional array by one of it's columns |
7 |
|
|
# |
8 |
|
|
-function csort($array, $column, $ascdec=SORT_ASC){ |
9 |
|
|
- if (sizeof($array) == 0) return $array; |
10 |
|
|
+function csort($array, $column, $ascdec=SORT_ASC){ |
11 |
|
|
|
12 |
|
|
- // Sort by digital date rather than text date |
13 |
|
|
- if ($column == 'issued') $column = "issuedSort"; |
14 |
|
|
- if ($column == 'expires') $column = 'expiresSort'; |
15 |
|
|
+ if (sizeof($array) == 0) return $array; |
16 |
|
|
|
17 |
|
|
- foreach($array as $x) $sortarr[]=$x[$column]; |
18 |
|
|
- array_multisort($sortarr, $ascdec, $array); |
19 |
|
|
- |
20 |
|
|
- return $array; |
21 |
|
|
+ // Sort by digital date rather than text date |
22 |
|
|
+ if ($column == 'issued') $column = "issuedSort"; |
23 |
|
|
+ if ($column == 'expires') $column = 'expiresSort'; |
24 |
|
|
+ |
25 |
|
|
+ if ($column == 'status') { |
26 |
|
|
+ foreach($array as $x) { |
27 |
|
|
+ $sortarr[]=$x[$column]; |
28 |
|
|
+ $sortdate[] = $x['expiresSort']; |
29 |
|
|
+ } |
30 |
|
|
+ array_multisort($sortarr, $ascdec, $sortdate, SORT_ASC, $array); |
31 |
|
|
+ } else { |
32 |
|
|
+ foreach($array as $x) $sortarr[]=$x[$column]; |
33 |
|
|
+ array_multisort($sortarr, $ascdec, $array); |
34 |
|
|
+ } |
35 |
|
|
+ return $array; |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
|