separated home logged in and not
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
This commit is contained in:
@ -13,8 +13,37 @@ class Home extends Page
|
||||
{
|
||||
$u = new User();
|
||||
$this->set('userdata', $u->getAll());
|
||||
$this->set('template', "home.html");
|
||||
//return $this->renderPagecontent();
|
||||
|
||||
if(!$_SESSION['user'])
|
||||
{
|
||||
$this->set('template', 'home-nouser.html');
|
||||
return;
|
||||
}
|
||||
else {
|
||||
$dogs = $_SESSION['user']->data['dogs'];
|
||||
$doggos = [];
|
||||
|
||||
foreach($dogs as $key => $dogid)
|
||||
{
|
||||
$dog = new Dog();
|
||||
try{
|
||||
$dog->load($dogid);
|
||||
}
|
||||
catch(Exception $e)
|
||||
{
|
||||
error_log("Dog $dogid not found. Deleting from user");
|
||||
unset($_SESSION['user']->data['dogs'][$key]);
|
||||
$_SESSION['user']->save();
|
||||
continue;
|
||||
}
|
||||
if($dog->data)
|
||||
$doggos[] = array_merge($dog->data,['id'=>$dogid]);
|
||||
$this->set('doggos',$doggos);
|
||||
}
|
||||
//var_dump($doggos);
|
||||
$this->set('template', "home.html");
|
||||
}
|
||||
}
|
||||
|
||||
function maySeeThisPage(){return true;}
|
||||
|
Reference in New Issue
Block a user