forked from Wavyzz/dolibarr
Add library files for files processing
This commit is contained in:
53
htdocs/lib/files.lib.php
Normal file
53
htdocs/lib/files.lib.php
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/lib/files.lib.php
|
||||||
|
\brief Library for file managing functions
|
||||||
|
\version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
function dol_compare_file($a, $b)
|
||||||
|
{
|
||||||
|
global $sortorder;
|
||||||
|
global $sortfield;
|
||||||
|
|
||||||
|
$sortorder=strtoupper($sortorder);
|
||||||
|
|
||||||
|
if ($sortorder == 'ASC') { $retup=-1; $retdown=1; }
|
||||||
|
else { $retup=1; $retdown=-1; }
|
||||||
|
|
||||||
|
if ($sortfield == 'name')
|
||||||
|
{
|
||||||
|
if ($a->name == $b->name) return 0;
|
||||||
|
return ($a->name < $b->name) ? $retup : $retdown;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'date')
|
||||||
|
{
|
||||||
|
if ($a->date == $b->date) return 0;
|
||||||
|
return ($a->date < $b->date) ? $retup : $retdown;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'size')
|
||||||
|
{
|
||||||
|
if ($a->size == $b->size) return 0;
|
||||||
|
return ($a->size < $b->size) ? $retup : $retdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user