Revision e1e062a4
Von Holger Lindemann vor fast 14 Jahren hinzugefügt
lxo-import/import_lib.php | ||
---|---|---|
306 | 306 |
|
307 | 307 |
function anmelden($login=false,$pwd=false) { |
308 | 308 |
ini_set("gc_maxlifetime","3600"); |
309 |
$tmp = @file_get_contents("../config/authentication.pl"); |
|
310 |
preg_match("/'db'[ ]*=> '(.+)'/",$tmp,$hits); |
|
311 |
$dbname=$hits[1]; |
|
312 |
preg_match("/'password'[ ]*=> '(.+)'/",$tmp,$hits); |
|
313 |
$dbpasswd=$hits[1]; |
|
314 |
preg_match("/'user'[ ]*=> '(.+)'/",$tmp,$hits); |
|
315 |
$dbuser=$hits[1]; |
|
316 |
preg_match("/'host'[ ]*=> '(.+)'/",$tmp,$hits); |
|
317 |
$dbhost=($hits[1])?$hits[1]:"localhost"; |
|
318 |
preg_match("/'port'[ ]*=> '?(.+)'?/",$tmp,$hits); |
|
319 |
$dbport=($hits[1])?$hits[1]:"5432"; |
|
320 |
preg_match("/[ ]*\\\$self->\{cookie_name\}[ ]*=[ ]*'(.+)'/",$tmp,$hits); |
|
321 |
$cookiename=$hits[1]; |
|
309 |
if (file_exists("../config/lx_office.conf")) { |
|
310 |
$lxo = fopen("../config/lx_office.conf","r"); |
|
311 |
} else if (file_exists("../config/lx_office.conf.default")) { |
|
312 |
$lxo = fopen("../config/lx_office.conf.default","r"); |
|
313 |
} else { |
|
314 |
return false; |
|
315 |
} |
|
316 |
$dbsec = false; |
|
317 |
$tmp = fgets($lxo,512); |
|
318 |
while (!feof($lxo)) { |
|
319 |
if (preg_match("/^[\s]*#/",$tmp)) { |
|
320 |
$tmp = fgets($lxo,512); |
|
321 |
continue; |
|
322 |
} |
|
323 |
if ($dbsec) { |
|
324 |
preg_match("/db[ ]*= (.+)/",$tmp,$hits); |
|
325 |
if ($hits[1]) $dbname=$hits[1]; |
|
326 |
preg_match("/password[ ]*= (.+)/",$tmp,$hits); |
|
327 |
if ($hits[1]) $dbpasswd=$hits[1]; |
|
328 |
preg_match("/user[ ]*= (.+)/",$tmp,$hits); |
|
329 |
if ($hits[1]) $dbuser=$hits[1]; |
|
330 |
preg_match("/host[ ]*= (.+)/",$tmp,$hits); |
|
331 |
if ($hits[1]) $dbhost=($hits[1])?$hits[1]:"localhost"; |
|
332 |
preg_match("/port[ ]*= (.+)/",$tmp,$hits); |
|
333 |
if ($hits[1]) $dbport=($hits[1])?$hits[1]:"5432"; |
|
334 |
if (preg_match("/\[[a-z]+/",$tmp)) break; |
|
335 |
$tmp = fgets($lxo,512); |
|
336 |
continue; |
|
337 |
} |
|
338 |
preg_match("/[ ]*cookie_name[ ]*=[ ]*(.+)/",$tmp,$hits); |
|
339 |
if ($hits[1]) $cookiename=$hits[1]; |
|
340 |
if (preg_match("!\[authentication/database\]!",$tmp)) $dbsec = true; |
|
341 |
$tmp = fgets($lxo,512); |
|
342 |
} |
|
322 | 343 |
if (!$cookiename) $cookiename='lx_office_erp_session_id'; |
344 |
$cookie=$_COOKIE[$cookiename]; |
|
323 | 345 |
if ($login) { |
324 | 346 |
$auth=authuser($dbhost,$dbport,$dbuser,$dbpasswd,$dbname,false,$login,$pwd); |
325 | 347 |
} else { |
Auch abrufbar als: Unified diff
Anpassung der Anmeldung an die neuen Configurations-Files
Zuerst lx_office.conf versuchen, dann lx_office.conf.default