Merge branch 'ent-4834-pandora-custom-logo-text-on-conf' into 'develop'

Ent 4834 pandora custom logo text on conf

See merge request artica/pandorafms!2850
This commit is contained in:
Daniel Rodriguez 2019-11-11 13:33:37 +01:00
commit 7d45cad637
4 changed files with 75 additions and 16 deletions

View File

@ -88,6 +88,24 @@ if (!empty($config['login_background'])) {
$login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\""; $login_body_style = "style=\"background:linear-gradient(74deg, #02020255 36%, transparent 36%), url('".$background_url."');\"";
} }
// Get alternative custom in case of db fail.
$custom_fields = [
'custom_logo_login',
'custom_splash_login',
'custom_title1_login',
'custom_title2_login',
'rb_product_name',
];
foreach ($custom_fields as $field) {
if (!isset($config[$field])) {
if (isset($config[$field.'_alt'])) {
$config[$field] = $config[$field.'_alt'];
$custom_conf_enabled = true;
}
}
}
// Get the custom icons. // Get the custom icons.
$docs_logo = ui_get_docs_logo(); $docs_logo = ui_get_docs_logo();
$support_logo = ui_get_support_logo(); $support_logo = ui_get_support_logo();
@ -96,16 +114,16 @@ echo '<div id="header_login">';
echo '<div id="list_icon_docs_support"><ul>'; echo '<div id="list_icon_docs_support"><ul>';
if ($docs_logo !== false) { if ($docs_logo !== false) {
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>'; echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$docs_logo.'" alt="docs"></a></li>';
} }
echo '<li><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank">'.__('Docs').'</li>'; echo '<li><a href="'.$config['custom_docs_url'].'" target="_blank">'.__('Docs').'</li>';
if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) {
if ($support_logo !== false) { if ($support_logo !== false) {
echo '<li id="li_margin_left"><a href="'.ui_get_full_external_url($config['custom_docs_url']).'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_left"><a href="'.$config['custom_docs_url'].'" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
} }
echo '<li><a href="'.ui_get_full_external_url($config['custom_support_url']).'" target="_blank">'.__('Support').'</li>'; echo '<li><a href="'.$config['custom_support_url'].'" target="_blank">'.__('Support').'</li>';
} else { } else {
echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>'; echo '<li id="li_margin_left"><a href="https://pandorafms.com/monitoring-services/support/" target="_blank"><img src="'.$support_logo.'" alt="support"></a></li>';
echo '<li>'.__('Support').'</li>'; echo '<li>'.__('Support').'</li>';
@ -133,7 +151,7 @@ if (defined('METACONSOLE')) {
html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image('enterprise/images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} }
} else { } else {
if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] == 0) { if (!isset($config['custom_logo_login']) || $config['custom_logo_login'] === 0) {
html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image('images/custom_logo_login/pandora_logo.png', false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
} else { } else {
html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true); html_print_image('images/custom_logo_login/'.$config['custom_logo_login'], false, ['class' => 'login_logo', 'alt' => 'logo', 'border' => 0, 'title' => $logo_title], false, true);
@ -423,9 +441,14 @@ if ($login_screen == 'logout') {
} }
switch ($login_screen) { switch ($login_screen) {
case 'error_authconfig':
case 'error_dbconfig': case 'error_dbconfig':
case 'error_authconfig':
if (!isset($config['rb_product_name_alt'])) {
$title = __('Problem with %s database', get_product_name()); $title = __('Problem with %s database', get_product_name());
} else {
$title = __('Problem with %s database', $config['rb_product_name_alt']);
}
$message = __( $message = __(
'Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file.<i><br/><br/> 'Cannot connect to the database, please check your database setup in the <b>include/config.php</b> file.<i><br/><br/>
Probably your database, hostname, user or password values are incorrect or Probably your database, hostname, user or password values are incorrect or

View File

@ -83,7 +83,6 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
</style> </style>
</head> </head>
<body> <body>
<div id="alert_messages_na"> <div id="alert_messages_na">
<div class='modalheade'> <div class='modalheade'>
@ -100,10 +99,29 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%;
?> ?>
</div> </div>
</div> </div>
<a href='https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration' target='_blank'> <?php
<div class='modalwikibutto cerrar'> $custom_conf_enabled = false;
<span class='modalwikibuttontex'> <?php echo __('Documentation'); ?></span> foreach ($config as $key => $value) {
if (preg_match('/._alt/i', $key)) {
$custom_conf_enabled = true;
break;
}
}
if (!$custom_conf_enabled) {
echo '
<a href="https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_en:Configuration" target="_blank">
<div class="modalwikibutto cerrar">
<span class="modalwikibuttontex">'.__('Documentation').'
</span>
</div> </div>
</a>
';
}
?>
</a> </a>
</div> </div>

View File

@ -148,8 +148,6 @@ if (!isset($config['homeurl_static'])) {
} }
} }
db_select_engine();
$config['dbconnection'] = db_connect();
if (! defined('EXTENSIONS_DIR')) { if (! defined('EXTENSIONS_DIR')) {
@ -160,6 +158,9 @@ if (! defined('ENTERPRISE_DIR')) {
define('ENTERPRISE_DIR', 'enterprise'); define('ENTERPRISE_DIR', 'enterprise');
} }
db_select_engine();
$config['dbconnection'] = db_connect();
require_once $ownDir.'functions_config.php'; require_once $ownDir.'functions_config.php';
date_default_timezone_set('Europe/Madrid'); date_default_timezone_set('Europe/Madrid');

View File

@ -873,6 +873,15 @@ function install_step4()
$config["dbpass"]="'.$random_password.'"; // DB Password $config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host $config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir $config["homedir"]="'.$path.'"; // Config homedir
// ----------Rebranding--------------------
// Uncomment this lines and add your customs text and paths.
// $config["custom_logo_login_alt"] ="login_logo.png";
// $config["custom_splash_login_alt"] = "splash_image_default.png";
// $config["custom_title1_login_alt"] = "WELCOME TO Pandora FMS";
// $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS";
/* /*
----------Attention-------------------- ----------Attention--------------------
Please note that in certain installations: Please note that in certain installations:
@ -975,6 +984,14 @@ function install_step4()
$config["dbpass"]="'.$random_password.'"; // DB Password $config["dbpass"]="'.$random_password.'"; // DB Password
$config["dbhost"]="'.$dbhost.'"; // DB Host $config["dbhost"]="'.$dbhost.'"; // DB Host
$config["homedir"]="'.$path.'"; // Config homedir $config["homedir"]="'.$path.'"; // Config homedir
// ----------Rebranding--------------------
// Uncomment this lines and add your customs text and paths.
// $config["custom_logo_login_alt"] ="login_logo.png";
// $config["custom_splash_login_alt"] = "splash_image_default.png";
// $config["custom_title1_login_alt"] = "WELCOME TO Pandora FMS";
// $config["custom_title2_login_alt"] = "NEXT GENERATION";
// $config["rb_product_name_alt"] = "Pandora FMS";
/* /*
----------Attention-------------------- ----------Attention--------------------
Please note that in certain installations: Please note that in certain installations: