SF.net SVN: postfixadmin: [288] trunk/common.php
Brought to you by:
christian_boltz,
gingerdog
|
From: <chr...@us...> - 2008-01-06 19:39:06
|
Revision: 288
http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=288&view=rev
Author: christian_boltz
Date: 2008-01-06 11:39:08 -0800 (Sun, 06 Jan 2008)
Log Message:
-----------
common.php:
- check if setup.php exists before blindly redirecting to it.
Display error message if the user has already deleted it.
(old behaviour caused some user confusion)
Modified Paths:
--------------
trunk/common.php
Modified: trunk/common.php
===================================================================
--- trunk/common.php 2008-01-06 17:12:10 UTC (rev 287)
+++ trunk/common.php 2008-01-06 19:39:08 UTC (rev 288)
@@ -19,6 +19,17 @@
define('POSTFIXADMIN', 1); # checked in included files
+function incorrect_setup() {
+ global $incpath;
+ # we ask the user to delete setup.php, which makes a blind redirect a bad idea
+ if(!is_file("$incpath/setup.php")) {
+ die ("config.inc.php does not exist or is not configured correctly. Please re-install setup.php and create/fix your config.");
+ } else {
+ header("Location: setup.php");
+ exit(0);
+ }
+}
+
$incpath = dirname(__FILE__);
(ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_runtime', '0') : '1');
(ini_get('magic_quotes_gpc') ? ini_set('magic_quotes_sybase', '0') : '1');
@@ -27,16 +38,15 @@
die("Please turn off register_globals; edit your php.ini");
}
require_once("$incpath/variables.inc.php");
+
if(!is_file("$incpath/config.inc.php")) {
// incorrectly setup...
- header("Location: setup.php");
- exit(0);
+ incorrect_setup();
}
require_once("$incpath/config.inc.php");
if(isset($CONF['configured'])) {
if($CONF['configured'] == FALSE) {
- header("Location: setup.php");
- exit(0);
+ incorrect_setup();
}
}
require_once("$incpath/languages/language.php");
@@ -44,3 +54,5 @@
require_once("$incpath/languages/" . check_language () . ".lang");
session_start();
+
+/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|