aboutsummaryrefslogtreecommitdiffstats
path: root/mayor-orig/mayor-base/www/include/modules/session/accountInfo.php
blob: b14a8edb2cb5ebfabd0dc747bfced68bc492bd31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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;

    }

?>