fix installation into subdir of domain

This commit is contained in:
Friendika 2010-12-02 17:31:48 -08:00
parent e818170c9f
commit 2ef6ad80a4
4 changed files with 9 additions and 3 deletions

View file

@ -169,6 +169,9 @@ class App {
if(x($_GET,'q')) if(x($_GET,'q'))
$this->cmd = trim($_GET['q'],'/'); $this->cmd = trim($_GET['q'],'/');
$path = trim(dirname($_SERVER['SCRIPT_NAME']),'/');
if(isset($path) && strlen($path) && ($path != $this->path))
$this->path = $path;
$this->argv = explode('/',$this->cmd); $this->argv = explode('/',$this->cmd);
$this->argc = count($this->argv); $this->argc = count($this->argv);
@ -231,7 +234,7 @@ class App {
function init_pagehead() { function init_pagehead() {
$tpl = load_view_file("view/head.tpl"); $tpl = load_view_file("view/head.tpl");
$this->page['htmlhead'] = replace_macros($tpl,array( $this->page['htmlhead'] = replace_macros($tpl,array(
'$baseurl' => $this->get_baseurl() '$baseurl' => $this->get_baseurl() . '/'
)); ));
} }

View file

@ -5,6 +5,7 @@ function install_post(&$a) {
global $db; global $db;
$urlpath = $a->get_path();
$dbhost = notags(trim($_POST['dbhost'])); $dbhost = notags(trim($_POST['dbhost']));
$dbuser = notags(trim($_POST['dbuser'])); $dbuser = notags(trim($_POST['dbuser']));
$dbpass = notags(trim($_POST['dbpass'])); $dbpass = notags(trim($_POST['dbpass']));
@ -40,6 +41,7 @@ function install_post(&$a) {
'$dbpass' => $dbpass, '$dbpass' => $dbpass,
'$dbdata' => $dbdata, '$dbdata' => $dbdata,
'$timezone' => $timezone, '$timezone' => $timezone,
'$urlpath' => $urlpath,
'$phpath' => $phpath '$phpath' => $phpath
)); ));
$result = file_put_contents('.htconfig.php', $txt); $result = file_put_contents('.htconfig.php', $txt);
@ -102,6 +104,7 @@ function install_content(&$a) {
$tpl = load_view_file('view/install_db.tpl'); $tpl = load_view_file('view/install_db.tpl');
$o .= replace_macros($tpl, array( $o .= replace_macros($tpl, array(
'$baseurl' => $a->get_baseurl(),
'$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()),
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$dbhost' => ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost'), '$dbhost' => ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost'),

View file

@ -13,7 +13,7 @@ $db_data = '$dbdata';
// For instance if your URL is 'http://example.com/directory/subdirectory', // For instance if your URL is 'http://example.com/directory/subdirectory',
// set $a->path to 'directory/subdirectory'. // set $a->path to 'directory/subdirectory'.
$a->path = ''; $a->path = '$urlpath';
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles". // Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers. // It can be changed later and only applies to timestamps for anonymous viewers.

View file

@ -6,7 +6,7 @@
In order to install Friendika we need to know how to contact your database. Please contact your hosting provider or site administrator if you have questions about these settings. The database you specify below must already exist. If it does not, please create it before continuing. In order to install Friendika we need to know how to contact your database. Please contact your hosting provider or site administrator if you have questions about these settings. The database you specify below must already exist. If it does not, please create it before continuing.
</p> </p>
<form id="install-form" action="install" method="post"> <form id="install-form" action="$baseurl/install" method="post">
<input type="hidden" name="phpath" value="$phpath" /> <input type="hidden" name="phpath" value="$phpath" />