|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/logmcpe/www/MC/includes/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
/**
* This file loads configuration settings from the data file settings.php and
* sets up some needed variables.
*
* The settings.php file is created during installation using the web-based db
* setup page (install/index.php).
*
* <b>Note:</b>
* DO NOT EDIT THIS FILE!
*
* (Versions 0.9.44 and older required users to edit this file to configure
* WebCalendar. Version 0.9.45 and later requires editing the settings.php
* file instead.)
*
* @version $Id: config.php,v 1.53.2.12 2006/04/11 12:15:13 cknudsen Exp $
* @package WebCalendar
*/
if ( empty ( $PHP_SELF ) && ! empty ( $_SERVER ) &&
! empty ( $_SERVER['PHP_SELF'] ) ) {
$PHP_SELF = $_SERVER['PHP_SELF'];
}
if ( ! empty ( $PHP_SELF ) && preg_match ( "/\/includes\//", $PHP_SELF ) ) {
die ( "You can't access this file directly!" );
}
/**
* Prints a fatal error message to the user along with a link to the
* Troubleshooting section of the WebCalendar System Administrator's Guide.
*
* Execution is aborted.
*
* @param string $error The error message to display
*
* @internal We don't normally put functions in this file. But, since this
* file is included before some of the others, this function either
* goes here or we repeat this code in multiple files.
*/
function die_miserable_death ( $error )
{
/*global $TROUBLE_URL;
echo "<html><head><title>Fatal Error</title></head>\n" .
"<body><h2>WebCalendar Error</h2>\n" .
"<p>$error</p>\n<hr />" .
"<p><a href=\"$TROUBLE_URL\" target=\"_blank\">" .
"Troubleshooting Help</a></p></body></html>\n";
exit;*/
}
// Open settings file to read
$settings = array ();
$settings_file = dirname(__FILE__) . "/settings.php";
//called from send_reminders.php
if ( ! empty ( $includedir ) )
$fd = @fopen ( "$includedir/settings.php", "rb", true );
else
$fd = @fopen ( "settings.php", "rb", true );
if ( ! $fd )
$fd = @fopen ( "includes/settings.php", "rb", true );
if ( ! $fd && file_exists ( $settings_file ) )
$fd = @fopen ( $settings_file, "rb", true );
if ( empty ( $fd ) ) {
// There is no settings.php file.
// Redirect user to install page if it exists.
if ( file_exists ( "install/index.php" ) ) {
Header ( "Location: install/index.php" );
exit;
} else {
die_miserable_death ( "Could not find settings.php file.<br />\n" .
"Please copy settings.php.orig to settings.php and modify for your " .
"site.\n" );
}
}
// We don't use fgets() since it seems to have problems with Mac-formatted
// text files. Instead, we read in the entire file, then split the lines
// manually.
$data = '';
while ( ! feof ( $fd ) ) {
$data .= fgets ( $fd, 4096 );
}
fclose ( $fd );
// Replace any combination of carriage return (\r) and new line (\n)
// with a single new line.
$data = preg_replace ( "/[\r\n]+/", "\n", $data );
// Split the data into lines.
$configLines = explode ( "\n", $data );
for ( $n = 0; $n < count ( $configLines ); $n++ ) {
$buffer = $configLines[$n];
$buffer = trim ( $buffer, "\r\n " );
if ( preg_match ( "/^#/", $buffer ) )
continue;
if ( preg_match ( "/^<\?/", $buffer ) ) // start php code
continue;
if ( preg_match ( "/^\?>/", $buffer ) ) // end php code
continue;
if ( preg_match ( "/(\S+):\s*(\S+)/", $buffer, $matches ) ) {
$settings[$matches[1]] = $matches[2];
//echo "settings $matches[1] => $matches[2] <br>";
}
}
$configLines = $data = '';
// Extract db settings into global vars
$db_type = $settings['db_type'];
$db_host = $settings['db_host'];
$db_login = $settings['db_login'];
$db_password = $settings['db_password'];
$db_database = $settings['db_database'];
$db_persistent = preg_match ( "/(1|yes|true|on)/i",
$settings['db_persistent'] ) ? '1' : '0';
foreach ( array ( "db_type", "db_host", "db_login", "db_password" ) as $s ) {
if ( empty ( $settings[$s] ) ) {
die_miserable_death ( "Could not find <tt>$s</tt> defined in " .
"your <tt>settings.php</tt> file.\n" );
}
}
// Make sure magic quotes is enabled, since this app requires it.
if ( get_magic_quotes_gpc () == 0 ) {
ob_start ();
phpinfo ();
$val = ob_get_clean ();
$loc = '';
if ( preg_match ( "/>([^<>]*php.ini)</", $val, $matches ) ) {
$loc = "Please edit the following file and restart your server:" .
"<br /><br />\n" .
"<blockquote>\n<tt>" . $matches[1] . "</tt>\n</blockquote>\n";
}
die_miserable_death ( "You must reconfigure your <tt>php.ini</tt> file to " .
"have <span style=\"font-weight:bold;\">magic_quotes_gpc</span> set " .
" to <span style=\"font-weight:bold;\">ON</span>.<br /><br />\n" .
$loc );
}
?>
