From 8ccd3a203d407f549cd8697a5fa66181e90d9871 Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 17 Jan 2011 18:48:13 +0000 Subject: feature 2112 added: ability to set an additional local directory $conf['local_dir_site'] in local/config/multisite.inc.php git-svn-id: http://piwigo.org/svn/trunk@8722 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/common.inc.php | 18 ++++++++++++++++-- include/constants.php | 1 + include/functions.inc.php | 2 +- include/functions_mail.inc.php | 2 +- include/template.class.php | 6 +++--- 5 files changed, 22 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/common.inc.php b/include/common.inc.php index c898ec546..a67433000 100644 --- a/include/common.inc.php +++ b/include/common.inc.php @@ -70,7 +70,17 @@ $header_msgs = array(); $header_notes = array(); $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')) { header('Location: install.php'); @@ -92,6 +102,10 @@ foreach( array( 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'); if(isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) @@ -151,7 +165,7 @@ if ( is_admin() || (defined('IN_ADMIN') and IN_ADMIN) ) load_language('admin.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) ); // only now we can set the localized username of the guest user (and not in // include/user.inc.php) diff --git a/include/constants.php b/include/constants.php index 8135147eb..a3885da8c 100644 --- a/include/constants.php +++ b/include/constants.php @@ -27,6 +27,7 @@ define('PHPWG_DEFAULT_LANGUAGE', 'en_UK'); define('PHPWG_DEFAULT_TEMPLATE', 'Sylvia'); define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/'); +define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/'); // Required versions define('REQUIRED_PHP_VERSION', '5.0.0'); diff --git a/include/functions.inc.php b/include/functions.inc.php index 653031ab6..d8f3da32f 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -575,7 +575,7 @@ function redirect_html( $url , $msg = '', $refresh_time = 0) $user = build_user( $conf['guest_id'], true); 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()); } elseif (defined('IN_ADMIN') and IN_ADMIN) diff --git a/include/functions_mail.inc.php b/include/functions_mail.inc.php index 5443781a7..27da2cf3b 100644 --- a/include/functions_mail.inc.php +++ b/include/functions_mail.inc.php @@ -223,7 +223,7 @@ function switch_lang_to($language) // Translations are in admin file too 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) ); diff --git a/include/template.class.php b/include/template.class.php index 9e8a6231f..0cccace81 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -797,13 +797,13 @@ var s;'; $css = array(); 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)) { array_push($css, "{combine_css path='$f' order=10}"); } } - $f = 'local/css/rules.css'; + $f = PWG_LOCAL_DIR.'css/rules.css'; if (file_exists(PHPWG_ROOT_PATH.$f)) { array_push($css, "{combine_css path='$f' order=10}"); @@ -1133,7 +1133,7 @@ class ScriptLoader /*Allows merging of javascript and css files into a single one.*/ final class FileCombiner { - const OUT_SUB_DIR = 'local/combined/'; + const OUT_SUB_DIR = PWG_COMBINED_DIR; private $type; // js or css private $files = array(); private $versions = array(); -- cgit v1.2.3