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
This commit is contained in:
plegall 2011-01-17 18:48:13 +00:00
parent 91fc33dc8e
commit 8ccd3a203d
11 changed files with 76 additions and 18 deletions

View file

@ -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)

View file

@ -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');

View file

@ -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)

View file

@ -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)
);

View file

@ -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();

View file

@ -114,8 +114,22 @@ else
$prefixeTable = DEFAULT_PREFIX_TABLE;
}
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
if (!empty($_GET['dl']) && file_exists($conf['local_data_dir'].'/pwg_'.$_GET['dl']))
@ -152,7 +166,7 @@ if (isset($_POST['install']))
$infos = array();
$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))
{
include($config_file);

View file

@ -34,7 +34,7 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.p
load_language('admin.lang');
// 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) );

View file

@ -130,7 +130,7 @@ if (isset($_POST['create_tpl']))
switch ($page['tab'])
{
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'];
@ -145,14 +145,14 @@ switch ($page['tab'])
$selected = 0;
$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;
$options[] = '----------------------';
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;
}
@ -247,7 +247,7 @@ switch ($page['tab'])
$options[] = '----------------------';
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)
{
$selected = $value;

View file

@ -49,7 +49,7 @@ class language_controler {
// Reload language only if it isn't the same one
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)
);
if (defined('IN_ADMIN') and IN_ADMIN) { // Never currently

View file

@ -24,7 +24,17 @@
define('PHPWG_ROOT_PATH', './');
// 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)
{
@ -36,9 +46,13 @@ if ($php_end_tag === false)
die('Cannot find php end tag in '.$config_file);
}
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
define('USERS_TABLE', $prefixeTable.'users');
@ -308,7 +322,7 @@ if ((isset($_POST['submit']) or isset($_GET['now']))
$page['infos'],
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">'
.implode("\r\n" , $mysql_changes).'</textarea></p>'

View file

@ -32,9 +32,24 @@ define('PHPWG_ROOT_PATH', './');
include_once(PHPWG_ROOT_PATH.'include/functions.inc.php');
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');
// +-----------------------------------------------------------------------+