From 31a1d4f1a7082ee08a6ad33b1eb6f4efd698e9b2 Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 30 Jan 2018 15:45:41 +0100 Subject: [PATCH] Use Carbon in SABnzbd class in set and unset cookies --- Changelog | 1 + nntmux/SABnzbd.php | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Changelog b/Changelog index 65aaed480..d5da674bb 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2018-01-30 DariusIII + * Chg: Use Carbon in SABnzbd class in set and unset cookies * Chg: Update ReleaseSearch class * Chg: Update .styleci.yml to exclude database/fixtures folder from checks * Chg: Update Tmux and TmuxOutput classes diff --git a/nntmux/SABnzbd.php b/nntmux/SABnzbd.php index 6391cca3c..000ab9933 100755 --- a/nntmux/SABnzbd.php +++ b/nntmux/SABnzbd.php @@ -5,6 +5,7 @@ namespace nntmux; use App\Models\User; use GuzzleHttp\Client; use App\Models\Settings; +use Illuminate\Support\Carbon; /** * Class SABnzbd. @@ -319,10 +320,10 @@ class SABnzbd */ public function setCookie($host, $apikey, $priority, $apitype) { - setcookie('sabnzbd_'.$this->uid.'__host', $host, time() + 2592000); - setcookie('sabnzbd_'.$this->uid.'__apikey', $apikey, time() + 2592000); - setcookie('sabnzbd_'.$this->uid.'__priority', $priority, time() + 2592000); - setcookie('sabnzbd_'.$this->uid.'__apitype', $apitype, time() + 2592000); + setcookie('sabnzbd_'.$this->uid.'__host', $host, Carbon::now()->addDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__apikey', $apikey, Carbon::now()->addDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__priority', $priority, Carbon::now()->addDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__apitype', $apitype, Carbon::now()->addDays(30)->timestamp); } /** @@ -330,9 +331,9 @@ class SABnzbd */ public function unsetCookie() { - setcookie('sabnzbd_'.$this->uid.'__host', '', time() - 2592000); - setcookie('sabnzbd_'.$this->uid.'__apikey', '', time() - 2592000); - setcookie('sabnzbd_'.$this->uid.'__priority', '', time() - 2592000); - setcookie('sabnzbd_'.$this->uid.'__apitype', '', time() - 2592000); + setcookie('sabnzbd_'.$this->uid.'__host', '', Carbon::now()->subDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__apikey', '', Carbon::now()->subDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__priority', '', Carbon::now()->subDays(30)->timestamp); + setcookie('sabnzbd_'.$this->uid.'__apitype', '', Carbon::now()->subDays(30)->timestamp); } }