mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
Fix loading login json file
This commit is contained in:
parent
39eef44217
commit
faadfbdc23
16
api/setup/login.json
Normal file
16
api/setup/login.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"apps": {
|
||||||
|
"admin": {"title":"Admin","icon":"/admin/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"mail": {"title":"Mail","icon":"/mail/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"kanban": {"title":"Kanban","icon":"/kanban/templates/default/images/navbar.svg","desc":""},
|
||||||
|
"timesheet": {"title":"Timesheet","icon":"/timesheet/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"calendar": {"title":"Calendar","icon":"/calendar/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"smallpart": {"title":"SmallPart","icon":"/smallpart/templates/default/images/navbar.svg","desc":""},
|
||||||
|
"infolog": {"title":"Infolog","icon":"/infolog/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"tracker": {"title":"Tracker","icon":"/tracker/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"rocketchat": {"title":"Rocket.Chat","icon":"/rocketchat/templates/default/images/navbar.svg","desc":""},
|
||||||
|
"videoconference": {"title":"Videoconference","icon":"/status/templates/pixelegg/images/videoconference.svg","desc":""},
|
||||||
|
"addressbook": {"title":"Addressbook","icon":"/addressbook/templates/pixelegg/images/navbar.svg","desc":""},
|
||||||
|
"projectmanager": {"title":"Projectmanager","icon":"/projectmanager/templates/pixelegg/images/navbar.svg","desc":""}
|
||||||
|
}
|
||||||
|
}
|
@ -304,17 +304,25 @@ class Login
|
|||||||
*/
|
*/
|
||||||
static function get_apps_node()
|
static function get_apps_node()
|
||||||
{
|
{
|
||||||
$object = json_decode(file_get_contents('https://laklak.egroupware.org/egroupware/login_feed.json'), true);
|
if (!($json = Api\Cache::getCache(Api\Cache::TREE, __CLASS__, 'egw_login_json')))
|
||||||
$apps = []; //TODO: set what we want to dispaly for instances with no access to outside
|
|
||||||
$nodes = '';
|
|
||||||
if (is_array($object))
|
|
||||||
{
|
{
|
||||||
$apps = (is_array($object['apps'])) ? $object['apps'] : $apps;
|
$json = file_get_contents('https://www.egroupware.org/egw_login_feed.json',
|
||||||
|
false, Api\Framework::proxy_context());
|
||||||
|
// Fallback login.json
|
||||||
|
if (!$json) $json = file_get_contents('api/setup/login.json');
|
||||||
|
// Cache the json object for a day
|
||||||
|
Api\Cache::setCache(Api\Cache::TREE, __CLASS__, 'egw_login_json', $json, 86400);
|
||||||
}
|
}
|
||||||
foreach ($apps as $app)
|
$data = json_decode($json, true);
|
||||||
|
$nodes = '';
|
||||||
|
if (is_array($data))
|
||||||
{
|
{
|
||||||
$nodes .= '<a class="app" href="'.htmlspecialchars($app['url']).'" title="'.htmlspecialchars(lang($app['title'])).'">'
|
foreach ($data['apps'] as $app)
|
||||||
.'<img src="'.htmlspecialchars($app['icon']).'"/><span>'.htmlspecialchars($app['desc']).'</span></a>';
|
{
|
||||||
|
$icon = strpos($app['icon'], "/") === 0 ? $GLOBALS['egw_info']['server']['webserver_url'].$app['icon'] : $app['icon'];
|
||||||
|
$nodes .= '<a class="app" href="'.htmlspecialchars($app['url']).'" title="'.htmlspecialchars(lang($app['title'])).'">'
|
||||||
|
.'<img src="'.htmlspecialchars($icon).'"/><span>'.htmlspecialchars($app['desc']).'</span></a>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $nodes;
|
return $nodes;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user