causefx 8 лет назад
Родитель
Сommit
4d76adad3a
1 измененных файлов с 17 добавлено и 4 удалено
  1. 17 4
      api/functions/static-globals.php

+ 17 - 4
api/functions/static-globals.php

@@ -28,6 +28,18 @@ function pluginFiles($type)
 	return $files;
 }
 
+function loadConfigOnce($path = null)
+{
+	$path = ($path) ? $path : $GLOBALS['userConfigPath'];
+	if (!is_file($path)) {
+		return null;
+	} else {
+		return (array)call_user_func(function () use ($path) {
+			return include($path);
+		});
+	}
+}
+
 function favIcons()
 {
 	$favicon = '
@@ -42,10 +54,11 @@ function favIcons()
 	<meta name="msapplication-config" content="plugins/images/favicon/browserconfig.xml">
 	<meta name="theme-color" content="#ffffff">
 	';
-	if (file_exists('config' . DIRECTORY_SEPARATOR . 'config.php')) {
-		if (isset($GLOBALS['favIcon'])) {
-			if ($GLOBALS['favIcon'] !== '') {
-				$favicon = $GLOBALS['favIcon'];
+	if (file_exists($GLOBALS['userConfigPath'])) {
+		$config = loadConfigOnce($GLOBALS['userConfigPath']);
+		if (isset($config['favIcon'])) {
+			if ($config['favIcon'] !== '') {
+				$favicon = $config['favIcon'];
 			}
 		}
 	}