XOOPS  2.6.0
Factory.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 class Factory
26 {
38  public static function getAuthConnection($uname, $_force=false)
39  {
41  static $auth_instance;
42  if (!isset($auth_instance) OR (bool)$_force) {
43  /* @var $config_handler XoopsConfigHandler */
44  $authConfig = $xoops->getConfigs();
45  if (empty($authConfig['auth_method'])) { // If there is a config error, we use xoops
46  $xoops_auth_method = 'xoops';
47  } else {
48  $xoops_auth_method = $authConfig['auth_method'];
49  }
50  // Verify if uname allow to bypass LDAP auth
51  if (isset($authConfig['ldap_users_bypass']) && in_array($uname, $authConfig['ldap_users_bypass'])) {
52  $xoops_auth_method = 'xoops';
53  }
54 
55  $class = '\\Xoops\\Auth\\' . ucfirst($xoops_auth_method);
56  if (!class_exists($class)) {
57  trigger_error(\XoopsLocale::EF_CLASS_NOT_FOUND, E_USER_ERROR);
58  return false;
59  }
60  $dao = null;
61  switch ($xoops_auth_method) {
62  case 'xoops':
63  $dao = null;
64  break;
65  case 'ldap':
66  $dao = null;
67  break;
68  case 'ads':
69  $dao = null;
70  break;
71  }
72  $auth_instance = new $class($dao);
73  }
74  return $auth_instance;
75  }
76 }
static getAuthConnection($uname, $_force=false)
Definition: Factory.php:38
static getInstance()
Definition: Xoops.php:160
const EF_CLASS_NOT_FOUND
Definition: en_US.php:229
$xoops
Definition: admin.php:25
$uname
Definition: checklogin.php:37