1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| /**
* Delete file
*
* @param string $file File path
* @param array $exclude_files Excluded files
*/
public static function deleteFile($file, $exclude_files = array())
{
if (isset($exclude_files) && !is_array($exclude_files)) {
$exclude_files = array($exclude_files);
}
if (file_exists($file) && is_file($file) && array_search(basename($file), $exclude_files) === false) {
@chmod($file, 0777); // NT ?
unlink($file);
}
/************************************Modification**************************/
$size = '';
$size_max = '';
$size1 = '';
$cookie = new Cookie('psAdmin');
$id_employee = $cookie->id_employee;
$id_shop = '';
$sql = 'SELECT *
FROM '._DB_PREFIX_.'employee_shop
WHERE id_employee = '.(int)$id_employee.'
';
if ($row = Db::getInstance()->getRow($sql))
$id_shop = $row['id_shop'];
$sql1 = 'SELECT *
FROM recap
WHERE id_store = '.(int)$id_shop.'
';
if ($row1 = Db::getInstance()->getRow($sql1))
{
$size = $row1['size'];
$size_max = $row1['size_max'];
}
if ($id_shop != 1)
{
$size1 = $size - $file['size'];
Db::getInstance()->update('recap', array('size' => (int)$size1),
$where = 'id_store = '.(int)$id_shop.'', $limit = 0, $null_values = false, $use_cache = true, $add_prefix = false);
}
/*************************Modification********************************/
} |
Partager