LiveUser
[ class tree: LiveUser ] [ index: LiveUser ] [ all elements ]

Source for file SQL.php

Documentation is available at SQL.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
  3.  
  4. /**
  5.  * A framework for authentication and authorization in PHP applications
  6.  *
  7.  * LiveUser is an authentication/permission framework designed
  8.  * to be flexible and easily extendable.
  9.  *
  10.  * Since it is impossible to have a
  11.  * "one size fits all" it takes a container
  12.  * approach which should enable it to
  13.  * be versatile enough to meet most needs.
  14.  *
  15.  * PHP version 4 and 5
  16.  *
  17.  * LICENSE: This library is free software; you can redistribute it and/or
  18.  * modify it under the terms of the GNU Lesser General Public
  19.  * License as published by the Free Software Foundation; either
  20.  * version 2.1 of the License, or (at your option) any later version.
  21.  *
  22.  * This library is distributed in the hope that it will be useful,
  23.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  25.  * Lesser General Public License for more details.
  26.  *
  27.  * You should have received a copy of the GNU Lesser General Public
  28.  * License along with this library; if not, write to the Free Software
  29.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  30.  * MA  02111-1307  USA
  31.  *
  32.  *
  33.  * @category authentication
  34.  * @package LiveUser
  35.  * @author  Markus Wolff <wolff@21st.de>
  36.  * @author  Helgi Þormar Þorbjörnsson <dufuz@php.net>
  37.  * @author  Lukas Smith <smith@pooteeweet.org>
  38.  * @author  Arnaud Limbourg <arnaud@php.net>
  39.  * @author  Pierre-Alain Joye <pajoye@php.net>
  40.  * @author  Bjoern Kraus <krausbn@php.net>
  41.  * @copyright 2002-2006 Markus Wolff
  42.  * @license http://www.gnu.org/licenses/lgpl.txt
  43.  * @version CVS: $Id: SQL.php,v 1.28 2006/03/14 13:10:04 lsmith Exp $
  44.  * @link http://pear.php.net/LiveUser
  45.  */
  46.  
  47. /**
  48.  * Require parent class definition.
  49.  */
  50. require_once 'LiveUser/Perm/Storage.php';
  51.  
  52. /**
  53.  * SQL container for permission handling
  54.  *
  55.  * @category authentication
  56.  * @package LiveUser
  57.  * @author  Lukas Smith <smith@pooteeweet.org>
  58.  * @author  Bjoern Kraus <krausbn@php.net>
  59.  * @copyright 2002-2006 Markus Wolff
  60.  * @license http://www.gnu.org/licenses/lgpl.txt
  61.  * @version Release: @package_version@
  62.  * @link http://pear.php.net/LiveUser
  63.  */
  64. {
  65.     /**
  66.      * dsn that was connected to
  67.      * @var string 
  68.      * @access private
  69.      */
  70.     var $dsn = false;
  71.  
  72.     /**
  73.      * instance of the database backend object.
  74.      *
  75.      * @var object 
  76.      * @access private
  77.      */
  78.     var $dbc = false;
  79.  
  80.     /**
  81.      * Database connection options.
  82.      *
  83.      * @var    object 
  84.      * @access private
  85.      */
  86.     var $options = array();
  87.  
  88.     /**
  89.      * Table prefix
  90.      * Prefix for all db tables the container has.
  91.      *
  92.      * @var    string 
  93.      * @access public
  94.      */
  95.     var $prefix = 'liveuser_';
  96.  
  97.     /**
  98.      * properly disconnect from resources
  99.      *
  100.      * @return bool true on success and false on failure
  101.      *
  102.      * @access public
  103.      */
  104.     function disconnect()
  105.     {
  106.         if ($this->dsn{
  107.             $result $this->dbc->disconnect();
  108.             if (PEAR::isError($result)) {
  109.                 $this->stack->push(
  110.                     LIVEUSER_ERROR'exception',
  111.                     array('reason' => $result->getMessage('-' $result->getUserInfo())
  112.                 );
  113.                 return false;
  114.             }
  115.             $this->dbc = false;
  116.         }
  117.         return true;
  118.     }
  119. }
  120. ?>

Documentation generated on Mon, 28 Jan 2008 03:30:32 -0500 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.