X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/a86f431a5340d5326500070cc17e47208c029ca1..e0e275daf3624e7c6bfce0eb27717d14572273ce:/sistema/local_lib/intranetdb.php diff --git a/sistema/local_lib/intranetdb.php b/sistema/local_lib/intranetdb.php index f47978c..02c08e4 100644 --- a/sistema/local_lib/intranetdb.php +++ b/sistema/local_lib/intranetdb.php @@ -1,57 +1,53 @@ -// +----------------------------------------------------------------------+ +// ------------------------------------------------------------------- +// Ministerio de Economía +// Intranet +// ------------------------------------------------------------------- +// This file is part of Intranet. +// +// Intranet is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published +// by the Free Software Foundation; either version 2 of the License, +// or (at your option) any later version. +// +// Intranet is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Intrane; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// ------------------------------------------------------------------- +// Created: Mon Jun 9 17:53:31 2003 +// Author: Gonzalo Merayo +// ------------------------------------------------------------------- // -// $Id: bandadb.php 12 2003-06-24 16:54:23Z gmeray $ -// $Author: gmeray $ -// $URL: http://portal.mecon.ar/svn/bandas/sistema/lib/bandadb.php $ -// $Date: 2003-06-24 13:54:23 -0300 (Tue, 24 Jun 2003) $ -// $Rev: 12 $ +// $Id$ // -#require_once 'PEAR.php'; require_once 'DB.php'; - - -// +X2C Class 121 :BandaDB /** * @access public */ class IntranetDB extends DB { - // ~X2C - // +X2C Operation 122 - /** - * @return void - * @access public - */ - function connect() // ~X2C - { - $conf = include 'configuracion.php'; - $dsn = $conf['db_type'].'://'.$conf['db_user'].':'.$conf['db_pass'].'@'.$conf['db_host'].'/'.$conf['db_name']; - $db = DB::connect($dsn,true); - if (DB::isError($db)) { - die ($db->getMessage()); + /** + * @return void + * @access public + */ + function connect() + { + $config = @parse_ini_file(dirname(__FILE__).'/../conf/db.ini'); + $dsn = @$config['dsn'] ? $config['dsn'] : 'mysql://intranet:c35b9aa6b0758@unix(/var/run/mysqld/mysql.sock)/intranet'; + $db = DB::connect($dsn, isset($config['persistent']) ? $config['persistent'] : true); + if (DB::isError($db)) { + trigger_error($db->getMessage(), E_USER_ERROR); + } + return $db; } - return $db; - } - // -X2C -} // -X2C Class :BandaDB +} ?>