From 15298feec87dd2206794ca6b3821f729c8e779ad Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Fri, 21 Aug 2015 13:01:37 +0200 Subject: [PATCH] generate_lang_file.php : make script callable from anywhere --- public_html/lang/generate_lang_file.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/public_html/lang/generate_lang_file.php b/public_html/lang/generate_lang_file.php index deedb3dd..205e2848 100755 --- a/public_html/lang/generate_lang_file.php +++ b/public_html/lang/generate_lang_file.php @@ -23,8 +23,12 @@ error_reporting(E_ERROR); -require_once('../core.php'); -require_once('../conf/config.inc.php'); +// Change directory +$curdir=getcwd(); +chdir(dirname(__FILE__).'/../'); + +require_once('core.php'); +require_once('conf/config.inc.php'); $withoutselectlist=False; $copyoriginalvalue=False; @@ -32,8 +36,8 @@ $additionalfileformat=False; $translations=array(); if ($argc > 1) { for ($i=1;$i<$argc;$i++) { - if (is_file($argv[$i])) { - @include($argv[$i]); + if (is_file($curdir.'/'.$argv[$i])) { + @include($curdir.'/'.$argv[$i]); foreach($GLOBALS['LSlang'] as $msg => $trans) { $translations[$msg]=$trans; } @@ -66,9 +70,6 @@ function add($msg) { } } -// Change directory -chdir('../'); - // Initialize session LSsession :: initialize();