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 | |
0337d704 |
22 | class CoreConfig |
23 | { |
24 | var $locale = 'fr_FR'; |
25 | } |
26 | |
f1ca33de |
27 | class PlatalGlobals |
0337d704 |
28 | { |
29 | var $page = 'XorgPage'; |
30 | var $session; |
31 | var $menu; |
32 | var $hook; |
33 | |
34 | /** The x.org version */ |
35 | var $version = '@VERSION@'; |
36 | var $debug = 0; |
37 | |
38 | /** db params */ |
39 | var $dbdb = 'x4dat'; |
40 | var $dbhost = 'localhost'; |
41 | var $dbuser = 'x4dat'; |
42 | var $dbpwd = 'x4dat'; |
72542de0 |
43 | |
f1ca33de |
44 | /** The class to use for session handling. */ |
45 | var $session = 'DiogenesCoreSession'; |
46 | |
0337d704 |
47 | /** paths */ |
72542de0 |
48 | var $baseurl; |
49 | var $spoolroot; |
0337d704 |
50 | |
51 | function PlatalGlobals($sess) |
52 | { |
72542de0 |
53 | $this->session = $sess; |
54 | |
55 | $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://'; |
f5c2e9c6 |
56 | $this->baseurl = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/'); |
72542de0 |
57 | $this->spoolroot = dirname(dirname(dirname(__FILE__))); |
0337d704 |
58 | } |
59 | |
f1ca33de |
60 | function dbconnect() |
61 | { |
62 | @mysql_connect($this->dbhost, $this->dbuser, $this->dbpwd); |
63 | @mysql_select_db($this->dbdb); |
64 | } |
65 | |
0337d704 |
66 | function read_config() |
67 | { |
a4eaaa7b |
68 | $array = parse_ini_file($this->spoolroot.'/configs/platal.ini', true); |
69 | foreach ($array as $cat => $conf) { |
70 | $c = strtolower($cat); |
71 | foreach ($conf as $k => $v) { |
72 | $this->$c->$k = $v; |
73 | } |
74 | } |
75 | |
72542de0 |
76 | $array = parse_ini_file($this->spoolroot.'/configs/platal.conf', true); |
0337d704 |
77 | if (!is_array($array)) { |
78 | return; |
79 | } |
80 | |
81 | foreach ($array as $cat=>$conf) { |
82 | $c = strtolower($cat); |
83 | foreach ($conf as $key=>$val) { |
84 | if ($c == 'core' && isset($this->$key)) { |
85 | $this->$key=$val; |
86 | } else { |
87 | $this->$c->$key = $val; |
88 | } |
89 | } |
90 | } |
91 | } |
92 | |
93 | function setlocale() |
94 | { |
95 | global $globals; |
96 | setlocale(LC_MESSAGES, $globals->core->locale); |
97 | setlocale(LC_TIME, $globals->core->locale); |
98 | setlocale(LC_CTYPE, $globals->core->locale); |
99 | } |
100 | } |
101 | |
0337d704 |
102 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: |
103 | ?> |