Quellcode durchsuchen

Dependency check fails incorrectly on PHP 7.4 (#1288)

CauseFX vor 6 Jahren
Ursprung
Commit
3757b965ca
2 geänderte Dateien mit 12 neuen und 5 gelöschten Zeilen
  1. 10 3
      api/functions/api-functions.php
  2. 2 2
      api/index.php

+ 10 - 3
api/functions/api-functions.php

@@ -1196,9 +1196,9 @@ function allGroups()
 	return false;
 }
 
-function loadTabs()
+function loadTabs($type = null)
 {
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
+	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php') && $type) {
 		try {
 			$connect = new Dibi\Connection([
 				'driver' => 'sqlite3',
@@ -1219,7 +1219,14 @@ function loadTabs()
 				$v['count'] = isset($count[$v['category_id']]) ? $count[$v['category_id']] : 0;
 			}
 			$all['categories'] = $categories;
-			return $all;
+			switch ($type){
+				case 'categories':
+					return $all['categories'];
+				case 'tabs':
+					return $all['tabs'];
+				default:
+					return $all;
+			}
 		} catch (Dibi\Exception $e) {
 			return false;
 		}

+ 2 - 2
api/index.php

@@ -1133,8 +1133,8 @@ switch ($function) {
 				$status['status'] = organizrStatus();
 				$result['appearance'] = loadAppearance();
 				$status['user'] = $GLOBALS['organizrUser'];
-				$status['categories'] = loadTabs()['categories'];
-				$status['tabs'] = loadTabs()['tabs'];
+				$status['categories'] = loadTabs('categories');
+				$status['tabs'] = loadTabs('tabs');
 				$status['plugins'] = array_filter($GLOBALS, function ($k) use ($pluginSearch) {
 					return stripos($k, $pluginSearch) !== false;
 				}, ARRAY_FILTER_USE_KEY);