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 304421 2010-10-15 13:30:56Z clockwerx $ 44 * @link http://pear.php.net/LiveUser 45 */ 46 47/** 48 * Require parent class definition. 49 */ 50require_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 */ 64class LiveUser_Perm_Storage_SQL extends LiveUser_Perm_Storage 65{ 66 /** 67 * dsn that was connected to 68 * @var string 69 * @access private 70 */ 71 var $dsn = false; 72 73 /** 74 * instance of the database backend object. 75 * 76 * @var object 77 * @access private 78 */ 79 var $dbc = false; 80 81 /** 82 * Database connection options. 83 * 84 * @var object 85 * @access private 86 */ 87 var $options = array(); 88 89 /** 90 * Table prefix 91 * Prefix for all db tables the container has. 92 * 93 * @var string 94 * @access public 95 */ 96 var $prefix = 'liveuser_'; 97 98 /** 99 * properly disconnect from resources 100 * 101 * @return bool true on success and false on failure 102 * 103 * @access public 104 */ 105 function disconnect() 106 { 107 if ($this->dsn) { 108 $result = $this->dbc->disconnect(); 109 if (PEAR::isError($result)) { 110 $this->stack->push( 111 LIVEUSER_ERROR, 'exception', 112 array('reason' => $result->getMessage() . '-' . $result->getUserInfo()) 113 ); 114 return false; 115 } 116 $this->dbc = false; 117 } 118 return true; 119 } 120} 121?>