remove path from install; better autodetection now
This commit is contained in:
		
							
								
								
									
										12
									
								
								install.php
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								install.php
									
									
									
									
									
								
							@@ -88,7 +88,6 @@ function checkExtension($name)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
function showForm()
 | 
					function showForm()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $config_path = htmlentities(trim(dirname($_SERVER['REQUEST_URI']), '/'));
 | 
					 | 
				
			||||||
    echo<<<E_O_T
 | 
					    echo<<<E_O_T
 | 
				
			||||||
        </ul>
 | 
					        </ul>
 | 
				
			||||||
    </dd>
 | 
					    </dd>
 | 
				
			||||||
@@ -116,11 +115,6 @@ function showForm()
 | 
				
			|||||||
                <input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
 | 
					                <input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
 | 
				
			||||||
                <p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
 | 
					                <p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
 | 
				
			||||||
            </li>
 | 
					            </li>
 | 
				
			||||||
            <li>
 | 
					 | 
				
			||||||
                <label for="host">Site path</label>
 | 
					 | 
				
			||||||
                <input type="text" id="path" name="path" value="$config_path" />
 | 
					 | 
				
			||||||
                <p class="form_guide">Site path, following the "/" after the domain name in the URL. Empty is fine. Field should be filled automatically.</p>
 | 
					 | 
				
			||||||
            </li>
 | 
					 | 
				
			||||||
            <li>
 | 
					            <li>
 | 
				
			||||||
                <label for="host">Hostname</label>
 | 
					                <label for="host">Hostname</label>
 | 
				
			||||||
                <input type="text" id="host" name="host" />
 | 
					                <input type="text" id="host" name="host" />
 | 
				
			||||||
@@ -167,7 +161,6 @@ function handlePost()
 | 
				
			|||||||
    $username = $_POST['username'];
 | 
					    $username = $_POST['username'];
 | 
				
			||||||
    $password = $_POST['password'];
 | 
					    $password = $_POST['password'];
 | 
				
			||||||
    $sitename = $_POST['sitename'];
 | 
					    $sitename = $_POST['sitename'];
 | 
				
			||||||
    $path     = $_POST['path'];
 | 
					 | 
				
			||||||
    $fancy    = !empty($_POST['fancy']);
 | 
					    $fancy    = !empty($_POST['fancy']);
 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
    <dl class="system_notice">
 | 
					    <dl class="system_notice">
 | 
				
			||||||
@@ -243,7 +236,7 @@ function handlePost()
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    updateStatus("Writing config file...");
 | 
					    updateStatus("Writing config file...");
 | 
				
			||||||
    $sqlUrl = "mysqli://$username:$password@$host/$database";
 | 
					    $sqlUrl = "mysqli://$username:$password@$host/$database";
 | 
				
			||||||
    $res = writeConf($sitename, $sqlUrl, $fancy, $path);
 | 
					    $res = writeConf($sitename, $sqlUrl, $fancy);
 | 
				
			||||||
    if (!$res) {
 | 
					    if (!$res) {
 | 
				
			||||||
        updateStatus("Can't write config file.", true);
 | 
					        updateStatus("Can't write config file.", true);
 | 
				
			||||||
        showForm();
 | 
					        showForm();
 | 
				
			||||||
@@ -257,14 +250,13 @@ function handlePost()
 | 
				
			|||||||
<?php
 | 
					<?php
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function writeConf($sitename, $sqlUrl, $fancy, $path)
 | 
					function writeConf($sitename, $sqlUrl, $fancy)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    $res = file_put_contents(INSTALLDIR.'/config.php',
 | 
					    $res = file_put_contents(INSTALLDIR.'/config.php',
 | 
				
			||||||
                             "<?php\n".
 | 
					                             "<?php\n".
 | 
				
			||||||
                             "if (!defined('LACONICA')) { exit(1); }\n\n".
 | 
					                             "if (!defined('LACONICA')) { exit(1); }\n\n".
 | 
				
			||||||
                             "\$config['site']['name'] = \"$sitename\";\n\n".
 | 
					                             "\$config['site']['name'] = \"$sitename\";\n\n".
 | 
				
			||||||
                             ($fancy ? "\$config['site']['fancy'] = true;\n\n":'').
 | 
					                             ($fancy ? "\$config['site']['fancy'] = true;\n\n":'').
 | 
				
			||||||
                             "\$config['site']['path'] = \"$path\";\n\n".
 | 
					 | 
				
			||||||
                             "\$config['db']['database'] = \"$sqlUrl\";\n\n".
 | 
					                             "\$config['db']['database'] = \"$sqlUrl\";\n\n".
 | 
				
			||||||
                             "?>");
 | 
					                             "?>");
 | 
				
			||||||
    return $res;
 | 
					    return $res;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user