2006-04-26 12:28:53 +00:00
|
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
$Id: config.php,v 1.12 2005/12/18 09:51:32 benjamin Exp $
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
AlternC - Web Hosting System
|
|
|
|
|
Copyright (C) 2002 by the AlternC Development Team.
|
|
|
|
|
http://alternc.org/
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
Based on:
|
|
|
|
|
Valentin Lacambre's web hosting softwares: http://altern.org/
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
LICENSE
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License (GPL)
|
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
To read the license please visit http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
Original Author of file: Benjamin Sonntag
|
|
|
|
|
Purpose of file: General configuration file for AlternC Desktop
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
|
2013-02-18 10:34:09 +00:00
|
|
|
|
// To enable the display of the alternc debug error, do the following :
|
|
|
|
|
// #<23>touch /etc/alternc/alternc_display_php_error
|
|
|
|
|
if (file_exists('/etc/alternc/alternc_display_php_error')) {
|
|
|
|
|
ini_set('display_errors', true);
|
|
|
|
|
}
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
2013-02-14 15:38:11 +00:00
|
|
|
|
session_start();
|
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
|
/*
|
|
|
|
|
Si vous voulez mettre le bureau en maintenance, d<EFBFBD>commentez le code ci-dessous
|
|
|
|
|
et mettez votre ip dans le IF pour que seule votre ip puisse acc<EFBFBD>der au bureau :
|
|
|
|
|
*/
|
|
|
|
|
|
2012-10-15 16:06:12 +00:00
|
|
|
|
/* * /
|
|
|
|
|
if (getenv("REMOTE_ADDR")!="127.0.0.1") {
|
2006-04-26 12:28:53 +00:00
|
|
|
|
echo "Le bureau AlternC est en vacances jusqu'a minuit pour maintenance.<br>
|
|
|
|
|
Merci de revenir plus tard.";
|
|
|
|
|
exit();
|
|
|
|
|
}
|
2012-10-15 16:06:12 +00:00
|
|
|
|
/* */
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
2012-08-24 18:21:00 +00:00
|
|
|
|
// FIXME: Some constant, we put them here so that we can change them later ;) LFS
|
|
|
|
|
define('ALTERNC_MAIL', "/var/alternc/mail");
|
2012-08-21 17:04:24 +00:00
|
|
|
|
define('ALTERNC_HTML', "/var/alternc/html");
|
2013-02-18 11:39:46 +00:00
|
|
|
|
define('ALTERNC_PANEL', "/usr/lib/alternc/panel");
|
2012-08-21 17:04:24 +00:00
|
|
|
|
define('ALTERNC_LOGS', "/var/alternc/logs");
|
2013-02-18 11:57:56 +00:00
|
|
|
|
define('ALTERNC_LOCALES', ALTERNC_PANEL."/locales");
|
2012-08-21 17:04:24 +00:00
|
|
|
|
|
2013-01-30 18:11:58 +00:00
|
|
|
|
/* Toutes les pages du bureau passent ici. On utilise une s<EFBFBD>maphore pour
|
|
|
|
|
s'assurer que personne ne pourra acc<EFBFBD>der <EFBFBD> 2 pages du bureau en m<EFBFBD>me temps.
|
|
|
|
|
*/
|
2006-04-26 12:28:53 +00:00
|
|
|
|
// 1. Get a semaphore id for the alternc magic number (18577)
|
|
|
|
|
$alternc_sem = sem_get ( 18577 );
|
|
|
|
|
// 2. Declare the shutdown function, that release the semaphore
|
|
|
|
|
function alternc_shutdown() {
|
|
|
|
|
global $alternc_sem;
|
|
|
|
|
@sem_release( $alternc_sem );
|
|
|
|
|
}
|
|
|
|
|
// 3. Register the shutdown function
|
|
|
|
|
register_shutdown_function("alternc_shutdown");
|
|
|
|
|
// 4. Acquire the semaphore : with that process,
|
|
|
|
|
sem_acquire( $alternc_sem );
|
|
|
|
|
|
2006-05-16 17:54:59 +00:00
|
|
|
|
if (ini_get("safe_mode")) {
|
2010-08-04 14:33:28 +00:00
|
|
|
|
echo "SAFE MODE IS ENABLED for the web panel ! It's a bug in your php or apache configuration, please fix it !!";
|
2006-05-16 17:54:59 +00:00
|
|
|
|
exit();
|
|
|
|
|
}
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
2011-02-04 15:24:14 +00:00
|
|
|
|
// For people who want to authenticate with HTTP AUTH
|
|
|
|
|
if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
|
2011-03-06 18:06:27 +00:00
|
|
|
|
if (isset($http_auth) && $http_auth) {
|
2011-02-04 15:24:14 +00:00
|
|
|
|
if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
|
|
|
|
|
header('WWW-Authenticate: Basic realm="Test Authentication System"');
|
|
|
|
|
header('HTTP/1.0 401 Unauthorized');
|
|
|
|
|
exit();
|
|
|
|
|
}
|
2011-06-03 12:42:00 +00:00
|
|
|
|
}
|
2011-02-04 15:24:14 +00:00
|
|
|
|
if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
|
|
|
|
|
// Gruiiik
|
|
|
|
|
$_REQUEST["username"]=$_SERVER['PHP_AUTH_USER'];
|
|
|
|
|
$_REQUEST["password"]=$_SERVER['PHP_AUTH_PW'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2009-09-08 05:29:38 +00:00
|
|
|
|
$help_baseurl="http://www.aide-alternc.org/";
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
|
|
/* Server Domain Name */
|
|
|
|
|
$host=getenv("HTTP_HOST");
|
|
|
|
|
|
|
|
|
|
/* Global variables (AlternC configuration) */
|
2011-06-03 12:42:00 +00:00
|
|
|
|
require_once(dirname(__FILE__)."/local.php");
|
2011-06-03 12:28:05 +00:00
|
|
|
|
/* PHPLIB inclusions : */
|
2012-08-21 17:04:24 +00:00
|
|
|
|
$root=ALTERNC_PANEL."/";
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
2012-08-21 17:04:24 +00:00
|
|
|
|
require_once($root."/class/db_mysql.php");
|
|
|
|
|
require_once($root."/class/functions.php");
|
2006-04-26 12:28:53 +00:00
|
|
|
|
require_once($root."class/variables.php");
|
|
|
|
|
|
2006-05-16 18:08:29 +00:00
|
|
|
|
// Redirection si appel <20> https://(!fqdn)/
|
2011-03-06 18:06:27 +00:00
|
|
|
|
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
|
2006-05-16 18:08:29 +00:00
|
|
|
|
header("Location: https://$L_FQDN/");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
|
// Classe h<>rit<69>e de la classe db de la phplib.
|
|
|
|
|
/**
|
|
|
|
|
* Class for MySQL management in the bureau
|
|
|
|
|
*
|
|
|
|
|
* This class heriting from the db class of the phplib manages
|
|
|
|
|
* the connection to the MySQL database.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class DB_system extends DB_Sql {
|
|
|
|
|
var $Host,$Database,$User,$Password;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creator
|
|
|
|
|
*/
|
|
|
|
|
function DB_system() {
|
|
|
|
|
global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD;
|
|
|
|
|
$this->Host = $L_MYSQL_HOST;
|
|
|
|
|
$this->Database = $L_MYSQL_DATABASE;
|
|
|
|
|
$this->User = $L_MYSQL_LOGIN;
|
|
|
|
|
$this->Password = $L_MYSQL_PWD;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$db= new DB_system();
|
|
|
|
|
|
|
|
|
|
// Current User ID = the user whose commands are made on behalf of.
|
|
|
|
|
$cuid=0;
|
|
|
|
|
|
2006-04-26 14:50:29 +00:00
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
|
$classes=array();
|
2010-08-04 14:33:28 +00:00
|
|
|
|
/* CLASSES PHP : automatic include : */
|
2006-04-26 12:28:53 +00:00
|
|
|
|
$c=opendir($root."class/");
|
|
|
|
|
while ($di=readdir($c)) {
|
2011-06-17 10:32:21 +00:00
|
|
|
|
if (preg_match("#^m_(.*)\\.php$#",$di,$match)) { // $
|
2006-04-26 12:28:53 +00:00
|
|
|
|
$name1="m_".$match[1];
|
|
|
|
|
$name2=$match[1];
|
|
|
|
|
$classes[]=$name2;
|
|
|
|
|
require_once($root."class/".$name1.".php");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
closedir($c);
|
|
|
|
|
/* THE DEFAULT CLASSES ARE :
|
|
|
|
|
dom, ftp, mail, quota, bro, admin, mem, mysql, err
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Language */
|
2007-10-05 18:07:02 +00:00
|
|
|
|
include_once("lang_env.php");
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
|
|
$mem=new m_mem();
|
|
|
|
|
$err=new m_err();
|
2011-06-03 17:08:44 +00:00
|
|
|
|
$authip=new m_authip();
|
2012-11-12 16:01:54 +00:00
|
|
|
|
$hooks=new m_hooks();
|
2006-04-26 12:28:53 +00:00
|
|
|
|
|
|
|
|
|
/* Check the User identity (if required) */
|
|
|
|
|
if (!defined('NOCHECK')) {
|
2007-09-09 21:55:18 +00:00
|
|
|
|
if (!$mem->checkid()) {
|
2006-04-26 12:28:53 +00:00
|
|
|
|
$error=$err->errstr();
|
|
|
|
|
include("index.php");
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for($i=0;$i<count($classes);$i++) {
|
2012-08-21 13:13:04 +00:00
|
|
|
|
$name2=$classes[$i];
|
|
|
|
|
if (isset($$name2)) continue; // for already instancied class like mem, err or authip
|
|
|
|
|
$name1="m_".$name2;
|
|
|
|
|
$$name2= new $name1();
|
2006-04-26 12:28:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-16 14:50:16 +00:00
|
|
|
|
$oldid=intval(isset($_COOKIE['oldid'])?$_COOKIE['oldid']:'');
|
|
|
|
|
$isinvited=false;
|
|
|
|
|
if ($admin->enabled) $isinvited=true;
|
|
|
|
|
|
|
|
|
|
if ($oldid && $oldid!=$cuid) {
|
|
|
|
|
$isinvited=true;
|
|
|
|
|
}
|
|
|
|
|
|
2006-04-26 12:28:53 +00:00
|
|
|
|
?>
|