From 05ff27515be9f6a28754d7a709c18c4ffa24e294 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Sun, 31 Mar 2013 05:23:10 +0200 Subject: [PATCH] Added local include directory --- public_html/core.php | 1 + public_html/css/local | 1 + public_html/images/local | 1 + public_html/includes/class/class.LSconfig.php | 14 +++++++++----- public_html/includes/class/class.LSsession.php | 14 ++++++++------ public_html/local/.gitignore | 1 + public_html/local/conf/.gitignore | 1 + public_html/local/conf/LSobjects/.gitignore | 1 + public_html/local/css/.gitignore | 2 ++ public_html/local/images/.gitignore | 2 ++ public_html/local/includes/.gitignore | 1 + public_html/local/includes/addons/.gitignore | 1 + public_html/local/includes/class/.gitignore | 1 + public_html/local/includes/libs/.gitignore | 2 ++ public_html/local/lang/.gitignore | 2 ++ public_html/local/templates/.gitignore | 2 ++ public_html/templates/local | 1 + 17 files changed, 37 insertions(+), 11 deletions(-) create mode 120000 public_html/css/local create mode 120000 public_html/images/local create mode 100644 public_html/local/.gitignore create mode 100644 public_html/local/conf/.gitignore create mode 100644 public_html/local/conf/LSobjects/.gitignore create mode 100644 public_html/local/css/.gitignore create mode 100644 public_html/local/images/.gitignore create mode 100644 public_html/local/includes/.gitignore create mode 100644 public_html/local/includes/addons/.gitignore create mode 100644 public_html/local/includes/class/.gitignore create mode 100644 public_html/local/includes/libs/.gitignore create mode 100644 public_html/local/lang/.gitignore create mode 100644 public_html/local/templates/.gitignore create mode 120000 public_html/templates/local diff --git a/public_html/core.php b/public_html/core.php index 923fcea7..f1ac3f32 100644 --- a/public_html/core.php +++ b/public_html/core.php @@ -34,6 +34,7 @@ define('LS_LIB_DIR', LS_INCLUDE_DIR .'libs/'); define('LS_ADDONS_DIR', LS_INCLUDE_DIR .'addons/'); define('LS_JS_DIR', LS_INCLUDE_DIR .'js/'); define('LS_TMP_DIR', 'tmp/'); +define('LS_LOCAL_DIR', 'local/'); // Locale define('LS_TEXT_DOMAIN', 'ldapsaisie'); diff --git a/public_html/css/local b/public_html/css/local new file mode 120000 index 00000000..b2f4d3bb --- /dev/null +++ b/public_html/css/local @@ -0,0 +1 @@ +../local/css/ \ No newline at end of file diff --git a/public_html/images/local b/public_html/images/local new file mode 120000 index 00000000..50a4cb9b --- /dev/null +++ b/public_html/images/local @@ -0,0 +1 @@ +../local/images/ \ No newline at end of file diff --git a/public_html/includes/class/class.LSconfig.php b/public_html/includes/class/class.LSconfig.php index 091e06cf..5d6b8700 100644 --- a/public_html/includes/class/class.LSconfig.php +++ b/public_html/includes/class/class.LSconfig.php @@ -39,13 +39,17 @@ class LSconfig { * @retval boolean True si tout s'est bien passé, False sinon **/ public static function start() { - if (loadDir(LS_CONF_DIR, '^config\..*\.php$')) { - if (is_array($GLOBALS['LSconfig'])) { - self :: $data = $GLOBALS['LSconfig']; - self :: $data['LSaddons'] = $GLOBALS['LSaddons']; - return true; + $files=array('config.inc.php','config.LSaddons.php'); + foreach($files as $file) { + if (!LSsession::includeFile(LS_CONF_DIR.'/'.$file)) { + return; } } + if (is_array($GLOBALS['LSconfig'])) { + self :: $data = $GLOBALS['LSconfig']; + self :: $data['LSaddons'] = $GLOBALS['LSaddons']; + return true; + } return; } diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php index 21d131c1..a93ff512 100644 --- a/public_html/includes/class/class.LSsession.php +++ b/public_html/includes/class/class.LSsession.php @@ -92,7 +92,10 @@ class LSsession { * @retval true si tout c'est bien passé, false sinon */ public static function includeFile($file) { - if (!file_exists($file)) { + if (file_exists(LS_LOCAL_DIR.'/'.$file)) { + $file=LS_LOCAL_DIR.'/'.$file; + } + elseif (!file_exists($file)) { return; } if (defined('LSdebug') && constant('LSdebug')) { @@ -385,11 +388,10 @@ class LSsession { bindtextdomain(LS_TEXT_DOMAIN, LS_I18N_DIR); textdomain(LS_TEXT_DOMAIN); - if (is_file(LS_I18N_DIR.'/'.$lang.'/lang.php')) { - include(LS_I18N_DIR.'/'.$lang.'/lang.php'); - } - foreach (listFiles(LS_I18N_DIR.'/'.$lang,'/^lang.+\.php$/') as $file) { - include(LS_I18N_DIR."/$lang/$file"); + self :: includeFile(LS_I18N_DIR.'/'.$lang.'/lang.php'); + + foreach (listFiles(LS_LOCAL_DIR.'/'.LS_I18N_DIR.'/'.$lang,'/^lang.+\.php$/') as $file) { + include(LS_LOCAL_DIR.'/'.LS_I18N_DIR."/$lang/$file"); } } else { diff --git a/public_html/local/.gitignore b/public_html/local/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/conf/.gitignore b/public_html/local/conf/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/conf/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/conf/LSobjects/.gitignore b/public_html/local/conf/LSobjects/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/conf/LSobjects/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/css/.gitignore b/public_html/local/css/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/public_html/local/css/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/public_html/local/images/.gitignore b/public_html/local/images/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/public_html/local/images/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/public_html/local/includes/.gitignore b/public_html/local/includes/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/includes/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/includes/addons/.gitignore b/public_html/local/includes/addons/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/includes/addons/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/includes/class/.gitignore b/public_html/local/includes/class/.gitignore new file mode 100644 index 00000000..cde8069e --- /dev/null +++ b/public_html/local/includes/class/.gitignore @@ -0,0 +1 @@ +*.php diff --git a/public_html/local/includes/libs/.gitignore b/public_html/local/includes/libs/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/public_html/local/includes/libs/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/public_html/local/lang/.gitignore b/public_html/local/lang/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/public_html/local/lang/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/public_html/local/templates/.gitignore b/public_html/local/templates/.gitignore new file mode 100644 index 00000000..d6b7ef32 --- /dev/null +++ b/public_html/local/templates/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/public_html/templates/local b/public_html/templates/local new file mode 120000 index 00000000..4781d99f --- /dev/null +++ b/public_html/templates/local @@ -0,0 +1 @@ +../local/templates/ \ No newline at end of file