Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(log): correct the undefined index notice in the logs #7395

Merged
merged 1 commit into from
Apr 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions www/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Copyright 2005-2015 Centreon
* Centreon is developped by : Julien Mathis and Romain Le Merlus under
* Copyright 2005-2019 Centreon
* Centreon is developed by : Julien Mathis and Romain Le Merlus under
* GPL Licence 2.0.
*
* This program is free software; you can redistribute it and/or modify it under
Expand Down Expand Up @@ -34,35 +34,33 @@
*
*/

require_once realpath(dirname(__FILE__) . '/../config/centreon.config.php');
require_once realpath(__DIR__ . '/../config/centreon.config.php');

$etc = _CENTREON_ETC_;

define('SMARTY_DIR', realpath('../vendor/smarty/smarty/libs/') . '/');

ini_set('display_errors', 'Off');

clearstatcache(true, "$etc/centreon.conf.php");
if (!file_exists("$etc/centreon.conf.php") && is_dir('./install')) {
clearstatcache(true, $etc . "/centreon.conf.php");
if (!file_exists($etc . "/centreon.conf.php") && is_dir('./install')) {
header("Location: ./install/install.php");
return;
} elseif (file_exists("$etc/centreon.conf.php") && is_dir('install')) {
require_once("$etc/centreon.conf.php");
require_once $etc . "/centreon.conf.php";
header("Location: ./install/upgrade.php");
} else {
if (file_exists("$etc/centreon.conf.php")) {
require_once("$etc/centreon.conf.php");
$freeze = 0;
} else {
$freeze = 0;
if (file_exists($etc . "/centreon.conf.php")) {
require_once $etc . "/centreon.conf.php";
}
$freeze = 0;
}

require_once "$classdir/centreon.class.php";
require_once "$classdir/centreonSession.class.php";
require_once "$classdir/centreonAuth.SSO.class.php";
require_once "$classdir/centreonLog.class.php";
require_once "$classdir/centreonDB.class.php";
require_once $classdir . "/centreon.class.php";
require_once $classdir . "/centreonSession.class.php";
require_once $classdir . "/centreonAuth.SSO.class.php";
require_once $classdir . "/centreonLog.class.php";
require_once $classdir . "/centreonDB.class.php";
require_once SMARTY_DIR . "Smarty.class.php";

/*
Expand All @@ -71,11 +69,11 @@
global $pearDB;
$pearDB = new CentreonDB();

$DBRESULT = $pearDB->query("SELECT * FROM `options`");
while ($generalOption = $DBRESULT->fetchRow()) {
$dbResult = $pearDB->query("SELECT * FROM `options`");
while ($generalOption = $dbResult->fetch()) {
$generalOptions[$generalOption["key"]] = $generalOption["value"];
}
$DBRESULT->closeCursor();
$dbResult->closeCursor();

/*
* detect installation dir
Expand Down Expand Up @@ -109,7 +107,10 @@
} else {
$hashStatic = explode('static/css/main.', $staticExists[0]);
$hashTemplate = explode('template/css/main.', glob('template/css/*.css')[0]);
if ($hashTemplate[1] !== $hashStatic) {
if (isset($hashTemplate[1])
&& isset($hashStatic)
&& $hashTemplate[1] !== $hashStatic
) {
shell_exec('rm -rf ' . __DIR__ . '/static ');
shell_exec('cp -pR ' . __DIR__ . '/template '. __DIR__ . '/static');
$allCssFiles = glob('static/css/*');
Expand Down Expand Up @@ -164,5 +165,5 @@
if (version_compare(phpversion(), '7.1') < 0) {
echo "<div class='msg'> PHP version is < 7.1. Please Upgrade PHP</div>";
} else {
include_once("./include/core/login/login.php");
include_once "./include/core/login/login.php";
}