phpldapadmin/htdocs/index.php

100 lines
3.0 KiB
PHP
Raw Normal View History

2009-06-30 08:07:14 +00:00
<?php
2009-06-30 10:46:00 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/index.php,v 1.49 2007/12/15 13:17:43 wurley Exp $
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
/**
* @package phpLDAPadmin
*/
2009-06-30 08:07:14 +00:00
/*******************************************
<pre>
2009-06-30 08:05:37 +00:00
If you are seeing this in your browser,
PHP is not installed on your web server!!!
2009-06-30 08:07:14 +00:00
</pre>
*******************************************/
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
/*
2009-06-30 09:29:51 +00:00
* We will perform some sanity checking here, since this file is normally loaded first when users
* first setup PLA.
*/
2009-06-30 10:46:00 +00:00
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
2009-06-30 09:29:51 +00:00
ini_set('display_errors',1);
error_reporting(E_ALL);
2009-06-30 10:26:08 +00:00
# General functions needed to proceed.
2009-06-30 09:29:51 +00:00
ob_start();
if (! file_exists(LIBDIR.'functions.php')) {
2009-06-30 10:46:00 +00:00
if (ob_get_level()) ob_end_clean();
die(sprintf("Fatal error: Required file '<b>%sfunctions.php</b>' does not exist.",LIBDIR));
2009-06-30 09:29:51 +00:00
}
if (! is_readable(LIBDIR.'functions.php')) {
2009-06-30 10:46:00 +00:00
if (ob_get_level()) ob_end_clean();
die(sprintf("Cannot read the file '<b>%sfunctions.php</b>' its permissions may be too strict.",LIBDIR));
2009-06-30 09:29:51 +00:00
}
2009-06-30 10:46:00 +00:00
if (ob_get_level()) ob_end_clean();
2009-06-30 10:40:33 +00:00
2009-06-30 09:29:51 +00:00
require LIBDIR.'functions.php';
$config_file = CONFDIR.'config.php';
2009-06-30 10:40:33 +00:00
# Make sure this PHP install has gettext, we use it for language translation
if (! extension_loaded('gettext'))
2009-06-30 10:46:00 +00:00
pla_error('<p>Your install of PHP appears to be missing GETTEXT support.</p><p>GETTEXT is used for language translation.</p><p>Please install GETTEXT support before using phpLDAPadmin.<br /><small>(Dont forget to restart your web server afterwards)</small></p>');
2009-06-30 10:40:33 +00:00
2009-06-30 10:46:00 +00:00
/*
* Helper functions.
2009-06-30 09:29:51 +00:00
* Our required helper functions are defined in functions.php
*/
foreach ($pla_function_files as $file_name ) {
if (! file_exists($file_name))
2009-06-30 10:26:08 +00:00
pla_error(sprintf('Fatal error: Required file "%s" does not exist.',$file_name));
2009-06-30 09:29:51 +00:00
if (! is_readable($file_name))
2009-06-30 10:46:00 +00:00
pla_error(sprintf('Fatal error: Cannot read the file "%s", its permissions may be too strict.',$file_name));
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
ob_start();
require $file_name;
2009-06-30 10:46:00 +00:00
if (ob_get_level()) ob_end_clean();
2009-06-30 09:29:51 +00:00
}
2009-06-30 08:07:14 +00:00
2009-06-30 09:29:51 +00:00
# Configuration File check
if (! file_exists($config_file)) {
2009-06-30 10:26:08 +00:00
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"';
echo '"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '<html>';
echo '<head>';
printf('<title>phpLDAPadmin - %s</title>',pla_version());
echo '<link type="text/css" rel="stylesheet" href="css/style.css" />';
echo '</head>';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '<body>';
echo '<h3 class="title">Configure phpLDAPadmin</h3>';
echo '<br /><br />';
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
echo '<center>';
printf(_('You need to configure phpLDAPadmin. Edit the file "%s" to do so. An example config file is provided in "%s.example".'),$config_file,$config_file);
echo '</center>';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '</body>';
echo '</html>';
2009-06-30 09:29:51 +00:00
die();
2009-06-30 08:09:20 +00:00
2009-06-30 09:29:51 +00:00
} elseif (! is_readable($config_file)) {
2009-06-30 10:46:00 +00:00
pla_error(sprintf('Fatal error: Cannot read your configuration file "%s", its permissions may be too strict.',$config_file));
2009-06-30 09:29:51 +00:00
}
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
# If our config file fails the sanity check, then stop now.
if (! check_config($config_file)) {
$www = new page();
$body = new block();
$www->block_add('body',$body);
$www->display();
2009-06-30 10:26:08 +00:00
exit;
}
2009-06-30 08:05:37 +00:00
2009-06-30 10:46:00 +00:00
include './cmd.php';
2009-06-30 08:05:37 +00:00
?>