home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / CMS / xoops-2.0.18.1.exe / xoops-2.0.18.1 / htdocs / class / auth / auth.php < prev    next >
Encoding:
PHP Script  |  2006-09-04  |  3.7 KB  |  106 lines

  1. <?php
  2. // $Id: auth.php 694 2006-09-04 11:33:22Z skalpa $
  3. // auth.php - defines abstract authentification wrapper class
  4. //  ------------------------------------------------------------------------ //
  5. //                XOOPS - PHP Content Management System                      //
  6. //                    Copyright (c) 2000 XOOPS.org                           //
  7. //                       <http://www.xoops.org/>                             //
  8. //  ------------------------------------------------------------------------ //
  9. //  This program is free software; you can redistribute it and/or modify     //
  10. //  it under the terms of the GNU General Public License as published by     //
  11. //  the Free Software Foundation; either version 2 of the License, or        //
  12. //  (at your option) any later version.                                      //
  13. //                                                                           //
  14. //  You may not change or alter any portion of this comment or credits       //
  15. //  of supporting developers from this source code or any supporting         //
  16. //  source code which is considered copyrighted (c) material of the          //
  17. //  original comment or credit authors.                                      //
  18. //                                                                           //
  19. //  This program is distributed in the hope that it will be useful,          //
  20. //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
  21. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
  22. //  GNU General Public License for more details.                             //
  23. //                                                                           //
  24. //  You should have received a copy of the GNU General Public License        //
  25. //  along with this program; if not, write to the Free Software              //
  26. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
  27. //  ------------------------------------------------------------------------ //
  28. /**
  29.  * @package     kernel
  30.  * @subpackage  auth
  31.  * @description    Authentification base class
  32.  * @author        Pierre-Eric MENUET    <pemphp@free.fr>
  33.  * @copyright    copyright (c) 2000-2003 XOOPS.org
  34.  */
  35. class XoopsAuth {
  36.  
  37.     var    $_dao;
  38.  
  39.     var    $_errors;
  40.     /**
  41.      * Authentication Service constructor
  42.      */
  43.     function XoopsAuth (&$dao){
  44.         $this->_dao = $dao;
  45.     }
  46.  
  47.     /**
  48.      * @abstract need to be write in the dervied class
  49.      */    
  50.     function authenticate() {
  51.         $authenticated = false;
  52.                 
  53.         return $authenticated;
  54.     }        
  55.     
  56.     /**
  57.      * add an error 
  58.      * 
  59.      * @param string $value error to add
  60.      * @access public
  61.      */
  62.     function setErrors($err_no, $err_str)
  63.     {
  64.         $this->_errors[$err_no] = trim($err_str);
  65.     }
  66.  
  67.     /**
  68.      * return the errors for this object as an array
  69.      * 
  70.      * @return array an array of errors
  71.      * @access public
  72.      */
  73.     function getErrors()
  74.     {
  75.         return $this->_errors;
  76.     }
  77.  
  78.     /**
  79.      * return the errors for this object as html
  80.      * 
  81.      * @return string html listing the errors
  82.      * @access public
  83.      */
  84.     function getHtmlErrors()
  85.     {
  86.         global $xoopsConfig;
  87.         $ret = '<br>';
  88.         if ( $xoopsConfig['debug_mode'] == 1 || $xoopsConfig['debug_mode'] == 2 ) 
  89.         {           
  90.             if (!empty($this->_errors)) {
  91.                 foreach ($this->_errors as $errno => $errstr) {                
  92.                     $ret .=  $errstr . '<br/>';
  93.                 }
  94.             } else {
  95.                 $ret .= _NONE.'<br />';
  96.             }        
  97.             $ret .= sprintf(_AUTH_MSG_AUTH_METHOD, $this->auth_method);
  98.         }
  99.         else {
  100.             $ret .= _US_INCORRECTLOGIN;
  101.         }
  102.         return $ret;
  103.     }    
  104. }
  105.  
  106. ?>