Skip to content

Commit

Permalink
Fixed base_url not being set on fresh installs.
Browse files Browse the repository at this point in the history
Improved base_url not to contain protocol so the browser can decide wether to use https or http.
  • Loading branch information
Hal9000 committed May 26, 2013
1 parent 4faa067 commit 82292cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions setup/inc/step2.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
$setup->tpl->assign('check', $check);
if (!$check) { // Dump sql file to db
$dump = $setup->configDump();
$base_url = @$_SERVER['HTTPS'] ? 'https://' : 'http://';
$base_url = "//";
$base_url .= $_SERVER['SERVER_NAME'];
$base_url .= $_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT'];
$base_url .= str_replace('setup/index.php', '', $_SERVER['SCRIPT_NAME']);
$this->db->update('magirc_config', array('value' => $base_url), array('parameter' => 'base_url'));
$setup->db->update('magirc_config', array('value' => $base_url), array('parameter' => 'base_url'));
} else { // Upgrade db
$updated = $setup->configUpgrade();
}
Expand Down
2 changes: 1 addition & 1 deletion setup/lib/Setup.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ function configUpgrade() {
$this->db->query("ALTER TABLE magirc_config CHANGE value value VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''");
}
if ($version < 11) {
$base_url = @$_SERVER['HTTPS'] ? 'https://' : 'http://';
$base_url = "//";
$base_url .= $_SERVER['SERVER_NAME'];
$base_url .= $_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT'];
$base_url .= str_replace('setup/index.php', '', $_SERVER['SCRIPT_NAME']);
Expand Down

0 comments on commit 82292cd

Please sign in to comment.