8673f7e70bbbddc93b4cdc6c3c6bf601d704604c
2 /***************************************************************************
3 * Copyright (C) 2003-2006 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
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. *
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. *
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 *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
26 /** The x.org version */
27 var $version = '@VERSION@';
32 var $dbhost = 'localhost';
33 var $dbuser = 'x4dat';
43 function PlatalGlobals($sess)
45 $this->session
= $sess;
47 $base = empty($_SERVER['HTTPS']) ?
'http://' : 'https://';
48 $this->baseurl
= trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
49 $this->spoolroot
= dirname(dirname(__FILE__
));
57 function read_ini_file($filename)
59 $array = parse_ini_file($filename, true
);
60 if (!is_array($array)) {
63 foreach ($array as $cat => $conf) {
64 $c = strtolower($cat);
65 foreach ($conf as $k => $v) {
66 if ($c == 'core' && property_exists($this, $k)) {
69 if (!isset($this->$c)) {
70 $this->$c = new stdClass
;
78 function read_config()
80 $this->read_ini_file($this->spoolroot
.'/configs/platal.ini');
82 $this->read_ini_file($this->spoolroot
.'/configs/platal.conf');
87 @mysql_connect
($this->dbhost
, $this->dbuser
, $this->dbpwd
);
88 @mysql_select_db
($this->dbdb
);
93 setlocale(LC_MESSAGES
, $this->locale
);
94 setlocale(LC_TIME
, $this->locale
);
95 setlocale(LC_CTYPE
, $this->locale
);
96 date_default_timezone_set($this->timezone
);
99 function asso($key=null
)
105 $gp = substr($gp, 0, strpos($gp, '/'));
108 $res = XDB
::query('SELECT a.*, d.nom AS domnom
109 FROM groupex.asso AS a
110 LEFT JOIN groupex.dom AS d ON d.id = a.dom
111 WHERE diminutif = {?}', $gp);
112 if (!($aid = $res->fetchOneAssoc())) {
121 } elseif ( isset($aid[$key]) ) {
129 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker: