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

Revision 2675, 4.4 KB checked in by benjamin, 3 years ago (diff)

suite des modifications majeures pour 1.0 : glossaire, ergonomie etc.

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/* Toutes les pages du bureau passent ici. On utilise une sémaphore pour
32   s'assurer que personne ne pourra accéder à 2 pages du bureau en même temps.
33*/
34
35/*
36  Si vous voulez mettre le bureau en maintenance, décommentez le code ci-dessous
37  et mettez votre ip dans le IF pour que seule votre ip puisse accéder au bureau :
38*/
39
40/*
41if (getenv("REMOTE_ADDR")!="81.56.98.108") {
42  echo "Le bureau AlternC est en vacances jusqu'a minuit pour maintenance.<br>
43Merci de revenir plus tard.";
44  exit();
45}
46*/
47
48// 1. Get a semaphore id for the alternc magic number (18577)
49$alternc_sem = sem_get ( 18577 );
50// 2. Declare the shutdown function, that release the semaphore
51function alternc_shutdown() {
52  global $alternc_sem;
53  @sem_release( $alternc_sem );
54}
55// 3. Register the shutdown function
56register_shutdown_function("alternc_shutdown");
57// 4. Acquire the semaphore : with that process,
58sem_acquire( $alternc_sem );
59
60if (!get_magic_quotes_gpc()) {
61  echo "MAGIC QUOTES GPC IS DISABLED ! It's a bug in your php4 configuration, please fix it !!";
62  exit();
63}
64if (ini_get("safe_mode")) {
65  echo "SAFE MODE IS ENABLED for the web panel ! It's a bug in your php4 or apache configuration, please fix it !!";
66  exit();
67}
68
69$help_baseurl="http://www.aide-alternc.org/";
70
71/* PHPLIB inclusions : */
72$root="/var/alternc/bureau/";
73/* Server Domain Name */
74$host=getenv("HTTP_HOST");
75
76/* Global variables (AlternC configuration) */
77require_once($root."class/local.php");
78
79require_once($root."class/db_mysql.php");
80require_once($root."class/functions.php");
81require_once($root."class/variables.php");
82
83// Redirection si appel à https://(!fqdn)/
84if ($_SERVER["HTTPS"]=="on" && $host!=$L_FQDN) {
85  header("Location: https://$L_FQDN/");
86}
87
88
89// Classe héritée de la classe db de la phplib.
90/**
91* Class for MySQL management in the bureau
92*
93* This class heriting from the db class of the phplib manages
94* the connection to the MySQL database.
95*/
96
97class DB_system extends DB_Sql {
98  var $Host,$Database,$User,$Password;
99
100  /**
101  * Creator
102  */
103  function DB_system() {
104    global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD;
105    $this->Host     = $L_MYSQL_HOST;
106    $this->Database = $L_MYSQL_DATABASE;
107    $this->User     = $L_MYSQL_LOGIN;
108    $this->Password = $L_MYSQL_PWD;
109  }
110}
111
112$db= new DB_system();
113
114// Current User ID = the user whose commands are made on behalf of.
115$cuid=0;
116
117
118$classes=array();
119/* CLASSES PHP4 : automatic include : */
120$c=opendir($root."class/");
121while ($di=readdir($c)) {
122  if (ereg("^m_(.*)\\.php$",$di,$match)) { // $
123    $name1="m_".$match[1];
124    $name2=$match[1];
125    $classes[]=$name2;
126    require_once($root."class/".$name1.".php");
127  }
128}
129closedir($c);
130/* THE DEFAULT CLASSES ARE :
131   dom, ftp, mail, quota, bro, admin, mem, mysql, err
132*/
133
134
135/* Language */
136include_once("lang_env.php");
137
138$mem=new m_mem();
139$err=new m_err();
140
141/* Check the User identity (if required) */
142if (!defined('NOCHECK')) {
143  if (!$mem->checkid()) {
144    $error=$err->errstr();
145    include("index.php");
146    exit();
147  }
148} 
149
150for($i=0;$i<count($classes);$i++) {
151  if ($classes[$i]!="mem" && $classes[$i]!="err") {
152    $name2=$classes[$i];
153    $name1="m_".$name2;
154    $$name2= new $name1();
155  }
156}
157
158?>
Note: See TracBrowser for help on using the repository browser.