ILIAS
Release_4_1_x_branch Revision 61804
◀ ilDoc Overview
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
Examples
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Groups
Pages
class.ilCalendarRemoteAccessHandler.php
Go to the documentation of this file.
1
<?php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
24
include_once
'./Services/Calendar/classes/class.ilCalendarAuthenticationToken.php'
;
25
34
class
ilCalendarRemoteAccessHandler
35
{
36
private
$token_handler
= null;
37
42
public
function
__construct
()
43
{
44
}
45
46
public
function
getTokenHandler
()
47
{
48
return
$this->token_handler
;
49
}
50
55
public
function
parseRequest
()
56
{
57
if
(
$_GET
[
'client_id'
])
58
{
59
$_COOKIE
[
'ilClientId'
] =
$_GET
[
'client_id'
];
60
61
}
62
else
63
{
64
$path_info_components
= explode(
'/'
,$_SERVER[
'PATH_INFO'
]);
65
$_COOKIE
[
'ilClientId'
] =
$path_info_components
[1];
66
}
67
}
68
73
public
function
handleRequest
()
74
{
75
$this->
initIlias
();
76
$this->
initTokenHandler
();
77
78
if
($this->
getTokenHandler
()->getIcal() and !$this->
getTokenHandler
()->isIcalExpired())
79
{
80
echo $this->
getTokenHandler
()->getIcal();
81
exit
;
82
}
83
84
include_once
'./Services/Calendar/classes/Export/class.ilCalendarExport.php'
;
85
include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php'
;
86
87
$cats =
ilCalendarCategories::_getInstance
();
88
$cats->initialize(
ilCalendarCategories::MODE_REMOTE_ACCESS
);
89
$export =
new
ilCalendarExport
($cats->getCategories());
90
$export->
export
();
91
92
$this->
getTokenHandler
()->setIcal($export->getExportString());
93
$this->
getTokenHandler
()->storeIcal();
94
95
echo $export->getExportString();
96
#echo nl2br($export->getExportString());
97
98
#$fp = fopen('ilias.ics', 'w');
99
#fwrite($fp,$export->getExportString());
100
$GLOBALS
[
'ilAuth'
]->logout();
101
exit
;
102
}
103
104
protected
function
initTokenHandler
()
105
{
106
$this->token_handler =
new
ilCalendarAuthenticationToken
(
107
ilCalendarAuthenticationToken::lookupUser
(
$_GET
[
'token'
]),
108
$_GET
[
'token'
]
109
);
110
return
true
;
111
}
112
113
protected
function
initIlias
()
114
{
115
include_once
'./Services/Authentication/classes/class.ilAuthFactory.php'
;
116
ilAuthFactory::setContext
(
ilAuthFactory::CONTEXT_CALENDAR_TOKEN
);
117
118
$_POST
[
'username'
] =
'cal_auth_token'
;
119
$_POST
[
'password'
] =
'cal_auth_token'
;
120
121
include_once(
"Services/Init/classes/class.ilInitialisation.php"
);
122
$GLOBALS
[
'ilInit'
] =
new
ilInitialisation
();
123
$GLOBALS
[
'ilInit'
]->initILIAS();
124
$GLOBALS
[
'lng'
]->loadLanguageModule(
'dateplaner'
);
125
}
126
}
127
?>
Services
Calendar
classes
class.ilCalendarRemoteAccessHandler.php
Generated on Thu Apr 21 2016 19:02:42 for ILIAS by
1.8.1.2 (using
Doxyfile
)