Index: /trunk/include/common.inc.php
===================================================================
--- /trunk/include/common.inc.php	(revision 8721)
+++ /trunk/include/common.inc.php	(revision 8722)
@@ -71,5 +71,15 @@
 $filter = array();
 
-@include(PHPWG_ROOT_PATH .'local/config/database.inc.php');
+if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'))
+{
+  include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php');
+  define('PWG_LOCAL_DIR', $conf['local_dir_site']);
+}
+else
+{
+  define('PWG_LOCAL_DIR', 'local/');
+}
+
+@include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
 if (!defined('PHPWG_INSTALLED'))
 {
@@ -93,4 +103,8 @@
 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
 @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+if (isset($conf['local_dir_site']))
+{
+  @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
+}
 include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
 
@@ -152,5 +166,5 @@
 }
 trigger_action('loading_lang');
-load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
+load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
 
 // only now we can set the localized username of the guest user (and not in
Index: /trunk/include/constants.php
===================================================================
--- /trunk/include/constants.php	(revision 8721)
+++ /trunk/include/constants.php	(revision 8722)
@@ -28,4 +28,5 @@
 
 define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/');
+define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/');
 
 // Required versions
Index: /trunk/include/functions.inc.php
===================================================================
--- /trunk/include/functions.inc.php	(revision 8721)
+++ /trunk/include/functions.inc.php	(revision 8722)
@@ -576,5 +576,5 @@
     load_language('common.lang');
     trigger_action('loading_lang');
-    load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
+    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
     $template = new Template(PHPWG_ROOT_PATH.'themes', get_default_theme());
   }
Index: /trunk/include/functions_mail.inc.php
===================================================================
--- /trunk/include/functions_mail.inc.php	(revision 8721)
+++ /trunk/include/functions_mail.inc.php	(revision 8722)
@@ -224,5 +224,5 @@
     load_language('admin.lang', '', array('language'=>$language) );
     trigger_action('loading_lang');
-    load_language('lang', PHPWG_ROOT_PATH.'local/',
+    load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR,
       array('language'=>$language, 'no_fallback'=>true, 'local'=>true)
     );
Index: /trunk/include/template.class.php
===================================================================
--- /trunk/include/template.class.php	(revision 8721)
+++ /trunk/include/template.class.php	(revision 8722)
@@ -798,5 +798,5 @@
     foreach ($smarty->get_template_vars('themes') as $theme)
     {
-      $f = 'local/css/'.$theme['id'].'-rules.css';
+      $f = PWG_LOCAL_DIR.'css/'.$theme['id'].'-rules.css';
       if (file_exists(PHPWG_ROOT_PATH.$f))
       {
@@ -804,5 +804,5 @@
       }
     }
-    $f = 'local/css/rules.css';
+    $f = PWG_LOCAL_DIR.'css/rules.css';
     if (file_exists(PHPWG_ROOT_PATH.$f))
     {
@@ -1134,5 +1134,5 @@
 final class FileCombiner
 {
-  const OUT_SUB_DIR = 'local/combined/';
+  const OUT_SUB_DIR = PWG_COMBINED_DIR;
   private $type; // js or css
   private $files = array();
Index: /trunk/install.php
===================================================================
--- /trunk/install.php	(revision 8721)
+++ /trunk/install.php	(revision 8722)
@@ -115,6 +115,20 @@
 }
 
+if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'))
+{
+  include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php');
+  define('PWG_LOCAL_DIR', $conf['local_dir_site']);
+}
+else
+{
+  define('PWG_LOCAL_DIR', 'local/');
+}
+
 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
 @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+if (isset($conf['local_dir_site']))
+{
+  @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
+}
 
 // download database config file if exists
@@ -153,5 +167,5 @@
 $errors = array();
 
-$config_file = PHPWG_ROOT_PATH . 'local/config/database.inc.php';
+$config_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php';
 if (@file_exists($config_file))
 {
Index: /trunk/nbm.php
===================================================================
--- /trunk/nbm.php	(revision 8721)
+++ /trunk/nbm.php	(revision 8722)
@@ -35,5 +35,5 @@
 // Need to update a second time
 trigger_action('loading_lang');
-load_language('lang', PHPWG_ROOT_PATH.'local/', array('no_fallback'=>true, 'local'=>true) );
+load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR, array('no_fallback'=>true, 'local'=>true) );
 
 
Index: /trunk/plugins/LocalFilesEditor/admin.php
===================================================================
--- /trunk/plugins/LocalFilesEditor/admin.php	(revision 8721)
+++ /trunk/plugins/LocalFilesEditor/admin.php	(revision 8722)
@@ -131,5 +131,5 @@
 {
   case 'localconf':
-    $edited_file = PHPWG_ROOT_PATH . "local/config/config.inc.php";
+    $edited_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "config/config.inc.php";
     $content_file = file_exists($edited_file) ?
       file_get_contents($edited_file) : $new_file['localconf'];
@@ -146,5 +146,5 @@
     $options[] = l10n('locfiledit_choose_file');
     $options[] = '----------------------';
-    $value = PHPWG_ROOT_PATH . "local/css/rules.css";
+    $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . "css/rules.css";
     $options[$value] = 'local / css / rules.css';
     if ($edited_file == $value) $selected = $value;
@@ -153,5 +153,5 @@
     foreach (get_dirs($conf['themes_dir']) as $theme_id)
     {
-      $value = PHPWG_ROOT_PATH . 'local/css/'.$theme_id.'-rules.css';
+      $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR . 'css/'.$theme_id.'-rules.css';
       $options[$value] = 'local / css / '.$theme_id.'-rules.css';
       if ($edited_file == $value) $selected = $value;
@@ -248,5 +248,5 @@
     foreach (get_languages() as $language_code => $language_name)
     {
-      $value = PHPWG_ROOT_PATH.'local/language/'.$language_code.'.lang.php';
+      $value = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'language/'.$language_code.'.lang.php';
       if ($edited_file == $value)
       {
Index: /trunk/plugins/language_switch/language_switch.inc.php
===================================================================
--- /trunk/plugins/language_switch/language_switch.inc.php	(revision 8721)
+++ /trunk/plugins/language_switch/language_switch.inc.php	(revision 8722)
@@ -50,5 +50,5 @@
     if ( $same !== $user['language']) {
       load_language('common.lang', '', array('language'=>$user['language']) );
-      load_language('lang', PHPWG_ROOT_PATH.'local/',
+      load_language('lang', PHPWG_ROOT_PATH.PWG_LOCAL_DIR,
         array('language'=>$user['language'], 'no_fallback'=>true, 'local'=>true)
       );
Index: /trunk/upgrade.php
===================================================================
--- /trunk/upgrade.php	(revision 8721)
+++ /trunk/upgrade.php	(revision 8722)
@@ -25,5 +25,15 @@
 
 // load config file
-$config_file = PHPWG_ROOT_PATH.'local/config/database.inc.php';
+if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'))
+{
+  include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php');
+  define('PWG_LOCAL_DIR', $conf['local_dir_site']);
+}
+else
+{
+  define('PWG_LOCAL_DIR', 'local/');
+}
+
+$config_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'config/database.inc.php';
 $config_file_contents = @file_get_contents($config_file);
 if ($config_file_contents === false)
@@ -37,7 +47,11 @@
 }
 
-include(PHPWG_ROOT_PATH.'local/config/database.inc.php');
+include($config_file);
 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
 @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+if (isset($conf['local_dir_site']))
+{
+  @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
+}
 
 // $conf is not used for users tables - define cannot be re-defined
@@ -309,5 +323,5 @@
           sprintf(
             l10n('In <i>%s</i>, before <b>?></b>, insert:'),
-            'local/config/database.inc.php'
+            PWG_LOCAL_DIR.'config/database.inc.php'
             )
           .'<p><textarea rows="4" cols="40">'
Index: /trunk/upgrade_feed.php
===================================================================
--- /trunk/upgrade_feed.php	(revision 8721)
+++ /trunk/upgrade_feed.php	(revision 8722)
@@ -33,7 +33,22 @@
 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
 include_once(PHPWG_ROOT_PATH.'admin/include/functions_upgrade.php');
-include(PHPWG_ROOT_PATH.'local/config/database.inc.php');
+
+if (is_file(PHPWG_ROOT_PATH .'local/config/multisite.inc.php'))
+{
+  include(PHPWG_ROOT_PATH .'local/config/multisite.inc.php');
+  define('PWG_LOCAL_DIR', $conf['local_dir_site']);
+}
+else
+{
+  define('PWG_LOCAL_DIR', 'local/');
+}
+
+include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR .'config/database.inc.php');
 include(PHPWG_ROOT_PATH . 'include/config_default.inc.php');
 @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php');
+if (isset($conf['local_dir_site']))
+{
+  @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php');
+}
 include(PHPWG_ROOT_PATH .'include/dblayer/functions_'.$conf['dblayer'].'.inc.php');
 
