diff --git a/inc/html.class.php b/inc/html.class.php index 772868b17d..bcf992353b 100755 --- a/inc/html.class.php +++ b/inc/html.class.php @@ -1280,6 +1280,45 @@ static function displayProgressBar($width, $percent, $options = []) } } + /* Returns a list of CSS files to include for plugins + * + * @return array + */ + static function getPluginsCss() { + global $PLUGIN_HOOKS; + $css = []; + if (isset($PLUGIN_HOOKS['add_css']) && count($PLUGIN_HOOKS['add_css'])) { + foreach ($PLUGIN_HOOKS["add_css"] as $plugin => $files) { + if (!Plugin::isPluginActive($plugin)) { + continue; + } + + $plugin_root_dir = Plugin::getPhpDir($plugin, true); + $plugin_web_dir = Plugin::getWebDir($plugin, false); + $version = Plugin::getInfo($plugin, 'version'); + + if (!is_array($files)) { + $files = [$files]; + } + + foreach ($files as $file) { + $filename = "$plugin_root_dir/$file"; + + if (!file_exists($filename)) { + continue; + } + + if ('scss' === substr(strrchr($filename, '.'), 1)) { + $css[] = Html::scss("$plugin_web_dir/$file", ['version' => $version]); + } else { + $css[] = Html::css("$plugin_web_dir/$file", ['version' => $version]); + } + } + } + } + return $css; + } + /** * Include common HTML headers @@ -1453,6 +1492,7 @@ static function includeHeader($title = '', $sector = 'none', $item = 'none', $op // CSS link echo Html::scss('css/styles'); + echo Html::scss('css/colors'); echo Html::scss('css/itsm2'); if (isset($_SESSION['glpihighcontrast_css']) && $_SESSION['glpihighcontrast_css']) { echo Html::scss('css/highcontrast'); @@ -1462,40 +1502,11 @@ static function includeHeader($title = '', $sector = 'none', $item = 'none', $op echo "\n"; - // Add specific css for plugins - if (isset($PLUGIN_HOOKS['add_css']) && count($PLUGIN_HOOKS['add_css'])) { - - foreach ($PLUGIN_HOOKS["add_css"] as $plugin => $files) { - if (!Plugin::isPluginActive($plugin)) { - continue; - } - - $plugin_root_dir = Plugin::getPhpDir($plugin, true); - $plugin_web_dir = Plugin::getWebDir($plugin, false); - $version = Plugin::getInfo($plugin, 'version'); - - if (!is_array($files)) { - $files = [$files]; - } - - foreach ($files as $file) { - $filename = "$plugin_root_dir/$file"; - - if (!file_exists($filename)) { - continue; - } - - if ('scss' === substr(strrchr($filename, '.'), 1)) { - echo Html::scss("$plugin_web_dir/$file", ['version' => $version]); - } else { - echo Html::css("$plugin_web_dir/$file", ['version' => $version]); - } - } - } + $pluginCss = self::getPluginsCss(); + foreach ($pluginCss as $css) { + echo $css; } - echo Html::scss('css/palettes/' . $theme); - // Custom CSS for active entity if ($DB instanceof DBmysql && $DB->connected) { $entity = new Entity(); diff --git a/inc/itsmnguploadhandler.class.php b/inc/itsmnguploadhandler.class.php index 53b499c1ee..f233c9703d 100644 --- a/inc/itsmnguploadhandler.class.php +++ b/inc/itsmnguploadhandler.class.php @@ -49,6 +49,9 @@ class ItsmngUploadHandler { static function getUploadPath($type, $filename, $withDir = true) { $extension = strtoupper(pathinfo($filename, PATHINFO_EXTENSION)); switch ($type) { + case self::UPLOAD: + $upload_path = '_uploads'; + break; case self::TMP: $upload_path = '_tmp'; break; @@ -62,7 +65,7 @@ static function getUploadPath($type, $filename, $withDir = true) { $upload_path = '_dumps'; break; default: - $upload_path = '_uploads'; + $upload_path = $type; break; } if (!file_exists(GLPI_DOC_DIR . $upload_path . '/' . $extension)) { diff --git a/index.php b/index.php index 132da7ef47..dbff24bccb 100755 --- a/index.php +++ b/index.php @@ -155,9 +155,7 @@ CronTask::callCronForce(); } - -try { - renderTwigTemplate('index.twig', ["root_doc" => $CFG_GLPI['root_doc'], 'header_data' => $header_data] + $twig_vars); -} catch (\Exception $e) { - echo $e->getMessage(); -} \ No newline at end of file +renderTwigTemplate('index.twig', [ + "root_doc" => $CFG_GLPI['root_doc'], + 'header_data' => $header_data +] + $twig_vars);