Просмотр исходного кода

More Fixes

Add PLex Config value
Fixed auth again, this time for good.
causefx 8 лет назад
Родитель
Сommit
4545ecad34
5 измененных файлов с 49 добавлено и 43 удалено
  1. 11 7
      auth.php
  2. 10 9
      config/configDefaults.php
  3. 1 0
      functions.php
  4. 4 4
      homepage.php
  5. 23 23
      settings.php

+ 11 - 7
auth.php

@@ -7,29 +7,33 @@ $whitelist = isset($_GET['whitelist']) ? $_GET['whitelist'] : false;
 $currentIP = get_client_ip();
 
 if ($whitelist) {
+	$skipped = false;
     if(in_array($currentIP, getWhitelist($whitelist))) {
-       !$debug ? exit(http_response_code(200)) : die("$currentIP is Whitelist Authorized");
+       !$debug ? exit(http_response_code(200)) : die("$currentIP Whitelist Authorized");
+	}else{
+		$skipped = true;
 	}
-} elseif (isset($_GET['admin'])) {
+}
+if (isset($_GET['admin'])) {
     if($USER->authenticated && $USER->role == "admin" && !in_array(strtoupper($USER->username), getBannedUsers($ban))) {
         !$debug ? exit(http_response_code(200)) : die("$USER->username Authorized At Admin Level");
 	} else {
         !$debug ? exit(http_response_code(401)) : die("$USER->username Not Authorized At Admin Level");
     }
-} elseif (isset($_GET['user'])) {
+}
+if (isset($_GET['user'])) {
     if($USER->authenticated && !in_array(strtoupper($USER->username), getBannedUsers($ban))) {
         !$debug ? exit(http_response_code(200)) : die("$USER->username Authorized At User Level");
 	} else {
         !$debug ? exit(http_response_code(401)) : die("$USER->username Not Authorized At User Level");
 	}
-} elseif (!isset($_GET['user']) && !isset($_GET['admin']) && !isset($_GET['whitelist'])) {
+}
+if (!isset($_GET['user']) && !isset($_GET['admin']) && !isset($_GET['whitelist'])) {
     !$debug ? exit(http_response_code(401)) : die("Not Authorized Due To No Parameters Set");
 }
 
 if ($skipped) {
-	!$debug ? exit(http_response_code(401)) : die("$currentIP Not Authorized On Whitelist");
+	!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP $skipped Not Authorized Nor On Whitelist");
 }
 
-!$debug ? exit(http_response_code(401)) : die("$USER->username on $currentIP $skipped Not Authorized");
-
 ?>

+ 10 - 9
config/configDefaults.php

@@ -9,17 +9,18 @@ return array(
 	"plexRecentTV" => "false",
 	"plexRecentMusic" => "false",
 	"plexPlayingNow" => "false",
- "plexShowNames" => false,
+ 	"plexShowNames" => false,
 	"plexHomeAuth" => false,
 	"plexSearch" => false,
 	"plexRecentItems" => "20",
+	"plexTabName" => "",
 	"embyURL" => "",
 	"embyToken" => "",
 	"embyRecentMovie" => "false",
 	"embyRecentTV" => "false",
 	"embyRecentMusic" => "false",
 	"embyPlayingNow" => "false",
- "embyShowNames" => false,
+ 	"embyShowNames" => false,
 	"embyHomeAuth" => false,
 	"embySearch" => false,
 	"embyRecentItems" => "20",
@@ -77,11 +78,11 @@ return array(
 	"homepageCustomHTML1Auth" => false,
 	"git_branch" => "master",
 	"git_check" => true,
- "speedTest" => false,
- "smtpHostType" => "tls",
- "homepageNoticeTitle" => "",
- "homepageNoticeMessage" => "",
- "homepageNoticeType" => "success",
- "homepageNoticeAuth" => "false",
- "homepageNoticeLayout" => "elegant",
+	"speedTest" => false,
+	"smtpHostType" => "tls",
+	"homepageNoticeTitle" => "",
+	"homepageNoticeMessage" => "",
+	"homepageNoticeType" => "success",
+	"homepageNoticeAuth" => "false",
+	"homepageNoticeLayout" => "elegant",
 );

+ 1 - 0
functions.php

@@ -2856,6 +2856,7 @@ function getPlatform($platform){
         "Emby for iOS" => "ios.png",
         "Emby Mobile" => "emby.png",
         "Emby Theater" => "emby.png",
+        "Safari" => "safari.png",
     );
     if (array_key_exists($platform, $allPlatforms)) {
         return $allPlatforms[$platform];

+ 4 - 4
homepage.php

@@ -551,14 +551,14 @@ endif; ?>
         
 		$('.openTab').click(function(e){
 			if($(this).attr("openTab") === "true") {
-				var isActive = parent.$("div[data-content-name^='<?php echo PLEXTABNAME;?>']");
+				var isActive = parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']");
 				var activeFrame = isActive.children('iframe');
 				if(isActive.length === 1){
 					activeFrame.attr("src", $(this).attr("href"));
-					parent.$("li[name='<?php echo PLEXTABNAME;?>']").trigger("click");
+					parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
 				}else{
-					parent.$("li[name='<?php echo PLEXTABNAME;?>']").trigger("click");
-					parent.$("div[data-content-name^='<?php echo PLEXTABNAME;?>']").children('iframe').attr("src", $(this).attr("href"));
+					parent.$("li[name='<?php echo strtolower(PLEXTABNAME);?>']").trigger("click");
+					parent.$("div[data-content-name^='<?php echo strtolower(PLEXTABNAME);?>']").children('iframe').attr("src", $(this).attr("href"));
 				}
 				e.preventDefault();
 			}else{

+ 23 - 23
settings.php

@@ -652,12 +652,12 @@ echo buildSettings(
 						'value' => HOMEPAGEAUTHNEEDED,
 						'options' => $userTypes,
 					),
-    array(
-        'type' => 'checkbox',
-        'labelTranslate' => 'SPEED_TEST',
-        'name' => 'speedTest',
-        'value' => SPEEDTEST,
-    ),
+					array(
+						'type' => 'checkbox',
+						'labelTranslate' => 'SPEED_TEST',
+						'name' => 'speedTest',
+						'value' => SPEEDTEST,
+					),
 					/*
 					array(
 						'type' => 'custom',
@@ -1089,32 +1089,32 @@ echo buildSettings(
 						'value' => HOMEPAGENOTICEAUTH,
 						'options' => $userTypes,
 					),
-     array(
+     				array(
 						'type' => $userSelectType,
 						'labelTranslate' => 'NOTICE_LAYOUT',
 						'name' => 'homepageNoticeLayout',
 						'value' => HOMEPAGENOTICELAYOUT,
 						'options' => array(
-         'Elegant' => 'elegant',
-         'Basic' => 'basic',
-         'Jumbotron' => 'jumbotron',
-        ),
+							'Elegant' => 'elegant',
+							'Basic' => 'basic',
+							'Jumbotron' => 'jumbotron',
+						),
 					),
-     array(
+     				array(
 						'type' => $userSelectType,
 						'labelTranslate' => 'NOTICE_COLOR',
 						'name' => 'homepageNoticeType',
 						'value' => HOMEPAGENOTICETYPE,
 						'options' => array(
-         'Green' => 'success',
-         'Blue' => 'primary',
-         'Gray' => 'gray',
-         'Red' => 'danger',
-         'Yellow' => 'warning',
-         'Light Blue' => 'info',
-        ),
-					),
-     array(
+							'Green' => 'success',
+							'Blue' => 'primary',
+							'Gray' => 'gray',
+							'Red' => 'danger',
+							'Yellow' => 'warning',
+							'Light Blue' => 'info',
+						),
+					),
+     				array(
 						'type' => 'text',
 						'labelTranslate' => 'NOTICE_TITLE',
 						'name' => 'homepageNoticeTitle',
@@ -1125,10 +1125,10 @@ echo buildSettings(
 						'labelTranslate' => 'NOTICE_MESSAGE',
 						'name' => 'homepageNoticeMessage',
 						'value' => HOMEPAGENOTICEMESSAGE,
-      'rows' => 5,
+      					'rows' => 5,
 						'class' => 'material no-code',
 					),*/
-        array(
+        			array(
 						'type' => 'custom',
 		 				'labelTranslate' => 'NOTICE_MESSAGE',
 						'html' => '<div class="summernote" name="homepageNoticeMessage">'.HOMEPAGENOTICEMESSAGE.'</div>',