Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/Horde.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function log(
* before we can start logging. Otherwise, queue entries. */
if (isset($GLOBALS['injector'])
&& Horde_Core_Factory_Logger::available()) {
$GLOBALS['injector']->getInstance('Horde_Log_Logger')->logObject($log_ob);
$GLOBALS['injector']->get('Horde_Log_Logger')->logObject($log_ob);
} else {
Horde_Core_Factory_Logger::queue($log_ob);
}
Expand Down
12 changes: 5 additions & 7 deletions lib/Horde/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function __construct($app = 'horde', ?Injector $injector = null)
public function checkVersions()
{
$response = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_HttpClient')
->get(Horde_Core_Factory_HttpClient::class)
->create([
'request.timeout' => 60,
'request.userAgent' => 'Horde ' . $GLOBALS['registry']->getVersion('horde', true),
Expand Down Expand Up @@ -352,7 +352,7 @@ public function writePHPConfig($formvars, &$php = null)
}

/* Cannot write. Save to session. */
$GLOBALS['injector']->getInstance(HordeSession::class)
$GLOBALS['injector']->get(HordeSession::class)
->setScoped('horde', 'config/' . $this->_app, $php);

return false;
Expand Down Expand Up @@ -540,7 +540,7 @@ protected function _parseLevel(&$conf, $children, $ctx)
$name = $node->getAttribute('name');
// Don't pass Null or Integer to a Text Filter
$desc = (string) $node->getAttribute('desc');
$desc = $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($desc, 'linkurls');
$desc = $GLOBALS['injector']->get(Horde_Core_Factory_TextFilter::class)->filter($desc, 'linkurls');
$required = !($node->getAttribute('required') == 'false');
$quote = !($node->getAttribute('quote') == 'false');

Expand All @@ -556,7 +556,7 @@ protected function _parseLevel(&$conf, $children, $ctx)

$conf[$name] = [
'_type' => 'description',
'desc' => $GLOBALS['injector']->getInstance('Horde_Core_Factory_TextFilter')->filter($this->_default($curctx, $this->_getNodeOnlyText($node)), 'linkurls'),
'desc' => $GLOBALS['injector']->get(Horde_Core_Factory_TextFilter::class)->filter($this->_default($curctx, $this->_getNodeOnlyText($node)), 'linkurls'),
];
break;

Expand Down Expand Up @@ -1198,9 +1198,7 @@ public function configSQL($ctx, $node = null, $switchname = 'driverconfig')

if ($useMetadata && $injector) {
try {
$provider = $injector->getInstance(
ConfigMetadataProvider::class
);
$provider = $injector->get(ConfigMetadataProvider::class);
$adapter = new LegacyConfigAdapter($provider);

// Get driver metadata converted to legacy format
Expand Down
4 changes: 2 additions & 2 deletions lib/Horde/Core/ActiveSync/Connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function calendar_import_attendee(
// iTips, check if we are allowed to autoupdate. If we have no
// configuration, err on the side of caution and DO NOT auto import.
$config = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_MimeViewer')
->get(Horde_Core_Factory_MimeViewer::class)
->getViewerConfig('text/calendar', $this->_registry->hasInterface('mail'));

if ($config[1]['driver'] == 'Itip' && !empty($config[1]['auto_update_eventreply'])) {
Expand Down Expand Up @@ -429,7 +429,7 @@ public function getRecipientCache($max = 100)
|| !$this->_registry->hasInterface('contacts')) {
return [];
}
$cache = $GLOBALS['injector']->getInstance('Horde_Cache');
$cache = $GLOBALS['injector']->get('Horde_Cache');
$cache_key = 'HCASC:' . $this->_registry->getAuth() . ':' . $max;
if (!$cache->exists($cache_key, 3600)) {
$results = $this->_registry->mail->favouriteRecipients($max);
Expand Down
46 changes: 23 additions & 23 deletions lib/Horde/Core/ActiveSync/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function authenticate($username, $password, $domain = null)
// backend is configured or when explicitly turned off.
$throttleKey = $this->_authThrottleKey($username);
if ($this->_authThrottleExceeded($throttleKey)) {
$injector->getInstance('Horde_Log_Logger')->warn(sprintf(
$injector->get('Horde_Log_Logger')->warn(sprintf(
'ActiveSync: too many failed authentication attempts for user %s; temporarily refusing further attempts.',
$username
));
Expand All @@ -277,12 +277,12 @@ public function authenticate($username, $password, $domain = null)
// First try transparent/X509. Happens for authtype == 'cert' || 'basic_cert'
if ($conf['activesync']['auth']['type'] != 'basic') {
if (!$this->_auth->transparent()) {
$injector->getInstance('Horde_Log_Logger')->notice(sprintf('Login failed ActiveSync client certificate for user %s.', $username));
$injector->get('Horde_Log_Logger')->notice(sprintf('Login failed ActiveSync client certificate for user %s.', $username));
$this->_recordAuthFailure($throttleKey);
return false;
}
if ($username != $GLOBALS['registry']->getAuth()) {
$injector->getInstance('Horde_Log_Logger')->notice(sprintf(
$injector->get('Horde_Log_Logger')->notice(sprintf(
'Access granted based on transparent authentication of user %s, but ActiveSync client is requesting access for %s.',
$GLOBALS['registry']->getAuth(),
$username
Expand Down Expand Up @@ -321,7 +321,7 @@ public function authenticate($username, $password, $domain = null)
}

if (!$authResult) {
$injector->getInstance('Horde_Log_Logger')->notice(sprintf('Login failed from ActiveSync client for user %s.', $username));
$injector->get('Horde_Log_Logger')->notice(sprintf('Login failed from ActiveSync client for user %s.', $username));
$this->_recordAuthFailure($throttleKey);
return false;
}
Expand All @@ -344,7 +344,7 @@ public function authenticate($username, $password, $domain = null)
(string) $username
));
}
$perms = $injector->getInstance('Horde_Perms');
$perms = $injector->get('Horde_Perms');
if ($perms->exists('horde:activesync')) {
// Check permissions to ActiveSync
if (!$this->_getPolicyValue('activesync', $perms->getPermissions('horde:activesync', $username))) {
Expand Down Expand Up @@ -3166,7 +3166,7 @@ public function getProvisioning(?Horde_ActiveSync_Device $device = null)
{
if (!empty($device)) {
try {
$hooks = $GLOBALS['injector']->getInstance('Horde_Core_Hooks');
$hooks = $GLOBALS['injector']->get(Horde_Core_Hooks::class);
$result = $hooks->callHook('activesync_provisioning_check', 'horde', [$device, $this->_user]);
if ($result !== -1) {
return $result;
Expand All @@ -3176,7 +3176,7 @@ public function getProvisioning(?Horde_ActiveSync_Device $device = null)
}

$provisioning = $GLOBALS['injector']
->getInstance('Horde_Perms')
->get('Horde_Perms')
->getPermissions(
'horde:activesync:provisioning',
$this->_user
Expand Down Expand Up @@ -3251,7 +3251,7 @@ public function getSettings(array $settings, $device)
break;
case 'userinformation':
$identities = $injector
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($registry->getAuth());
$as_ident = $prefs->getValue('activesync_identity');
if ($as_ident != 'horde') {
Expand Down Expand Up @@ -3333,7 +3333,7 @@ public function setSettings(array $settings, $device)
*/
public function autoDiscover($params = [], $version = 1)
{
$hooks = $GLOBALS['injector']->getInstance('Horde_Core_Hooks');
$hooks = $GLOBALS['injector']->get(Horde_Core_Hooks::class);
$url = parse_url((string) Horde::url(null, true));

if ($version == 2) {
Expand All @@ -3347,7 +3347,7 @@ public function autoDiscover($params = [], $version = 1)

// Attempt to get a username from the email address.
$ident = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($GLOBALS['registry']->getAuth());
$params['display_name'] = $ident->getValue('fullname');
$params['email'] = $ident->getValue('from_addr');
Expand Down Expand Up @@ -3411,7 +3411,7 @@ public function getUsernameFromEmail($email)
// no break
case 'hook':
try {
return $GLOBALS['injector']->getInstance('Horde_Core_Hooks')
return $GLOBALS['injector']->get(Horde_Core_Hooks::class)
->callHook('activesync_get_autodiscover_username', 'horde', [$email]);
} catch (Horde_Exception_HookNotSet $e) {
return $email;
Expand Down Expand Up @@ -3756,7 +3756,7 @@ public function meetingResponse(array $response)
}

// Update the vCal so the response will be reflected when imported.
$ident = $injector->getInstance('Horde_Core_Factory_Identity')->create($this->_user);
$ident = $injector->get(Horde_Core_Factory_Identity::class)->create($this->_user);
//$cn = $ident->getValue('fullname');
$email = $ident->getValue('from_addr');
switch ($response['response']) {
Expand Down Expand Up @@ -3845,7 +3845,7 @@ public function meetingResponse(array $response)
}
$itip = Horde_Itip::factory($vEvent, $resource);
$itipOptions = new Horde_Core_Itip_Response_Options_Horde('UTF-8', []);
$mail = $injector->getInstance('Horde_Mail');
$mail = $injector->get('Horde_Mail');

if (!empty($response['sendresponse'])) {
try {
Expand Down Expand Up @@ -3935,7 +3935,7 @@ public function versionCallback(Horde_ActiveSync $server)
if ($mode === 'device') {
$allowed = $this->_getDeviceScopedVersionPermission($server, $username);
} else {
$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perms = $GLOBALS['injector']->get('Horde_Perms');
if (!$perms->exists('horde:activesync:version')) {
return;
}
Expand Down Expand Up @@ -3991,7 +3991,7 @@ protected function _getDeviceScopedVersionPermission(Horde_ActiveSync $server, $
}

try {
return $GLOBALS['injector']->getInstance('Horde_Core_Hooks')
return $GLOBALS['injector']->get(Horde_Core_Hooks::class)
->callHook('activesync_device_version', 'horde', [$deviceId, $username]);
} catch (Horde_Exception_HookNotSet $e) {
}
Expand Down Expand Up @@ -4048,12 +4048,12 @@ public function createDeviceCallback(Horde_ActiveSync_Device $device)
{
global $injector, $registry;

$perms = $injector->getInstance('Horde_Perms');
$perms = $injector->get('Horde_Perms');

// Check max_device
if ($perms->exists('horde:activesync:max_devices')) {
$max_devices = $this->_getPolicyValue('max_devices', $perms->getPermissions('horde:activesync:max_devices', $registry->getAuth()));
$state = $injector->getInstance('Horde_ActiveSyncState');
$state = $injector->get('Horde_ActiveSyncState');
$devices = $state->listDevices($registry->getAuth());
if (count($devices) >= $max_devices) {
$this->_logger->meta(sprintf(
Expand All @@ -4065,7 +4065,7 @@ public function createDeviceCallback(Horde_ActiveSync_Device $device)
}
}
try {
return $injector->getInstance('Horde_Core_Hooks')
return $injector->get(Horde_Core_Hooks::class)
->callHook('activesync_create_device', 'horde', [$device]);
} catch (Horde_Exception_HookNotSet $e) {
}
Expand All @@ -4086,7 +4086,7 @@ public function createDeviceCallback(Horde_ActiveSync_Device $device)
public function deviceCallback(Horde_ActiveSync_Device $device)
{
try {
return $GLOBALS['injector']->getInstance('Horde_Core_Hooks')
return $GLOBALS['injector']->get(Horde_Core_Hooks::class)
->callHook('activesync_device_check', 'horde', [$device]);
} catch (Horde_Exception_HookNotSet $e) {
}
Expand All @@ -4105,7 +4105,7 @@ public function deviceCallback(Horde_ActiveSync_Device $device)
public function modifyDeviceCallback(Horde_ActiveSync_Device $device)
{
try {
$device = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')
$device = $GLOBALS['injector']->get(Horde_Core_Hooks::class)
->callHook('activesync_device_modify', 'horde', [$device]);
if (!($device instanceof Horde_ActiveSync_Device)) {
$this->_logger->err('activesync_device_modify hook must return device object.');
Expand Down Expand Up @@ -4539,7 +4539,7 @@ protected function _searchMailbox(array $query, array $options, bool $deepTraver
protected function _searchGal(array $query, array $options, bool $deepTraversal): ?array
{
// If no perms to the GAL, return zero results.
$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perms = $GLOBALS['injector']->get('Horde_Perms');
if ($perms->exists('horde:activesync:no_gal')
&& $perms->getPermissions('horde:activesync:no_gal', $this->_user)) {
return null;
Expand Down Expand Up @@ -4689,7 +4689,7 @@ protected function _getPolicyFromPerms($deviceinfo = false)
{
$prefix = 'horde:activesync:provisioning:';
$policy = [];
$perms = $GLOBALS['injector']->getInstance('Horde_Perms');
$perms = $GLOBALS['injector']->get('Horde_Perms');
if (!$perms->exists('horde:activesync:provisioning')) {
return $policy;
}
Expand Down Expand Up @@ -4761,7 +4761,7 @@ protected function _getIdentityFromAddress()
global $prefs;

$ident = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($this->_user);

$as_ident = $prefs->getValue('activesync_identity');
Expand Down
4 changes: 2 additions & 2 deletions lib/Horde/Core/ActiveSync/Imap/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function getMailboxes($force = false)
}
}
try {
$this->_mailboxlist = $injector->getInstance('Horde_Core_Hooks')->callHook(
$this->_mailboxlist = $injector->get(Horde_Core_Hooks::class)->callHook(
'activesync_mailboxlist',
'horde',
[$this->_mailboxlist]
Expand Down Expand Up @@ -178,7 +178,7 @@ public function getSpecialMailboxes()
// Sentmail is dependent on Identity.
if (count($this->_specialMailboxlist['sent']) > 1) {
$this->_specialMailboxlist['sent'] = $injector
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($registry->getAuth(), $registry->hasInterface('mail'))
->getValue('sent_mail_folder', $prefs->getValue('activesync_identity'));
} else {
Expand Down
12 changes: 6 additions & 6 deletions lib/Horde/Core/ActiveSync/Mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function send()

protected function _callPreSendHook()
{
$hooks = $GLOBALS['injector']->getInstance('Horde_Core_Hooks');
$hooks = $GLOBALS['injector']->get(Horde_Core_Hooks::class);
$params = [
'raw' => $this->_raw,
'imap_msg' => $this->imapMessage,
Expand Down Expand Up @@ -321,7 +321,7 @@ protected function _sendRaw()
}

try {
$GLOBALS['injector']->getInstance('Horde_Mail')
$GLOBALS['injector']->get('Horde_Mail')
->send($recipients, $h_array, $this->_raw->getMessage()->stream);
} catch (Horde_Mail_Exception $e) {
throw new Horde_ActiveSync_Exception($e->getMessage());
Expand Down Expand Up @@ -362,7 +362,7 @@ protected function _tryWithoutBinary($recipients, array $headers)
$mime = $this->_raw->getMimeObject();
$this->_raw->replaceMime($mime);
try {
$GLOBALS['injector']->getInstance('Horde_Mail')
$GLOBALS['injector']->get('Horde_Mail')
->send($recipients, $headers, $this->_raw->getMessage()->stream);
} catch (Exception $e) {
return false;
Expand Down Expand Up @@ -392,7 +392,7 @@ protected function _sendSmart()
}

try {
$mail->send($GLOBALS['injector']->getInstance('Horde_Mail'));
$mail->send($GLOBALS['injector']->get('Horde_Mail'));
$this->_mailer = $mail;
} catch (Horde_Mime_Exception $e) {
throw new Horde_ActiveSync_Exception($e);
Expand Down Expand Up @@ -610,7 +610,7 @@ protected function _getIdentityFromAddress()
global $prefs;

$ident = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($this->_user);

$as_ident = $prefs->getValue('activesync_identity');
Expand All @@ -635,7 +635,7 @@ protected function _getReplyToAddress()
global $prefs;

$ident = $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Identity')
->get(Horde_Core_Factory_Identity::class)
->create($this->_user);

$as_ident = $prefs->getValue('activesync_identity');
Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Core/Ajax/Application/Handler/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function listGroups()

try {
$groups = $GLOBALS['injector']
->getInstance('Horde_Group')
->get('Horde_Group')
->listAll(empty($GLOBALS['conf']['share']['any_group'])
&& !$GLOBALS['registry']->isAdmin()
? $GLOBALS['registry']->getAuth()
Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Core/Ajax/Application/Handler/Imple.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function imple()
global $injector, $registry;

$pushed = $registry->pushApp($this->vars->app);
$imple = $injector->getInstance('Horde_Core_Factory_Imple')->create($this->vars->imple, [], true);
$imple = $injector->get(Horde_Core_Factory_Imple::class)->create($this->vars->imple, [], true);

$result = $imple->handle($this->vars);

Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Core/Ajax/Imple/Geocoder/Geonames.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function _handle(Horde_Variables|Variables $vars)
'username' => $vars->key,
]);

$response = $GLOBALS['injector']->getInstance('Horde_Core_Factory_HttpClient')->create()->get($url);
$response = $GLOBALS['injector']->get(Horde_Core_Factory_HttpClient::class)->create()->get($url);

return new Horde_Core_Ajax_Response_Prototypejs([
'results' => $response->getBody(),
Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Core/Ajax/Imple/SpellChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function _handle(Horde_Variables|Variables $vars)

try {
return new Horde_Core_Ajax_Response_Prototypejs(
$injector->getInstance('Horde_Core_Factory_SpellChecker')->create($args, $input)->spellCheck($input)
$injector->get(Horde_Core_Factory_SpellChecker::class)->create($args, $input)->spellCheck($input)
);
} catch (Horde_Exception $e) {
Horde::log($e, Horde_Log::ERR);
Expand Down
2 changes: 1 addition & 1 deletion lib/Horde/Core/Ajax/Imple/UserAutoCompleter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function _getAutoCompleter()
protected function _handleAutoCompleter($input)
{
return $GLOBALS['injector']
->getInstance('Horde_Core_Factory_Auth')
->get(Horde_Core_Factory_Auth::class)
->create()
->searchUsers($input);
}
Expand Down
Loading
Loading