Skip to content

Commit

Permalink
Merge pull request LibreBooking#48 from apfelchips/develop
Browse files Browse the repository at this point in the history
added API documentation / other stuff
  • Loading branch information
effgarces authored May 18, 2021
2 parents 1b36c3b + e7da1aa commit ed7cc4f
Show file tree
Hide file tree
Showing 4 changed files with 2,475 additions and 32 deletions.
50 changes: 26 additions & 24 deletions Pages/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,29 +451,31 @@ private function ShouldShowNewVersion()
return false;
}

$newVersion = $this->server->GetCookie('new_version');
if (empty($newVersion)) {
$cookie = sprintf('v=%s,fs=%s', Configuration::VERSION, Date::Now()->Timestamp());
$this->server->SetCookie(new Cookie('new_version', $cookie));
return true;
}

$parts = explode(',', $newVersion);
$versionParts = explode('=', $parts[0]);
$firstShownParts = explode('=', $parts[1]);

if ($versionParts[1] != Configuration::VERSION)
{
$cookie = sprintf('v=%s,fs=%s', Configuration::VERSION, Date::Now()->Timestamp());
$this->server->SetCookie(new Cookie('new_version', $cookie));
return true;
}

if (Date::Now()->AddDays(-3)->Timestamp() > $firstShownParts[1])
{
return false;
}

return true;
// $newVersion = $this->server->GetCookie('new_version');
// if (empty($newVersion)) {
// $cookie = sprintf('v=%s,fs=%s', Configuration::VERSION, Date::Now()->Timestamp());
// $this->server->SetCookie(new Cookie('new_version', $cookie));
// return true;
// }

// $parts = explode(',', $newVersion);
// $versionParts = explode('=', $parts[0]);
// $firstShownParts = explode('=', $parts[1]);

// if ($versionParts[1] != Configuration::VERSION)
// {
// $cookie = sprintf('v=%s,fs=%s', Configuration::VERSION, Date::Now()->Timestamp());
// $this->server->SetCookie(new Cookie('new_version', $cookie));
// return true;
// }

// if (Date::Now()->AddDays(-3)->Timestamp() > $firstShownParts[1])
// {
// return false;
// }

// TODO Actually check for new versions on git / save install date to DB.
// The old Method doesn't work when deleting cookies and confuses the users.
return false;
}
}
Loading

0 comments on commit ed7cc4f

Please sign in to comment.