瀏覽代碼

Merge pull request #1827 from causefx/v2-develop

V2 develop
causefx 4 年之前
父節點
當前提交
ae833f54dd

+ 72 - 10
api/classes/organizr.class.php

@@ -65,7 +65,7 @@ class Organizr
 
 	// ===================================
 	// Organizr Version
-	public $version = '2.1.1840';
+	public $version = '2.1.1860';
 	// ===================================
 	// Quick php Version check
 	public $minimumPHP = '7.3';
@@ -1962,15 +1962,31 @@ class Organizr
 	public function uploadImage()
 	{
 		$filesCheck = array_filter($_FILES);
-		if (!empty($filesCheck) && $this->approvedFileExtension($_FILES['file']['name'], 'image') && strpos($_FILES['file']['type'], 'image/') !== false) {
-			ini_set('upload_max_filesize', '10M');
-			ini_set('post_max_size', '10M');
-			$tempFile = $_FILES['file']['tmp_name'];
-			$targetPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'userTabs' . DIRECTORY_SEPARATOR;
-			$this->makeDir($targetPath);
-			$targetFile = $targetPath . $this->sanitizeUserString($_FILES['file']['name']);
-			$this->setAPIResponse(null, pathinfo($_FILES['file']['name'], PATHINFO_BASENAME) . ' has been uploaded', null);
-			return move_uploaded_file($tempFile, $targetFile);
+		if (!empty($filesCheck)) {
+			if (strpos($_FILES['file']['type'], 'image/') === false) {
+				$this->setResponse(403, 'File Type not approved', $_FILES['file']['type']);
+				return false;
+			}
+			if (!$this->approvedFileType($_FILES['file']['tmp_name'])) {
+				$this->setResponse(403, 'File Type not approved', $_FILES['file']['tmp_name']);
+				return false;
+			}
+			if ($this->approvedFileExtension($_FILES['file']['name'])) {
+				ini_set('upload_max_filesize', '10M');
+				ini_set('post_max_size', '10M');
+				$tempFile = $_FILES['file']['tmp_name'];
+				$targetPath = $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'userTabs' . DIRECTORY_SEPARATOR;
+				$this->makeDir($targetPath);
+				$targetFile = $targetPath . $this->sanitizeUserString($_FILES['file']['name']);
+				$this->setAPIResponse(null, pathinfo($_FILES['file']['name'], PATHINFO_BASENAME) . ' has been uploaded', null);
+				return move_uploaded_file($tempFile, $targetFile);
+			} else {
+				$this->setResponse(403, 'File Extension not approved');
+				return false;
+			}
+		} else {
+			$this->setResponse(500, 'No File was uploaded');
+			return false;
 		}
 	}
 
@@ -2094,6 +2110,7 @@ class Organizr
 				$this->settingsOption('multiple-url', 'loginWallpaper', ['label' => 'Login Wallpaper URL', 'help' => 'You may enter multiple URL\'s']),
 				$this->settingsOption('switch', 'useLogoLogin', ['label' => 'Use Logo instead of Title on Login Page']),
 				$this->settingsOption('switch', 'minimalLoginScreen', ['label' => 'Minimal Login Screen']),
+				$this->settingsOption('switch', 'useRandomMediaImage', ['label' => 'Use Random Media Wallpaper From Media Server']),
 			],
 			'Options' => [
 				$this->settingsOption('switch', 'alternateHomepageHeaders', ['label' => 'Alternate Homepage Titles']),
@@ -2194,6 +2211,7 @@ class Organizr
 		$appearance['buttonTextHoverColor'] = $this->config['buttonTextHoverColor'];
 		$appearance['buttonHoverColor'] = $this->config['buttonHoverColor'];
 		$appearance['loginWallpaper'] = $this->config['loginWallpaper'];
+		$appearance['randomMediaImage'] = $this->getRandomMediaImage('np');
 		$appearance['loginLogo'] = $this->config['loginLogo'];
 		$appearance['customCss'] = $this->config['customCss'];
 		$appearance['customThemeCss'] = $this->config['customThemeCss'];
@@ -2202,6 +2220,50 @@ class Organizr
 		return $appearance;
 	}
 
+	public function getRandomMediaImage($type = null)
+	{
+		if (!$this->config['useRandomMediaImage']) {
+			return false;
+		}
+		if (file_exists(dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache')) {
+			$folder = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'cache';
+			try {
+				$directoryIterator = new RecursiveDirectoryIterator($folder, FilesystemIterator::SKIP_DOTS);
+				$iteratorIterator = new RecursiveIteratorIterator($directoryIterator);
+				$image = null;
+				switch ($type) {
+					case 'np':
+						$i = 0;
+						$array = iterator_to_array($iteratorIterator);
+						if (count($array) > 0) {
+							shuffle($array);
+							$iteratorIterator = new ArrayIterator($array);
+						}
+						foreach ($iteratorIterator as $info) {
+							if (stripos($info->getFilename(), 'np') !== false) {
+								if ($i < 1) {
+									$imageInfo = getimagesize($folder . DIRECTORY_SEPARATOR . $info->getFilename());
+									if ($imageInfo[0] >= $this->getCacheImageSize('npw')) {
+										$image = 'data/cache/' . $info->getFilename();
+										$i++;
+									}
+								} else {
+									break;
+								}
+							}
+						}
+						return $image;
+					default:
+						return false;
+				}
+			} catch (Exception $e) {
+				return false;
+			}
+		} else {
+			return false;
+		}
+	}
+
 	public function getSettingsMain()
 	{
 		$certificateStatus = $this->hasCustomCert() ? '<span lang="en">Custom Certificate Loaded</span><br />Located at <span>' . $this->getCustomCert() . '</span>' : '<span lang="en">Custom Certificate not found - please upload below</span>';

+ 2 - 1
api/config/default.php

@@ -658,5 +658,6 @@ return [
 	'checkForPluginUpdate' => true,
 	'checkForThemeUpdate' => true,
 	'autoUpdateCronEnabled' => false,
-	'autoUpdateCronSchedule' => '@weekly'
+	'autoUpdateCronSchedule' => '@weekly',
+	'useRandomMediaImage' => false
 ];

+ 3 - 14
api/functions/normal-functions.php

@@ -222,20 +222,9 @@ trait NormalFunctions
 		return $tmp;
 	}
 
-	public function isEncrypted($password)
-	{
-		switch (strlen($password)) {
-			case '24':
-			case '88':
-				return strpos($password, '==') !== false;
-			case '44':
-			case '108':
-				return substr($password, -1, 1) == '=';
-			case '64':
-				return true;
-			default:
-				return false;
-		}
+	public function isEncrypted($password = null)
+	{
+		return ($password == null || $password == '') ? false : $this->decrypt($password);
 	}
 
 	public function fillString($string, $length)

+ 8 - 5
api/functions/option-functions.php

@@ -386,11 +386,14 @@ trait OptionsFunction
 					<div id="' . $name . 'Editor" style="height:300px">' . htmlentities($this->config[$name]) . '</div>
 					<script>
 						let mode = ace.require("' . $mode . '").Mode;
-						' . $name . ' = ace.edit("' . $name . 'Editor");
-						' . $name . '.session.setMode(new mode());
-						' . $name . '.setTheme("ace/theme/idle_fingers");
-						' . $name . '.setShowPrintMargin(false);
-						' . $name . '.session.on("change", function(delta) { $(".' . $name . 'Textarea").val(' . $name . '.getValue()); $(".' . $name . 'Textarea").trigger("change") });
+						' . str_replace('-', '', $name) . ' = ace.edit("' . $name . 'Editor");
+						' . str_replace('-', '', $name) . '.session.setMode(new mode());
+						' . str_replace('-', '', $name) . '.setTheme("ace/theme/idle_fingers");
+						' . str_replace('-', '', $name) . '.setShowPrintMargin(false);
+						' . str_replace('-', '', $name) . '.session.on("change", function(delta) { 
+							$(".' . $name . 'Textarea").val(' . str_replace('-', '', $name) . '.getValue());
+							$(".' . $name . 'Textarea").trigger("change");
+                        });
 					</script>
 					'
 				];

+ 20 - 2
api/functions/organizr-functions.php

@@ -230,6 +230,24 @@ trait OrganizrFunctions
 		}
 	}
 
+	public function approvedFileType($file, $type = 'image')
+	{
+		$finfo = new finfo(FILEINFO_MIME_TYPE);
+		$ext = $finfo->file($file);
+		if ($type == 'image') {
+			switch ($ext) {
+				case 'image/gif':
+				case 'image/png':
+				case 'image/jpeg':
+				case 'image/pjpeg':
+					return true;
+				default:
+					return false;
+			}
+		}
+		return false;
+	}
+
 	public function getImages()
 	{
 		$allIconsPrep = array();
@@ -545,11 +563,11 @@ trait OrganizrFunctions
 		$cacheTime = 604800;
 		$ctx = stream_context_create(array(
 			'http' => array(
-				'timeout' =>5 ,
+				'timeout' => 5,
 				'protocol_version' => 1.1,
 				'header' => 'Connection: close'
 			)
-			));
+		));
 		if ((file_exists($cacheFile) && (time() - $cacheTime) > filemtime($cacheFile)) || !file_exists($cacheFile)) {
 			@copy($url, $cacheFile, $ctx);
 		}

+ 38 - 0
api/functions/upgrade-functions.php

@@ -80,6 +80,14 @@ trait UpgradeFunctions
 				$this->upgradeToVersion($versionCheck);
 			}
 			// End Upgrade check start for version above
+			// Upgrade check start for version below
+			$versionCheck = '2.1.1860';
+			if ($compare->lessThan($oldVer, $versionCheck)) {
+				$updateDB = false;
+				$oldVer = $versionCheck;
+				$this->upgradeToVersion($versionCheck);
+			}
+			// End Upgrade check start for version above
 			if ($updateDB == true) {
 				//return 'Upgraded Needed - Current Version '.$oldVer.' - New Version: '.$versionCheck;
 				// Upgrade database to latest version
@@ -335,6 +343,8 @@ trait UpgradeFunctions
 				$this->upgradeInstalledPluginsConfigItem();
 			case '2.1.1500':
 				$this->upgradeDataToFolder();
+			case '2.1.1860':
+				$this->upgradePluginsToDataFolder();
 			default:
 				$this->setAPIResponse('success', 'Ran update function for version: ' . $version, 200);
 				return true;
@@ -441,6 +451,34 @@ trait UpgradeFunctions
 		return false;
 	}
 
+	public function upgradePluginsToDataFolder()
+	{
+		if ($this->hasDB()) {
+			// Make main data folder
+			$rootFolderMade = $this->makeDir($this->root . DIRECTORY_SEPARATOR . 'data');
+			if ($rootFolderMade) {
+				// Migrate over plugins folder
+				$this->makeDir($this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'plugins');
+				$plexLibraries = $this->root . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'plexLibraries';
+				if (file_exists($plexLibraries)) {
+					if (rename($plexLibraries, $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'plexLibraries')) {
+						$this->setLoggerChannel('Migration');
+						$this->logger->info('The plugin folder "plexLibraries" was migrated to new data folder');
+					}
+				}
+				$test = $this->root . DIRECTORY_SEPARATOR . 'api' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'test';
+				if (file_exists($test)) {
+					if (rename($test, $this->root . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'test')) {
+						$this->setLoggerChannel('Migration');
+						$this->logger->info('The plugin folder "test" was migrated to new data folder');
+					}
+				}
+			}
+			return true;
+		}
+		return false;
+	}
+
 	public function upgradeSettingsTabURL()
 	{
 		$response = [

+ 6 - 2
api/pages/settings-image-manager.php

@@ -19,8 +19,12 @@ function get_page_settings_image_manager($Organizr)
       headers:{ "formKey": local("g","formKey") },
       init: function() {
         this.on("complete", function(file) {
-            buildImageManagerView();
-            //$.magnificPopup.close();
+            if(file["status"] === "success"){
+                buildImageManagerView();
+            }else{
+                let response = JSON.parse(file.xhr.responseText);
+            	message("Upload Error", response.response.message,activeInfo.settings.notifications.position,"#FFF","error","5000");
+            }
         });
       }
     });

+ 118 - 118
api/plugins/php-mailer/plugin.php

@@ -250,291 +250,291 @@ class PhpMailer extends Organizr
 	/* GET PHPMAILER SETTINGS */
 	public function _phpMailerPluginGetSettings()
 	{
-		return array(
-			'Host' => array(
-				array(
+		return [
+			'Host' => [
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-smtpHost',
 					'label' => 'SMTP Host',
 					'value' => $this->config['PHPMAILER-smtpHost']
-				),
-				array(
+				],
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-smtpHostPort',
 					'label' => 'SMTP Port',
 					'value' => $this->config['PHPMAILER-smtpHostPort']
-				)
-			),
-			'Authentication' => array(
-				array(
+				]
+			],
+			'Authentication' => [
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-smtpHostUsername',
 					'label' => 'Username',
 					'value' => $this->config['PHPMAILER-smtpHostUsername']
-				),
-				array(
+				],
+				[
 					'type' => 'password',
 					'name' => 'PHPMAILER-smtpHostPassword',
 					'label' => 'Password',
 					'value' => $this->config['PHPMAILER-smtpHostPassword']
-				),
-				array(
+				],
+				[
 					'type' => 'switch',
 					'name' => 'PHPMAILER-smtpHostAuth',
 					'label' => 'Authentication',
 					'value' => $this->config['PHPMAILER-smtpHostAuth']
-				),
-				array(
+				],
+				[
 					'type' => 'select',
 					'name' => 'PHPMAILER-smtpHostType',
 					'label' => 'Authentication Type',
 					'value' => $this->config['PHPMAILER-smtpHostType'],
-					'options' => array(
-						array(
+					'options' => [
+						[
 							'name' => 'tls',
 							'value' => 'tls'
-						),
-						array(
+						],
+						[
 							'name' => 'ssl',
 							'value' => 'ssl'
-						),
-						array(
+						],
+						[
 							'name' => 'off',
 							'value' => 'n/a'
-						)
-					)
-				),
-				array(
+						]
+					]
+				],
+				[
 					'type' => 'switch',
 					'name' => 'PHPMAILER-verifyCert',
 					'label' => 'Verify Certificate',
 					'value' => $this->config['PHPMAILER-verifyCert']
-				),
-			),
-			'Sender Information' => array(
-				array(
+				],
+			],
+			'Sender Information' => [
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-smtpHostSenderName',
 					'label' => 'Sender Name',
 					'value' => $this->config['PHPMAILER-smtpHostSenderName']
-				),
-				array(
+				],
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-smtpHostSenderEmail',
 					'label' => 'Sender Email',
 					'value' => $this->config['PHPMAILER-smtpHostSenderEmail'],
 					'placeholder' => 'i.e. same as username'
-				)
-			),
-			'Test & Options' => array(
-				array(
+				]
+			],
+			'Test & Options' => [
+				[
 					'type' => 'button',
 					'label' => 'Send Test',
 					'class' => 'phpmSendTestEmail',
 					'icon' => 'fa fa-paper-plane',
 					'text' => 'Send'
-				),
-				array(
+				],
+				[
 					'type' => 'switch',
 					'name' => 'PHPMAILER-debugTesting',
 					'label' => 'Enable Debug Output on Email Test',
 					'value' => $this->config['PHPMAILER-debugTesting'],
-				),
-				array(
+				],
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-domain',
 					'label' => 'Domain Link Override',
 					'value' => $this->config['PHPMAILER-domain'],
 					'placeholder' => 'https://domain.com/',
-				),
-				array(
+				],
+				[
 					'type' => 'select',
 					'name' => 'PHPMAILER-template',
 					'label' => 'Theme',
 					'value' => $this->config['PHPMAILER-template'],
 					'options' => $this->_phpMailerPluginGetTemplates()
-				),
-				array(
+				],
+				[
 					'type' => 'input',
 					'name' => 'PHPMAILER-logo',
 					'label' => 'WAN Logo URL',
 					'value' => $this->config['PHPMAILER-logo'],
 					'placeholder' => 'Full URL',
-				),
-				array(
+				],
+				[
 					'type' => 'switch',
 					'name' => 'PHPMAILER-emailTemplateRegisterUserEnabled',
 					'label' => 'Send Welcome E-Mail',
 					'value' => $this->config['PHPMAILER-emailTemplateRegisterUserEnabled'],
-				),
-			),
-			'Templates' => array(
-				array(
+				],
+			],
+			'Templates' => [
+				[
 					'type' => 'accordion',
 					'label' => 'Edit Template',
 					'id' => 'customEmailTemplates',
 					'override' => 12,
-					'options' => array(
-						array(
+					'options' => [
+						[
 							'id' => 'PHPMAILER-emailTemplateRegisterUserForm',
 							'header' => 'New Registration',
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateRegisterUserSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateRegisterUserSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateRegisterUser',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateRegisterUser'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateResetPasswordForm',
 							'header' => 'Reset Password',
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateResetSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateResetSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateReset',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateReset'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateInviteUserForm',
 							'header' => 'Invite User',
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateInviteUserSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateInviteUserSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateInviteUser',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateInviteUser'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateCustom-include-OneForm',
 							'header' => $this->config['PHPMAILER-emailTemplateCustom-include-OneName'],
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-OneName',
 									'smallLabel' => 'Name',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-OneName'],
-								),
-								array(
+								],
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-OneSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-OneSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-One',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-One'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateCustom-include-TwoForm',
 							'header' => $this->config['PHPMAILER-emailTemplateCustom-include-TwoName'],
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-TwoName',
 									'smallLabel' => 'Name',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-TwoName'],
-								),
-								array(
+								],
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-TwoSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-TwoSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-Two',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-Two'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateCustom-include-ThreeForm',
 							'header' => $this->config['PHPMAILER-emailTemplateCustom-include-ThreeName'],
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-ThreeName',
 									'smallLabel' => 'Name',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-ThreeName'],
-								),
-								array(
+								],
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-ThreeSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-ThreeSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-Three',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-Three'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-						array(
+								]
+							]
+						],
+						[
 							'id' => 'PHPMAILER-emailTemplateCustom-include-FourForm',
 							'header' => $this->config['PHPMAILER-emailTemplateCustom-include-FourName'],
-							'body' => array(
-								array(
+							'body' => [
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-FourName',
 									'smallLabel' => 'Name',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-FourName'],
-								),
-								array(
+								],
+								[
 									'type' => 'input',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-FourSubject',
 									'smallLabel' => 'Subject',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-FourSubject'],
-								),
-								array(
+								],
+								[
 									'type' => 'textbox',
 									'name' => 'PHPMAILER-emailTemplateCustom-include-Four',
 									'smallLabel' => 'Body',
 									'value' => $this->config['PHPMAILER-emailTemplateCustom-include-Four'],
 									'attr' => 'rows="10"',
-								)
-							)
-						),
-					)
-				)
-			)
-		);
+								]
+							]
+						],
+					]
+				]
+			]
+		];
 	}
 }

+ 7 - 62
api/v2/routes/root.php

@@ -10,7 +10,7 @@ $app->get('/', function ($request, $response, $args) {
 		->withHeader('Location', '/api/v2/status')
 		->withStatus(302);
 });
-$app->get('/status', function ($request, $response, $args) {
+$app->get('/status[/]', function ($request, $response, $args) {
 	/**
 	 * @OA\Get(
 	 *     path="/api/v2/status",
@@ -25,78 +25,23 @@ $app->get('/status', function ($request, $response, $args) {
 	 */
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	if ($Organizr->checkRoute($request)) {
-		$GLOBALS['api']['response']['data'] = $Organizr->status(true);
+		$GLOBALS['api']['response']['data'] = $Organizr->status(false);
 	}
 	$response->getBody()->write(jsonE($GLOBALS['api']));
 	return $response
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
-$app->any('/auth', function ($request, $response, $args) {
-	/**
-	 * @OA\Get(
-	 *     path="/api/v2/auth",
-	 *     summary="Nginx auth_request",
-	 * @OA\Parameter(
-	 *   name="group",
-	 *   description="The id of the group allowed",
-	 *   @OA\Schema(
-	 *     type="integer",
-	 *     format="int64",
-	 *   ),
-	 *   in="query",
-	 *   required=false
-	 * ),
-	 * @OA\Parameter(
-	 *   name="whitelist",
-	 *   description="Whitelisted Ip's",
-	 *   @OA\Schema(
-	 *     type="array",
-	 *     @OA\Items(
-	 *      type="string",
-	 *     ),
-	 *   ),
-	 *   in="query",
-	 *   explode=false,
-	 *   required=false
-	 * ),
-	 * @OA\Parameter(
-	 *   name="blacklist",
-	 *   description="Blacklisted Ip's",
-	 *   @OA\Schema(
-	 *     type="array",
-	 *     @OA\Items(
-	 *      type="string",
-	 *     ),
-	 *   ),
-	 *   in="query",
-	 *   explode=false,
-	 *   required=false
-	 * ),
-	 * @OA\Response(
-	 *  response="200",
-	 *  description="Success",
-	 *  ),
-	 *  @OA\Response(response="401",description="Unauthorized"),
-	 * )
-	 */
-	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
-	$Organizr->auth();
-	$response->getBody()->write(jsonE($GLOBALS['api']));
-	return $response
-		->withHeader('Content-Type', 'application/json;charset=UTF-8')
-		->withStatus($GLOBALS['responseCode']);
-});
-$app->any('/auth-{group}', function ($request, $response, $args) {
+$app->any('/auth-[{group}[/]]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
-	$_GET['group'] = $args['group'];
+	$_GET['group'] = $args['group'] ?? 0;
 	$Organizr->auth();
 	$response->getBody()->write(jsonE($GLOBALS['api']));
 	return $response
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
-$app->any('/auth/[{group}[/{type}[/{ips}]]]', function ($request, $response, $args) {
+$app->any('/auth[/[{group}[/{type}[/{ips}]]]]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$_GET['group'] = $args['group'] ?? 0;
 	$_GET['type'] = $args['type'] ?? 'deny';
@@ -107,7 +52,7 @@ $app->any('/auth/[{group}[/{type}[/{ips}]]]', function ($request, $response, $ar
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
-$app->any('/organizr-auth/[{group}[/{type}[/{ips}]]]', function ($request, $response, $args) {
+$app->any('/organizr-auth[/[{group}[/{type}[/{ips}]]]]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$_GET['group'] = $args['group'] ?? 0;
 	$_GET['type'] = $args['type'] ?? 'deny';
@@ -118,7 +63,7 @@ $app->any('/organizr-auth/[{group}[/{type}[/{ips}]]]', function ($request, $resp
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')
 		->withStatus($GLOBALS['responseCode']);
 });
-$app->get('/launch', function ($request, $response, $args) {
+$app->get('/launch[/]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
 	$tabInfo = $Organizr->getUserTabsAndCategories();
 	$GLOBALS['api']['response']['data']['categories'] = ($tabInfo['categories']) ?? false;

+ 0 - 51
docs/api.json

@@ -3069,57 +3069,6 @@
                 }
             }
         },
-        "/api/v2/auth": {
-            "get": {
-                "summary": "Nginx auth_request",
-                "parameters": [
-                    {
-                        "name": "group",
-                        "in": "query",
-                        "description": "The id of the group allowed",
-                        "required": false,
-                        "schema": {
-                            "type": "integer",
-                            "format": "int64"
-                        }
-                    },
-                    {
-                        "name": "whitelist",
-                        "in": "query",
-                        "description": "Whitelisted Ip's",
-                        "required": false,
-                        "explode": false,
-                        "schema": {
-                            "type": "array",
-                            "items": {
-                                "type": "string"
-                            }
-                        }
-                    },
-                    {
-                        "name": "blacklist",
-                        "in": "query",
-                        "description": "Blacklisted Ip's",
-                        "required": false,
-                        "explode": false,
-                        "schema": {
-                            "type": "array",
-                            "items": {
-                                "type": "string"
-                            }
-                        }
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "Success"
-                    },
-                    "401": {
-                        "description": "Unauthorized"
-                    }
-                }
-            }
-        },
         "/api/v2/update": {
             "get": {
                 "tags": [

+ 5 - 2
js/functions.js

@@ -5073,7 +5073,10 @@ function loadAppearance(appearance){
 			}
 		`;
 	}
-	if(appearance.loginWallpaper !== ''){
+	if(appearance.loginWallpaper !== '' || appearance.randomMediaImage){
+		if(appearance.randomMediaImage){
+			appearance.loginWallpaper = appearance.randomMediaImage;
+		}
 		cssSettings += `
 		    .login-register {
 			    background: url(`+randomCSV(appearance.loginWallpaper)+`) center center/cover no-repeat!important;
@@ -9778,7 +9781,7 @@ function PopupCenter(url, title, w, h) {
     return newWindow;
 }
 function getPlexHeaders(){
-    let plexTitle = activeInfo.appearance.title == '' ? 'Organizr' : activeInfo.appearance.title;
+    let plexTitle = activeInfo.appearance.title == '' ? 'Organizr' : cleanClass(activeInfo.appearance.title);
     return {
         'Accept': 'application/json',
         'X-Plex-Product': plexTitle,

+ 9 - 0
js/sponsors.json

@@ -13,5 +13,14 @@
     "logo": "https://user-images.githubusercontent.com/16184466/49177230-e6f6f680-f309-11e8-9d6a-67be65109d14.png",
     "logo_dark": "https://user-images.githubusercontent.com/16184466/49177230-e6f6f680-f309-11e8-9d6a-67be65109d14.png",
     "website": "https://unraid.net/"
+  },
+  {
+    "company_name": "Ultra.cc",
+    "logo": "https://user-images.githubusercontent.com/16184466/165360431-7324ecac-2c4d-4dc0-aa70-f582f197eb1f.png",
+    "logo_dark": "https://user-images.githubusercontent.com/16184466/165360431-7324ecac-2c4d-4dc0-aa70-f582f197eb1f.png",
+    "website": "https://ultra.cc/",
+    "about": "<b>Premium apps hosting that just works<\/b><br\/>",
+    "coupon": "FLASH20",
+    "coupon_about": "20% off recurring"
   }
 ]

+ 7 - 0
js/version.json

@@ -558,5 +558,12 @@
     "new": "",
     "fixed": "fix defaultTab if organizrLogin hash is still set|fixed plugin container not hiding if clicking other plugin|fixed private repo for plugins|fix user plugin not loading default config file",
     "notes": "renamed php error to organizr error"
+  },
+  "2.1.1880": {
+    "date": "2022-04-27 15:13",
+    "title": "Plugin Fix",
+    "new": "added function getRandomMediaImage to changing media images|added new sponsor|added only wide images \u003E 1200 to getRandomMediaImage function|added useRandomMediaImage for changing media image on login",
+    "fixed": "fixed plugins not being migrated over|fixed isEncrypted function to work with any style of password (#1826)|fixed issue allowing non images to be uploaded|fixed Using Certain Characters for the Organizr Title breaks Plex oAuth (#1824)",
+    "notes": "changed getRandomMediaImage from array to string|change width from 1200 to getCacheImageSize|consolidated auth endpoints|tweak randomize result for getRandomMediaImage|updated root api routes to include optional slash"
   }
 }