فهرست منبع

Remove ports from homepage services

Cerothen 9 سال پیش
والد
کامیت
52f7e55a72
4فایلهای تغییر یافته به همراه20 افزوده شده و 68 حذف شده
  1. 0 5
      config/configDefaults.php
  2. 17 46
      functions.php
  3. 1 1
      index.php
  4. 2 16
      settings.php

+ 0 - 5
config/configDefaults.php

@@ -4,14 +4,12 @@ return array(
 	"user_home" => false,
 	"timezone" => "",
 	"plexURL" => "",
-	"plexPort" => "",
 	"plexToken" => "",
 	"plexRecentMovie" => "false",
 	"plexRecentTV" => "false",
 	"plexRecentMusic" => "false",
 	"plexPlayingNow" => "false",
 	"embyURL" => "",
-	"embyPort" => "",
 	"embyToken" => "",
 	"embyRecentMovie" => "false",
 	"embyRecentTV" => "false",
@@ -24,14 +22,11 @@ return array(
 	"radarrURL" => "",
 	"radarrKey" => "",
 	"nzbgetURL" => "",
-	"nzbgetPort" => "",
 	"nzbgetUsername" => "",
 	"nzbgetPassword" => "",
 	"sabnzbdURL" => "",
-	"sabnzbdPort" => "",
 	"sabnzbdKey" => "",
 	"headphonesURL" => "",
-	"headphonesPort" => "",
 	"headphonesKey" => "",
 	"calendarStart" => "0",
 	"calendarView" => "basicWeek",

+ 17 - 46
functions.php

@@ -872,14 +872,16 @@ function upgradeCheck() {
 		unset($config['databaseLocation']);
 		
 		// Turn Off Emby And Plex Recent
-		$config["plexRecentMovie"] = "false";
-		$config["plexRecentTV"] = "false";
-		$config["plexRecentMusic"] = "false";
-		$config["plexPlayingNow"] = "false";
-		$config["embyRecentMovie"] = "true";
-		$config["embyRecentTV"] = "true";
-		$config["embyRecentMusic"] = "false";
-		$config["embyPlayingNow"] = "true";
+		$config["embyURL"] = $config["embyURL"].(!empty($config["embyPort"])?':'.$config["embyPort"]:'');
+		unset($config["embyPort"]);
+		$config["plexURL"] = $config["plexURL"].(!empty($config["plexPort"])?':'.$config["plexPort"]:'');
+		unset($config["plexPort"]);
+		$config["nzbgetURL"] = $config["nzbgetURL"].(!empty($config["nzbgetPort"])?':'.$config["nzbgetPort"]:'');
+		unset($config["nzbgetPort"]);
+		$config["sabnzbdURL"] = $config["sabnzbdURL"].(!empty($config["sabnzbdPort"])?':'.$config["sabnzbdPort"]:'');
+		unset($config["sabnzbdPort"]);
+		$config["headphonesURL"] = $config["headphonesURL"].(!empty($config["headphonesPort"])?':'.$config["headphonesPort"]:'');
+		unset($config["headphonesPort"]);
 		
 		$createConfigSuccess = createConfig($config, 'config/config.php', $nest = 0);
 		
@@ -890,6 +892,8 @@ function upgradeCheck() {
 			
 			// Remove Old ini file
 			unlink('databaseLocation.ini.php');
+		} else {
+			debug_out('Couldn\'t create updated configuration.' ,1);
 		}
 	}
 	
@@ -1343,18 +1347,7 @@ function getRadarrCalendar($array){
 }
 
 function nzbgetConnect($url, $port, $username, $password, $list){
-    
-    $urlCheck = stripos($url, "http");
-
-    if ($urlCheck === false) {
-        
-        $url = "http://" . $url;
-    
-    }
-    
-    if($port !== ""){ $url = $url . ":" . $port; }
-    
-    $address = $url;
+    $url = qualifyURL(NZBGETURL);
     
     $api = file_get_contents("$url/$username:$password/jsonrpc/$list");
                     
@@ -1413,18 +1406,7 @@ function nzbgetConnect($url, $port, $username, $password, $list){
 }
 
 function sabnzbdConnect($url, $port, $key, $list){
-    
-    $urlCheck = stripos($url, "http");
-
-    if ($urlCheck === false) {
-        
-        $url = "http://" . $url;
-    
-    }
-    
-    if($port !== ""){ $url = $url . ":" . $port; }
-    
-    $address = $url;
+    $url = qualifyURL(SABNZBDURL);
 
     $api = file_get_contents("$url/api?mode=$list&output=json&apikey=$key");
                     
@@ -1473,27 +1455,16 @@ function sabnzbdConnect($url, $port, $key, $list){
 }
 
 function getHeadphonesCalendar($url, $port, $key, $list){
-
-    $urlCheck = stripos($url, "http");
-
-    if ($urlCheck === false) {
-        
-        $url = "http://" . $url;
+	$url = qualifyURL(HEADPHONESURL);
     
-    }
-    
-    if($port !== ""){ $url = $url . ":" . $port; }
-    
-    $address = $url;
+    $api = file_get_contents($url."/api?apikey=".$key."&cmd=$list");
     
-    $api = file_get_contents($address."/api?apikey=".$key."&cmd=$list");
-                    
     $api = json_decode($api, true);
     
     $i = 0;
     
     $gotCalendar = "";
-
+	
     foreach($api AS $child) {
 
         if($child['Status'] == "Wanted"){

+ 1 - 1
index.php

@@ -899,7 +899,7 @@ endif; ?>
                                                 
                                                 <?php 
                                                 
-                                                if(file_exists(dirname(__DIR__) . '/users.db') || file_exists(__DIR__ . '/users.db')) : 
+                                                if(file_exists(dirname(__DIR__) . '/users.db') || file_exists(__DIR__ . '/users.db') || file_exists(__DIR__ . '/config/users.db')) : 
                                                 
                                                 echo '<h5 class="text-center red">';
                                                 echo $language->translate("DONT_WORRY");

+ 2 - 16
settings.php

@@ -1327,14 +1327,7 @@ endif;?></textarea>
                                                             <div class="form-group">
 
                                                                 <input type="text" class="form-control material input-sm" name="plexURL" placeholder="<?php echo $language->translate("PLEX_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("PLEX_URL");?></p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="plexPort" placeholder="<?php echo $language->translate("PLEX_PORT");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXPORT;?>">
-                                                                <p class="help-text"><?php echo $language->translate("PLEX_PORT");?></p>
+                                                                <p class="help-text"><?php echo $language->translate("PLEX_URL");?> - i.e. http://hostname:32400</p>
 
                                                             </div>
 
@@ -1392,14 +1385,7 @@ endif;?></textarea>
                                                             <div class="form-group">
 
                                                                 <input type="text" class="form-control material input-sm" name="embyURL" placeholder="<?php echo $language->translate("EMBY_URL");?>" autocorrect="off" autocapitalize="off" value="<?php echo EMBYURL;?>">
-                                                                <p class="help-text"><?php echo $language->translate("EMBY_URL");?></p>
-
-                                                            </div>
-
-                                                            <div class="form-group">
-
-                                                                <input type="text" class="form-control material input-sm" name="embyPort" placeholder="<?php echo $language->translate("EMBY_PORT");?>" autocorrect="off" autocapitalize="off" value="<?php echo EMBYPORT;?>">
-                                                                <p class="help-text"><?php echo $language->translate("EMBY_PORT");?></p>
+                                                                <p class="help-text"><?php echo $language->translate("EMBY_URL");?> - i.e. http://hostname:8096 | hostname/emby | http://hostname:8096/emby</p>
 
                                                             </div>