Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Check for /lang/, which should be lang/
#1
include.inc.php is generating an error when a open_basedir restriction is active on htdocs:
"aLang Error: Language File for de doesn't exist! (/lang/de.ini not found)"

Please fix this, a temporary fix is adding /lang/ to the open_basedir, but that's not the best solution.
Edit: solution isn't working either, the only way to make this work is creating /lang/de.ini, but that is an ugly solution.
Edit: this occurs when no connection to MySQL can be established.
Edit: This is always reproduceble.

Edit: the problem is caused by an incorrect constant PATH, used in aLang.class.php (defined on line 6 in include.inc.php)
See my next post for more information.
Found my post helpful? Rate me Big Grin
Project: creating a compact and easy to setup DSLan (Linux) (Windoze is in development)
#2
Please don't hardcode \ as a directory separator, but use the PHP constant DIRECTORY_SEPARATOR.
It's strongly discougared to use $_SERVER['PHP_SELF'] for determining the path, unless you're REALLY sure about what you're doing.

The problem described is caused by assuming that the directory separator is always '\'.
This is not the case on Linux and Mac, it's '/'.
You're doing something like:
Code:
$a = explode('\\', $_SERVER['PHP_SELF']);
array_pop($a);
define('PATH', implode('/', $a));
This is completely wrong, as PHP_SELF can contain pathinfo, and the directory separator does not have to be '\'.
So this happens on a Linux system:
Code:
$a = array('/opt/twlan/htdocs/include.inc.php');
array_pop($a);//returns '/opt/twlan/htdocs/include.inc.php'
// $a = array() (empty!)
define('PATH', explode('', array()));//yields ''

A better approach would be:
Code:
define('PATH', dirname(__FILE__));
Note: you can't use the magic constant __DIR__, that's available from PHP 5.3.0.
Source: http://nl.php.net/manual/en/language.con...efined.php

Now clean that messy code up.
Found my post helpful? Rate me Big Grin
Project: creating a compact and easy to setup DSLan (Linux) (Windoze is in development)
#3
Wenn ich DS Lan 1.4 unter Linux laufen lasse muss ich im Rootverzeichnis "/" einen Ordner Lang anlegen und die Daten aus dem DS Lan Lang Ordner da rein kopieren, d.h. miss beim abrufen der Sprachdateien irgendwo eine unsaubere Referenzierung der Datei Stattfinden so das Linux diese im Rootverzeichnis "/" sucht anstatt im Serverrootverzeichnis "/opt/lampp/htdocs".
#4
Workaround: edit htdocs/include.inc.php and replace '<?php' by:
Code:
<?php define('PATH',dirname(__FILE__));
See http://dslan.gfx-dose.de/thread-3369.html

I've built a light server with htdocs from the original v1.4, fixing several template bugs (making it XHTML 1.0 Transitional valid), character bugs (square with questionmark instead of umlauts for example), added "Select all units" on place, added "targets.php" link.
Downloadsize: 9MB; extracted 20MB.
Status: being tested, download links will follow soon.
Found my post helpful? Rate me Big Grin
Project: creating a compact and easy to setup DSLan (Linux) (Windoze is in development)




Users browsing this thread: 1 Guest(s)