Was this an error ???
[platal.git] / include / platal / globals.inc.php.in
CommitLineData
0337d704 1<?php
2/***************************************************************************
50a40a33 3 * Copyright (C) 2003-2006 Polytechnique.org *
0337d704 4 * http://opensource.polytechnique.org/ *
5 * *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
21
22require_once('diogenes/diogenes.core.globals.inc.php');
23require_once('diogenes/diogenes.database.inc.php');
483b202a 24require_once dirname(__FILE__).'/../../classes/XDB.php';
0337d704 25
26class CoreConfig
27{
28 var $locale = 'fr_FR';
29}
30
0337d704 31class PlatalGlobals extends DiogenesCoreGlobals
32{
33 var $page = 'XorgPage';
34 var $session;
35 var $menu;
36 var $hook;
37
38 /** The x.org version */
39 var $version = '@VERSION@';
40 var $debug = 0;
41
42 /** db params */
43 var $dbdb = 'x4dat';
44 var $dbhost = 'localhost';
45 var $dbuser = 'x4dat';
46 var $dbpwd = 'x4dat';
72542de0 47
0337d704 48 var $table_auth = 'auth_user_md5';
49 var $table_log_actions = 'logger.actions';
50 var $table_log_sessions = 'logger.sessions';
51 var $table_log_events = 'logger.events';
52
53 /** logger */
54 var $tauth = array('native'=>'auth_user_md5');
55 var $tlabel = array('native'=>'X.Org');
56
57 /** paths */
72542de0 58 var $baseurl;
59 var $spoolroot;
0337d704 60
61 function PlatalGlobals($sess)
62 {
72542de0 63 $this->session = $sess;
64
65 $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
f5c2e9c6 66 $this->baseurl = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
72542de0 67 $this->spoolroot = dirname(dirname(dirname(__FILE__)));
0337d704 68 }
69
70 function read_config()
71 {
a4eaaa7b 72 $array = parse_ini_file($this->spoolroot.'/configs/platal.ini', true);
73 foreach ($array as $cat => $conf) {
74 $c = strtolower($cat);
75 foreach ($conf as $k => $v) {
76 $this->$c->$k = $v;
77 }
78 }
79
72542de0 80 $array = parse_ini_file($this->spoolroot.'/configs/platal.conf', true);
0337d704 81 if (!is_array($array)) {
82 return;
83 }
84
85 foreach ($array as $cat=>$conf) {
86 $c = strtolower($cat);
87 foreach ($conf as $key=>$val) {
88 if ($c == 'core' && isset($this->$key)) {
89 $this->$key=$val;
90 } else {
91 $this->$c->$key = $val;
92 }
93 }
94 }
95 }
96
97 function setlocale()
98 {
99 global $globals;
100 setlocale(LC_MESSAGES, $globals->core->locale);
101 setlocale(LC_TIME, $globals->core->locale);
102 setlocale(LC_CTYPE, $globals->core->locale);
103 }
104}
105
0337d704 106// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
107?>