Skip to content

Commit 7f3d91b

Browse files
committed
chore: Upgrade calls into Horde_Util or Horde_Support classes to PSR-4 variants.
1 parent 9f850f3 commit 7f3d91b

72 files changed

Lines changed: 305 additions & 159 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

admin/activesync.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @package Horde
1515
*/
1616

17+
use Horde\Util\Util;
18+
1719
require_once __DIR__ . '/../lib/Application.php';
1820
Horde_Registry::appInit('horde', [
1921
'permission' => ['horde:administration:activesync'],
@@ -28,8 +30,8 @@
2830
$state->setLogger($injector->getInstance('Horde_Log_Logger'));
2931

3032
/** Check for any actions **/
31-
if ($actionID = Horde_Util::getPost('actionID')) {
32-
$deviceID = Horde_Util::getPost('deviceID');
33+
if ($actionID = Util::getPost('actionID')) {
34+
$deviceID = Util::getPost('deviceID');
3335

3436
$device_desc = explode(':', $deviceID);
3537
$deviceID = $device_desc[0];
@@ -49,7 +51,7 @@
4951
$state->removeState(
5052
[
5153
'devId' => $deviceID,
52-
'user' => Horde_Util::getPost('uid')]
54+
'user' => Util::getPost('uid')]
5355
);
5456
$GLOBALS['notification']->push(_("Device successfully removed."), 'horde.success');
5557
break;
@@ -73,13 +75,13 @@
7375
}
7476
}
7577

76-
switch (Horde_Util::getPost('searchBy')) {
78+
switch (Util::getPost('searchBy')) {
7779
case 'username':
78-
$devices = $state->listDevices(Horde_Util::getPost('searchInput'));
80+
$devices = $state->listDevices(Util::getPost('searchInput'));
7981
break;
8082

8183
default:
82-
$devices = $state->listDevices(null, [Horde_Util::getPost('searchBy') => Horde_Util::getPost('searchInput')]);
84+
$devices = $state->listDevices(null, [Util::getPost('searchBy') => Util::getPost('searchInput')]);
8385
}
8486

8587
$view = new Horde_View([

admin/alarms.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
* @package Horde
1313
*/
1414

15+
use Horde\Support\Uuid;
16+
use Horde\Util\Variables;
17+
1518
require_once __DIR__ . '/../lib/Application.php';
1619
Horde_Registry::appInit('horde', [
1720
'permission' => ['horde:administration:alarms'],
@@ -23,7 +26,7 @@
2326
$methods[$name] = $method->getDescription();
2427
}
2528

26-
$vars = $injector->getInstance('Horde_Variables');
29+
$vars = $injector->getInstance(Variables::class);
2730

2831
$form = new Horde_Form($vars, _("Add new alarm"));
2932
$form->addHidden('', 'alarm', 'text', false);
@@ -46,7 +49,7 @@
4649
if ($form->validate()) {
4750
$info = $form->getInfo($vars);
4851
if (empty($info['alarm'])) {
49-
$info['alarm'] = strval(new Horde_Support_Uuid());
52+
$info['alarm'] = strval(new Uuid());
5053
}
5154

5255
$params = [];

admin/cache.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
* @package Horde
1616
*/
1717

18+
use Horde\Util\Variables;
19+
1820
require_once __DIR__ . '/../lib/Application.php';
1921
Horde_Registry::appInit('horde', [
2022
'permission' => ['horde:administration:cache'],
2123
]);
2224

2325
$cache = $injector->getInstance('Horde_Cache');
24-
$vars = $injector->getInstance('Horde_Variables');
26+
$vars = $injector->getInstance(Variables::class);
2527

2628
if ($vars->clearcache) {
2729
try {

admin/cmdshell.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* @package Horde
1313
*/
1414

15+
use Horde\Util\Util;
16+
1517
require_once __DIR__ . '/../lib/Application.php';
1618
Horde_Registry::appInit('horde', [
1719
'permission' => ['horde:administration:cmdshell'],
@@ -26,11 +28,11 @@
2628
$view->addHelper('Text');
2729

2830
$view->action = Horde::url('admin/cmdshell.php');
29-
$view->command = trim(Horde_Util::getFormData('cmd'));
31+
$view->command = trim(Util::getFormData('cmd'));
3032
$view->title = $title;
3133
$view->session = $session;
3234
if ($view->command) {
33-
$session->checkToken(Horde_Util::getPost('token'));
35+
$session->checkToken(Util::getPost('token'));
3436
$cmds = explode("\n", $view->command);
3537
$out = [];
3638

admin/config/config.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
* @package Horde
1313
*/
1414

15+
use Horde\Util\Util;
16+
1517
require_once __DIR__ . '/../../lib/Application.php';
1618
Horde_Registry::appInit('horde', [
1719
'permission' => ['horde:administration:configuration'],
1820
]);
1921

20-
if (!Horde_Util::extensionExists('domxml')
21-
&& !Horde_Util::extensionExists('dom')) {
22+
if (!Util::extensionExists('domxml')
23+
&& !Util::extensionExists('dom')) {
2224
throw new Horde_Exception('You need the domxml or dom PHP extension to use the configuration tool.');
2325
}
2426

@@ -66,7 +68,7 @@
6668
if ($config->writePHPConfig($vars, $php)) {
6769
Horde::url('admin/config/index.php', true)->redirect();
6870
} else {
69-
$notification->push(sprintf(_("Could not save the configuration file %s. You can either use one of the options to save the code back on %s or copy manually the code below to %s."), Horde_Util::realPath($configFile), Horde::link(Horde::url('admin/config/index.php') . '#update', _("Configuration")) . _("Configuration") . '</a>', Horde_Util::realPath($configFile)), 'horde.warning', ['content.raw', 'sticky']);
71+
$notification->push(sprintf(_("Could not save the configuration file %s. You can either use one of the options to save the code back on %s or copy manually the code below to %s."), Util::realPath($configFile), Horde::link(Horde::url('admin/config/index.php') . '#update', _("Configuration")) . _("Configuration") . '</a>', Util::realPath($configFile)), 'horde.warning', ['content.raw', 'sticky']);
7072
}
7173
} elseif ($form->isSubmitted()) {
7274
$notification->push(_("There was an error in the configuration form. Perhaps you left out a required field."), 'horde.error');

admin/config/diff.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* @package Horde
1515
*/
1616

17+
use Horde\Util\HordeString;
18+
1719
require_once __DIR__ . '/../../lib/Application.php';
1820
Horde_Registry::appInit('horde', [
1921
'permission' => ['horde:administration:configuration'],
@@ -23,7 +25,7 @@
2325

2426
/* Set up the diff renderer. */
2527
$render_type = $vars->get('render', 'inline');
26-
$class = 'Horde_Text_Diff_Renderer_' . Horde_String::ucfirst($render_type);
28+
$class = 'Horde_Text_Diff_Renderer_' . HordeString::ucfirst($render_type);
2729
$renderer = new $class();
2830

2931
/**

admin/config/index.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
* @package Horde
1515
*/
1616

17+
use Horde\Util\ArrayUtils;
18+
use Horde\Util\Util;
19+
use Horde\Util\Variables;
20+
1721
require_once __DIR__ . '/../../lib/Application.php';
1822
Horde_Registry::appInit('horde', [
1923
'permission' => ['horde:administration:configuration'],
@@ -50,7 +54,7 @@ function _uploadFTP($params)
5054

5155
try {
5256
$vfs->writeData($path, 'conf.php', $config);
53-
$notification->push(sprintf(_("Successfully wrote %s"), Horde_Util::realPath($path . '/conf.php')), 'horde.success');
57+
$notification->push(sprintf(_("Successfully wrote %s"), Util::realPath($path . '/conf.php')), 'horde.success');
5458
$GLOBALS['session']->remove('horde', 'config/' . $app);
5559
} catch (Horde_Vfs_Exception $e) {
5660
$no_errors = false;
@@ -110,13 +114,13 @@ function _uploadFTP($params)
110114
&& $xml_ver == $php_ver)))) {
111115
continue;
112116
}
113-
$vars = new Horde_Variables();
117+
$vars = new Variables();
114118
$form = new Horde_Config_Form($vars, $app, true);
115119
$form->setSubmitted(true);
116120
if ($form->validate($vars)) {
117121
$config = new Horde_Config($app);
118122
if (!$config->writePHPConfig($vars)) {
119-
$notification->push(sprintf(_("Could not save the configuration file %s. Use one of the options below to save the code."), Horde_Util::realPath($config->configFile())), 'horde.warning', ['content.raw', 'sticky']);
123+
$notification->push(sprintf(_("Could not save the configuration file %s. Use one of the options below to save the code."), Util::realPath($config->configFile())), 'horde.warning', ['content.raw', 'sticky']);
120124
}
121125
} else {
122126
$notification->push(sprintf(_("The configuration for %s cannot be updated automatically. Please update the configuration manually."), $app), 'horde.error');
@@ -404,7 +408,7 @@ function _uploadFTP($params)
404408
}
405409

406410
/* Sort the apps by name. */
407-
Horde_Array::arraySort($apps, 'sort');
411+
ArrayUtils::arraySort($apps, 'sort');
408412

409413
/* Set up any actions that may be offered. */
410414
$actions = [];
@@ -438,7 +442,7 @@ function _uploadFTP($params)
438442
];
439443

440444
/* Set up the form for FTP upload of scripts. */
441-
$vars = Horde_Variables::getDefaultVariables();
445+
$vars = Variables::getDefaultVariables();
442446
$ftpform = new Horde_Form($vars);
443447
$ftpform->setButtons(_("Upload"), true);
444448
$ftpform->addVariable(_("Username"), 'username', 'text', true, false, null, ['', 20]);
@@ -480,7 +484,7 @@ function _uploadFTP($params)
480484
$view->ftpform = $ftpform;
481485
$view->schema_outdated = $schema_outdated;
482486
$view->version_action = Horde::url('admin/config/index.php');
483-
$view->version_input = Horde_Util::formInput();
487+
$view->version_input = Util::formInput();
484488
$view->versions = !empty($versions);
485489

486490
$page_output->addScriptFile('stripe.js', 'horde');

admin/config/scripts.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
* @package Horde
1919
*/
2020

21+
use Horde\Util\Util;
22+
2123
require_once __DIR__ . '/../../lib/Application.php';
2224
Horde_Registry::appInit('horde', [
2325
'permission' => ['horde:administration:configuration'],
@@ -29,11 +31,11 @@
2931
/* Check if this is only a request to clean up. */
3032
if ($vars->clean == 'tmp') {
3133
$tmp_dir = Horde::getTempDir();
32-
$path = Horde_Util::realPath($tmp_dir . '/' . $filename);
34+
$path = Util::realPath($tmp_dir . '/' . $filename);
3335
if (@unlink($tmp_dir . '/' . $filename)) {
3436
$notification->push(sprintf(_("Deleted configuration upgrade script \"%s\"."), $path), 'horde.success');
3537
} else {
36-
$notification->push(sprintf(_("Could not delete configuration upgrade script \"%s\"."), Horde_Util::realPath($path)), 'horde.error');
38+
$notification->push(sprintf(_("Could not delete configuration upgrade script \"%s\"."), Util::realPath($path)), 'horde.error');
3739
}
3840
$registry->rebuild();
3941
Horde::url('admin/config/index.php', true)->redirect();
@@ -87,7 +89,7 @@
8789
$data .= ' echo \'WARNING!!! REMOVE SCRIPT MANUALLY FROM ' . $tmp_dir . '\' . "\n";' . "\n";
8890
$data .= '}' . "\n";
8991
/* The script should be saved to server's temporary directory. */
90-
$path = Horde_Util::realPath($tmp_dir . '/' . $filename);
92+
$path = Util::realPath($tmp_dir . '/' . $filename);
9193
if (file_put_contents($tmp_dir . '/' . $filename, $data)) {
9294
chmod($tmp_dir . '/' . $filename, 0o777);
9395
$notification->push(sprintf(_("Saved configuration upgrade script to: \"%s\"."), $path), 'horde.success', ['sticky']);

admin/groups.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
* @package Horde
1313
*/
1414

15+
use Horde\Util\Variables;
16+
1517
require_once __DIR__ . '/../lib/Application.php';
1618
Horde_Registry::appInit('horde', [
1719
'permission' => ['horde:administration:groups'],
1820
]);
1921

2022
$auth = $injector->getInstance('Horde_Core_Factory_Auth')->create();
2123
$groups = $injector->getInstance('Horde_Group');
22-
$vars = $injector->getInstance('Horde_Variables');
24+
$vars = $injector->getInstance(Variables::class);
2325

2426
$form = $groups->readOnly() ? null : 'add.inc';
2527
$gid = $vars->gid;

admin/hashtable.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@
1515
* @package Horde
1616
*/
1717

18+
use Horde\Util\Variables;
19+
1820
require_once __DIR__ . '/../lib/Application.php';
1921
Horde_Registry::appInit('horde', [
2022
'permission' => ['horde:administration:hashtable'],
2123
]);
2224

2325
$ht = $injector->getInstance('Horde_HashTable');
24-
$vars = $injector->getInstance('Horde_Variables');
26+
$vars = $injector->getInstance(Variables::class);
2527

2628
if ($vars->clearht) {
2729
$ht->clear();

0 commit comments

Comments
 (0)