]> git.llucax.com Git - mecon/intranet.git/blobdiff - sistema/local_lib/intranetdb.php
Bugfixes y actualizacion de documentacion.
[mecon/intranet.git] / sistema / local_lib / intranetdb.php
index f47978c915af694a5a8b7ec44555e8d6373d59b3..203162424cad965944e9319505f20c327983d4e7 100644 (file)
@@ -1,57 +1,53 @@
 <?php
 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +----------------------------------------------------------------------+
-// | PHP Version 4                                                        |
-// +----------------------------------------------------------------------+
-// | Copyright (c) 1997-2003 The PHP Group                                |
-// +----------------------------------------------------------------------+
-// | This source file is subject to version 2.02 of the PHP license,      |
-// | that is bundled with this package in the file LICENSE, and is        |
-// | available at through the world-wide-web at                           |
-// | http://www.php.net/license/2_02.txt.                                 |
-// | If you did not receive a copy of the PHP license and are unable to   |
-// | obtain it through the world-wide-web, please send a note to          |
-// | license@php.net so we can mail you a copy immediately.               |
-// +----------------------------------------------------------------------+
-// | Created: Mon Jun 9 17:53:31 2003
-// | Author:  Gonzalo Merayo <gmeray@mecon.gov.ar>
-// +----------------------------------------------------------------------+
+// -------------------------------------------------------------------
+//                      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 <gmeray@mecon.gov.ar>
+// -------------------------------------------------------------------
 //
-// $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@localhost/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
+}
 ?>