Added local include directory
authorBenjamin Renard <bn8@zionetrix.net>
Sun, 31 Mar 2013 03:23:10 +0000 (05:23 +0200)
committerBenjamin Renard <bn8@zionetrix.net>
Sun, 31 Mar 2013 03:23:10 +0000 (05:23 +0200)
17 files changed:
public_html/core.php
public_html/css/local [new symlink]
public_html/images/local [new symlink]
public_html/includes/class/class.LSconfig.php
public_html/includes/class/class.LSsession.php
public_html/local/.gitignore [new file with mode: 0644]
public_html/local/conf/.gitignore [new file with mode: 0644]
public_html/local/conf/LSobjects/.gitignore [new file with mode: 0644]
public_html/local/css/.gitignore [new file with mode: 0644]
public_html/local/images/.gitignore [new file with mode: 0644]
public_html/local/includes/.gitignore [new file with mode: 0644]
public_html/local/includes/addons/.gitignore [new file with mode: 0644]
public_html/local/includes/class/.gitignore [new file with mode: 0644]
public_html/local/includes/libs/.gitignore [new file with mode: 0644]
public_html/local/lang/.gitignore [new file with mode: 0644]
public_html/local/templates/.gitignore [new file with mode: 0644]
public_html/templates/local [new symlink]

index 923fcea..f1ac3f3 100644 (file)
@@ -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 (symlink)
index 0000000..b2f4d3b
--- /dev/null
@@ -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 (symlink)
index 0000000..50a4cb9
--- /dev/null
@@ -0,0 +1 @@
+../local/images/
\ No newline at end of file
index 091e06c..5d6b870 100644 (file)
@@ -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;
   }
   
index 21d131c..a93ff51 100644 (file)
@@ -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 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/conf/.gitignore b/public_html/local/conf/.gitignore
new file mode 100644 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/conf/LSobjects/.gitignore b/public_html/local/conf/LSobjects/.gitignore
new file mode 100644 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/css/.gitignore b/public_html/local/css/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/public_html/local/images/.gitignore b/public_html/local/images/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/public_html/local/includes/.gitignore b/public_html/local/includes/.gitignore
new file mode 100644 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/includes/addons/.gitignore b/public_html/local/includes/addons/.gitignore
new file mode 100644 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/includes/class/.gitignore b/public_html/local/includes/class/.gitignore
new file mode 100644 (file)
index 0000000..cde8069
--- /dev/null
@@ -0,0 +1 @@
+*.php
diff --git a/public_html/local/includes/libs/.gitignore b/public_html/local/includes/libs/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/public_html/local/lang/.gitignore b/public_html/local/lang/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/public_html/local/templates/.gitignore b/public_html/local/templates/.gitignore
new file mode 100644 (file)
index 0000000..d6b7ef3
--- /dev/null
@@ -0,0 +1,2 @@
+*
+!.gitignore
diff --git a/public_html/templates/local b/public_html/templates/local
new file mode 120000 (symlink)
index 0000000..4781d99
--- /dev/null
@@ -0,0 +1 @@
+../local/templates/
\ No newline at end of file