cvs: pear /Perm_LiveUser/Perm/Container DB_Complex.php DB_Medium.php DB_Simple.php MDB2_Complex.php MDB2_Medium.php MDB2_Simple.php MDB_Complex.php
MDB_Medium.php MDB_Simple.php XML_Simple.php

From: Date: Sat, 26 Jun 2004 11:33:16 +0000
Subject: cvs: pear /Perm_LiveUser/Perm/Container DB_Complex.php DB_Medium.php DB_Simple.php MDB2_Complex.php MDB2_Medium.php MDB2_Simple.php MDB_Complex.php
MDB_Medium.php MDB_Simple.php XML_Simple.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-21151@lists.php.net to get a copy of this message
arnaud Sat Jun 26 07:33:16 2004 EDT Modified files: /pear/Perm_LiveUser/Perm/Container DB_Complex.php DB_Medium.php DB_Simple.php MDB2_Complex.php MDB2_Medium.php MDB2_Simple.php MDB_Complex.php MDB_Medium.php MDB_Simple.php XML_Simple.php Log: * using ErrorStack

http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/DB_Complex.php?r1=1.51&r2=1.52&ty=u Index: pear/Perm_LiveUser/Perm/Container/DB_Complex.php diff -u pear/Perm_LiveUser/Perm/Container/DB_Complex.php:1.51 pear/Perm_LiveUser/Perm/Container/DB_Complex.php:1.52 --- pear/Perm_LiveUser/Perm/Container/DB_Complex.php:1.51 Wed Jun 16 15:54:50 2004 +++ pear/Perm_LiveUser/Perm/Container/DB_Complex.php Sat Jun 26 07:33:16 2004 @@ -43,7 +43,7 @@ * * @author Lukas Smith <smith@backendmedia.com> * @author Bjoern Kraus <krausbn@php.net> - * @version $Id: DB_Complex.php,v 1.51 2004/06/16 19:54:50 arnaud Exp $ + * @version $Id: DB_Complex.php,v 1.52 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -52,7 +52,8 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::DB object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_DB_Complex(&$connectOptions) @@ -96,7 +97,7 @@ $result = $this->dbc->getAssoc($query, false, null, DB_FETCHMODE_ORDERED, true); if (DB::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -124,7 +125,7 @@ $result = $this->dbc->getAll($query, null, DB_FETCHMODE_ASSOC); if (DB::isError($result)) { - return $result; + return false; } elseif (is_array($result)) { foreach ($result as $val) { // only store the implied right if the right wasn't stored before http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/DB_Medium.php?r1=1.39&r2=1.40&ty=u Index: pear/Perm_LiveUser/Perm/Container/DB_Medium.php diff -u pear/Perm_LiveUser/Perm/Container/DB_Medium.php:1.39 pear/Perm_LiveUser/Perm/Container/DB_Medium.php:1.40 --- pear/Perm_LiveUser/Perm/Container/DB_Medium.php:1.39 Thu Jun 17 10:45:48 2004 +++ pear/Perm_LiveUser/Perm/Container/DB_Medium.php Sat Jun 26 07:33:16 2004 @@ -40,7 +40,7 @@ * - authareas * * @author Arnaud Limbourg - * @version $Id: DB_Medium.php,v 1.39 2004/06/17 14:45:48 lsmith Exp $ + * @version $Id: DB_Medium.php,v 1.40 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -49,7 +49,9 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::DB object. + * @access protected + * @param mixed configuration array + * @return void */ function LiveUser_Perm_Container_DB_Medium(&$connectOptions) { @@ -57,6 +59,41 @@ } /** + * Tries to find the user with the given user ID in the permissions + * container. Will read all permission data and return true on success. + * + * @access public + * @param string $uid user identifier + * @return mixed true on success or a PEAR_Error object + */ + function init($uid) + { + $success = true; + + $query = ' + SELECT + LU.perm_user_id AS userid, + LU.perm_type AS usertype + FROM + ' . $this->prefix . 'perm_users LU + WHERE + auth_user_id=' . $this->dbc->quoteSmart($uid); + + $result = $this->dbc->getRow($query, null, DB_FETCHMODE_ASSOC); + + if (DB::isError($result)) { + $success = false; + } + + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; + + $this->readRights(); + + return $success; + } // end func init + + /** * Reads all rights of current user into an * associative array. * Group rights and invididual rights are being merged @@ -141,7 +178,7 @@ $result = $this->dbc->getAssoc($query); if (DB::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -192,20 +229,20 @@ SELECT GU.group_id FROM - '.$this->prefix.'groupusers GU + ' . $this->prefix.'groupusers GU INNER JOIN - '.$this->prefix.'groups G + ' . $this->prefix.'groups G ON GU.group_id=G.group_id WHERE G.is_active=\'Y\' AND - perm_user_id='.$this->permUserId; + perm_user_id=' . $this->permUserId; $result = $this->dbc->getCol($query); if (!DB::isError($result)) { - $this->groupIds = $result; + $this->groupIds = null; } else { $this->groupIds = array(); } @@ -230,15 +267,15 @@ GR.right_id, MAX(GR.right_level) FROM - '.$this->prefix.'grouprights GR + ' . $this->prefix.'grouprights GR WHERE - GR.group_id IN('.implode(',', $this->groupIds).') + GR.group_id IN(' . implode(',', $this->groupIds) . ') GROUP BY GR.right_id'; $result = $this->dbc->getAssoc($query); if (DB::isError($result)) { - return $result; + return false; } if (is_array($result)) { http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/DB_Simple.php?r1=1.21&r2=1.22&ty=u Index: pear/Perm_LiveUser/Perm/Container/DB_Simple.php diff -u pear/Perm_LiveUser/Perm/Container/DB_Simple.php:1.21 pear/Perm_LiveUser/Perm/Container/DB_Simple.php:1.22 --- pear/Perm_LiveUser/Perm/Container/DB_Simple.php:1.21 Thu Jun 17 10:46:34 2004 +++ pear/Perm_LiveUser/Perm/Container/DB_Simple.php Sat Jun 26 07:33:16 2004 @@ -38,7 +38,7 @@ * - userrights * * @author Björn Kraus <krausbn@php.net> - * @version $Id: DB_Simple.php,v 1.21 2004/06/17 14:46:34 lsmith Exp $ + * @version $Id: DB_Simple.php,v 1.22 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -76,11 +76,13 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::DB object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_DB_Simple(&$connectOptions) { + $this->LiveUser_Perm_Common(); if (is_array($connectOptions)) { foreach ($connectOptions as $key => $value) { if (isset($this->$key)) { @@ -113,11 +115,12 @@ * * @access public * @param string $uid user identifier - * @return mixed true if a perm user was found, - false if no perm user was found or a PEAR_Error object + * @return mixed true on success or a PEAR_Error object */ function init($uid) { + $success = true; + $query = ' SELECT LU.perm_user_id AS userid, @@ -130,17 +133,15 @@ $result = $this->dbc->getRow($query, null, DB_FETCHMODE_ASSOC); if (DB::isError($result)) { - return $result; + $success = false; } - if(is_array($result)) { - $this->permUserId = $result['userid']; - $this->userType = $result['usertype']; + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; - $this->readRights(); - } + $this->readRights(); - return (bool)$result; + return $success; } // end func init /** @@ -211,7 +212,7 @@ $result = $this->dbc->getAssoc($query); if (DB::isError($result)) { - return $result; + return false; } // if $this->rights = $result; http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php?r1=1.12&r2=1.13&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php diff -u pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php:1.12 pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php:1.13 --- pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php:1.12 Wed Jun 16 15:54:50 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB2_Complex.php Sat Jun 26 07:33:16 2004 @@ -43,7 +43,7 @@ * * @author Lukas Smith <smith@backendmedia.com> * @author Bjoern Kraus <krausbn@php.net> - * @version $Id: MDB2_Complex.php,v 1.12 2004/06/16 19:54:50 arnaud Exp $ + * @version $Id: MDB2_Complex.php,v 1.13 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -52,7 +52,8 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB2 object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_MDB2_Complex(&$connectOptions) @@ -97,7 +98,7 @@ $result = $this->dbc->queryAll($query, $types, MDB2_FETCHMODE_ORDERED, true, false, true); if (MDB2::isError($result)) { - return $result; + return false; } if (is_array($result)) { http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php?r1=1.8&r2=1.9&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php diff -u pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php:1.8 pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php:1.9 --- pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php:1.8 Thu Jun 17 10:45:48 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB2_Medium.php Sat Jun 26 07:33:16 2004 @@ -39,9 +39,9 @@ * - userrights * - authareas * - * @author Arnaud Limbourg - * @version $Id: MDB2_Medium.php,v 1.8 2004/06/17 14:45:48 lsmith Exp $ - * @package LiveUser + * @author Arnaud Limbourg + * @version $Id: MDB2_Medium.php,v 1.9 2004/06/26 11:33:16 arnaud Exp $ + * @package LiveUser * @category authentication */ class LiveUser_Perm_Container_MDB2_Medium extends LiveUser_Perm_Container_MDB2_Simple @@ -49,7 +49,9 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB2 object. + * @access protected + * @param mixed configuration array + * @return void */ function LiveUser_Perm_Container_MDB2_Medium(&$connectOptions) { @@ -57,6 +59,41 @@ } /** + * Tries to find the user with the given user ID in the permissions + * container. Will read all permission data and return true on success. + * + * @access public + * @param string $uid user identifier + * @return mixed true on success or a PEAR_Error object + */ + function init($uid) + { + $success = true; + + $query = ' + SELECT + LU.perm_user_id AS userid, + LU.perm_type AS usertype + FROM + '.$this->prefix.'perm_users LU + WHERE + auth_user_id='.$this->dbc->quote($uid, 'text'); + + $result = $this->dbc->queryRow($query, array('integer', 'integer'), MDB2_FETCHMODE_ASSOC); + + if (MDB2::isError($result)) { + $success = false; + } + + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; + + $this->readRights(); + + return $success; + } // end func init + + /** * Reads all rights of current user into an * associative array. * Group rights and invididual rights are being merged @@ -142,7 +179,7 @@ $result = $this->dbc->queryAll($query, $types, MDB2_FETCHMODE_ORDERED, true); if (MDB2::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -207,7 +244,7 @@ $result = $this->dbc->queryCol($query); if (!MDB2::isError($result)) { - $this->groupIds = $result; + $this->groupIds = null; } else { $this->groupIds = array(); } @@ -241,7 +278,7 @@ $result = $this->dbc->queryAll($query, $types, MDB2_FETCHMODE_ORDERED, true); if (MDB2::isError($result)) { - return $result; + return false; } if (is_array($result)) { http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php?r1=1.15&r2=1.16&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php diff -u pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php:1.15 pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php:1.16 --- pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php:1.15 Thu Jun 17 10:46:34 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB2_Simple.php Sat Jun 26 07:33:16 2004 @@ -38,7 +38,7 @@ * - userrights * * @author Björn Kraus <krausbn@php.net> - * @version $Id: MDB2_Simple.php,v 1.15 2004/06/17 14:46:34 lsmith Exp $ + * @version $Id: MDB2_Simple.php,v 1.16 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -90,11 +90,13 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB2 object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_MDB2_Simple(&$connectOptions) { + $this->LiveUser_Perm_Common(); if (is_array($connectOptions)) { foreach ($connectOptions as $key => $value) { if (isset($this->$key)) { @@ -134,12 +136,13 @@ * container. Will read all permission data and return true on success. * * @access public - * @param string $uid user identifier - * @return mixed true if a perm user was found, - false if no perm user was found or a PEAR_Error object + * @param string user identifier + * @return boolean true on success or false on failure */ function init($uid) { + $success = true; + $query = ' SELECT LU.perm_user_id AS userid, @@ -152,17 +155,15 @@ $result = $this->dbc->queryRow($query, array('integer', 'integer'), MDB2_FETCHMODE_ASSOC); if (MDB2::isError($result)) { - return $result; + $success = false; } - if(is_array($result)) { - $this->permUserId = $result['userid']; - $this->userType = $result['usertype']; + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; - $this->readRights(); - } + $this->readRights(); - return (bool)$result; + return $success; } // end func init /** @@ -232,11 +233,11 @@ UR.perm_user_id='.$this->dbc->quote($this->permUserId, 'integer') . ' AND UR.right_level > 0'; - $types = array('integer', 'integer'); + $types = array('integer', 'integer'); $result = $this->dbc->queryAll($query, $types, MDB2_FETCHMODE_ORDERED, true); if (MDB2::isError($result)) { - return $result; + return false; } // if $this->rights = $result; http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB_Complex.php?r1=1.21&r2=1.22&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB_Complex.php diff -u pear/Perm_LiveUser/Perm/Container/MDB_Complex.php:1.21 pear/Perm_LiveUser/Perm/Container/MDB_Complex.php:1.22 --- pear/Perm_LiveUser/Perm/Container/MDB_Complex.php:1.21 Wed Jun 16 15:54:50 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB_Complex.php Sat Jun 26 07:33:16 2004 @@ -43,7 +43,7 @@ * * @author Lukas Smith <smith@backendmedia.com> * @author Bjoern Kraus <krausbn@php.net> - * @version $Id: MDB_Complex.php,v 1.21 2004/06/16 19:54:50 arnaud Exp $ + * @version $Id: MDB_Complex.php,v 1.22 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -52,7 +52,8 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_MDB_Complex(&$connectOptions) @@ -97,7 +98,7 @@ $result = $this->dbc->queryAll($query, $types, MDB_FETCHMODE_ORDERED, true, false, true); if (MDB::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -126,7 +127,7 @@ $result = $this->dbc->queryAll($query, $types, MDB_FETCHMODE_ASSOC); if (MDB::isError($result)) { - return $result; + return false; } elseif (is_array($result)) { foreach ($result as $val) { // only store the implied right if the right wasn't stored before http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB_Medium.php?r1=1.15&r2=1.16&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB_Medium.php diff -u pear/Perm_LiveUser/Perm/Container/MDB_Medium.php:1.15 pear/Perm_LiveUser/Perm/Container/MDB_Medium.php:1.16 --- pear/Perm_LiveUser/Perm/Container/MDB_Medium.php:1.15 Thu Jun 17 10:45:48 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB_Medium.php Sat Jun 26 07:33:16 2004 @@ -40,7 +40,7 @@ * - authareas * * @author Arnaud Limbourg - * @version $Id: MDB_Medium.php,v 1.15 2004/06/17 14:45:48 lsmith Exp $ + * @version $Id: MDB_Medium.php,v 1.16 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -49,7 +49,9 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB object. + * @access protected + * @param mixed configuration array + * @return void */ function LiveUser_Perm_Container_MDB_Medium(&$connectOptions) { @@ -57,6 +59,41 @@ } /** + * Tries to find the user with the given user ID in the permissions + * container. Will read all permission data and return true on success. + * + * @access public + * @param string $uid user identifier + * @return mixed true on success or a PEAR_Error object + */ + function init($uid) + { + $success = true; + + $query = ' + SELECT + LU.perm_user_id AS userid, + LU.perm_type AS usertype + FROM + '.$this->prefix.'perm_users LU + WHERE + auth_user_id='.$this->dbc->getValue('text', $uid); + + $result = $this->dbc->queryRow($query, array('integer', 'integer'), MDB_FETCHMODE_ASSOC); + + if (MDB::isError($result)) { + $success = false; + } + + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; + + $this->readRights(); + + return $success; + } // end func init + + /** * Reads all rights of current user into an * associative array. * Group rights and invididual rights are being merged @@ -142,7 +179,7 @@ $result = $this->dbc->queryAll($query, $types, MDB_FETCHMODE_ORDERED, true); if (MDB::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -167,7 +204,7 @@ $result = $this->dbc->queryAll($query, $types, MDB_FETCHMODE_ORDERED, true); if (MDB::isError($result)) { - return $result; + return false; } if (is_array($result)) { @@ -207,7 +244,7 @@ $result = $this->dbc->queryCol($query); if (!MDB::isError($result)) { - $this->groupIds = $result; + $this->groupIds = null; } else { $this->groupIds = array(); } @@ -241,7 +278,7 @@ $result = $this->dbc->queryAll($query, $types, MDB_FETCHMODE_ORDERED, true); if (MDB::isError($result)) { - return $result; + return false; } if (is_array($result)) { http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/MDB_Simple.php?r1=1.24&r2=1.25&ty=u Index: pear/Perm_LiveUser/Perm/Container/MDB_Simple.php diff -u pear/Perm_LiveUser/Perm/Container/MDB_Simple.php:1.24 pear/Perm_LiveUser/Perm/Container/MDB_Simple.php:1.25 --- pear/Perm_LiveUser/Perm/Container/MDB_Simple.php:1.24 Thu Jun 17 10:46:34 2004 +++ pear/Perm_LiveUser/Perm/Container/MDB_Simple.php Sat Jun 26 07:33:16 2004 @@ -38,7 +38,7 @@ * - userrights * * @author Björn Kraus <krausbn@php.net> - * @version $Id: MDB_Simple.php,v 1.24 2004/06/17 14:46:34 lsmith Exp $ + * @version $Id: MDB_Simple.php,v 1.25 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -90,11 +90,13 @@ /** * Constructor * - * @param mixed $connectOptions Array or PEAR::MDB object. + * @access protected + * @param mixed configuration array * @return void */ function LiveUser_Perm_Container_MDB_Simple(&$connectOptions) { + $this->LiveUser_Perm_Common(); if (is_array($connectOptions)) { foreach ($connectOptions as $key => $value) { if (isset($this->$key)) { @@ -135,11 +137,12 @@ * * @access public * @param string $uid user identifier - * @return mixed true if a perm user was found, - false if no perm user was found or a PEAR_Error object + * @return mixed true on success or a PEAR_Error object */ function init($uid) { + $success = true; + $query = ' SELECT LU.perm_user_id AS userid, @@ -155,14 +158,12 @@ return $result; } - if(is_array($result)) { - $this->permUserId = $result['userid']; - $this->userType = $result['usertype']; + $this->permUserId = $result['userid']; + $this->userType = $result['usertype']; - $this->readRights(); - } + $this->readRights(); - return (bool)$result; + return $success; } // end func init /** http://cvs.php.net/diff.php/pear/Perm_LiveUser/Perm/Container/XML_Simple.php?r1=1.11&r2=1.12&ty=u Index: pear/Perm_LiveUser/Perm/Container/XML_Simple.php diff -u pear/Perm_LiveUser/Perm/Container/XML_Simple.php:1.11 pear/Perm_LiveUser/Perm/Container/XML_Simple.php:1.12 --- pear/Perm_LiveUser/Perm/Container/XML_Simple.php:1.11 Thu Jun 17 15:15:49 2004 +++ pear/Perm_LiveUser/Perm/Container/XML_Simple.php Sat Jun 26 07:33:16 2004 @@ -38,7 +38,7 @@ * - userrights * * @author Björn Kraus <krausbn@php.net> - * @version $Id: XML_Simple.php,v 1.11 2004/06/17 19:15:49 arnaud Exp $ + * @version $Id: XML_Simple.php,v 1.12 2004/06/26 11:33:16 arnaud Exp $ * @package LiveUser * @category authentication */ @@ -54,16 +54,16 @@ /** * XML::Tree object. * - * @var object * @access private + * @var XML_Tree */ var $tree = null; /** * XML::Tree object of the user logged in. * - * @var object * @access private + * @var XML_Tree * @see readUserData() */ var $userObj = null; @@ -83,10 +83,11 @@ /** * Constructor * - * @param mixed $connectoptions connection options + * @access protected + * @param mixed configuration array * @return void */ - function LiveUser_Perm_Container_XML_Simple(&$connectOptions) + function &LiveUser_Perm_Container_XML_Simple(&$connectOptions) { if (is_array($connectOptions)) { foreach ($connectOptions as $key => $value) { @@ -98,8 +99,8 @@ if (is_file(getenv('DOCUMENT_ROOT') . $this->file)) { $this->file = getenv('DOCUMENT_ROOT') . $this->file; } else { - return LiveUser::raiseError(LIVEUSER_ERROR_MISSING_DEPS, null, null, - "Perm initialisation failed. Can't find xml file."); + $this->_stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(), "Perm initialisation failed. Can't find xml file."); + return false; } } if ($this->file) { @@ -107,19 +108,18 @@ $tree =& new XML_Tree($this->file); $err =& $tree->getTreeFromFile(); if (PEAR::isError($err)) { - return $err; + return false; } else { $this->tree = $tree; $this->init_ok = true; } } else { - $this->_error = true; - return LiveUser::raiseError(LIVEUSER_ERROR_MISSING_DEPS, null, null, - "Perm initialisation failed. Can't find XML_Tree class."); + $this->_stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(), "Perm initialisation failed. Can't find XML_Tree class"); + return false; } } else { - return LiveUser::raiseError(LIVEUSER_ERROR_MISSING_DEPS, null, null, - "Perm initialisation failed. Can't find xml file."); + $this->_stack->push(LIVEUSER_ERROR_MISSING_DEPS, 'exception', array(), "Perm initialisation failed. Can't find XML_Tree class"); + return false; } } } @@ -143,10 +143,6 @@ $userIndex = 0; foreach ($this->tree->root->children as $node) { - if ($nodeIndex == 0) { - continue; - } - if ($node->name == 'users') { foreach ($node->children as $user) { if ($uid == $user->attributes['authUserId']) {
« previous php.pear.cvs (#21151) next »