From f51c9ed2abe5c68211bb3736be5f70b1fe2c9ec0 Mon Sep 17 00:00:00 2001 From: M.Gergo Date: Fri, 8 Mar 2019 21:20:34 +0100 Subject: további rendrakás --- mayor-orig/www/include/share/session/base.php | 173 -------------------------- 1 file changed, 173 deletions(-) delete mode 100644 mayor-orig/www/include/share/session/base.php (limited to 'mayor-orig/www/include/share/session/base.php') diff --git a/mayor-orig/www/include/share/session/base.php b/mayor-orig/www/include/share/session/base.php deleted file mode 100644 index 337c72df..00000000 --- a/mayor-orig/www/include/share/session/base.php +++ /dev/null @@ -1,173 +0,0 @@ -0) return $return; - else { - $return = array(); - if (is_array($AUTH[$toPolicy]['categories'])) - foreach ($AUTH[$toPolicy]['categories'] as $key => $category) { - if (memberOf($userAccount, $category, $toPolicy)) { - $return[] = $category; - } - if ($cacheable) _registerToCache('aCat',implode(';',$return),$toPolicy); // ha több csoport tagja is, ";" - } - return $return; - } - } - - function _queryCache($kulcs, $policy, $rType="indexed") { - $v = array(_SESSIONID,$kulcs,$policy); - return db_query("SELECT `ertek` FROM `cache` WHERE sessionID='%s' AND dt>NOW() - INTERVAL 5 MINUTE AND `kulcs`='%s' AND policy='%s'", array('fv' => 'getAccountCategories', 'modul' => 'login', 'result' => $rType, 'values'=>$v)); - } - - function _registerToCache($kulcs,$ertek,$policy) { - $v = array(_SESSIONID,$policy,$kulcs,$ertek); - db_query("REPLACE INTO `cache` (sessionID,policy,kulcs,ertek,dt) VALUES ('%s','%s','%s','%s',NOW())", array('fv' => 'cache', 'modul' => 'login', 'result' => 'indexed', 'values'=>$v)); - } - - function _maintainCache() { - $q = "DELETE FROM `cache` WHERE dt 'cache', 'modul' => 'login', 'result' => 'indexed', 'values'=>$v)); - } - - function _clearSessionCache($sessionID) { - $q = "DELETE FROM `cache` WHERE sessionID IN ('%s','%s')"; - $v = array(_SESSIONID,$sessionID); - db_query($q, array('debug'=>false,'fv' => 'cache', 'modul' => 'login', 'result' => 'indexed', 'values'=>$v)); - } - -###################################################### -# getBackendAttrs - az adott policy backend-jéhez tartozó attribútumok - session modul -###################################################### - - function getBackendAttrs($type = 'Account', $toPolicy = _POLICY) { - - global $AUTH; - require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/base.php'); - - global $AUTH; - $attrArrayName = $AUTH[$toPolicy]['backend'].$type.'AttrDef'; - global $$attrArrayName; - $backendAttrDef = $$attrArrayName; - - // Válogassuk ki az olvasható attribútumokat - reset($backendAttrDef); - foreach ($backendAttrDef as $attr => $def) { - - if (!isset($def['rights']) || $def['rights'] == '') { - $rigths = _DEFAULT_LDAP_RIGHTS; //LDAP??? - $backendAttrDef[$attr]['rights'] = $rights; - } else $rights = $def['rights']; - - if ($rights[_ACCESS_AS] != '-') $attrList[] = $attr; - - } - return array($attrList,$backendAttrDef); - - } - -###################################################################### -# Utolsó bejelentkezés dátuma -###################################################################### - - function getLastLoginDt($toPolicy, $userAccount=_USERACCOUNT, $lr = null) { - $q = "SELECT dt FROM loginLog WHERE policy='%s' AND userAccount='%s' AND flag=0 ORDER BY dt DESC LIMIT 1"; - return db_query($q , array('fv' => 'getLastLoginDt', 'modul' => 'login', 'result' => 'value', 'values' => array($toPolicy,$userAccount)), $lr); - } - -###################################################################### -# Hibás bejelentkezések száma, a legutolsó sikeres bejelentkezés óta -###################################################################### - - function getFailedLoginCount($toPolicy, $userAccount=_USERACCOUNT, $lr = null) { - if ($sinceDt == '') $sinceDt = getLastLoginDt($toPolicy, $userAccount, $lr); - $q = "SELECT COUNT(*) AS db FROM loginLog WHERE policy='%s' AND userAccount='%s' AND dt>'%s' AND flag>0"; - return db_query($q , array('fv' => 'getFailedLoginCount', 'modul' => 'login', 'result' => 'value', 'values' => array($toPolicy, $userAccount, $sinceDt)), $lr); - } - -?> -- cgit v1.2.3