set not found parameters, and changes on date class

This commit is contained in:
Diego Najar 2017-11-26 16:04:57 +01:00
parent e162c03392
commit 981dc9ffb4
3 changed files with 12 additions and 4 deletions

View File

@ -35,6 +35,13 @@ class Date {
return false;
}
public static function convertToUTC($date, $currentFormat, $outputFormat)
{
$Date = DateTime::createFromFormat($currentFormat, $date);
$Date->setTimezone(new DateTimeZone('UTC'));
return $Date->format($outputFormat);
}
public static function timeago($time)
{
$time = time() - $time;

View File

@ -296,6 +296,7 @@ class Page {
$tmp['contentRaw'] = $this->contentRaw(); // No Markdown parsed
$tmp['description'] = $this->description();
$tmp['date'] = $this->dateRaw();
$tmp['dateUTC'] = Date::convertToUTC($this->dateRaw(), DB_DATE_FORMAT, DB_DATE_FORMAT);
$tmp['permalink'] = $this->permalink(true);
if($returnsArray) {

View File

@ -155,12 +155,12 @@ class Url
return 1;
}
public function setNotFound()
public function setNotFound($notFound=true, $httpCode=404, $httpMessage='Not Found')
{
$this->setWhereAmI('page');
$this->notFound = true;
$this->httpCode = 404;
$this->httpMessage = 'Not Found';
$this->notFound = $notFound;
$this->httpCode = $httpCode;
$this->httpMessage = $httpMessage;
}
public function httpCode()