From ebd1624f03e705f9783c7ce87b39b1b257a2ee6c Mon Sep 17 00:00:00 2001 From: axeloz Date: Thu, 20 Jul 2017 16:15:35 +0200 Subject: [PATCH] Moving IPs configuration into .env file --- app/Helpers/Upload.php | 8 ++++++++ config/sharing.php | 6 +----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/Helpers/Upload.php b/app/Helpers/Upload.php index af40c2f..0d505b4 100644 --- a/app/Helpers/Upload.php +++ b/app/Helpers/Upload.php @@ -77,11 +77,19 @@ class Upload { // Getting the IP limit configuration $ips = config('sharing.upload_ip_limit'); + if (empty($ips)) { + return true; + } + + $ips = explode(',', $ips); + // If set and not empty, checking client's IP if (! empty($ips) && count($ips) > 0) { $valid = false; foreach ($ips as $ip) { + $ip = trim($ip); + // Client's IP appears in the whitelist if (self::isValidIp($current_ip, $ip)) { $valid = true; diff --git a/config/sharing.php b/config/sharing.php index 8abe3c3..f400d12 100644 --- a/config/sharing.php +++ b/config/sharing.php @@ -13,9 +13,5 @@ return [ ** 3. CIDR Format (192.168.10/24) OR 1.2.3.4/255.255.255.0 ** 4. Start-end IP (192.168.10.0-192.168.10.10) */ - 'upload_ip_limit' => [ - '127.0.0.1' - ] - - + 'upload_ip_limit' => env('UPLOAD_LIMIT_IPS', null), ];