function loginUser($u, $p)
 {
     global $_SESSION;
     if (!file_exists($this->passwd_filename)) {
         $this->signed_username = Null;
         unset($_SESSION['username']);
         return FALSE;
     } else {
         FMWK_include_once("pear/pear.inc.php");
         include_once "File/Passwd.php";
         $passwd =& File_Passwd::factory('Cvs');
         $passwd->setFile($this->passwd_filename);
         $passwd->load();
         $res = $passwd->verifyPasswd($u, $p);
         if (!is_object($res) & $res) {
             $_SESSION['username'] = $u;
             $this->signed_username = $u;
             return TRUE;
         } else {
             $this->signed_username = Null;
             unset($_SESSION['username']);
             return FALSE;
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Load and initialize the File_Passwd object
  * 
  * @return  object  File_Passwd_Cvs|PEAR_Error
  */
 function &_load()
 {
     static $pw_obj;
     if (!isset($pw_obj)) {
         $pw_obj = File_Passwd::factory('Cvs');
         if (PEAR::isError($pw_obj)) {
             return $pw_obj;
         }
         $pw_obj->setFile($this->pwfile);
         $res = $pw_obj->load();
         if (PEAR::isError($res)) {
             return $res;
         }
     }
     return $pw_obj;
 }
 /**
  * Regression test for File_Passwd.factory method
  * @access public
  */
 function testfactory()
 {
     foreach ($GLOBALS['_EXT_'] as $ext) {
         $o = File_Passwd::factory($ext);
         $this->assertTrue(is_a($o, "File_Passwd_{$ext}"));
     }
 }
Ejemplo n.º 4
0
 /**
  * Load and initialize the File_Passwd object
  *
  * @return  object  File_Passwd_Cvs|PEAR_Error
  */
 function &_load()
 {
     static $pw_obj;
     if (!isset($pw_obj)) {
         $this->log('Instanciating File_Password object of type ' . $this->options['type'], AUTH_LOG_DEBUG);
         $pw_obj = File_Passwd::factory($this->options['type']);
         if (PEAR::isError($pw_obj)) {
             return $pw_obj;
         }
         $pw_obj->setFile($this->pwfile);
         $res = $pw_obj->load();
         if (PEAR::isError($res)) {
             return $res;
         }
     }
     return $pw_obj;
 }