Skip to content

Commit b7ea9af

Browse files
committed
Replace hardcoded localhost URL with AccessUrl::DEFAULT_ACCESS_URL - refs BT#22639
1 parent 082e61f commit b7ea9af

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

public/main/admin/access_url_edit.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @author Julio Montoya <[email protected]>
77
*/
88

9+
use Chamilo\CoreBundle\Entity\AccessUrl;
910
use Chamilo\CoreBundle\Enums\ActionIcon;
1011
use Chamilo\CoreBundle\Framework\Container;
1112
use Symfony\Component\HttpFoundation\Request as HttpRequest;
@@ -44,7 +45,7 @@
4445
// If we're still with localhost (should only happen at the very beginning)
4546
// offer the current URL by default. Once this has been saved, no more
4647
// magic will happen, ever.
47-
if ($url_data['id'] === 1 && $url_data['url'] === 'http://localhost/') {
48+
if ($url_data['id'] === 1 && $url_data['url'] === AccessUrl::DEFAULT_ACCESS_URL) {
4849
$https = api_is_https() ? 'https://' : 'http://';
4950
$url_data['url'] = $https.$_SERVER['HTTP_HOST'].'/';
5051
}

public/main/admin/access_urls.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
}
112112

113113
// 1) Find the default URL (ID = 1)
114-
$defaultUrl = 'http://localhost/';
114+
$defaultUrl = AccessUrl::DEFAULT_ACCESS_URL;
115115
foreach ($url_list as $u) {
116116
if ($u->getId() === 1) {
117117
$defaultUrl = trim($u->getUrl());
@@ -121,7 +121,7 @@
121121

122122
// 2) Tooltip message (in English, per spec)
123123
$tooltip = 'Adding new URLs requires you to first set the first URL to a value different than localhost.';
124-
$isLocalhost = ($defaultUrl === 'http://localhost/');
124+
$isLocalhost = ($defaultUrl === AccessUrl::DEFAULT_ACCESS_URL);
125125

126126
// 3) Decide link href and base attributes
127127
$attributes = ['id' => 'add-url-button'];

0 commit comments

Comments
 (0)