Commit d675a6e8216a36668f9acaeacee7ba94151f6b73

Authored by Hacene SI HADJ MOHAND
1 parent f85f44e4

Fix UserMgr

Showing 1 changed file with 14 additions and 14 deletions   Show diff stats
php/classes/UserMgr.php
@@ -276,9 +276,9 @@ class UserMgr @@ -276,9 +276,9 @@ class UserMgr
276 else { 276 else {
277 // totally rewrite 277 // totally rewrite
278 if ($base->hasAttribute('isSimulation')) { 278 if ($base->hasAttribute('isSimulation')) {
279 - /*$centerNode = $this->makeSimulationBase($baseId); 279 + $centerNode = $this->makeSimulationBase($baseId);
280 $center = new $baseId(); 280 $center = new $baseId();
281 - $centerNode->setAttribute('available', $center->monitor());*/ 281 + $centerNode->setAttribute('available', $center->monitor());
282 } 282 }
283 else { 283 else {
284 $center = new $baseId(); 284 $center = new $baseId();
@@ -334,18 +334,19 @@ class UserMgr @@ -334,18 +334,19 @@ class UserMgr
334 334
335 $this->paramMgr->xmlDom->formatOutput = true; 335 $this->paramMgr->xmlDom->formatOutput = true;
336 $this->paramMgr->xmlDom->preserveWhiteSpace = false; 336 $this->paramMgr->xmlDom->preserveWhiteSpace = false;
337 - 337 +
338 $BASE = $this->paramMgr->xmlDom->createElement('dataRoot'); 338 $BASE = $this->paramMgr->xmlDom->createElement('dataRoot');
339 $BASE->setAttribute('xml:id','myRemoteData-treeRootNode'); 339 $BASE->setAttribute('xml:id','myRemoteData-treeRootNode');
340 340
341 foreach ($this->paramMgr->Bases as $baseId) 341 foreach ($this->paramMgr->Bases as $baseId)
342 { 342 {
343 $centerNode = $this->makeNewBase($baseId); 343 $centerNode = $this->makeNewBase($baseId);
344 - $BASE->appendChild($centerNode); 344 + if (isset($centerNode))
  345 + $BASE->appendChild($centerNode);
345 } 346 }
346 - 347 +
347 $this->paramMgr->xmlDom->appendChild($BASE); 348 $this->paramMgr->xmlDom->appendChild($BASE);
348 - 349 +
349 return $this->paramMgr->xmlDom->save($this->paramMgr->xmlName); 350 return $this->paramMgr->xmlDom->save($this->paramMgr->xmlName);
350 } 351 }
351 } 352 }
@@ -353,11 +354,11 @@ class UserMgr @@ -353,11 +354,11 @@ class UserMgr
353 protected function makeNewBase($baseId) 354 protected function makeNewBase($baseId)
354 { 355 {
355 // no data base description ; skip this data base 356 // no data base description ; skip this data base
356 - if (!@file_exists(RemoteData.$baseId.'/base.xml')) return; 357 + if (!@file_exists(RemoteData.$baseId.'/base.xml')) return NULL;
357 358
358 // can't read base.xml ; skip this data base 359 // can't read base.xml ; skip this data base
359 - if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) return;  
360 - 360 + if (!@$this->baseExtXml->load(RemoteData.$baseId.'/base.xml')) return NULL;
  361 +
361 $base = $this->paramMgr->basesDom->getElementById($baseId); 362 $base = $this->paramMgr->basesDom->getElementById($baseId);
362 363
363 if ($base->hasAttribute('default')) 364 if ($base->hasAttribute('default'))
@@ -527,7 +528,7 @@ class UserMgr @@ -527,7 +528,7 @@ class UserMgr
527 528
528 529
529 public function init() 530 public function init()
530 - { 531 + {
531 if ($this->ddLogin() != 0) 532 if ($this->ddLogin() != 0)
532 die('<h2>You are trying to log in as '.$this->user.'<br/> Please check that you entered a valid password</h2>'); 533 die('<h2>You are trying to log in as '.$this->user.'<br/> Please check that you entered a valid password</h2>');
533 534
@@ -573,12 +574,11 @@ class UserMgr @@ -573,12 +574,11 @@ class UserMgr
573 $this->setPath(); 574 $this->setPath();
574 575
575 $this->userGrps = $this->getUserGrps(); 576 $this->userGrps = $this->getUserGrps();
576 - 577 +
577 if (!$this->makeLocalTree()) 578 if (!$this->makeLocalTree())
578 die("Login for ".$this->user." failed: Can't make LocalParams.xml");; 579 die("Login for ".$this->user." failed: Can't make LocalParams.xml");;
579 - //$ok = $this->makeRemoteTree();  
580 -  
581 -//die("BRE"); 580 +
  581 + $ok = $this->makeRemoteTree();
582 582
583 if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr(); 583 if (!file_exists(USERWSDIR.'Request.xml')) $reqMgr = new RequestMgr();
584 if (!file_exists(USERWSDIR.'Tt.xml')) $ttMgr = new TimeTableMgr(); 584 if (!file_exists(USERWSDIR.'Tt.xml')) $ttMgr = new TimeTableMgr();