touched up tag comparision in file view
This commit is contained in:
parent
2f178ed9c7
commit
d62b4bd248
@ -53,13 +53,38 @@ if (empty($files))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
function comp_tag ($a, $b)
|
||||||
|
{
|
||||||
|
$x = explode ('.', $a);
|
||||||
|
$y = explode ('.', $b);
|
||||||
|
$cx = count($x);
|
||||||
|
$cy = count($y);
|
||||||
|
$max = max($cx, $cy);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $max; $i++)
|
||||||
|
{
|
||||||
|
if (is_numeric($x[$i]) && is_numeric($y[$i]))
|
||||||
|
{
|
||||||
|
$q = (int)$x[$i] - (int)$y[$i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$q = strcmp($x[$i], $y[$i]);
|
||||||
|
}
|
||||||
|
if ($q != 0) return $q;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ($cx > $cy)? 1:
|
||||||
|
($cx < $cy)? -1: 0;
|
||||||
|
}
|
||||||
|
|
||||||
function comp_files ($a, $b)
|
function comp_files ($a, $b)
|
||||||
{
|
{
|
||||||
//$cmp = strcmp ($b->tag, $a->tag);
|
//$cmp = version_compare ($b->tag, $a->tag);
|
||||||
$cmp = version_compare ($b->tag, $a->tag);
|
$cmp = comp_tag ($b->tag, $a->tag);
|
||||||
if ($cmp == 0)
|
if ($cmp == 0)
|
||||||
{
|
{
|
||||||
return strcmp ($a->name, $b->name);
|
$cmp = strcmp ($a->name, $b->name);
|
||||||
}
|
}
|
||||||
return $cmp;
|
return $cmp;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user