From: Robin Millette Date: Sun, 17 May 2009 04:05:07 +0000 (-0400) Subject: Added site path field to installer + fancy URL javascript auto-detection. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f3ea79a12a7bdf0d4efcd7eb706d25ae81b7fad9;p=quix0rs-gnu-social.git Added site path field to installer + fancy URL javascript auto-detection. --- diff --git a/index.php b/index.php index e24bde9179..cfef211896 100644 --- a/index.php +++ b/index.php @@ -63,6 +63,10 @@ function handleError($error) function main() { + // quick check for fancy URL auto-detection support in installer. + if ('/check-fancy' === $_SERVER['REDIRECT_URL']) { + die("Fancy URL support detection succeeded. We suggest you enable this to get fancy (pretty) URLs."); + } global $user, $action, $config; if (!_have_config()) { diff --git a/install.php b/install.php index 66e8e87124..32915200b2 100644 --- a/install.php +++ b/install.php @@ -86,7 +86,8 @@ function checkExtension($name) function showForm() { -?> + $config_path = htmlentities(trim(dirname($_SERVER['REQUEST_URI']), '/')); + echo<< @@ -108,11 +109,21 @@ function showForm()

The name of your site

  • + + enable
    + disable
    +

    Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.

    +
  • Database hostname

  • +
  • + + +

    Site path, following the "/" after the domain name in the URL. Empty is fine. Field should be filled automatically.

    +
  • @@ -132,7 +143,8 @@ function showForm() -
    Page notice
    @@ -225,29 +239,34 @@ function handlePost() } updateStatus("Writing config file..."); $sqlUrl = "mysqli://$username:$password@$host/$database"; - $res = writeConf($sitename, $sqlUrl); + $res = writeConf($sitename, $sqlUrl, $fancy, $path); if (!$res) { updateStatus("Can't write config file.", true); showForm(); return; } updateStatus("Done!"); + if ($path) $path .= '/'; + updateStatus("You can visit your new Laconica site + +
    diff --git a/js/install.js b/js/install.js new file mode 100644 index 0000000000..32a54111e2 --- /dev/null +++ b/js/install.js @@ -0,0 +1,18 @@ +$(document).ready(function(){ + $.ajax({url:'check-fancy', + type:'GET', + success:function(data, textStatus) { + $('#fancy-enable').attr('checked', true); + $('#fancy-disable').attr('checked', false); + $('#fancy-form_guide').text(data); + }, + error:function(XMLHttpRequest, textStatus, errorThrown) { + $('#fancy-enable').attr('checked', false); + $('#fancy-disable').attr('checked', true); + $('#fancy-enable').attr('disabled', true); + $('#fancy-disable').attr('disabled', true); + $('#fancy-form_guide').text("Fancy URL support detection failed, disabling this option. Make sure you renamed htaccess.sample to .htaccess."); + } + }); +}); +