aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-base/www/include/modules
diff options
context:
space:
mode:
Diffstat (limited to 'mayor-orig/mayor-base/www/include/modules')
-rw-r--r--mayor-orig/mayor-base/www/include/modules/auth/base/forgotten.php53
-rw-r--r--mayor-orig/mayor-base/www/include/modules/auth/base/login.php37
-rw-r--r--mayor-orig/mayor-base/www/include/modules/auth/base/token.php116
-rw-r--r--mayor-orig/mayor-base/www/include/modules/password/base/changePassword.php13
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/accountInfo.php94
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/base/base.php19
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/createAccount.php19
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/createGroup.php16
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/download.php108
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/groupInfo.php38
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/search/searchAccount.php37
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/search/searchGroup.php34
-rw-r--r--mayor-orig/mayor-base/www/include/modules/session/sessionAdmin.php24
13 files changed, 608 insertions, 0 deletions
diff --git a/mayor-orig/mayor-base/www/include/modules/auth/base/forgotten.php b/mayor-orig/mayor-base/www/include/modules/auth/base/forgotten.php
new file mode 100644
index 00000000..16571855
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/auth/base/forgotten.php
@@ -0,0 +1,53 @@
+<?php
+
+ function generatePasswordRecoveryRequest($accountData) {
+
+ $URL = 'https://'.$_SERVER['SERVER_NAME'].'/index.php?page=password&f=resetPassword&';
+
+ if (version_compare(PHP_VERSION,'5.3.0')>=0) {
+ $selector = bin2hex(openssl_random_pseudo_bytes(8));
+ $token = openssl_random_pseudo_bytes(32);
+ } elseif (version_compare(PHP_VERSION,'7.0.0')>=0) {
+ $selector = bin2hex(random_bytes(8));
+ $token = random_bytes(32);
+ } else {
+ return false; // nem támogatjuk
+ }
+ $urlToEmail = href($URL.http_build_query(array(
+ 'selector' => $selector,
+ 'validator' => bin2hex($token)
+ ),'','&'));
+
+ $expires = new DateTime('NOW');
+ $expires->add(new DateInterval('PT01H')); // 1 hour
+
+ // rate limiting és karbantartás
+ $lr = db_connect('login');
+ db_start_trans($lr);
+
+ $q = "DELETE FROM accountRecovery WHERE expires <= NOW() - INTERVAL 10 DAY";
+ db_query($q, array('debug'=>false,'fv' => 'generatePasswordRecoveryRequest', 'modul'=>'login', 'result'=>'delete'),$lr);
+
+ $q = "SELECT count(*) as db FROM accountRecovery WHERE policy='%s' AND userAccount='%s'";
+ $v = array($accountData['policy'], $accountData['userAccount']);
+ $recoveryRequestDb = db_query($q, array('debug'=>false,'fv' => 'generatePasswordRecoveryRequest', 'modul'=>'login', 'result'=>'value', 'values'=>$v),$lr);
+
+ if ($recoveryRequestDb<5) {
+ $q = "INSERT INTO accountRecovery (policy, userAccount, selector, token, expires) VALUES ('%s', '%s', '%s', '%s', '%s');";
+ $v = array($accountData['policy'], $accountData['userAccount'],
+ $selector,
+ hash('sha256', $token),
+ $expires->format('Y-m-d\TH:i:s'));
+ $recoveryId = db_query($q, array('debug'=>false,'fv' => 'generatePasswordRecoveryRequest', 'modul'=>'login', 'result'=>'insert', 'values'=>$v),$lr);
+ } else {
+ return false;
+ }
+ db_commit($lr);
+ db_close($lr);
+
+ if ($recoveryId !== false) return $urlToEmail;
+ else return false;
+
+ }
+
+?> \ No newline at end of file
diff --git a/mayor-orig/mayor-base/www/include/modules/auth/base/login.php b/mayor-orig/mayor-base/www/include/modules/auth/base/login.php
new file mode 100644
index 00000000..f9cb3a2d
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/auth/base/login.php
@@ -0,0 +1,37 @@
+<?php
+
+ function userAuthentication($userAccount, $userPassword, &$accountInformation, $toPolicy) {
+ global $AUTH;
+ require_once('include/share/auth/base.php');
+
+ if (file_exists('include/backend/'.$AUTH[$toPolicy]['backend'].'/auth/login.php')) {
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/auth/login.php');
+ } else {
+ throw new Exception('Fatal Error');
+ }
+
+ //$x = call_user_func( str_replace('-','_',$AUTH[$toPolicy]['backend'])."UserAuthentication",$userAccount, $userPassword, $accountInformation, $toPolicy);
+ switch ($AUTH[$toPolicy]['backend']) {
+ case 'mysql':
+ $r = mysqlUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ case 'ldap':
+ $r = ldapUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ case 'ldap-ng':
+ $r = ldap_ngUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ case 'ldapng':
+ $r = ldapngUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ case 'ads':
+ $r = adsUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ case 'file':
+ $r = fileUserAuthentication($userAccount, $userPassword, $accountInformation, $toPolicy);
+ break;
+ }
+ return $r;
+ }
+
+?> \ No newline at end of file
diff --git a/mayor-orig/mayor-base/www/include/modules/auth/base/token.php b/mayor-orig/mayor-base/www/include/modules/auth/base/token.php
new file mode 100644
index 00000000..72cbcffb
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/auth/base/token.php
@@ -0,0 +1,116 @@
+<?php
+
+ function generateAuthToken($accountData) {
+
+ if (!defined('AUTHTOKENENABLED') || AUTHTOKENENABLED!==true) return false;
+
+ if (version_compare(PHP_VERSION,'5.3.0')>=0) {
+ $selector = bin2hex(openssl_random_pseudo_bytes(8));
+ $token = openssl_random_pseudo_bytes(32);
+ } elseif (version_compare(PHP_VERSION,'7.0.0')>=0) {
+ $selector = bin2hex(random_bytes(8));
+ $token = random_bytes(32);
+ } else {
+ return false; // nem támogatjuk
+ }
+
+ if (isset($_COOKIE['t_selector'])===true && isset($_COOKIE['t_validator'])===true) return true; // már van selector/validator elmentve
+
+ $lr = db_connect('login');
+ db_start_trans($lr);
+
+ $q = "DELETE FROM authToken WHERE expires <= NOW() - INTERVAL 10 DAY";
+ db_query($q, array('debug'=>false,'fv' => 'na', 'modul'=>'login', 'result'=>'delete'),$lr);
+
+ $q = "INSERT INTO authToken (policy, userAccount,
+ userCn, studyId,
+ selector, token, expires, activity, ipAddress) VALUES ('%s', '%s', '%s', '%s', '%s','%s',NOW() + INTERVAL 30 DAY,NOW(),'%s')";
+ $v = array($accountData['policy'], $accountData['userAccount'],
+ $accountData['userCn'], $accountData['studyId'],
+ $selector,
+ hash('sha256', $token),
+ CLIENTIPADDRESS
+ );
+ $Id = db_query($q, array('debug'=>false,'fv' => 'na', 'modul'=>'login', 'result'=>'insert', 'values'=>$v),$lr);
+ db_commit($lr);
+ db_close($lr);
+
+ if ($Id !== false) {
+ setcookie('t_selector',$selector,time()+604800*5,'/','',TRUE,TRUE);
+ setcookie('t_validator',bin2hex($token),time()+604800*5,'/','',TRUE,TRUE);
+ $_SESSION['mayorapiauth'] = true;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function unsetTokenCookies() { // + MS_*
+ $selector = readVariable($_COOKIE['t_selector'], 'string', readVariable($_GET['t_selector'], 'hexa', null));
+ if ($selector!='') {
+ $q = "DELETE FROM authToken WHERE selector='%s'";
+ $values = array($selector);
+ db_query($q, array('debug'=>false,'fv' => 'na', 'modul'=>'login', 'result'=>'delete', 'values'=>$values),$lr);
+ }
+ setcookie('t_selector','',time() - 3600,'/','',TRUE,TRUE);
+ setcookie('t_validator','',time() - 3600,'/','',TRUE,TRUE);
+ if (is_array($_COOKIE)) {
+ foreach($_COOKIE as $key => $value) {
+ if (substr($key,0,3) == 'MS_') {
+ setcookie($key,'',time() - 3600,'/','',TRUE,TRUE);
+ }
+ }
+ }
+ $_SESSION['mayorapiauth'] = false;
+ }
+
+ function mayorApiAuth() {
+
+ // $MAYORAPIDATA tömb feltöltése
+ $selector = readVariable($_COOKIE['t_selector'], 'string', readVariable($_GET['t_selector'], 'hexa', null));
+ $validator = readVariable($_COOKIE['t_validator'], 'string', readVariable($_GET['t_validator'], 'hexa', null));
+ if ($selector!='' && $validator!='') {
+ $q = "SELECT * FROM authToken WHERE selector = '%s' AND expires >= NOW()";
+ $r = db_query($q, array('fv'=>'rights/xltoken','modul'=>'login','result'=>'record','values'=>array($selector)));
+ }
+ if (is_array($r)) {
+ $calc = hash('sha256', hex2bin($validator));
+ if (hash_equals($calc, $r['token'])) { // valid token
+ global $sessionMode;
+ $sessionMode = 2;
+ // reauth AS:
+ $toPolicy = $r['policy'];
+ $userAccount = $r['userAccount'];
+ $userCn = $r['userCn'];
+ $studyId = $r['studyId'];
+ $userPassword = ''; // ???
+ $lang = _DEFAULT_LANG;
+ $data = $r;
+ $_SESSION['mayorapiauth'] = true;
+ $q = "UPDATE authToken SET activity=NOW(), ipAddress='%s' WHERE selector = '%s'";
+ $v = array(CLIENTIPADDRESS,$selector);
+ db_query($q, array('fv'=>'rights/xltoken','modul'=>'login','result'=>'update','values'=>$v));
+ return array('userAccount'=>$data['userAccount'],'toPolicy'=>$data['policy'],'studyId'=>$data['studyId'],'userCn'=>$data['userCn'],'valid'=>true);
+ } else {
+ unsetTokenCookies();
+ }
+ } else {
+ unsetTokenCookies();
+ }
+ return false;
+ }
+
+ function getMyActivity() {
+ $q = "SELECT ipAddress,activity FROM authToken WHERE userAccount ='%s' AND policy='%s'";
+ $v = array(_USERACCOUNT,_POLICY);
+ return db_query($q, array('fv'=>'rights/getMyActivity','modul'=>'login','result'=>'indexed','values'=>$v));
+ }
+
+ function revokeTokens() {
+ unsetTokenCookies();
+ $q = "DELETE FROM authToken WHERE userAccount ='%s' AND policy='%s'";
+ $v = array(_USERACCOUNT,_POLICY);
+ return db_query($q, array('fv'=>'rights/revokeTokens','modul'=>'login','result'=>'delete','values'=>$v));
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/password/base/changePassword.php b/mayor-orig/mayor-base/www/include/modules/password/base/changePassword.php
new file mode 100644
index 00000000..b2233303
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/password/base/changePassword.php
@@ -0,0 +1,13 @@
+<?php
+/*
+ Module: base/password
+*/
+
+// changeMyPassword-pre.php - kikommentezve - mindenképp újra bejelentkezünk
+// function updateSessionPassword($userAccount, $policy, $newPassword) {
+ //$q = "UPDATE session SET userPassword=encode('%s','"._MYSQL_ENCODE_STR."') WHERE userAccount='%s' AND policy='%s'";
+ //$v = array($newPassword, $userAccount, $policy);
+ //return db_query($q, array('fv' => 'updateSessionPassword', 'modul' => 'login', 'values' => $v));
+// }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/accountInfo.php b/mayor-orig/mayor-base/www/include/modules/session/accountInfo.php
new file mode 100644
index 00000000..b14a8edb
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/accountInfo.php
@@ -0,0 +1,94 @@
+<?php
+/*
+ Modules: base/session
+
+ share --> function getAccountInfo($userAccount, $toPolicy = '') {
+ share --> function getUserInfo($userAccount, $toPolicy = '') {
+ function changeAccountInfo($userAccount, $toPolicy = '') {
+*/
+
+ require('include/share/session/accountInfo.php');
+
+###########################################################
+# changeAccountInfo - felhasználói információk módosítása
+###########################################################
+
+ function changeAccountInfo($userAccount, $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/accountInfo.php');
+ $func = $AUTH[$toPolicy]['backend'].'ChangeAccountInfo';
+ return $func($userAccount, $toPolicy);
+
+
+ }
+
+ function getUserSettings($userAccount,$toPolicy = _POLICY) {
+
+ $q = "SELECT * FROM settings WHERE userAccount='%s' AND policy='%s'";
+ $res = db_query($q, array('modul'=>'login','values'=>array($userAccount,$toPolicy), 'result'=>'record'));
+ return $res;
+
+ }
+
+ function setUserSettings($userAccount,$toPolicy,$ADAT) {
+
+ if (!isset($ADAT['skin']) || $ADAT['skin']=='') {
+ $q = "UPDATE settings SET skin=NULL WHERE userAccount='%s' AND policy='%s'";
+ $res = db_query($q, array('modul'=>'login','values'=>array($userAccount,$toPolicy)));
+ } else {
+ $q = "UPDATE settings SET skin='%s' WHERE userAccount='%s' AND policy='%s'";
+ $res = db_query($q, array('modul'=>'login','values'=>array($ADAT['skin'],$userAccount,$toPolicy)));
+ }
+ return $res;
+
+ }
+
+ function setEduroamRecord($ADAT) {
+
+ // ALTER TABLE eduroam ADD UNIQUE INDEX (userAccount,policy);
+ // ALTER TABLE eduroam ADD UNIQUE INDEX (eduroamUID);
+ // https://wiki.niif.hu/index.php?title=Sulinet_felhaszn%C3%A1l%C3%B3k_t%C3%B6meges_felvitele
+
+ $q = "UPDATE eduroam SET eduroamPASSWORD='%s', modositasDt = NOW() WHERE userAccount='%s' AND policy='%s'";
+ $res = db_query($q, array('modul'=>'login','values'=>array($ADAT['eduroamPASSWORD'],$userAccount,$toPolicy)));
+
+ }
+
+ function createEduroamSettings($ADAT) {
+
+ $q = "INSERT INTO eduroam (userAccount,policy,eduroamUID,eduroamPASSWORD,eduroamAFFILIATION,eduroamDOMAIN)
+ VALUES ('%s','%s','%s','%s','%s','%s')";
+ $values = array(
+ $ADAT['userAccount'],
+ $ADAT['policy'],
+ $ADAT['eduroamUID'],
+ $ADAT['eduroamPASSWORD'],
+ $ADAT['eduroamAFFILIATION'],
+ $ADAT['eduroamDOMAIN'],
+ );
+ $res = db_query($q, array('modul'=>'login','values'=>$values));
+ return $res;
+ }
+
+ function getEduroamSettings($userAccount,$toPolicy,$ADAT) {
+
+ $res = false;
+ if (_ACCESS_AS == _ADMIN_ACCESS) {
+ $userAccoungt = ($userAccount);
+ $toPolicy = ($toPolicy);
+ } else {
+ $userAccount = (_USERACCOUNT);
+ $toPolicy = (_POLICY);
+ }
+
+ if ($toPolicy == 'private') {
+ $q = "SELECT * FROM eduroam WHERE userAccount='%s' AND policy='%s'";
+ $res = db_query($q, array('modul'=>'login','values'=>array($userAccount,$toPolicy), 'result'=>'record'));
+ }
+ return $res;
+
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/base/base.php b/mayor-orig/mayor-base/www/include/modules/session/base/base.php
new file mode 100644
index 00000000..efc39324
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/base/base.php
@@ -0,0 +1,19 @@
+<?php
+/*
+ Module: base/session
+*/
+
+ // Attribútumok nyelvi konstansai
+
+ if (file_exists('lang/'.$lang.'/share/session/attrs.php')) {
+ require('lang/'.$lang.'/share/session/attrs.php');
+ } elseif (file_exists('lang/'._DEFAULT_LANG.'/share/session/attrs.php')) {
+ require('lang/'._DEFAULT_LANG.'/share/session/attrs.php');
+ }
+
+ // Attribútum információk
+ if (file_exists('include/share/session/attrs.php')) {
+ require('include/share/session/attrs.php');
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/createAccount.php b/mayor-orig/mayor-base/www/include/modules/session/createAccount.php
new file mode 100644
index 00000000..6222ed76
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/createAccount.php
@@ -0,0 +1,19 @@
+<?php
+/*
+ Modules: base/session
+*/
+
+ function createAccount($userCn, $userAccount, $userPassword, $toPolicy = _POLICY, $SET = array('category' => null, 'container' => null, 'groups' => '', 'policyAttrs' => array())) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/createAccount.php');
+ $func = $AUTH[$toPolicy]['backend'].'CreateAccount';
+ $r = $func($userCn, $userAccount, $userPassword, $toPolicy, $SET);
+ $_SESSION['lastCreatedAccount'] = $userAccount;
+
+ return $r;
+
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/createGroup.php b/mayor-orig/mayor-base/www/include/modules/session/createGroup.php
new file mode 100644
index 00000000..69b2bb45
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/createGroup.php
@@ -0,0 +1,16 @@
+<?php
+/*
+ Modules: base/session
+*/
+
+ function createGroup($groupCn, $groupDesc, $toPolicy = _POLICY, $SET = array('category' => null, 'container' => null, 'policyAttrs' => array())) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/createGroup.php');
+ $func = $AUTH[$toPolicy]['backend'].'CreateGroup';
+ return $func($groupCn, $groupDesc, $toPolicy, $SET);
+
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/download.php b/mayor-orig/mayor-base/www/include/modules/session/download.php
new file mode 100644
index 00000000..47d3bdb7
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/download.php
@@ -0,0 +1,108 @@
+<?php
+
+ $allowedExtensions = array(
+
+ // archives
+ 'zip' => 'application/zip',
+ 'tgz' => 'application/tar',
+
+ // documents
+ 'pdf' => 'application/pdf',
+ 'doc' => 'application/msword',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ 'csv' => 'application/vnd.ms-excel',
+ 'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
+
+ // executables
+ 'exe' => 'application/octet-stream',
+
+ // text
+ 'xml' => 'text/xml',
+
+ // images
+ 'gif' => 'image/gif',
+ 'png' => 'image/png',
+ 'jpg' => 'image/jpeg',
+ 'jpeg' => 'image/jpeg',
+
+ // audio
+ 'mp3' => 'audio/mpeg',
+ 'wav' => 'audio/x-wav',
+
+ // video
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'mov' => 'video/quicktime',
+ 'avi' => 'video/x-msvideo'
+ );
+
+ $allowedMimeTypes = array(
+ 'application/zip',
+ 'application/tar',
+ 'application/pdf',
+ 'application/msword',
+ 'application/vnd.ms-excel',
+ 'application/vnd.ms-powerpoint',
+ 'application/octet-stream',
+ 'text/xml',
+ 'image/gif',
+ 'image/png',
+ 'image/jpeg',
+ 'audio/mpeg',
+ 'audio/x-wav',
+ 'video/mpeg',
+ 'video/quicktime',
+ 'video/x-msvideo',
+ 'application/vnd.oasis.opendocument.spreadsheet'
+ );
+
+ function passFile($ADAT) {
+ if (in_array($ADAT['ext'],array('jpg','jpeg','png'))) passFile_image($ADAT);
+ else passFile_other($ADAT);
+ die();
+ }
+
+ function passFile_image($ADAT) {
+ ob_clean();
+ ignore_user_abort(true);
+ set_time_limit(0);
+ // Getting headers sent by the client.
+ $headers = apache_request_headers();
+ $fn = $ADAT['path'] ;
+ // Checking if the client is validating his cache and if it is current.
+ if (isset($headers['If-Modified-Since']) && (strtotime($headers['If-Modified-Since']) == filemtime($fn))) {
+ // Client's cache IS current, so we just respond '304 Not Modified'.
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($fn)).' GMT', true, 304);
+ header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('+10 day')).' GMT', true);
+ header("Cache-Control: max-age=604800, public", true);
+ header("Pragma: public", true);
+ } else {
+ header("Pragma: public", true);
+ header("Cache-Control: max-age=604800, public", true);
+ header('Last-Modified: '.gmdate('D, d M Y H:i:s', filemtime($fn)).' GMT', true, 200);
+ header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('+10 day')).' GMT', true);
+ header("Content-Length: " . $ADAT['size'], true);
+ header('Content-type: '.$ADAT['mime'], true);
+ echo file_get_contents($fn);
+ }
+ }
+
+ function passFile_other($ADAT) {
+ ob_clean();
+ header('Content-type: '.$ADAT['mime']);
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
+ header("Content-Description: File Transfer");
+ header("Content-Type: ".$ADAT['mime']);
+ if (!isset($ADAT['pure'])) // akkor force download as
+ header('Content-Disposition: attachment; filename="'.$ADAT['file'].'"');
+ header("Content-Transfer-Encoding: binary");
+ header("Content-Length: " . $ADAT['size']);
+ echo file_get_contents($ADAT['path']);
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/groupInfo.php b/mayor-orig/mayor-base/www/include/modules/session/groupInfo.php
new file mode 100644
index 00000000..fd46afee
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/groupInfo.php
@@ -0,0 +1,38 @@
+<?php
+/*
+ Modules: base/session
+
+ function getGroupInfo($groupCn, $toPolicy = '') {
+ function changeGroupInfo($userAccount, $toPolicy = '') {
+*/
+
+######################################################
+# getGroupInfo - csoport információk (backend)
+######################################################
+
+ function getGroupInfo($groupCn, $toPolicy = _POLICY, $SET = array('withNewAccounts' => true)) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/accountInfo.php');
+ $func = $AUTH[$toPolicy]['backend'].'GetGroupInfo';
+ return $func($groupCn, $toPolicy, $SET);
+
+
+ }
+
+###########################################################
+# changeGroupInfo - csoport információk módosítása
+###########################################################
+
+ function changeGroupInfo($groupCn, $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/accountInfo.php');
+ $func = $AUTH[$toPolicy]['backend'].'ChangeGroupInfo';
+ return $func($groupCn, $toPolicy);
+
+
+ }
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/search/searchAccount.php b/mayor-orig/mayor-base/www/include/modules/session/search/searchAccount.php
new file mode 100644
index 00000000..796a7423
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/search/searchAccount.php
@@ -0,0 +1,37 @@
+<?php
+/*
+ Module: base/session
+*/
+
+##############################################################
+# searchAccount - felhasználó kereső függvény
+##############################################################
+
+
+ function searchAccount($attr, $pattern, $searchAttrs = array('userCn'), $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/search/searchAccount.php');
+ $func = $AUTH[$toPolicy]['backend'].'SearchAccount';
+
+ return $func($attr, $pattern, $searchAttrs, $toPolicy);
+
+ }
+
+##############################################################
+# deleteAccount - felhasználó törlése
+##############################################################
+
+ function deleteAccount($userAccount, $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/search/searchAccount.php');
+ $func = $AUTH[$toPolicy]['backend'].'DeleteAccount';
+ return $func($userAccount, $toPolicy);
+
+ }
+
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/search/searchGroup.php b/mayor-orig/mayor-base/www/include/modules/session/search/searchGroup.php
new file mode 100644
index 00000000..f44f9aa2
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/search/searchGroup.php
@@ -0,0 +1,34 @@
+<?php
+/*
+ Module: base/session
+*/
+
+##############################################################
+# searchGroup - csoport kereső függvény
+##############################################################
+
+ function searchGroup($attr, $pattern, $searchAttrs = array('groupCn, groupDesc'), $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/search/searchAccount.php');
+ $func = $AUTH[$toPolicy]['backend'].'SearchGroup';
+ return $func($attr, $pattern, $searchAttrs, $toPolicy);
+
+ }
+
+##############################################################
+# deleteGroup - csoport torlese
+##############################################################
+
+ function deleteGroup($groupCn, $toPolicy = _POLICY) {
+
+ global $AUTH;
+
+ require_once('include/backend/'.$AUTH[$toPolicy]['backend'].'/session/search/searchAccount.php');
+ $func = $AUTH[$toPolicy]['backend'].'DeleteGroup';
+ return $func($groupCn, $toPolicy);
+
+ }
+
+?>
diff --git a/mayor-orig/mayor-base/www/include/modules/session/sessionAdmin.php b/mayor-orig/mayor-base/www/include/modules/session/sessionAdmin.php
new file mode 100644
index 00000000..ff3e99b8
--- /dev/null
+++ b/mayor-orig/mayor-base/www/include/modules/session/sessionAdmin.php
@@ -0,0 +1,24 @@
+<?php
+
+ function getSessions() {
+
+ $W = array();
+ if (intval(_SESSION_MAX_TIME) != 0) $W[] = "dt + INTERVAL ".intval(_SESSION_MAX_TIME)." HOUR > NOW()";
+ if (intval(_SESSION_MAX_IDLE_TIME) != 0) $W[] = "activity + INTERVAL ".intval(_SESSION_MAX_IDLE_TIME)." HOUR > NOW()";
+ $q = "SELECT userAccount,dt,policy,sessionID,userCn,studyId,skin,lang,activity,sessionCookie,ip FROM session LEFT JOIN loginLog USING (policy,userAccount,dt)";
+ if (count($W) > 0) $q .= " WHERE ".implode(' AND ', $W);
+ $q .= " ORDER BY activity DESC";
+
+ $ret = db_query($q, array('fv' => 'getSessions', 'modul' => 'login', 'result' => 'indexed'));
+ return $ret;
+ }
+
+ function deleteSession($sessionID, $policy) {
+
+ $q = "DELETE FROM session WHERE sessionID='%s' AND policy='%s'";
+ $v = array($sessionID, $policy);
+ return db_query($q, array('fv' => 'deleteSession','modul' => 'login', 'values' => $v));
+
+ }
+
+?>