2018-10-10 12:01:20 +00:00
|
|
|
<?php
|
|
|
|
|
/* Copyright (C) 2006-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
|
|
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
|
|
|
|
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
2021-10-17 09:59:25 +00:00
|
|
|
* Copyright (C) 2021 Regis Houssin <regis.houssin@inodbox.com>
|
2025-01-01 08:43:18 +00:00
|
|
|
* Copyright (C) 2024-2025 Frédéric France <frederic.france@free.fr>
|
2018-10-10 12:01:20 +00:00
|
|
|
*
|
2021-10-17 09:59:25 +00:00
|
|
|
* 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 3 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, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2018-10-10 12:01:20 +00:00
|
|
|
|
|
|
|
|
/**
|
2020-01-17 10:34:31 +00:00
|
|
|
* \file htdocs/admin/tools/export_files.php
|
|
|
|
|
* \brief Page to export documents into a compressed file
|
2018-10-10 12:01:20 +00:00
|
|
|
*/
|
|
|
|
|
|
2021-08-04 10:26:38 +00:00
|
|
|
if (! defined('CSRFCHECK_WITH_TOKEN')) {
|
|
|
|
|
define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-07 18:08:59 +00:00
|
|
|
// Load Dolibarr environment
|
2018-10-10 12:01:20 +00:00
|
|
|
require '../../main.inc.php';
|
2024-11-04 22:53:20 +00:00
|
|
|
/**
|
|
|
|
|
* @var Conf $conf
|
|
|
|
|
* @var DoliDB $db
|
|
|
|
|
* @var HookManager $hookmanager
|
|
|
|
|
* @var Translate $langs
|
|
|
|
|
* @var User $user
|
|
|
|
|
*/
|
2026-07-18 16:31:45 +00:00
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/utils.class.php';
|
|
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
2024-11-04 22:53:20 +00:00
|
|
|
|
2018-10-10 12:01:20 +00:00
|
|
|
$langs->load("admin");
|
|
|
|
|
|
2020-09-16 17:39:50 +00:00
|
|
|
$action = GETPOST('action', 'aZ09');
|
2020-04-10 08:59:32 +00:00
|
|
|
$what = GETPOST('what', 'alpha');
|
|
|
|
|
$export_type = GETPOST('export_type', 'alpha');
|
|
|
|
|
$file = trim(GETPOST('zipfilename_template', 'alpha'));
|
2020-12-11 14:11:51 +00:00
|
|
|
$compression = GETPOST('compression', 'aZ09');
|
2018-10-10 12:01:20 +00:00
|
|
|
|
2025-02-27 00:43:26 +00:00
|
|
|
$file = dol_sanitizeFileName($file, '_', 1, 1);
|
2021-10-17 09:59:25 +00:00
|
|
|
$file = preg_replace('/(\.zip|\.tar|\.tgz|\.gz|\.tar\.gz|\.bz2|\.zst)$/i', '', $file);
|
2019-05-21 12:33:28 +00:00
|
|
|
|
2020-09-18 15:13:01 +00:00
|
|
|
$sortfield = GETPOST('sortfield', 'aZ09comma');
|
2020-09-17 12:31:25 +00:00
|
|
|
$sortorder = GETPOST('sortorder', 'aZ09comma');
|
2024-03-01 00:52:40 +00:00
|
|
|
$page = GETPOSTISSET('pageplusone') ? (GETPOSTINT('pageplusone') - 1) : GETPOSTINT("page");
|
2021-02-26 21:04:03 +00:00
|
|
|
if (!$sortorder) {
|
|
|
|
|
$sortorder = "DESC";
|
|
|
|
|
}
|
|
|
|
|
if (!$sortfield) {
|
|
|
|
|
$sortfield = "date";
|
|
|
|
|
}
|
|
|
|
|
if ($page < 0) {
|
|
|
|
|
$page = 0;
|
|
|
|
|
} elseif (empty($page)) {
|
|
|
|
|
$page = 0;
|
|
|
|
|
}
|
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 13:05:53 +00:00
|
|
|
$limit = GETPOSTINT('limit') ? GETPOSTINT('limit') : $conf->liste_limit;
|
2018-10-10 12:01:20 +00:00
|
|
|
$offset = $limit * $page;
|
|
|
|
|
|
2021-02-26 21:04:03 +00:00
|
|
|
if (!$user->admin) {
|
|
|
|
|
accessforbidden();
|
|
|
|
|
}
|
2018-10-10 12:01:20 +00:00
|
|
|
|
2020-04-10 08:59:32 +00:00
|
|
|
$errormsg = '';
|
2018-10-10 12:01:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Actions
|
|
|
|
|
*/
|
|
|
|
|
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($action == 'delete') {
|
2020-10-31 13:32:18 +00:00
|
|
|
$filerelative = dol_sanitizeFileName(GETPOST('urlfile', 'alpha'));
|
|
|
|
|
$filepath = $conf->admin->dir_output.'/'.$filerelative;
|
2020-04-10 08:59:32 +00:00
|
|
|
$ret = dol_delete_file($filepath, 1);
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($ret) {
|
|
|
|
|
setEventMessages($langs->trans("FileWasRemoved", $filerelative), null, 'mesgs');
|
|
|
|
|
} else {
|
|
|
|
|
setEventMessages($langs->trans("ErrorFailToDeleteFile", $filerelative), null, 'errors');
|
|
|
|
|
}
|
2020-04-10 08:59:32 +00:00
|
|
|
$action = '';
|
2018-10-10 12:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* View
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
// Increase limit of time. Works only if we are not in safe mode
|
2025-01-01 08:43:18 +00:00
|
|
|
$ExecTimeLimit = getDolGlobalInt('MAIN_ADMIN_TOOLS_EXPORT_FILES_EXEC_TIME_LIMIT', 1800);; // 30mn
|
2021-02-26 21:04:03 +00:00
|
|
|
if (!empty($ExecTimeLimit)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$err = error_reporting();
|
|
|
|
|
error_reporting(0); // Disable all errors
|
|
|
|
|
//error_reporting(E_ALL);
|
|
|
|
|
@set_time_limit($ExecTimeLimit); // Need more than 240 on Windows 7/64
|
|
|
|
|
error_reporting($err);
|
2018-10-10 12:01:20 +00:00
|
|
|
}
|
2021-11-13 00:45:38 +00:00
|
|
|
|
|
|
|
|
/* If value has been forced with a php_admin_value, this has no effect. Example of value: '512M' */
|
|
|
|
|
$MemoryLimit = getDolGlobalString('MAIN_MEMORY_LIMIT_ARCHIVE_DATAROOT');
|
2021-02-26 21:04:03 +00:00
|
|
|
if (!empty($MemoryLimit)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
@ini_set('memory_limit', $MemoryLimit);
|
2018-10-10 12:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
2020-01-17 10:34:31 +00:00
|
|
|
$form = new Form($db);
|
2018-10-10 12:01:20 +00:00
|
|
|
$formfile = new FormFile($db);
|
|
|
|
|
|
|
|
|
|
//$help_url='EN:Backups|FR:Sauvegardes|ES:Copias_de_seguridad';
|
|
|
|
|
//llxHeader('','',$help_url);
|
|
|
|
|
|
|
|
|
|
//print load_fiche_titre($langs->trans("Backup"),'','title_setup');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Start with empty buffer
|
|
|
|
|
$dump_buffer = '';
|
|
|
|
|
$dump_buffer_len = 0;
|
|
|
|
|
|
|
|
|
|
// We will send fake headers to avoid browser timeout when buffering
|
|
|
|
|
$time_start = time();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$outputdir = $conf->admin->dir_output.'/documents';
|
2020-04-10 08:59:32 +00:00
|
|
|
$result = dol_mkdir($outputdir);
|
2018-10-10 12:01:20 +00:00
|
|
|
|
|
|
|
|
$utils = new Utils($db);
|
|
|
|
|
|
2022-08-31 20:14:20 +00:00
|
|
|
if ($export_type == 'externalmodule' && !empty($what)) {
|
2021-11-27 09:57:45 +00:00
|
|
|
$fulldirtocompress = DOL_DOCUMENT_ROOT.'/custom/'.dol_sanitizeFileName($what);
|
|
|
|
|
} else {
|
|
|
|
|
$fulldirtocompress = DOL_DATA_ROOT;
|
|
|
|
|
}
|
|
|
|
|
$dirtoswitch = dirname($fulldirtocompress);
|
|
|
|
|
$dirtocompress = basename($fulldirtocompress);
|
|
|
|
|
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($compression == 'zip') {
|
2020-01-17 10:52:21 +00:00
|
|
|
$file .= '.zip';
|
2022-03-09 22:32:59 +00:00
|
|
|
|
2022-03-09 22:32:59 +00:00
|
|
|
$excludefiles = '/(\.back|\.old|\.log|\.pdf_preview-.*\.png|[\/\\\]temp[\/\\\]|[\/\\\]admin[\/\\\]documents[\/\\\])/i';
|
2021-11-28 18:25:58 +00:00
|
|
|
|
|
|
|
|
//var_dump($fulldirtocompress);
|
|
|
|
|
//var_dump($outputdir."/".$file);exit;
|
|
|
|
|
|
|
|
|
|
$rootdirinzip = '';
|
|
|
|
|
if ($export_type == 'externalmodule' && !empty($what)) {
|
|
|
|
|
$rootdirinzip = $what;
|
|
|
|
|
|
|
|
|
|
global $dolibarr_allow_download_external_modules;
|
|
|
|
|
if (empty($dolibarr_allow_download_external_modules)) {
|
|
|
|
|
print 'Download of external modules is not allowed by $dolibarr_allow_download_external_modules in conf.php file';
|
|
|
|
|
$db->close();
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-02 10:56:57 +00:00
|
|
|
global $errormsg;
|
2025-02-27 12:59:43 +00:00
|
|
|
$ret = dol_compress_dir($fulldirtocompress, $outputdir."/".$file, $compression, $excludefiles, $rootdirinzip); // Can modify $errormsg
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($ret < 0) {
|
2020-10-31 13:32:18 +00:00
|
|
|
if ($ret == -2) {
|
|
|
|
|
$langs->load("errors");
|
|
|
|
|
$errormsg = $langs->trans("ErrNoZipEngine");
|
|
|
|
|
} else {
|
|
|
|
|
$langs->load("errors");
|
2025-02-27 12:59:43 +00:00
|
|
|
// @phpstan-ignore-next-line The $errormsg can have been modified by the dol_compress_dir function.
|
2025-02-27 01:04:39 +00:00
|
|
|
$errormsg = $langs->trans("ErrorFailedToWriteInDir", $outputdir).($errormsg ? "\n" . $errormsg : "");
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-10-17 09:59:25 +00:00
|
|
|
} elseif (in_array($compression, array('gz', 'bz', 'zstd'))) {
|
2019-09-03 20:39:24 +00:00
|
|
|
$userlogin = ($user->login ? $user->login : 'unknown');
|
|
|
|
|
|
2025-02-27 00:43:26 +00:00
|
|
|
$outputfile = $conf->admin->dir_temp.'/'.dol_sanitizeFileName('export_files.'.$userlogin.'.out'); // File used with popen method
|
2019-09-03 20:39:24 +00:00
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
$file .= '.tar';
|
2021-11-27 11:36:35 +00:00
|
|
|
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
// Write the tar into a temp directory outside the documents tree.
|
|
|
|
|
// If we wrote it directly under $outputdir (= DOL_DATA_ROOT/admin/documents),
|
|
|
|
|
// tar would notice its own output directory growing as it reads the source
|
|
|
|
|
// and exit with code 1 / 'file changed as we read it', even though the archive
|
|
|
|
|
// is complete. The error short-circuited compression at line 194 and left
|
|
|
|
|
// users with an uncompressed .tar plus a misleading error (#37266).
|
|
|
|
|
$tmpfile = $conf->admin->dir_temp.'/'.dol_sanitizeFileName($file);
|
|
|
|
|
|
2020-10-31 13:32:18 +00:00
|
|
|
// We also exclude '/temp/' dir and 'documents/admin/documents'
|
2021-11-27 11:36:35 +00:00
|
|
|
// We make escapement here and call executeCLI without escapement because we don't want to have the '*.log' escaped.
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
$cmd = "tar -cf '".escapeshellcmd($tmpfile)."' --exclude-vcs --exclude-caches-all --exclude='temp' --exclude='*.log' --exclude='*.pdf_preview-*.png' --exclude='documents/admin/documents' -C '".escapeshellcmd(dol_sanitizePathName($dirtoswitch))."' '".escapeshellcmd(dol_sanitizeFileName($dirtocompress))."'";
|
2020-10-31 13:32:18 +00:00
|
|
|
|
2021-11-27 11:36:35 +00:00
|
|
|
$result = $utils->executeCLI($cmd, $outputfile, 0, null, 1);
|
2020-10-31 13:32:18 +00:00
|
|
|
|
|
|
|
|
$retval = $result['error'];
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($result['result'] || !empty($retval)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$langs->load("errors");
|
|
|
|
|
dol_syslog("Documents tar retval after exec=".$retval, LOG_ERR);
|
|
|
|
|
$errormsg = 'Error tar generation return '.$retval;
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
if (file_exists($tmpfile)) {
|
|
|
|
|
unlink($tmpfile);
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
} else {
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
$compressedtmpfile = $tmpfile;
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($compression == 'gz') {
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
$cmd = "gzip -f ".$tmpfile;
|
|
|
|
|
$compressedtmpfile = $tmpfile.'.gz';
|
2021-10-17 12:38:12 +00:00
|
|
|
} elseif ($compression == 'bz') {
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
$cmd = "bzip2 -f ".$tmpfile;
|
|
|
|
|
$compressedtmpfile = $tmpfile.'.bz2';
|
2021-10-17 12:38:12 +00:00
|
|
|
} elseif ($compression == 'zstd') {
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
$cmd = "zstd -z -9 -q --rm ".$tmpfile;
|
|
|
|
|
$compressedtmpfile = $tmpfile.'.zst';
|
2021-10-17 09:59:25 +00:00
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
|
|
|
|
|
$result = $utils->executeCLI($cmd, $outputfile);
|
|
|
|
|
|
|
|
|
|
$retval = $result['error'];
|
2021-02-26 21:04:03 +00:00
|
|
|
if ($result['result'] || !empty($retval)) {
|
2020-10-31 13:32:18 +00:00
|
|
|
$errormsg = 'Error '.$compression.' generation return '.$retval;
|
Fix #37266 write document backup tar to a temp dir outside its own source tree (#38763)
* Fix #36510 advance pg sequence after forced-rowid dictionary insert (#38741)
Dictionary entry creation in admin/dict.php computes $newid = MAX(rowid)+1
in PHP and INSERTs with that rowid explicitly. On PostgreSQL the matching
serial sequence (<table>_rowid_seq) is never told about the manually
chosen value, so the next auto-increment insert (the next dictionary
entry, or any other code path that pulls from the same sequence) hits a
duplicate-key error mis-reported to the user as
'already existing record'.
Bump the sequence with setval(pg_get_serial_sequence(...), GREATEST(MAX,1))
right after a successful forced-rowid INSERT, gated on $db->type == 'pgsql'
so MySQL/MariaDB behaviour is unchanged.
Diagnosis by @hregis (#36510).
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #35661 drop duplicated ref segment in notify pdf path (#38746)
The fixed-target branch of Notify::send built the PDF path as
"$dir_output/$ref/$ref.pdf" while $dir_output already includes the
get_exdir(...) ref subdirectory. The double ref segment made
dol_is_file always fail and the PDF was never attached when a
notification was routed to a fixed email address. The matching block
just above for user/group targets has always used the correct
"$dir_output/$ref.pdf" form.
Drop the extra ref segment so both branches produce the same path.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #38614 align extrafield help-row position with create form (#38753)
In admin/extrafields the create page renders the Help tooltip row right
after Totalizable, before the Css rows. The edit page renders it after
all Css rows, so jumping from create to edit visually moves the field
without any meaningful reason.
Move the <tr class="help"> row in admin_extrafields_edit.tpl.php to the
same position as in admin_extrafields_add.tpl.php (after Totalizable,
before Css edit). Pure markup ordering, no logic change.
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
* Fix #37266 write document backup tar to a temp dir outside its own source tree
htdocs/admin/tools/export_files.php at line 189 used to write the tar
archive directly under $outputdir = DOL_DATA_ROOT/admin/documents.
$outputdir is itself inside the directory being archived. Even with
`--exclude='documents/admin/documents'`, GNU tar notices the output
directory growing while reading the source and exits with code 1 plus
'file changed as we read it'. The check at line 194 treated any non-zero
return as fatal, short-circuited the gzip / bzip2 / zstd step and left
the user with an uncompressed .tar plus 'Error tar generation return 1'.
Write the tar to $conf->admin->dir_temp (which is outside the documents
tree), run the compression step against that temp file, then rename the
compressed artefact into $outputdir as the last step. Add the matching
cleanup paths so a failure does not leave temp tar / compressed temp
files lying around.
Signed-off-by: Dolicraft <contact@dolicraft.com>
---------
Signed-off-by: Dolicraft <contact@dolicraft.com>
Co-authored-by: Dolicraft <contact@dolicraft.com>
2026-06-12 23:34:57 +00:00
|
|
|
if (file_exists($tmpfile)) {
|
|
|
|
|
unlink($tmpfile);
|
|
|
|
|
}
|
|
|
|
|
if (file_exists($compressedtmpfile)) {
|
|
|
|
|
unlink($compressedtmpfile);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
// Move the compressed archive from temp to the final outputdir.
|
|
|
|
|
$finalfile = $outputdir.'/'.basename($compressedtmpfile);
|
|
|
|
|
if (!@rename($compressedtmpfile, $finalfile)) {
|
|
|
|
|
$errormsg = 'Error moving generated archive to '.$outputdir;
|
|
|
|
|
if (file_exists($compressedtmpfile)) {
|
|
|
|
|
unlink($compressedtmpfile);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$file = basename($compressedtmpfile);
|
|
|
|
|
}
|
2020-10-31 13:32:18 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-11-28 18:25:58 +00:00
|
|
|
} else {
|
|
|
|
|
$errormsg = 'Bad value for compression method';
|
|
|
|
|
print $errormsg;
|
2018-10-10 12:01:20 +00:00
|
|
|
}
|
|
|
|
|
|
2022-08-30 17:38:35 +00:00
|
|
|
|
|
|
|
|
// Output export
|
|
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
if ($export_type != 'externalmodule' || empty($what)) {
|
2022-08-30 17:38:35 +00:00
|
|
|
top_httphead();
|
|
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
if ($errormsg) {
|
|
|
|
|
setEventMessages($langs->trans("Error")." : ".$errormsg, null, 'errors');
|
|
|
|
|
} else {
|
|
|
|
|
setEventMessages($langs->trans("BackupFileSuccessfullyCreated").'.<br>'.$langs->trans("YouCanDownloadBackupFile"), null, 'mesgs');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$db->close();
|
|
|
|
|
|
|
|
|
|
// Redirect to calling page
|
|
|
|
|
$returnto = 'dolibarr_export.php';
|
|
|
|
|
|
|
|
|
|
header("Location: ".$returnto);
|
2022-08-30 17:38:35 +00:00
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
exit();
|
2021-11-27 09:57:45 +00:00
|
|
|
} else {
|
2022-08-30 17:38:35 +00:00
|
|
|
top_httphead('application/zip');
|
|
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
$zipname = $outputdir."/".$file;
|
|
|
|
|
|
|
|
|
|
// Then download the zipped file.
|
2022-08-30 17:38:35 +00:00
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
header('Content-disposition: attachment; filename='.basename($zipname));
|
|
|
|
|
header('Content-Length: '.filesize($zipname));
|
|
|
|
|
readfile($zipname);
|
2018-10-10 12:01:20 +00:00
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
dol_delete_file($zipname);
|
2021-11-27 09:57:45 +00:00
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
$db->close();
|
2018-10-10 12:01:20 +00:00
|
|
|
|
2021-11-28 18:25:58 +00:00
|
|
|
exit();
|
|
|
|
|
}
|