| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Id: config.php,v 1.2 2003/03/27 00:08:03 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 | |
|---|
| 32 | /* PHPLIB inclusions : */ |
|---|
| 33 | $root="/var/alternc/bureau/"; |
|---|
| 34 | /* Server Domain Name */ |
|---|
| 35 | $host=getenv("HTTP_HOST"); |
|---|
| 36 | |
|---|
| 37 | /* Global variables (AlternC configuration) */ |
|---|
| 38 | require_once($root."class/local.php"); |
|---|
| 39 | |
|---|
| 40 | require_once($root."class/db_mysql.php"); |
|---|
| 41 | require_once($root."class/functions.php"); |
|---|
| 42 | |
|---|
| 43 | // Classe héritée de la classe db de la phplib. |
|---|
| 44 | class DB_system extends DB_Sql { |
|---|
| 45 | var $Host,$Database,$User,$Password; |
|---|
| 46 | function DB_system() { |
|---|
| 47 | global $L_MYSQL_HOST,$L_MYSQL_DATABASE,$L_MYSQL_LOGIN,$L_MYSQL_PWD; |
|---|
| 48 | $this->Host = $L_MYSQL_HOST; |
|---|
| 49 | $this->Database = $L_MYSQL_DATABASE; |
|---|
| 50 | $this->User = $L_MYSQL_LOGIN; |
|---|
| 51 | $this->Password = $L_MYSQL_PWD; |
|---|
| 52 | } |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | $db= new DB_system(); |
|---|
| 56 | |
|---|
| 57 | $classes=array(); |
|---|
| 58 | /* CLASSES PHP4 : automatic include : */ |
|---|
| 59 | $c=opendir($root."class/"); |
|---|
| 60 | while ($di=readdir($c)) { |
|---|
| 61 | if (ereg("^m_(.*)\\.php$",$di,$match)) { // $ |
|---|
| 62 | $name1="m_".$match[1]; |
|---|
| 63 | $name2=$match[1]; |
|---|
| 64 | $classes[]=$name2; |
|---|
| 65 | require_once($root."class/".$name1.".php"); |
|---|
| 66 | } |
|---|
| 67 | } |
|---|
| 68 | closedir($c); |
|---|
| 69 | /* THE DEFAULT CLASSES ARE : |
|---|
| 70 | dom, ftp, mail, quota, bro, admin, mem, mysql, err |
|---|
| 71 | */ |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | /* Language */ |
|---|
| 75 | bindtextdomain("alternc", "/var/alternc/bureau/locales"); |
|---|
| 76 | |
|---|
| 77 | if (!$do_not_set_lang_env) { |
|---|
| 78 | // setlang is on the link at the login page |
|---|
| 79 | if ($setlang) { |
|---|
| 80 | $lang=$setlang; |
|---|
| 81 | } |
|---|
| 82 | // default language (can be changed here) |
|---|
| 83 | $language="fr_FR"; |
|---|
| 84 | if (!$lang) { |
|---|
| 85 | // Use the browser first preferred language |
|---|
| 86 | $lang=strtolower(substr(trim($HTTP_ACCEPT_LANGUAGE),0,5)); |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | if (substr($lang,0,2)=="en") { |
|---|
| 90 | $language ='en_US'; |
|---|
| 91 | } |
|---|
| 92 | if (substr($lang,0,2)=="fr") { |
|---|
| 93 | $language ='fr_FR'; |
|---|
| 94 | } |
|---|
| 95 | if (substr($lang,0,2)=="es") { |
|---|
| 96 | $language ='es_ES'; |
|---|
| 97 | } |
|---|
| 98 | if ($setlang && $language) { |
|---|
| 99 | setcookie("lang",$lang); |
|---|
| 100 | } |
|---|
| 101 | /* Language*/ |
|---|
| 102 | putenv("LC_MESSAGES=$language"); |
|---|
| 103 | putenv("LANG=$language"); |
|---|
| 104 | putenv("LANGUAGE=$language"); |
|---|
| 105 | // this locale MUST be selected in "dpkg-reconfigure locales" |
|---|
| 106 | setlocale(LC_ALL,$language); |
|---|
| 107 | textdomain("alternc"); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | $mem=new m_mem(); |
|---|
| 111 | $err=new m_err(); |
|---|
| 112 | |
|---|
| 113 | /* Check the User identity (if required) */ |
|---|
| 114 | if (!$nocheck) { |
|---|
| 115 | if (!$mem->checkid()) { |
|---|
| 116 | $error=$err->errstr(); |
|---|
| 117 | include("index.php"); |
|---|
| 118 | exit(); |
|---|
| 119 | } |
|---|
| 120 | } |
|---|
| 121 | |
|---|
| 122 | for($i=0;$i<count($classes);$i++) { |
|---|
| 123 | if ($classes[$i]!="mem" && $classes[$i]!="err") { |
|---|
| 124 | $name2=$classes[$i]; |
|---|
| 125 | $name1="m_".$name2; |
|---|
| 126 | $$name2= new $name1($mem->uid); |
|---|
| 127 | } |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | /* Paramètres d'accès au serveur Ldap de gestion du mail (cf postfix configuration) */ |
|---|
| 131 | /* TODO : Send it to the class constructor */ |
|---|
| 132 | $mail->ldap=array( |
|---|
| 133 | "server" => "$L_LDAP_HOST", |
|---|
| 134 | "binddn" => "$L_LDAP_ROOT", |
|---|
| 135 | "bindpwd" => "$L_LDAP_ROOTPWD", |
|---|
| 136 | "basedn" => "$L_LDAP_POSTFIX" |
|---|
| 137 | ); |
|---|
| 138 | /* TODO : Send it to the class constructor */ |
|---|
| 139 | $sympa->ldap=$mail->ldap; |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | ?> |
|---|