Преглед изворни кода

fix start date and end date if not set

CauseFX пре 4 година
родитељ
комит
7a1fcdeca5
3 измењених фајлова са 6 додато и 6 уклоњено
  1. 2 2
      api/homepage/lidarr.php
  2. 2 2
      api/homepage/radarr.php
  3. 2 2
      api/homepage/sonarr.php

+ 2 - 2
api/homepage/lidarr.php

@@ -167,8 +167,8 @@ trait LidarrHomepageItem
 	
 	public function getLidarrCalendar($startDate = null, $endDate = null)
 	{
-		$startDate = ($startDate) ?? $_GET['start'];
-		$endDate = ($endDate) ?? $_GET['end'];
+		$startDate = ($startDate) ?? $_GET['start'] ?? date('Y-m-d', strtotime('-' . $this->config['calendarStart'] . ' days'));
+		$endDate = ($endDate) ?? $_GET['end'] ?? date('Y-m-d', strtotime('+' . $this->config['calendarEnd'] . ' days'));
 		if (!$this->homepageItemPermissions($this->lidarrHomepagePermissions('calendar'), true)) {
 			return false;
 		}

+ 2 - 2
api/homepage/radarr.php

@@ -196,8 +196,8 @@ trait RadarrHomepageItem
 	
 	public function getRadarrCalendar($startDate = null, $endDate = null)
 	{
-		$startDate = ($startDate) ?? $_GET['start'];
-		$endDate = ($endDate) ?? $_GET['end'];
+		$startDate = ($startDate) ?? $_GET['start'] ?? date('Y-m-d', strtotime('-' . $this->config['calendarStart'] . ' days'));
+		$endDate = ($endDate) ?? $_GET['end'] ?? date('Y-m-d', strtotime('+' . $this->config['calendarEnd'] . ' days'));
 		if (!$this->homepageItemPermissions($this->radarrHomepagePermissions('calendar'), true)) {
 			return false;
 		}

+ 2 - 2
api/homepage/sonarr.php

@@ -197,8 +197,8 @@ trait SonarrHomepageItem
 	
 	public function getSonarrCalendar($startDate = null, $endDate = null)
 	{
-		$startDate = ($startDate) ?? $_GET['start'];
-		$endDate = ($endDate) ?? $_GET['end'];
+		$startDate = ($startDate) ?? $_GET['start'] ?? date('Y-m-d', strtotime('-' . $this->config['calendarStart'] . ' days'));
+		$endDate = ($endDate) ?? $_GET['end'] ?? date('Y-m-d', strtotime('+' . $this->config['calendarEnd'] . ' days'));
 		if (!$this->homepageItemPermissions($this->sonarrHomepagePermissions('calendar'), true)) {
 			return false;
 		}