Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117758062
kolab.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
kolab.php
View Options
<?php
/*
* Kolab integration plugin for Roundcube webmail.
*
* @author Aleksander Machniak <machniak@apheleia-it.ch>
*
* Copyright (C) Apheleia IT AG <contact@apheleia-it.ch>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class
kolab
extends
rcube_plugin
{
private
$features
=
[
'Kolab
\A
ddresses'
,
'Kolab
\C
ockpitLink'
,
'Kolab
\C
onfiguration'
,
'Kolab
\C
ontacts'
,
'Kolab
\D
elegation'
,
'Kolab
\H
elpdesk'
,
'Kolab
\U
sers'
,
];
/**
* Plugin initialization
*/
public
function
init
()
{
// register autoloader for included classes
spl_autoload_register
([
$this
,
'autoloader'
]);
$this
->
add_hook
(
'startup'
,
[
$this
,
'startupHook'
]);
$this
->
add_hook
(
'login_after'
,
[
$this
,
'loginAfterHook'
]);
// Load features and let them do the whole work
foreach
(
$this
->
features
as
$feature_class
)
{
$feature
=
new
$feature_class
(
$this
);
$feature
->
init
();
}
}
/**
* PHP5 autoloader routine for dynamic class loading
*/
public
function
autoloader
(
string
$classname
):
bool
{
if
(
str_starts_with
(
$classname
,
"Kolab
\\
"
))
{
$classname
=
str_replace
(
"
\\
"
,
'/'
,
$classname
);
$filepath
=
"{$this->home}/{$classname}.php"
;
if
(
is_readable
(
$filepath
))
{
include_once
$filepath
;
return
true
;
}
}
return
false
;
}
/**
* Handler for 'startup' hook
*/
public
function
startupHook
(
$args
):
array
{
// Read the plugin config, we try to not do this in init()
$this
->
load_config
();
// Load localization
$this
->
add_texts
(
'localization/'
,
false
);
return
$args
;
}
/**
* Handler for 'login_after' hook
*/
public
function
loginAfterHook
(
$args
):
array
{
// This is the best moment to clear the client cache
Kolab\Client
::
cacheClear
();
// Handle client timezone argument in SSO return from Cockpit
// @TODO: We could also pass timezone via a claim in the OAuth token
// Note: It is currently possible to get the client timezone only because we load
// Cockpit page during the SSO redirect. If we change that (e.g. if we use cookies instead of browser storage,
// which might be useful for better responsiveness) detecting timezone will not be possible.
if
(!
empty
(
$_SESSION
[
'oauth_token'
]))
{
$timezone
=
\rcube_utils
::
get_input_string
(
'timezone'
,
\rcube_utils
::
INPUT_GPC
);
if
(
$timezone
&&
preg_match
(
'|^[a-z0-9/_+-]+$|i'
,
$timezone
))
{
$_SESSION
[
'timezone'
]
=
$timezone
;
}
}
return
$args
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Apr 4, 9:35 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823481
Default Alt Text
kolab.php (3 KB)
Attached To
Mode
rRPK roundcubemail-plugins-kolab
Attached
Detach File
Event Timeline