Przeglądaj źródła

Merge pull request #1823 from causefx/v2-develop

V2 develop
causefx 4 lat temu
rodzic
commit
c2c0d131c3
3 zmienionych plików z 36 dodań i 11 usunięć
  1. 16 3
      api/classes/organizr.class.php
  2. 13 8
      js/functions.js
  3. 7 0
      js/version.json

+ 16 - 3
api/classes/organizr.class.php

@@ -65,7 +65,7 @@ class Organizr
 
 	// ===================================
 	// Organizr Version
-	public $version = '2.1.1830';
+	public $version = '2.1.1840';
 	// ===================================
 	// Quick php Version check
 	public $minimumPHP = '7.3';
@@ -835,7 +835,7 @@ class Organizr
 
 	public function handleError($number, $message, $file, $line)
 	{
-		error_log(sprintf('PHP %s:  %s in %s on line %d', $number, $message, $file, $line));
+		error_log(sprintf('Organizr %s:  %s in %s on line %d', $number, $message, $file, $line));
 	}
 
 	public function checkRoute($request)
@@ -1347,6 +1347,19 @@ class Organizr
 				$loadedDefaults = array_merge($loadedDefaults, $this->loadConfig($info->getPathname()));
 			}
 		}
+		/*
+		 * Include all custom Plugin routes
+		 */
+		if (file_exists(dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'plugins')) {
+			$folder = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'plugins';
+			$directoryIterator = new RecursiveDirectoryIterator($folder, FilesystemIterator::SKIP_DOTS);
+			$iteratorIterator = new RecursiveIteratorIterator($directoryIterator);
+			foreach ($iteratorIterator as $info) {
+				if ($info->getFilename() == 'config.php') {
+					$loadedDefaults = array_merge($loadedDefaults, $this->loadConfig($info->getPathname()));
+				}
+			}
+		}
 		return (is_array($loadedDefaults) ? $this->fillDefaultConfig_recurse($array, $loadedDefaults) : false);
 	}
 
@@ -5974,7 +5987,7 @@ class Organizr
 
 	public function downloadFileToPath($from, $to, $path)
 	{
-		if ((stripos($from, 'api.github.com') !== false) && $this->config['githubAccessToken'] !== '') {
+		if (((stripos($from, 'api.github.com') !== false) || (stripos($from, 'raw.githubusercontent.com') !== false)) && $this->config['githubAccessToken'] !== '') {
 			$context = stream_context_create(
 				array(
 					'ssl' => array(

+ 13 - 8
js/functions.js

@@ -426,13 +426,15 @@ function getDefault(id){
             return false;
         }
     }
-	if(getHash() === false || getHash() == 'OrganizrLogin'){
-		if(tabInfo.name !== null && tabInfo.type !== null){
-			switchTab(id);
-		}else{
-			$('#side-menu').children().first().children().click()
-		}
-	}else{
+    if(getHash() === false){
+        if(tabInfo.name !== null && tabInfo.type !== null){
+            switchTab(id);
+        } else {
+            $('#side-menu').children().first().children().click()
+        }
+    }else if(getHash() == 'OrganizrLogin'){
+        loadNextTab(true);
+    }else{
 		let hashTab = getHash();
         let hashType = isNaN(hashTab) ? 'name' : 'id';
         let tabInfo = findTab(hashTab, hashType);
@@ -442,7 +444,7 @@ function getDefault(id){
             return false;
         }
 		let type = tabInfo.type;
-		if (typeof hashTab !== 'undefined' && typeof type !== 'undefined') {
+		if(typeof hashTab !== 'undefined' && typeof type !== 'undefined'){
 			directToHash = true;
 			switchTab(tabInfo.id);
 		}else{
@@ -689,6 +691,9 @@ function switchToPlugin(plugin){
     closeSideMenu();
     removeMenuActive();
     swapDisplay('plugin');
+    $(".plugin-container").each(function(){
+        $(this).addClass("hidden").removeClass("show");
+    });
     $('#container-plugin-'+plugin).addClass("show").removeClass('hidden');
 }
 function switchTab(id, split = null){

+ 7 - 0
js/version.json

@@ -551,5 +551,12 @@
     "new": "added check to see if username was blank before strtolower function called|added function printWarningsAndErrors for dev purposes|added php error message names to error handler|added sanitize tab name on added and edit|added sanitize to tabs, categories, users and bookmarks|added sanitize to uploaded image names|added sanitizeUserString and sanitizeEmail functions",
     "fixed": "fixed loading tab if no default is selected",
     "notes": "changed error_handler for organizr class to setAPIErrorResponse|changed the api response of warning and errors to admin and co-admin only|removed svg files from approved image lists|replaced FILTER_SANITIZE_STRING as it was being deprecated in php 8.1|tweak organizr error handler|updated cron file to include user plugins for advance cron jobs|updated dibi/dibi to 4.2.6"
+  },
+  "2.1.1840": {
+    "date": "2022-04-15 20:42",
+    "title": "Weekly Update",
+    "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"
   }
 }