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

Bugfix and homepage display fields

Cerothen пре 9 година
родитељ
комит
3cd6a7794a
4 измењених фајлова са 77 додато и 16 уклоњено
  1. 1 1
      config/configDefaults.php
  2. 1 1
      functions.php
  3. 4 1
      lang/en.ini
  4. 71 13
      settings.php

+ 1 - 1
config/configDefaults.php

@@ -67,5 +67,5 @@ return array(
 	"slimBar" => "true",
 	"gravatar" => "true",
 	"calTimeFormat" => "h(:mm)t",
-	"HOMEPAGEAUTHNEEDED" => false,
+	"homePageAuthNeeded" => false,
 );

+ 1 - 1
functions.php

@@ -1146,7 +1146,7 @@ function buildSettings($array) {
 					if (this.type == \'checkbox\') {
 						newVals[this.name] = this.checked;
 					} else {
-						newVals[this.name] = ele.val();
+						newVals[this.name] = $(this).val();
 					}
 				});
 				$.post(\'ajax.php?a=update-config\', newVals, function(data) {

+ 4 - 1
lang/en.ini

@@ -239,4 +239,7 @@ NO_CREATE = "Do Not Create Accounts"
 YES_CREATE = "Create Accounts As Needed"
 RECENT_CONTENT = "Recently Added Content"
 SETTINGS_SAVED = "Settings have been Saved"
-CALTIMEFORMAT = "Select time format"
+SETTINGS_NOT_SAVED = "Settings could not be saved"
+CALTIMEFORMAT = "Select time format"
+SHOW_HOMEPAGE = "Minimum authentication level to access homepage"
+SHOW_ON_HOMEPAGE = "Minimum authentication level for homepage"

+ 71 - 13
settings.php

@@ -274,13 +274,6 @@ if($action == "upgrade") :
     echo "<script>top.location.href = 'index.php#upgrade';</script>";
 
 endif;
-
-if($action == 'createLocation' || $action == 'homepageSettings') {
-    unset($_POST['action']);
-    updateConfig($_POST);
-    echo "<script>parent.notify('<strong>".$language->translate("SETTINGS_SAVED")."</strong>','floppy-o','success','5000', '$notifyExplode[0]', '$notifyExplode[1]');</script>";
-    echo "<script>setTimeout(function() {window.location.href = window.location.href},1500);</script>";
-}
                 
 if(!isset($_POST['op'])) :
 
@@ -1274,10 +1267,24 @@ endif;?></textarea>
                 <div class="email-content homepage-box white-bg">
 <?php
 $urlPattern = '.*'; // https?:\/\/([-a-zA-Z0-9@:%._\+~#=]{2,256}\.)+[a-z]{2,}\b(:\d{2,5})?[^?.\s]*
+$userTypes = array(
+	'None' => 'false',
+	'User' => 'user',
+	'Admin' => 'Admin',
+);
 echo buildSettings(
 	array(
 		'title' => 'Homepage Settings',
 		'id' => 'homepage_settings',
+		'fields' => array(
+			array(
+				'type' => 'select',
+				'labelTranslate' => 'SHOW_HOMEPAGE',
+				'name' => 'homePageAuthNeeded',
+				'value' => HOMEPAGEAUTHNEEDED,
+				'options' => $userTypes,
+			),
+		),
 		'tabs' => array(
 			array(
 				'title' => 'Plex',
@@ -1327,6 +1334,13 @@ echo buildSettings(
 							'value' => PLEXPLAYINGNOW,
 						),
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'plexHomeAuth',
+						'value' => PLEXHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1377,6 +1391,13 @@ echo buildSettings(
 							'value' => EMBYPLAYINGNOW,
 						),
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'embyHomeAuth',
+						'value' => EMBYHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1401,6 +1422,13 @@ echo buildSettings(
 						'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => SONARRKEY,
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'sonarrHomeAuth',
+						'value' => SONARRHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1425,6 +1453,13 @@ echo buildSettings(
 						'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => RADARRKEY,
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'radarrHomeAuth',
+						'value' => RADARRHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1449,6 +1484,13 @@ echo buildSettings(
 						//'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => SICKRAGEKEY,
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'sickrageHomeAuth',
+						'value' => SICKRAGEHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1473,6 +1515,13 @@ echo buildSettings(
 						//'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => HEADPHONESKEY,
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'headphonesHomeAuth',
+						'value' => HEADPHONESHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1497,6 +1546,13 @@ echo buildSettings(
 						//'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => SABNZBDKEY,
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'sabnzbdHomeAuth',
+						'value' => SABNZBDHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1527,6 +1583,13 @@ echo buildSettings(
 						//'pattern' => '[a-zA-Z0-9]{32}',
 						'value' => (empty(NZBGETPASSWORD)?'':randString(20)),
 					),
+					array(
+						'type' => 'select',
+						'labelTranslate' => 'SHOW_ON_HOMEPAGE',
+						'name' => 'nzbgetHomeAuth',
+						'value' => NZBGETHOMEAUTH,
+						'options' => $userTypes,
+					),
 				),
 			),
 			array(
@@ -1594,11 +1657,6 @@ echo buildSettings(
 		),
 	)
 );
-
-
-
-
-
 ?>
                 </div>
    
@@ -1846,7 +1904,7 @@ echo buildSettings(
 						'type' => 'select',
 						'labelTranslate' => 'NOTIFICATION_TYPE',
 						'name' => 'notifyEffect',
-						'onchange' => 'parent.notify(\'This is an example popup!\', \'fa-bullhorn\', \'success\', 4000, this.value.split(\'-\')[0], this.value.split(\'-\')[1]);',
+						'onchange' => 'parent.notify(\'This is an example popup!\', \'bullhorn\', \'success\', 4000, this.value.split(\'-\')[0], this.value.split(\'-\')[1]);',
 						'value' => explode("-", NOTIFYEFFECT)[1],
 						'options' => array(
 							'Slide From Top' => 'bar-slidetop',