minor feature added
This commit is contained in:
parent
c66e01f4ba
commit
467498182a
1 changed files with 10 additions and 6 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.9 $
|
Version : $Revision: 1.10 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/subj.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/alib/var/subj.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -39,7 +39,7 @@ define('ALIBERR_BADSMEMB', 21);
|
||||||
* (allow adding users to groups or groups to groups)
|
* (allow adding users to groups or groups to groups)
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.9 $
|
* @version $Revision: 1.10 $
|
||||||
* @see ObjClasses
|
* @see ObjClasses
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
|
@ -68,19 +68,21 @@ class Subjects extends ObjClasses{
|
||||||
* @param login string
|
* @param login string
|
||||||
* @param pass string, optional
|
* @param pass string, optional
|
||||||
* @param realname string, optional
|
* @param realname string, optional
|
||||||
|
* @param passenc boolean, optional, password already encrypted if true
|
||||||
* @return int/err
|
* @return int/err
|
||||||
*/
|
*/
|
||||||
function addSubj($login, $pass=NULL, $realname='')
|
function addSubj($login, $pass=NULL, $realname='', $passenc=FALSE)
|
||||||
{
|
{
|
||||||
if(!$login) return $this->dbc->raiseError(
|
if(!$login) return $this->dbc->raiseError(
|
||||||
get_class($this)."::addSubj: empty login"
|
get_class($this)."::addSubj: empty login"
|
||||||
);
|
);
|
||||||
$id = $this->dbc->nextId("{$this->subjTable}_id_seq");
|
$id = $this->dbc->nextId("{$this->subjTable}_id_seq");
|
||||||
if(PEAR::isError($id)) return $id;
|
if(PEAR::isError($id)) return $id;
|
||||||
|
if(!is_null($pass) && !$passenc) $pass = md5($pass);
|
||||||
$r = $this->dbc->query("
|
$r = $this->dbc->query("
|
||||||
INSERT INTO {$this->subjTable} (id, login, pass, type, realname)
|
INSERT INTO {$this->subjTable} (id, login, pass, type, realname)
|
||||||
VALUES ($id, '$login', ".
|
VALUES ($id, '$login', ".
|
||||||
(is_null($pass) ? "'!', 'G'" : "'".md5($pass)."', 'U'").",
|
(is_null($pass) ? "'!', 'G'" : "'$pass', 'U'").",
|
||||||
'$realname')
|
'$realname')
|
||||||
");
|
");
|
||||||
if(PEAR::isError($r)) return $r;
|
if(PEAR::isError($r)) return $r;
|
||||||
|
@ -149,11 +151,13 @@ class Subjects extends ObjClasses{
|
||||||
* @param login string
|
* @param login string
|
||||||
* @param oldpass string, old password (optional for 'superuser mode')
|
* @param oldpass string, old password (optional for 'superuser mode')
|
||||||
* @param pass string, optional
|
* @param pass string, optional
|
||||||
|
* @param passenc boolean, optional, password already encrypted if true
|
||||||
* @return boolean/err
|
* @return boolean/err
|
||||||
*/
|
*/
|
||||||
function passwd($login, $oldpass=null, $pass='')
|
function passwd($login, $oldpass=null, $pass='', $passenc=FALSE)
|
||||||
{
|
{
|
||||||
$cpass = md5($pass);
|
if(!$passenc) $cpass = md5($pass);
|
||||||
|
else $cpass = $pass;
|
||||||
if(!is_null($oldpass)){
|
if(!is_null($oldpass)){
|
||||||
$oldcpass = md5($oldpass);
|
$oldcpass = md5($oldpass);
|
||||||
$oldpCond = "AND pass='$oldcpass'";
|
$oldpCond = "AND pass='$oldcpass'";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue