From f57f87b50b8e83237192a6a56eb067facf419d78 Mon Sep 17 00:00:00 2001 From: Luis Date: Mon, 11 Nov 2019 13:33:37 +0100 Subject: [PATCH] Ent 4834 pandora custom logo text on conf --- pandora_console/general/login_page.php | 37 ++++++++++++++++++---- pandora_console/general/mysqlerr.php | 28 +++++++++++++--- pandora_console/include/config_process.php | 5 +-- pandora_console/install.php | 21 ++++++++++-- 4 files changed, 75 insertions(+), 16 deletions(-) diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index ea40ef48aa..7d4ebe7e04 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -88,6 +88,24 @@ if (!empty($config['login_background'])) { $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. $docs_logo = ui_get_docs_logo(); $support_logo = ui_get_support_logo(); @@ -96,16 +114,16 @@ echo '
'; echo '
    '; if ($docs_logo !== false) { - echo '
  • docs
  • '; + echo '
  • docs
  • '; } - echo '
  • '.__('Docs').'
  • '; + echo '
  • '.__('Docs').'
  • '; if (file_exists(ENTERPRISE_DIR.'/load_enterprise.php')) { if ($support_logo !== false) { - echo '
  • support
  • '; + echo '
  • support
  • '; } - echo '
  • '.__('Support').'
  • '; + echo '
  • '.__('Support').'
  • '; } else { echo '
  • support
  • '; echo '
  • '.__('Support').'
  • '; @@ -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); } } 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); } 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); @@ -423,9 +441,14 @@ if ($login_screen == 'logout') { } switch ($login_screen) { - case 'error_authconfig': case 'error_dbconfig': - $title = __('Problem with %s database', get_product_name()); + case 'error_authconfig': + if (!isset($config['rb_product_name_alt'])) { + $title = __('Problem with %s database', get_product_name()); + } else { + $title = __('Problem with %s database', $config['rb_product_name_alt']); + } + $message = __( 'Cannot connect to the database, please check your database setup in the include/config.php file.

    Probably your database, hostname, user or password values are incorrect or diff --git a/pandora_console/general/mysqlerr.php b/pandora_console/general/mysqlerr.php index 40da530386..9abd62691f 100644 --- a/pandora_console/general/mysqlerr.php +++ b/pandora_console/general/mysqlerr.php @@ -83,7 +83,6 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%; -
    @@ -100,10 +99,29 @@ background:black;opacity:0.1;left:0px;top:0px;width:100%;height:100%; ?>
    - -
    - -
    + $value) { + if (preg_match('/._alt/i', $key)) { + $custom_conf_enabled = true; + break; + } + } + + if (!$custom_conf_enabled) { + echo ' +
    +
    + '.__('Documentation').' + +
    +
    + '; + } + + ?> + +
diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index a9f503be0a..4967c2bc02 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -148,8 +148,6 @@ if (!isset($config['homeurl_static'])) { } } -db_select_engine(); -$config['dbconnection'] = db_connect(); if (! defined('EXTENSIONS_DIR')) { @@ -160,6 +158,9 @@ if (! defined('ENTERPRISE_DIR')) { define('ENTERPRISE_DIR', 'enterprise'); } +db_select_engine(); +$config['dbconnection'] = db_connect(); + require_once $ownDir.'functions_config.php'; date_default_timezone_set('Europe/Madrid'); diff --git a/pandora_console/install.php b/pandora_console/install.php index 3a6bc4e617..dc5c322444 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -872,7 +872,16 @@ function install_step4() $config["dbuser"]="pandora"; // DB User $config["dbpass"]="'.$random_password.'"; // DB Password $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-------------------- Please note that in certain installations: @@ -974,7 +983,15 @@ function install_step4() $config["dbuser"]="pandora"; // DB User $config["dbpass"]="'.$random_password.'"; // DB Password $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-------------------- Please note that in certain installations: