Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/CalendarsManager.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use Horde\Util\Util;

use Horde\Kronolith\KronolithConfig;
/**
* Copyright 2013-2026 Horde LLC (http://www.horde.org/)
*
Expand Down Expand Up @@ -103,6 +103,8 @@ class Kronolith_CalendarsManager
*/
protected $_displayExternal = false;

private KronolithConfig $kronolithConfig;

/**
* Const'r
* Sets up various display lists and session variables:
Expand All @@ -126,8 +128,13 @@ class Kronolith_CalendarsManager
*/
public function __construct($user = null)
{
// See horde/kronolith#78 and #79
// TODO: In H7 this should be injected via the constructor rather than using the global injector as a service locator.
$this->kronolithConfig = $GLOBALS['injector']->get(KronolithConfig::class);

$emptyUser = false;
if (empty($user)) {
// TODO: Use the modern session accessors instead of legacy Horde_Registry
$user = $GLOBALS['registry']->getAuth();
$emptyUser = true;
}
Expand Down Expand Up @@ -290,7 +297,7 @@ protected function _checkDisplayCals()
'display_external_cals' => 'displayExternal',
'holiday_drivers' => 'displayHolidaysInternal'];

if (!empty($GLOBALS['conf']['resource']['driver'])) {
if (!empty($this->kronolithConfig->get('resources.enabled'))) {
$display_prefs['display_resource_cals'] = 'displayResource';
}

Expand All @@ -305,7 +312,7 @@ protected function _checkDisplayCals()
// Run through getDisplayExternal to trim any that no longer exist.
$this->_getDisplayExternal();

if (empty($conf['holidays']['enable'])) {
if (empty($this->kronolithConfig->get('holidays.enable'))) {
$this->_displayHolidays = [];
$this->_displayHolidaysInternal = [];
}
Expand Down Expand Up @@ -608,7 +615,7 @@ protected function _getDisplayHolidays()
protected function _getAllResource()
{
$this->_allResource = [];
if (!empty($GLOBALS['conf']['resources']['enabled'])) {
if (!empty($this->kronolithConfig->get('resources.enabled'))) {
foreach (Kronolith::getDriver('Resource')->listResources(Horde_Perms::READ, ['isgroup' => 0]) as $resource) {
$rcal = new Kronolith_Calendar_Resource([
'resource' => $resource,
Expand Down
Loading