source: alternc/trunk/bureau/class/config.php @ 4331

Revision 4331, 5.8 KB checked in by squidly, 10 days ago (diff)

Remove WEBSERVERS_LOG var

Line 
1<?php
2/*
3 $Id: config.php,v 1.12 2005/12/18 09:51:32 benjamin Exp $
4 ----------------------------------------------------------------------
5 AlternC - Web Hosting System
6 Copyright (C) 2002 by the AlternC Development Team.
7 http://alternc.org/
8 ----------------------------------------------------------------------
9 Based on:
10 Valentin Lacambre's web hosting softwares: http://altern.org/
11 ----------------------------------------------------------------------
12 LICENSE
13
14 This program is free software; you can redistribute it and/or
15 modify it under the terms of the GNU General Public License (GPL)
16 as published by the Free Software Foundation; either version 2
17 of the License, or (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 GNU General Public License for more details.
23
24 To read the license please visit http://www.gnu.org/copyleft/gpl.html
25 ----------------------------------------------------------------------
26 Original Author of file: Benjamin Sonntag
27 Purpose of file: General configuration file for AlternC Desktop
28 ----------------------------------------------------------------------
29*/
30
31// To enable the display of the alternc debug error, do the following :
32// # touch /etc/alternc/alternc_display_php_error
33if (file_exists('/etc/alternc/alternc_display_php_error')) {
34  ini_set('display_errors', true);
35}
36session_name('AlternC_Panel'); 
37session_start();
38
39/*
40  Si vous voulez mettre le bureau en maintenance, décommentez le code ci-dessous
41  et mettez votre ip dans le IF pour que seule votre ip puisse accéder au bureau :
42*/
43
44/* * /
45if (getenv("REMOTE_ADDR")!="127.0.0.1") {
46  echo "Le bureau AlternC est en vacances jusqu'a minuit pour maintenance.<br>
47Merci de revenir plus tard.";
48  exit();
49}
50/* */
51
52/* Toutes les pages du bureau passent ici. On utilise une sémaphore pour
53   s'assurer que personne ne pourra accéder à 2 pages du bureau en même temps.
54*/
55// 1. Get a semaphore id for the alternc magic number (18577)
56$alternc_sem = sem_get ( 18577 );
57// 2. Declare the shutdown function, that release the semaphore
58function alternc_shutdown() {
59  global $alternc_sem;
60  @sem_release( $alternc_sem );
61}
62// 3. Register the shutdown function
63register_shutdown_function("alternc_shutdown");
64// 4. Acquire the semaphore : with that process,
65sem_acquire( $alternc_sem );
66
67if (ini_get("safe_mode")) {
68  echo "SAFE MODE IS ENABLED for the web panel ! It's a bug in your php or apache configuration, please fix it !!";
69  exit();
70}
71
72// For people who want to authenticate with HTTP AUTH
73if (isset($_GET['http_auth'])) $http_auth=strval($_GET['http_auth']);
74if (isset($http_auth) && $http_auth) {
75    if (empty($_SERVER['PHP_AUTH_USER']) || empty($_SERVER['PHP_AUTH_PW'])) {
76        header('WWW-Authenticate: Basic realm="Test Authentication System"');
77        header('HTTP/1.0 401 Unauthorized');
78        exit();
79    }
80}
81if (!empty($_SERVER['PHP_AUTH_USER']) && !empty($_SERVER['PHP_AUTH_PW'])) {
82  // Gruiiik
83  $_REQUEST["username"]=$_SERVER['PHP_AUTH_USER'];
84  $_REQUEST["password"]=$_SERVER['PHP_AUTH_PW'];
85 }
86
87
88$help_baseurl="http://www.aide-alternc.org/";
89
90/* Server Domain Name */
91$host=getenv("HTTP_HOST");
92
93/* Global variables (AlternC configuration) */
94require_once(dirname(__FILE__)."/local.php");
95
96// Define constants from vars of /etc/alternc/local.sh
97// The you can't choose where is the AlternC Panel
98define('ALTERNC_MAIL',     "$L_ALTERNC_MAIL");
99define('ALTERNC_HTML',     "$L_ALTERNC_HTML");
100if(isset($L_ALTERNC_LOGS_ARCHIVE))
101  define('ALTERNC_LOGS_ARCHIVE',  "$L_ALTERNC_LOGS_ARCHIVE");
102define('ALTERNC_LOGS',     "$L_ALTERNC_LOGS");
103define('ALTERNC_PANEL',    "/usr/share/alternc/panel");
104define('ALTERNC_LOCALES',  ALTERNC_PANEL."/locales");
105
106/* PHPLIB inclusions : */
107$root=ALTERNC_PANEL."/";
108
109require_once($root."/class/db_mysql.php");
110require_once($root."/class/functions.php");
111require_once($root."class/variables.php");
112
113// Redirection si appel à https://(!fqdn)/
114if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
115  header("Location: https://$L_FQDN/");
116}
117
118
119// Classe héritée de la classe db de la phplib.
120/**
121* Class for MySQL management in the bureau
122*
123* This class heriting from the db class of the phplib manages
124* the connection to the MySQL database.
125*/
126
127class DB_system extends DB_Sql {
128  var $Host,$Database,$User,$Password;
129
130  /**
131  * Creator
132  */
133  function DB_system() {
134    global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD;
135    $this->Host     = $L_MYSQL_HOST;
136    $this->Database = $L_MYSQL_DATABASE;
137    $this->User     = $L_MYSQL_LOGIN;
138    $this->Password = $L_MYSQL_PWD;
139  }
140}
141
142$db= new DB_system();
143
144// Current User ID = the user whose commands are made on behalf of.
145$cuid=0;
146
147
148$classes=array();
149/* CLASSES PHP : automatic include : */
150$c=opendir($root."class/");
151while ($di=readdir($c)) {
152  if (preg_match("#^m_(.*)\\.php$#",$di,$match)) { // $
153    $name1="m_".$match[1];
154    $name2=$match[1];
155    $classes[]=$name2;
156    require_once($root."class/".$name1.".php");
157  }
158}
159closedir($c);
160/* THE DEFAULT CLASSES ARE :
161   dom, ftp, mail, quota, bro, admin, mem, mysql, err
162*/
163
164
165/* Language */
166include_once("lang_env.php");
167
168$mem=new m_mem();
169$err=new m_err();
170$authip=new m_authip();
171$hooks=new m_hooks();
172
173/* Check the User identity (if required) */
174if (!defined('NOCHECK')) {
175  if (!$mem->checkid()) {
176    $error=$err->errstr();
177    include("index.php");
178    exit();
179  }
180} 
181
182for($i=0;$i<count($classes);$i++) {
183  $name2=$classes[$i];
184  if (isset($$name2)) continue; // for already instancied class like mem, err or authip
185  $name1="m_".$name2;
186  $$name2= new $name1();
187}
188
189$oldid=intval(isset($_COOKIE['oldid'])?$_COOKIE['oldid']:'');
190$isinvited=false;
191if ($admin->enabled) $isinvited=true;
192
193if ($oldid && $oldid!=$cuid) {
194  $isinvited=true;
195}
196
197?>
Note: See TracBrowser for help on using the repository browser.