| [1451] | 1 | <?php | 
|---|
|  | 2 | // définition des locales : | 
|---|
|  | 3 | setlocale(LC_ALL, $language); | 
|---|
|  | 4 | bindtextdomain('irpg', './lang'); | 
|---|
|  | 5 | textdomain('irpg'); | 
|---|
|  | 6 |  | 
|---|
|  | 7 |  | 
|---|
|  | 8 | function duration($s) { | 
|---|
|  | 9 | $s = abs(intval($s)); | 
|---|
|  | 10 | if ($s == 0) return "Aucune"; | 
|---|
|  | 11 | return sprintf("%d jour%s, %02d:%02d:%02d", | 
|---|
|  | 12 | $s/86400,intval($s/86400)<=1?"":"s", | 
|---|
|  | 13 | ($s%86400)/3600,($s%3600)/60,$s%60); | 
|---|
|  | 14 | } | 
|---|
|  | 15 | function cmp_level_asc($a,$b) { return cmp_level_desc($b,$a); } | 
|---|
|  | 16 | function cmp_level_desc($a,$b) { | 
|---|
|  | 17 | list(,,,$level1,,$time1)=explode("\t",trim($a)); | 
|---|
|  | 18 | list(,,,$level2,,$time2)=explode("\t",trim($b)); | 
|---|
|  | 19 | if ($level1 == $level2) return ($time1 <= $time2) ? -1 : 1; | 
|---|
|  | 20 | return ($level1 > $level2) ? -1 : 1; | 
|---|
|  | 21 | } | 
|---|
|  | 22 | function cmp_alignment_asc($a,$b) { return cmp_alignment_desc($b,$a); } | 
|---|
|  | 23 | function cmp_alignment_desc($a,$b) { | 
|---|
|  | 24 | list(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$a1)=explode("\t",trim($a)); | 
|---|
|  | 25 | list(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,$a2)=explode("\t",trim($b)); | 
|---|
|  | 26 | if ($a1 == "g" || $a2 == "e") return -1; | 
|---|
|  | 27 | if ($a1 == "e" || $a2 == "g") return 1; | 
|---|
|  | 28 | return 0; | 
|---|
|  | 29 | } | 
|---|
|  | 30 | function cmp_isadmin_asc($a,$b) { return cmp_isadmin_desc($b,$a); } | 
|---|
|  | 31 | function cmp_isadmin_desc($a,$b) { | 
|---|
|  | 32 | list(,,$o1)=explode("\t",trim($a)); | 
|---|
|  | 33 | list(,,$o2)=explode("\t",trim($b)); | 
|---|
|  | 34 | return ($o1 > $o2) ? -1 : 1; | 
|---|
|  | 35 | } | 
|---|
|  | 36 | function cmp_ttl_asc($a,$b) { return cmp_ttl_desc($b,$a); } | 
|---|
|  | 37 | function cmp_ttl_desc($a,$b) { | 
|---|
|  | 38 | list(,,,,,$time1)=explode("\t",trim($a)); | 
|---|
|  | 39 | list(,,,,,$time2)=explode("\t",trim($b)); | 
|---|
|  | 40 | return ($time2 < $time1) ? -1 : 1; | 
|---|
|  | 41 | } | 
|---|
|  | 42 | function cmp_user_asc($a,$b) { return cmp_user_desc($b,$a); } | 
|---|
|  | 43 | function cmp_user_desc($a,$b) { | 
|---|
|  | 44 | list($u1)=explode("\t",trim($a)); | 
|---|
|  | 45 | list($u2)=explode("\t",trim($b)); | 
|---|
|  | 46 | return (strtolower($u1) > strtolower($u2)) ? -1 : 1; | 
|---|
|  | 47 | } | 
|---|
|  | 48 | function cmp_online_asc($a,$b) { return cmp_online_desc($b,$a); } | 
|---|
|  | 49 | function cmp_online_desc($a,$b) { | 
|---|
|  | 50 | list(,,,,,,,,$o1)=explode("\t",trim($a)); | 
|---|
|  | 51 | list(,,,,,,,,$o2)=explode("\t",trim($b)); | 
|---|
|  | 52 | return ($o1 > $o2) ? -1 : 1; | 
|---|
|  | 53 | } | 
|---|
|  | 54 | function cmp_idled_asc($a,$b) { return cmp_idled_desc($b,$a); } | 
|---|
|  | 55 | function cmp_idled_desc($a,$b) { | 
|---|
|  | 56 | list(,,,,,,,,,$i1)=explode("\t",trim($a)); | 
|---|
|  | 57 | list(,,,,,,,,,$i2)=explode("\t",trim($b)); | 
|---|
|  | 58 | return ($i1 > $i2) ? -1 : 1; | 
|---|
|  | 59 | } | 
|---|
|  | 60 | function cmp_created_asc($a,$b) { return cmp_created_desc($b,$a); } | 
|---|
|  | 61 | function cmp_created_desc($a,$b) { | 
|---|
|  | 62 | list(,,,,,,,,,,,,,,,,,,,$i1)=explode("\t",trim($a)); | 
|---|
|  | 63 | list(,,,,,,,,,,,,,,,,,,,$i2)=explode("\t",trim($b)); | 
|---|
|  | 64 | return ($i1 > $i2) ? -1 : 1; | 
|---|
|  | 65 | } | 
|---|
|  | 66 | function cmp_lastlogin_asc($a,$b) { return cmp_lastlogin_desc($b,$a); } | 
|---|
|  | 67 | function cmp_lastlogin_desc($a,$b) { | 
|---|
|  | 68 | list(,,,,,,,,,,,,,,,,,,,,$i1)=explode("\t",trim($a)); | 
|---|
|  | 69 | list(,,,,,,,,,,,,,,,,,,,,$i2)=explode("\t",trim($b)); | 
|---|
|  | 70 | return ($i1 > $i2) ? -1 : 1; | 
|---|
|  | 71 | } | 
|---|
|  | 72 | function cmp_uhost_asc($a,$b) { return cmp_uhost_desc($b,$a); } | 
|---|
|  | 73 | function cmp_uhost_desc($a,$b) { | 
|---|
|  | 74 | list(,,,,,,,$u1)=explode("\t",trim($a)); | 
|---|
|  | 75 | list(,,,,,,,$u2)=explode("\t",trim($b)); | 
|---|
|  | 76 | return (strtolower($u1) > strtolower($u2)) ? -1 : 1; | 
|---|
|  | 77 | } | 
|---|
|  | 78 | function cmp_pen_asc($a,$b) { return cmp_pen_desc($b,$a); } | 
|---|
|  | 79 | function cmp_pen_desc($a,$b) { | 
|---|
|  | 80 | list(,,,,,,,,,,,,$p1[0],$p1[1],$p1[2],$p1[3],$p1[4],$p1[5], | 
|---|
|  | 81 | $p1[6])=explode("\t",trim($a)); | 
|---|
|  | 82 | list(,,,,,,,,,,,,$p2[0],$p2[1],$p2[2],$p2[3],$p2[4],$p2[5], | 
|---|
|  | 83 | $p2[6])=explode("\t",trim($b)); | 
|---|
|  | 84 | $s1 = $s2 = 0; | 
|---|
|  | 85 | foreach ($p1 as $pen) $s1 += $pen; | 
|---|
|  | 86 | foreach ($p2 as $pen) $s2 += $pen; | 
|---|
|  | 87 | return ($s1 > $s2) ? -1 : 1; | 
|---|
|  | 88 | } | 
|---|
|  | 89 | function cmp_sum_asc($a,$b) { return cmp_sum_desc($b,$a); } | 
|---|
|  | 90 | function cmp_sum_desc($a,$b) { | 
|---|
|  | 91 | list(,,,,,,,,,,,,,,,,,,,,,$i1[0],$i1[1],$i1[2],$i1[3],$i1[4],$i1[5], | 
|---|
|  | 92 | $i1[6],$i1[7],$i1[8],$i1[9])=explode("\t",trim($a)); | 
|---|
|  | 93 | list(,,,,,,,,,,,,,,,,,,,,,$i2[0],$i2[1],$i2[2],$i2[3],$i2[4],$i2[5], | 
|---|
|  | 94 | $i2[6],$i2[7],$i2[8],$i2[9])=explode("\t",trim($b)); | 
|---|
|  | 95 | $s1 = $s2 = 0; | 
|---|
|  | 96 | foreach ($i1 as $item) { $s1 += $item; } | 
|---|
|  | 97 | foreach ($i2 as $item) $s2 += $item; | 
|---|
|  | 98 | return ($s1 > $s2) ? -1 : 1; | 
|---|
|  | 99 | } | 
|---|
|  | 100 |  | 
|---|
|  | 101 | ?> | 
|---|