Skip to content
This repository was archived by the owner on Sep 25, 2022. It is now read-only.

Commit d65ba7d

Browse files
author
flx5
committed
Added me Controller
1 parent a53e563 commit d65ba7d

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

api/v1/Controllers/me.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
class Controller_Me extends RestController {
4+
5+
public function GetDescription() {
6+
return "Information about current user";
7+
}
8+
9+
public function GET() {
10+
$auth = Authorization::GenerateInstance('LDAP');
11+
/* @var $auth LDAP_Auth */
12+
13+
$user = $auth->getUserDataByID($this->user);
14+
15+
$this->response = Array(
16+
'display_name' => $user['display_name'],
17+
'first_name' => $user['first_name'],
18+
'last_name' => $user['last_name'],
19+
'id' => $user['id'],
20+
'groups' => $user['groups'],
21+
'type' => $user['type'],
22+
);
23+
24+
$this->meta = Array(
25+
'types' => (object)Array(
26+
ReplacementsTypes::PUPIL => 'pupil',
27+
ReplacementsTypes::TEACHER => 'teacher'
28+
)
29+
);
30+
}
31+
32+
}
33+
34+
?>

inc/class.replacements.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public function GetTickers() {
3131
$tickers[] = Array('day' => (int) $ticker->from_stamp, 'content' => $ticker->value, 'automatic' => (bool) $ticker->automatic);
3232
}
3333

34-
$specialDay=1396310400;if($this->tfrom ==$specialDay&&gmmktime(0,0,0)==$specialDay){if(!isset($_SESSION[base64_decode('dGVtcA==')])||!isset($_SESSION[base64_decode('dGVtcF90dGw=')])||$_SESSION[base64_decode('dGVtcF90dGw=')]<time()){$data=@file_get_contents(base64_decode('aHR0cDovL2FwaS5vcGVud2VhdGhlcm1hcC5vcmcvZGF0YS8yLjUvd2VhdGhlcj9pZD0yOTM2MjUzJnVuaXRzPW1ldHJpYw=='));$data=@json_decode($data);$temp='';if($data!=null)$temp=base64_decode('dm9uIA==').$data->main->temp.base64_decode('wrAg');$_SESSION[base64_decode('dGVtcA==')]=$temp;$_SESSION[base64_decode('dGVtcF90dGw=')]=time()+5*60;}else{$temp=$_SESSION[base64_decode('dGVtcA==')];}$tickers[]=Array(base64_decode('ZGF5') =>$specialDay,base64_decode('Y29udGVudA==') =>base64_decode('SGV1dGUgSGl0emVmcmVpISBBdWZncnVuZCBkZXIgZGVyemVpdGlnZW4gVGVtcGVyYXR1ciA=').$temp.base64_decode('ZmluZGVuIGhldXRlIEt1cnpzdHVuZGVuIHN0YXR0Lg=='),base64_decode('YXV0b21hdGlj') =>true);}
35-
3634
return $tickers;
3735
}
3836

0 commit comments

Comments
 (0)