Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -1,71 +1,65 @@
<?php
/**
* Observium Network Management and Monitoring System
* Copyright (C) 2006-2015, Adam Armstrong - http://www.observium.org
* Observium
*
* @package observium
* @subpackage webui
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* This file is part of Observium.
*
* @package observium
* @subpackage webui
* @copyright (C) Adam Armstrong
*
*/
$navbar['class'] = 'navbar-narrow';
$navbar['brand'] = 'Apps';
$app_types = array();
foreach ($app_list as $app)
{
if ($vars['app'] == $app['app_type'])
{
$navbar['options'][$app['app_type']]['class'] = 'active';
}
$navbar['options'][$app['app_type']]['url'] = generate_url(array('page' => 'apps', 'app' => $app['app_type']));
$navbar['options'][$app['app_type']]['text'] = nicecase($app['app_type']);
// Detect and add application icon
$icon = $app['app_type'];
$image = $config['html_dir'].'/images/apps/'.$icon.'.png';
if (is_file($image))
{
// Icon found
//$icon = $app['app_type'];
} else {
list($icon) = explode('-', str_replace('_', '-', $app['app_type']));
$image = $config['html_dir'].'/images/apps/'.$icon.'.png';
if ($icon != $app['app_type'] && is_file($image))
{
// 'postfix_qshape' -> 'postfix'
// 'exim-mailqueue' -> 'exim'
} else {
$icon = 'apps'; // Generic
$app_types = [];
foreach ($app_list as $app) {
if ($vars['app'] == $app['app_type']) {
$navbar['options'][$app['app_type']]['class'] = 'active';
}
}
$navbar['options'][$app['app_type']]['image'] = 'images/apps/'.$icon.'.png';
if (is_file($config['html_dir'].'/images/apps/'.$icon.'_2x.png'))
{
// HiDPI icon
$navbar['options'][$app['app_type']]['image_2x'] = 'images/apps/'.$icon.'_2x.png';
}
$navbar['options'][$app['app_type']]['url'] = generate_url(['page' => 'apps', 'app' => $app['app_type']]);
$navbar['options'][$app['app_type']]['text'] = nicecase($app['app_type']);
$app_types[$app['app_type']] = array();
// Detect and add application icon
$icon = $app['app_type'];
$image = $config['html_dir'] . '/images/apps/' . $icon . '.png';
if (is_file($image)) {
// Icon found
//$icon = $app['app_type'];
} else {
[$icon] = explode('-', str_replace('_', '-', $app['app_type']));
$image = $config['html_dir'] . '/images/apps/' . $icon . '.png';
if ($icon != $app['app_type'] && is_file($image)) {
// 'postfix_qshape' -> 'postfix'
// 'exim-mailqueue' -> 'exim'
} else {
$icon = 'apps'; // Generic
}
}
$navbar['options'][$app['app_type']]['image'] = 'images/apps/' . $icon . '.png';
if (is_file($config['html_dir'] . '/images/apps/' . $icon . '_2x.png')) {
// HiDPI icon
$navbar['options'][$app['app_type']]['image_2x'] = 'images/apps/' . $icon . '_2x.png';
}
$app_types[$app['app_type']] = [];
}
print_navbar($navbar);
unset($navbar);
if ($vars['app'] && is_alpha($vars['app']))
{
$include = $config['html_dir'].'/pages/apps/'.$vars['app'].'.inc.php';
if (is_file($include))
{
include($include);
} else {
include($config['html_dir'].'/pages/apps/default.inc.php');
}
if ($vars['app'] && is_alpha($vars['app'])) {
$include = $config['html_dir'] . '/pages/apps/' . $vars['app'] . '.inc.php';
if (is_file($include)) {
include($include);
} elseif (dbExist('applications', generate_where_clause([ '`app_type` = ?', generate_query_permitted_ng([ 'devices' ]) ]), [ $vars['app'] ])) {
include($config['html_dir'] . '/pages/apps/default.inc.php');
} else {
print_warning('The application "' . $vars['app'] . '" does not exist.');
}
} else {
include($config['html_dir'].'/pages/apps/overview.inc.php');
include($config['html_dir'] . '/pages/apps/overview.inc.php');
}
register_html_title('Applications');