Skip to content

Commit

Permalink
v. 5.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbogdani committed Sep 26, 2023
1 parent 5b870d0 commit 1e1a42c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ public static function getBase()
*/
public static function getBaseUrl()
{
// http://stackoverflow.com/questions/4503135/php-get-site-url-protocol-http-vs-https
$protocol = utils::is_ssl() ? "https://" : "http://";
$url = $protocol . $_SERVER['HTTP_HOST'] . self::getBase();
$config_base_url = cfg::get('base_url');
if ($config_base_url){
$url = $config_base_url;
} else {
// http://stackoverflow.com/questions/4503135/php-get-site-url-protocol-http-vs-https
$protocol = utils::is_ssl() ? "https://" : "http://";
$url = $protocol . $_SERVER['HTTP_HOST'] . self::getBase();
}

return (substr($url, -1) === '/' ? $url : $url . '/');
}

Expand Down
1 change: 1 addition & 0 deletions locale/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
$_lang['cfg-title'] = "Default title for site pages";
$_lang['cfg-description'] = "Site description";
$_lang['cfg-keywords'] = "Keywords";
$_lang['cfg-base_url'] = "Base URL";
$_lang['cfg-sys_lang'] = "System language id";
$_lang['cfg-sys_lang_string'] = "System language name";
$_lang['cfg-db_connection'] = "Database connection string";
Expand Down
1 change: 1 addition & 0 deletions locale/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@
$_lang['cfg-title'] = "Titolo di default delle pagine del sito";
$_lang['cfg-description'] = "Descrizione del sito";
$_lang['cfg-keywords'] = "Parole chiavi";
$_lang['cfg-base_url'] = "URL di base";
$_lang['cfg-sys_lang'] = "ID della lingua del sistema";
$_lang['cfg-sys_lang_string'] = "Nome dell lingua del sistema";
$_lang['cfg-db_connection'] = "Stringa di connessione al database";
Expand Down
11 changes: 11 additions & 0 deletions modules/cfg/tmpl/form.twig
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@
<span class="text-muted">Site's pages default comma separated keywords</span>
</div>
</div>

<!-- BASE_URL -->
<div class="form-group">
<label class="control-label col-sm-2">{{ tr.get('cfg-base_url') }}</label>
<div class="col-sm-5">
<input name="base_url" class="form-control">{{ data.base_url }}</textarea>
</div>
<div class="col-sm-5">
<span class="text-muted">The base URL of the site; if not provided will be inferred from the site URL</span>
</div>
</div>

<!-- SYS_LANG -->
<div class="form-group" {% if is_admin == false %}style="display:none"{% endif %}>
Expand Down
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
5.11.0[] = "Added cfg.base_url variable for sites served through proxies"
5.10.0[] = "Legacy controller.php route replaced by controller/"
5.9.2[] = "Phpfastcache uses TMP_DIR instead of system tmp dir"
5.9.1[] = "Template data are encoded to JSON forcedly as object to prevent unintended array resorting"
Expand Down

0 comments on commit 1e1a42c

Please sign in to comment.