- $base = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
- $this->baseurl = trim($base.$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF']), '/');
- $this->spoolroot = dirname(dirname(__FILE__));
-
- $this->read_config();
- $this->setlocale();
-
- require_once dirname(__FILE__) . '/../classes/xdb.php';
- XDB::connect($this->dbhost, $this->dbuser, $this->dbpwd, $this->dbdb, 'utf8', $this->debug);
- }
-
- function read_ini_file($filename)
- {
- $array = parse_ini_file($filename, true);
- if (!is_array($array)) {
- return;
- }
- foreach ($array as $cat => $conf) {
- $c = strtolower($cat);
- foreach ($conf as $k => $v) {
- if ($c == 'core' && property_exists($this, $k)) {
- $this->$k=$v;
- } else {
- if (!isset($this->$c)) {
- $this->$c = new stdClass;
- }
- $this->$c->$k = $v;
- }
- }
- }
- }
-
- function read_config()
- {
- $this->read_ini_file($this->spoolroot.'/configs/platal.ini');
-
- $this->read_ini_file($this->spoolroot.'/configs/platal.conf');
- }