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

Merge pull request #240 from causefx/cero-dev

Cero dev
causefx 9 лет назад
Родитель
Сommit
60f88d3d91
9 измененных файлов с 693 добавлено и 418 удалено
  1. 1 0
      .gitignore
  2. 9 0
      ajax.php
  3. 656 354
      ajax_remove_file.php
  4. 3 2
      homepage.php
  5. 2 1
      index.php
  6. 18 6
      register.php
  7. 2 55
      submitCSS.php
  8. 2 0
      updatedb.php
  9. 0 0
      vendor/autoload.php

+ 1 - 0
.gitignore

@@ -54,3 +54,4 @@ homepageSettings.ini.php
 loginLog.json
 custom.css
 _config.yml
+test.php

+ 9 - 0
ajax.php

@@ -0,0 +1,9 @@
+<?php
+// Authorization
+	# Check if user is currently active and allowed to access resource
+	
+// Process Request
+
+
+
+

Разница между файлами не показана из-за своего большого размера
+ 656 - 354
ajax_remove_file.php


+ 3 - 2
homepage.php

@@ -5,7 +5,7 @@ require_once("user.php");
 $image_url = $_GET['img'];
 $image_height = $_GET['height'];
 $image_width = $_GET['width'];
-$image_source = $_GET['source'];
+$image_source = (isset($_GET['source']) ? $_GET['source'] : 'plex');
 
 switch ($image_source) {
 	case 'emby':
@@ -27,6 +27,7 @@ switch ($image_source) {
 			echo "Invalid Emby Request";	
 		}
 		break;
+	case 'plex':
 	default:
 		$urlCheck = stripos(PLEXURL, "http");
 
@@ -46,4 +47,4 @@ switch ($image_source) {
 			echo "Invalid Plex Request";	
 		}
 		break;
-}
+}

+ 2 - 1
index.php

@@ -228,7 +228,7 @@ if(file_exists("images/settings2.png")) : $iconRotate = "false"; $settingsIcon =
 -->
 <!DOCTYPE html>
 
-<html lang="<?php echo $getLanguage; ?>" class="no-js">
+<html lang="<?php echo $language->getLang(); ?>" class="no-js">
 
     <head>
         
@@ -1147,6 +1147,7 @@ endif; ?>
                                             
                                             <input type="hidden" name="op" value="login">
 				                            <input type="hidden" name="sha1" value="">
+				                            <input type="hidden" name="password" value="">
                                             <input type="hidden" name="rememberMe" value="false"/>
                                             <input type="text" class="form-control material" name="username" placeholder="<?php echo $language->translate("USERNAME");?>" autocomplete="off" autocorrect="off" autocapitalize="off" value="" autofocus required>
                                         

+ 18 - 6
register.php

@@ -1425,7 +1425,7 @@ endif;?></textarea>
 
                                                         </div>
 
-                                                        <div class="tab-pane big-box fade active in" id="tab-emby">
+                                                        <div class="tab-pane big-box fade" id="tab-emby">
 
                                                             <div class="form-group">
 
@@ -1755,12 +1755,15 @@ endif;?></textarea>
 															<option value="both" <?php echo (AUTHTYPE=='both'?'selected':''); ?>>Both</option>
 														</select>
 														<p class="help-text"><?php echo $language->translate("AUTHTYPE"); ?></p>
-															
+														
 														<select id="authBackend" name="authBackend" class="form-control material input-sm" required>
-															<option value="ldap" <?php echo (AUTHBACKEND=='ldap' || !AUTHBACKEND?'selected':''); ?>>LDAP</option>
-															<option value="ftp" <?php echo (AUTHBACKEND=='ftp'?'selected':''); ?>>sFTP</option>
-															<option value="emby" <?php echo (AUTHBACKEND=='emby'?'selected':''); ?>>Emby</option>
-															<option value="plex" <?php echo (AUTHBACKEND=='plex'?'selected':''); ?> disabled>Plex</option>
+															<?php
+																$backendFunctions = array_filter(get_defined_functions()['user'],function($v) { return strpos($v, 'plugin_auth_') === 0; });
+																foreach ($backendFunctions as $value) {
+																	$name = str_replace('plugin_auth_','',$value);
+																	echo '<option value="'.$name.'" '.(AUTHBACKEND==$name?'selected':'').'>'.ucwords(str_replace('_',' ',$name)).'</option>';
+																}
+															?>
 														</select>
 														<p class="help-text"><?php echo $language->translate("AUTHBACKEND"); ?></p>
 														
@@ -1778,6 +1781,15 @@ endif;?></textarea>
 														
 														<input type="text" class="form-control material input-sm" name="authBackendDomain" placeholder="<?php echo $language->translate("AUTHBACKENDDOMAIN");?>" autocorrect="off" autocapitalize="off" value="<?php echo AUTHBACKENDDOMAIN;?>">
                                                         <p class="help-text"><?php echo $language->translate("AUTHBACKENDDOMAIN");?></p>
+														
+														<input type="text" class="form-control material input-sm" name="embyToken" placeholder="<?php echo $language->translate("EMBY_TOKEN");?>" autocorrect="off" autocapitalize="off" value="<?php echo EMBYTOKEN;?>">
+														<p class="help-text"><?php echo $language->translate("EMBY_TOKEN");?></p>
+                                                        
+                                                        <input type="text" class="form-control material input-sm" name="plexUsername" placeholder="<?php echo $language->translate("PLEX_USERNAME");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXUSERNAME;?>">
+														<p class="help-text"><?php echo $language->translate("PLEX_USERNAME");?></p>
+                                                        
+                                                        <input type="password" class="form-control material input-sm" name="plexPassword" placeholder="<?php echo $language->translate("PLEX_PASSWORD");?>" autocorrect="off" autocapitalize="off" value="<?php echo PLEXPASSWORD;?>">
+														<p class="help-text"><?php echo $language->translate("PLEX_PASSWORD");?></p>
                                                     </div>
 							
                                                     <div class="form-group">

+ 2 - 55
submitCSS.php

@@ -1,56 +1,3 @@
 <?php
-
-class setLanguage { 
-    
-    private $language = null; 
-    
-    function __construct($language) {
-        
-        if (file_exists("lang/{$language}.ini")) : 
-        
-            $this->language = parse_ini_file("lang/{$language}.ini", false, INI_SCANNER_RAW);
-        
-        else : 
-        
-            $this->language = parse_ini_file("lang/en.ini", false, INI_SCANNER_RAW);
-        
-        endif;
-        
-    } 
-    
-    public function translate($originalWord) {
-        
-        $getArg = func_num_args();
-        
-        if ($getArg > 1) : 
-        
-            $allWords = func_get_args();
-        
-            array_shift($allWords); 
-        
-        else :
-        
-            $allWords = array(); 
-        
-        endif;
-
-        $translatedWord = isset($this->language[$originalWord]) ? $this->language[$originalWord] : null; 
-    
-        if (!$translatedWord) : 
-        
-            echo ("Translation not found for: $originalWord"); 
-        
-        endif; 
-
-        $translatedWord = htmlspecialchars($translatedWord, ENT_QUOTES);
-        
-        return vsprintf($translatedWord, $allWords);
-        
-    }
-    
-} 
-
-$getLanguage = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : "en"; 
-$language = new setLanguage($getLanguage);
-
-?>
+// Legacy
+?>

+ 2 - 0
updatedb.php

@@ -38,6 +38,8 @@
     if(!empty($databaseConfig['authBackendPort'])) : define('AUTHBACKENDPORT', $databaseConfig['authBackendPort']); else : define('AUTHBACKENDPORT', ''); endif;
     if(!empty($databaseConfig['authBackendDomain'])) : define('AUTHBACKENDDOMAIN', $databaseConfig['authBackendDomain']); else : define('AUTHBACKENDDOMAIN', ''); endif;
     if(!empty($databaseConfig['authBackendCreate'])) : define('AUTHBACKENDCREATE', $databaseConfig['authBackendCreate']); else : define('AUTHBACKENDCREATE', 'false'); endif;
+    if(!empty($databaseConfig['plexUsername'])) : define('PLEXUSERNAME', $databaseConfig['plexUsername']); else : define('PLEXUSERNAME', ''); endif;
+    if(!empty($databaseConfig['plexPassword'])) : define('PLEXPASSWORD', $databaseConfig['plexPassword']); else : define('PLEXPASSWORD', ''); endif;
 	
     if(!file_exists('homepageSettings.ini.php')){ touch('homepageSettings.ini.php'); }
     $homepageConfig = parse_ini_file('homepageSettings.ini.php', true);        

+ 0 - 0
vendor/autoload.php


Некоторые файлы не были показаны из-за большого количества измененных файлов