Source for file jAuthDriverBase.class.php

Documentation is available at jAuthDriverBase.class.php

  1. <?php
  2. /**
  3. @package    jelix
  4. @subpackage auth_driver
  5. @author      Laurent Jouanneau
  6. @copyright   2011 Laurent Jouanneau
  7. @licence  http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public Licence, see LICENCE file
  8. */
  9.  
  10. /**
  11.  * base class for some jAuth drivers
  12.  */
  13. class jAuthDriverBase {
  14.  
  15.     protected $_params;
  16.  
  17.     function __construct($params){
  18.         $this->_params = $params;
  19.     }
  20.  
  21.     /**
  22.      * crypt the password
  23.      */
  24.     public function cryptPassword($password{
  25.         if (isset($this->_params['password_crypt_function'])) {
  26.             $f $this->_params['password_crypt_function'];
  27.             if ($f != ''{
  28.                 if ($f[1== ':'{
  29.                     $t $f[0];
  30.                     $f substr($f2);
  31.                     if ($t == '1'{
  32.                         return $f((isset($this->_params['password_salt'])?$this->_params['password_salt']:'')$password);
  33.                     }
  34.                     else if ($t == '2'{
  35.                         return $f($this->_params$password);
  36.                     }
  37.                 }
  38.                 return $f($password);
  39.             }
  40.         }
  41.         return $password;
  42.     }
  43. }
  44.  
  45.  
  46. /**
  47.  * function to use to crypt password. use the password_salt value in the config
  48.  * file of the plugin.
  49.  */
  50. function sha1WithSalt($salt$password{
  51.     return sha1($salt.':'.$password);
  52. }

Documentation generated on Mon, 19 Sep 2011 14:11:53 +0200 by phpDocumentor 1.4.3