From 20e8fa198342b26e0f725273caedd54263bec0e6 Mon Sep 17 00:00:00 2001
From: slerena <slerena@gmail.com>
Date: Wed, 8 Aug 2007 18:36:18 +0000
Subject: [PATCH] 2007-08-08  Sancho Lerena  <slerena@gmail.com>

        * reporting/stat_win.php, general/noaccess.php: Fixed problem with
        paths outside index.php call.

        * index.php: Some fixes in checks for problems in startup and needed files.

        * general/*: Better layout of problems, some minimal fixes. New file added to
        warn user of missed config.php file. Better treatment of fails.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@596 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
---
 pandora_console/ChangeLog                  | 13 +++--
 pandora_console/general/error_install.php  | 24 ++++------
 pandora_console/general/error_noconfig.php | 55 ++++++++++++++++++++++
 pandora_console/general/error_perms.php    | 25 +++++-----
 pandora_console/general/footer.php         | 18 ++++---
 pandora_console/general/header.php         | 12 ++---
 pandora_console/index.php                  | 12 +++--
 7 files changed, 111 insertions(+), 48 deletions(-)
 create mode 100644 pandora_console/general/error_noconfig.php

diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog
index 270ab82000..43836900dd 100644
--- a/pandora_console/ChangeLog
+++ b/pandora_console/ChangeLog
@@ -1,8 +1,15 @@
+2007-08-08  Sancho Lerena  <slerena@gmail.com>
+
+	* reporting/stat_win.php, general/noaccess.php: Fixed problem with
+        paths outside index.php call.
+
+	* index.php: Some fixes in checks for problems in startup and needed files.
+
+	* general/*: Better layout of problems, some minimal fixes. New file added to
+	warn user of missed config.php file. Better treatment of fails.
+
 2007-08-06  Sancho Lerena  <slerena@gmail.com>
 	
-	* reporting/stat_win.php, general/noaccess.php: Fixed problem with
-	paths outside index.php call.
-
         * pandoradb.sql, alert_manager.php: Alert time support uses TIME format 
 	instead numeric (changes requested by esanchezm).
 
diff --git a/pandora_console/general/error_install.php b/pandora_console/general/error_install.php
index 88013ae8c9..cbf8302e55 100644
--- a/pandora_console/general/error_install.php
+++ b/pandora_console/general/error_install.php
@@ -1,15 +1,15 @@
 <?php
-// Pandora FMS - the Free monitoring system
+// Pandora FMS - the Free Monitoring System
 // ========================================
-// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
-// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
+// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
+// Main PHP/SQL code development, project architecture and management.
 // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
-// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
-// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
+// CSS and some PHP code additions
+// Please see http://pandora.sourceforge.net for full contribution list
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation version 2
+// as published by the Free Software Foundation for version 2.
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -18,17 +18,13 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-include "include/config.php";
-if (file_exists("include/languages/language_".$language_code.".php")) {
-	 include "include/languages/language_".$language_code.".php";
-} else {
-	include "include/languages/language_en.php";
-}
+include "include/languages/language_en.php";
+
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>Pandora FMS - <?php echo $lang_label["header_title"]; ?></title>
+<title>Pandora FMS - The Free Monitoring System - Console Error</title>
 <meta http-equiv="expires" content="0">
 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
 <meta name="resource-type" content="document">
@@ -40,7 +36,7 @@ if (file_exists("include/languages/language_".$language_code.".php")) {
 <link rel="icon" href="images/pandora.ico" type="image/ico">
 <link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
 </head>
-<body background='images/backgrounds/<?php echo $config_bgimage; ?>'>
+<body>
 <div align='center'>
 <div id='login_f'>
 	<h1 id="log_f" class="error">Installer active</h1>
diff --git a/pandora_console/general/error_noconfig.php b/pandora_console/general/error_noconfig.php
new file mode 100644
index 0000000000..ff44dcdc0d
--- /dev/null
+++ b/pandora_console/general/error_noconfig.php
@@ -0,0 +1,55 @@
+<?php
+
+// Pandora FMS - the Free Monitoring System
+// ========================================
+// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
+// Main PHP/SQL code development, project architecture and management.
+// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
+// CSS and some PHP code additions
+// Please see http://pandora.sourceforge.net for full contribution list
+
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation for version 2.
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+include "include/languages/language_en.php";
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Pandora FMS - The Free Monitoring System - Console error</title>
+<meta http-equiv="expires" content="0">
+<meta http-equiv="content-type" content="text/html; charset=utf8">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="author" content="Sancho Lerena, Raul Mateos">
+<meta name="copyright" content="This is GPL software. Created by Sancho Lerena and others">
+<meta name="keywords" content="pandora, monitoring, system, GPL, software">
+<meta name="robots" content="index, follow">
+<link rel="icon" href="images/pandora.ico" type="image/ico">
+<link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
+</head>
+<body>
+<div align='center'>
+<div id='login_f'>
+	<h1 id="log_f" class="error">No configuration file found</h1>
+	<div>
+		<img src="images/pandora_logo.png" border="0"></a><br><font size="1">
+		<?php echo $pandora_version; ?>
+		</font>
+	</div>
+	<div class="msg">
+	<br><br>Pandora FMS Console cannot find <i>include/config.php</i> or this file has invalid
+	permissiones and HTTP server cannot read it. Please read documentation to fix this problem.</div>
+	</div>
+</div>
+</body>
+</html>
diff --git a/pandora_console/general/error_perms.php b/pandora_console/general/error_perms.php
index a5c0537f54..160f33e407 100644
--- a/pandora_console/general/error_perms.php
+++ b/pandora_console/general/error_perms.php
@@ -1,15 +1,15 @@
 <?php
-// Pandora FMS - the Free monitoring system
+// Pandora FMS - the Free Monitoring System
 // ========================================
-// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
-// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
+// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
+// Main PHP/SQL code development, project architecture and management.
 // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
-// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
-// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
+// CSS and some PHP code additions
+// Please see http://pandora.sourceforge.net for full contribution list
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation version 2
+// as published by the Free Software Foundation for version 2.
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -18,17 +18,14 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-include "include/config.php";
-if (file_exists("include/languages/language_".$language_code.".php")) {
-	 include "include/languages/language_".$language_code.".php";
-} else {
-	include "include/languages/language_en.php";
-}
+
+include "include/languages/language_en.php";
+
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<title>Pandora FMS - <?php echo $lang_label["header_title"]; ?></title>
+<title>Pandora FMS - The Free Monitoring System - Console error</title>
 <meta http-equiv="expires" content="0">
 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
 <meta name="resource-type" content="document">
@@ -40,7 +37,7 @@ if (file_exists("include/languages/language_".$language_code.".php")) {
 <link rel="icon" href="images/pandora.ico" type="image/ico">
 <link rel="stylesheet" href="include/styles/pandora.css" type="text/css">
 </head>
-<body background='images/backgrounds/<?php echo $config_bgimage; ?>'>
+<body>
 <div align='center'>
 <div id='login_f'>
 	<h1 id="log_f" class="error">Bad permission for include/config.php</h1>
diff --git a/pandora_console/general/footer.php b/pandora_console/general/footer.php
index 1cd329ae2e..618c9df62c 100644
--- a/pandora_console/general/footer.php
+++ b/pandora_console/general/footer.php
@@ -1,13 +1,15 @@
 <?PHP
-// Pandora - the Free monitoring system
-// ====================================
-// Copyright (c) 2004-2006 Sancho Lerena, slerena@gmail.com
-// Copyright (c) 2005-2006 Artica Soluciones Tecnol�icas S.L, info@artica.es
-// Copyright (c) 2004-2006 Raul Mateos Martin, raulofpandora@gmail.com
+// Pandora FMS - the Free Monitoring System
+// ========================================
+// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
+// Main PHP/SQL code development, project architecture and management.
+// Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
+// CSS and some PHP code additions
+// Please see http://pandora.sourceforge.net for full contribution list
+
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
+// as published by the Free Software Foundation for version 2.
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@@ -15,6 +17,8 @@
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+
+
 echo "<center>";
 echo '<a class="white_bold" target="_new" href="general/license/pandora_info_'.$language_code.'.html">
 Pandora FMS '.$pandora_version.' Build '.$build_version.'<br>'.
diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php
index 463f92a967..698862b126 100644
--- a/pandora_console/general/header.php
+++ b/pandora_console/general/header.php
@@ -1,15 +1,15 @@
 <?php
-// Pandora FMS - the Free monitoring system
+// Pandora FMS - the Free Monitoring System
 // ========================================
-// Copyright (c) 2004-2007 Sancho Lerena, slerena@openideas.info
-// Copyright (c) 2005-2007 Artica Soluciones Tecnologicas
+// Copyright (c) 2004-2007 Sancho Lerena, slerena@gmail.com
+// Main PHP/SQL code development, project architecture and management.
 // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
-// Copyright (c) 2006-2007 Jose Navarro jose@jnavarro.net
-// Copyright (c) 2006-2007 Jonathan Barajas, jonathan.barajas[AT]gmail[DOT]com
+// CSS and some PHP code additions
+// Please see http://pandora.sourceforge.net for full contribution list
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation version 2
+// as published by the Free Software Foundation for version 2.
 // This program is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
diff --git a/pandora_console/index.php b/pandora_console/index.php
index 9c82e94204..dc55687aca 100644
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -6,8 +6,7 @@
 // Main PHP/SQL code development, project architecture and management.
 // Copyright (c) 2004-2007 Raul Mateos Martin, raulofpandora@gmail.com
 // CSS and some PHP code additions
-// Copyright (c) 2006 Jose Navarro <jnavarro@jnavarro.net>
-// Additions to code for Pandora FMS 1.2 graph code
+// Please see http://pandora.sourceforge.net for full contribution list
 
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License
@@ -25,7 +24,7 @@
 // Pandora FMS 1.x uses Pear Image::Graph code
 
 //Pandora Version, if not defined here it would take from config.php
-$build_version="PC070806";
+$build_version="PC070808";
 $pandora_version="v1.3-dev";
 global $build_version;
 global $pandora_version;
@@ -37,7 +36,7 @@ if ($develop_bypass != 1){
 	// If no config file, automatically try to install
 	if (! file_exists("include/config.php")){
 		if (!file_exists("install.php")){
-			include "general/error_install.php";
+			include ("general/error_noconfig.php");
 			exit;
 		} else
 			include ("install.php");
@@ -59,6 +58,11 @@ if ($develop_bypass != 1){
 	}
 }
 
+if ((! file_exists("include/config.php")) OR (! is_readable("include/config.php"))){
+        include ("general/error_noconfig.php");
+        exit;
+}
+
 // Real start
 session_start();
 include "include/config.php";