From: Jerome Jutteau Date: Wed, 30 Dec 2020 08:52:09 +0000 (+0100) Subject: [FEATURE] allow admin to not log users IP in Jirafeau X-Git-Tag: 4.3.0~2 X-Git-Url: https://git.p6c8.net/jirafeau.git/commitdiff_plain/beae768cc711c728351b3dccdc780c60d59355a7?ds=sidebyside [FEATURE] allow admin to not log users IP in Jirafeau New option 'store_uploader_ip' set to true by default. closes #248 Signed-off-by: Jerome Jutteau --- diff --git a/lib/config.original.php b/lib/config.original.php index 1b16f32..d8722ac 100644 --- a/lib/config.original.php +++ b/lib/config.original.php @@ -181,6 +181,11 @@ $cfg['file_hash'] = 'md5'; */ $cfg['litespeed_workaround'] = false; +/* Store uploader's IP along with 'link' file. + * Depending of your legislation, you may have to adjust this parameter. + */ +$cfg['store_uploader_ip'] = true; + /* Required flag to test if the installation is already installed * or needs to start the installation script */ diff --git a/lib/functions.php b/lib/functions.php index b3dc904..546decc 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -680,7 +680,9 @@ function jirafeau_admin_list($name, $file_hash, $link_hash) echo t('EXPIRE') . ': ' . ($l['time'] == -1 ? '∞' : jirafeau_get_datetimefield($l['time'])) . '
'; echo t('ONETIME') . ': ' . ($l['onetime'] == 'O' ? 'Yes' : 'No') . '
'; echo t('UPLOAD_DATE') . ': ' . jirafeau_get_datetimefield($l['upload_date']) . '
'; - echo t('ORIGIN') . ': ' . $l['ip'] . '
'; + if (strlen($l['ip']) > 0) { + echo t('ORIGIN') . ': ' . $l['ip'] . '
'; + } echo ''; echo '
' . '' . diff --git a/script.php b/script.php index b8c4bcf..434a2c3 100644 --- a/script.php +++ b/script.php @@ -127,12 +127,18 @@ if (isset($_FILES['file']) && is_writable(VAR_FILES) exit; } + if ($cfg['store_uploader_ip']) { + $ip = get_ip_address($cfg); + } else { + $ip = ""; + } + $res = jirafeau_upload( $_FILES['file'], isset($_POST['one_time_download']), $key, $time, - get_ip_address($cfg), + $ip, $cfg['enable_crypt'], $cfg['link_name_length'], $cfg['file_hash'] @@ -461,13 +467,20 @@ elseif (isset($_GET['init_async'])) { break; } } + + if ($cfg['store_uploader_ip']) { + $ip = get_ip_address($cfg); + } else { + $ip = ""; + } + echo jirafeau_async_init( $_POST['filename'], $type, isset($_POST['one_time_download']), $key, $time, - get_ip_address($cfg) + $ip ); } /* Continue an asynchronous upload. */