diff options
Diffstat (limited to 'mayor-orig/www/include/modules/session')
9 files changed, 343 insertions, 0 deletions
diff --git a/mayor-orig/www/include/modules/session/accountInfo.php b/mayor-orig/www/include/modules/session/accountInfo.php new file mode 100644 index 00000000..4b1521d0 --- /dev/null +++ b/mayor-orig/www/include/modules/session/accountInfo.php @@ -0,0 +1,48 @@ +<?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; + + } + +?> diff --git a/mayor-orig/www/include/modules/session/base/base.php b/mayor-orig/www/include/modules/session/base/base.php new file mode 100644 index 00000000..efc39324 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/createAccount.php b/mayor-orig/www/include/modules/session/createAccount.php new file mode 100644 index 00000000..6222ed76 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/createGroup.php b/mayor-orig/www/include/modules/session/createGroup.php new file mode 100644 index 00000000..69b2bb45 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/download.php b/mayor-orig/www/include/modules/session/download.php new file mode 100644 index 00000000..47d3bdb7 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/groupInfo.php b/mayor-orig/www/include/modules/session/groupInfo.php new file mode 100644 index 00000000..fd46afee --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/search/searchAccount.php b/mayor-orig/www/include/modules/session/search/searchAccount.php new file mode 100644 index 00000000..796a7423 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/search/searchGroup.php b/mayor-orig/www/include/modules/session/search/searchGroup.php new file mode 100644 index 00000000..f44f9aa2 --- /dev/null +++ b/mayor-orig/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/www/include/modules/session/sessionAdmin.php b/mayor-orig/www/include/modules/session/sessionAdmin.php new file mode 100644 index 00000000..ff3e99b8 --- /dev/null +++ b/mayor-orig/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)); + + } + +?> |