XOOPS  2.6.0
AuthAbstract.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
12 namespace Xoops\Auth;
13 
25 abstract class AuthAbstract
26 {
30  protected $dao;
31 
35  protected $errors;
36 
40  protected $auth_method;
41 
47  public function __construct($dao)
48  {
49  $this->dao = $dao;
50  }
51 
60  abstract public function authenticate($uname, $pwd = null);
61 
70  public function setErrors($err_no, $err_str)
71  {
72  $this->errors[$err_no] = trim($err_str);
73  }
74 
80  public function getErrors()
81  {
82  return $this->errors;
83  }
84 
90  public function getHtmlErrors()
91  {
93  $ret = '<br />';
94  if ($xoops->getConfig('debug_mode') == 1 || $xoops->getConfig('debug_mode') == 2) {
95  if (!empty($this->errors)) {
96  foreach ($this->errors as $errstr) {
97  $ret .= $errstr . '<br/>';
98  }
99  } else {
100  $ret .= \XoopsLocale::NONE . '<br />';
101  }
102  $ret .= sprintf(\XoopsLocale::F_USING_AUTHENTICATION_METHOD, $this->auth_method);
103  } else {
105  }
106  return $ret;
107  }
108 }
const E_INCORRECT_LOGIN
Definition: en_US.php:332
static getInstance()
Definition: Xoops.php:160
setErrors($err_no, $err_str)
$xoops
Definition: admin.php:25
const F_USING_AUTHENTICATION_METHOD
Definition: en_US.php:447
authenticate($uname, $pwd=null)
$uname
Definition: checklogin.php:37