From 2ef6ad80a4f7374e0488b8b10b8139e3392f81ff Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 2 Dec 2010 17:31:48 -0800 Subject: [PATCH] fix installation into subdir of domain --- boot.php | 5 ++++- mod/install.php | 3 +++ view/en/htconfig.tpl | 2 +- view/en/install_db.tpl | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/boot.php b/boot.php index 66236f39d6..abc4c04e44 100644 --- a/boot.php +++ b/boot.php @@ -169,6 +169,9 @@ class App { if(x($_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->argc = count($this->argv); @@ -231,7 +234,7 @@ class App { function init_pagehead() { $tpl = load_view_file("view/head.tpl"); $this->page['htmlhead'] = replace_macros($tpl,array( - '$baseurl' => $this->get_baseurl() + '$baseurl' => $this->get_baseurl() . '/' )); } diff --git a/mod/install.php b/mod/install.php index 21a1b75138..9043459b86 100644 --- a/mod/install.php +++ b/mod/install.php @@ -5,6 +5,7 @@ function install_post(&$a) { global $db; + $urlpath = $a->get_path(); $dbhost = notags(trim($_POST['dbhost'])); $dbuser = notags(trim($_POST['dbuser'])); $dbpass = notags(trim($_POST['dbpass'])); @@ -40,6 +41,7 @@ function install_post(&$a) { '$dbpass' => $dbpass, '$dbdata' => $dbdata, '$timezone' => $timezone, + '$urlpath' => $urlpath, '$phpath' => $phpath )); $result = file_put_contents('.htconfig.php', $txt); @@ -102,6 +104,7 @@ function install_content(&$a) { $tpl = load_view_file('view/install_db.tpl'); $o .= replace_macros($tpl, array( + '$baseurl' => $a->get_baseurl(), '$tzselect' => ((x($_POST,'timezone')) ? select_timezone($_POST['timezone']) : select_timezone()), '$submit' => t('Submit'), '$dbhost' => ((x($_POST,'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost'), diff --git a/view/en/htconfig.tpl b/view/en/htconfig.tpl index 6e58d593b7..fda38b33ad 100644 --- a/view/en/htconfig.tpl +++ b/view/en/htconfig.tpl @@ -13,7 +13,7 @@ $db_data = '$dbdata'; // For instance if your URL is 'http://example.com/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". // It can be changed later and only applies to timestamps for anonymous viewers. diff --git a/view/en/install_db.tpl b/view/en/install_db.tpl index d5f28828e5..c413689c25 100644 --- a/view/en/install_db.tpl +++ b/view/en/install_db.tpl @@ -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.

-
+