Sfoglia il codice sorgente

Merge pull request #1812 from causefx/v2-develop

V2 develop
causefx 4 anni fa
parent
commit
76b343af34
2 ha cambiato i file con 16 aggiunte e 9 eliminazioni
  1. 9 9
      api/classes/organizr.class.php
  2. 7 0
      js/version.json

+ 9 - 9
api/classes/organizr.class.php

@@ -65,7 +65,7 @@ class Organizr
 
 	// ===================================
 	// Organizr Version
-	public $version = '2.1.1750';
+	public $version = '2.1.1760';
 	// ===================================
 	// Quick php Version check
 	public $minimumPHP = '7.3';
@@ -1705,9 +1705,9 @@ class Organizr
 		return ($page) ? strtolower(str_replace(array('%20', ' ', '-', '_'), '_', $page)) : '';
 	}
 
-	public function cleanClassName($name)
+	public function cleanClassName($name, $char = '-')
 	{
-		return ($name) ? (str_replace(array('%20', ' ', '-', '_'), '-', $name)) : '';
+		return ($name) ? (str_replace(array('%20', ' ', '-', '_'), $char, strtolower($name))) : '';
 	}
 
 	public function reverseCleanClassName($name)
@@ -1944,7 +1944,7 @@ class Organizr
 				$this->settingsOption('notice', null, ['notice' => 'danger', 'body' => '3rd Party Repositories are not affiliated with Organizr and therefore the themes on these repositories are not inspected.  Use at your own risk.']),
 				$this->settingsOption('multiple-url', 'externalThemeMarketplaceRepos', ['override' => 12, 'label' => 'External Marketplace Repo', 'help' => 'Only supports Github repos']),
 				$this->settingsOption('token', 'githubAccessToken', ['label' => 'Github Person Access Token', 'help' => 'The Github Person Access Token will help with API rate limiting as well as let you access your own Private Repos']),
-				$this->settingsOption('switch', 'checkForThemeUpdate', ['label' => 'Check for Plugin Updates', ['help' => 'Check for updates on page load']])
+				$this->settingsOption('switch', 'checkForThemeUpdate', ['label' => 'Check for Theme Updates', ['help' => 'Check for updates on page load']])
 			]
 		];
 	}
@@ -5115,14 +5115,14 @@ class Organizr
 	public function removeTheme($theme)
 	{
 		$this->setLoggerChannel('Theme Marketplace');
-		$theme = $this->reverseCleanClassName($theme);
+		$theme = $this->cleanClassName($theme, '_');
 		$array = $this->getThemesMarketplace();
 		$arrayLower = array_change_key_case($array);
 		if (!$array) {
 			$this->setAPIResponse('error', 'Could not access theme marketplace', 409);
 			return false;
 		}
-		if (!$arrayLower[$theme]) {
+		if (!isset($arrayLower[$theme])) {
 			$this->setAPIResponse('error', 'Theme does not exist in marketplace', 404);
 			return false;
 		} else {
@@ -5149,15 +5149,15 @@ class Organizr
 	public function installTheme($theme)
 	{
 		$this->setLoggerChannel('Theme Marketplace');
-		$theme = $this->reverseCleanClassName($theme);
+		$theme = $this->cleanClassName($theme, '_');
 		$array = $this->getThemesMarketplace();
 		$arrayLower = array_change_key_case($array);
 		if (!$array) {
 			$this->setAPIResponse('error', 'Could not access theme marketplace', 409);
 			return false;
 		}
-		if (!$arrayLower[$theme]) {
-			$this->setAPIResponse('error', 'Theme does not exist in marketplace', 404);
+		if (!isset($arrayLower[$theme])) {
+			$this->setAPIResponse('error', 'Theme [' . $theme . '] does not exist in marketplace', 404, $arrayLower);
 			return false;
 		} else {
 			$key = array_search($theme, array_keys($arrayLower));

+ 7 - 0
js/version.json

@@ -516,5 +516,12 @@
     "new": "added Active Plex Streams show user information without IP toggle (FR#147)|added api endpoint /themes|added api endpoint test/database|added api endpoint themes/marketplace|added date to create invite function|added defaultTables function|added defaultThemeInformation function|added destroy owl carousel to recent homepage item|added driver, dbHost, dbUsername, dbPassword, externalThemeMarketplaceRepos and checkForThemeUpdate to default config|added formatDatabaseDriver function|added getAllThemes function|added getAllThemesInformation function|added getDefaultTablesFormatted function|added getOrganizrThemes function|added getUserThemes function|added hasConfig function|added hasDatabase function|added ignore torrent label to rTorrent|added includeTrailing to qualifyURL function|added js functions  loadThemeMarketplace getRepoUsernameAndRepoName buildThemeSettings|added mysqli database support|added new unifi output to test format|added page settings_customize_settings|added removeDbExtension function|added replaceStringInDatabase function|added short range to debug message or authProxy logins|added testDatabaseConnection function|added theme marketplace 3rd party ability|added userThemeInformation function|added validateTheme function",
     "fixed": "fixed api response if no backups were created|fixed cache image size to not include float|fixed folder not writable check for wizard|fixed image manager|fixed objDiff function that had typo|fixed rTorrent showing leech on download item (#1785)|fixed suggested directory path for clipboard|fixed user plugins js/css not being added|fixed wizard not showing mysqli when selected",
     "notes": "moved duplicated code for rTorrent URL to rTorrentURL function|removed old api docs|removed old config file after migration|update api doc json|update createNewDB function|updated backup function to use new data folder|updated connectDB function|updated connectOtherDB function|updated default wizard values for not used fields|updated getPlugins function to be more inclusive|updated setTheme function for new theme format|Updated the following languages: [Chinese] [Dutch] [Italian]|updated themeChanger and changeTheme for new theme format|updated time format to reflect new database format|updated updateDB to reflect having mysqli support|updated value of null to 0 for tab options|updated wizard to show new mysqli option|update plugin queries to reflect new database options"
+  },
+  "2.1.1760": {
+    "date": "2022-03-26 16:21",
+    "title": "Theme Marketplace Hotfix",
+    "new": "",
+    "fixed": "fixed theme marketplace downloading of themes with spaces",
+    "notes": ""
   }
 }