Fix the détection of bad publication date. fix #245

The previous one was based on the fact that the PHP version used was 64bits and so the unix timestamp could go way back.

With a 32bits PHP that's not the case.  Check the notes in http://php.net/manual/en/function.strtotime.php for more information.
This commit is contained in:
Sébastien Lucas 2016-02-13 06:25:20 +01:00
parent df592eb668
commit 0a0007a096
3 changed files with 39 additions and 6 deletions

View file

@ -94,7 +94,7 @@ class Book extends Base {
$this->id = $line->id;
$this->title = $line->title;
$this->timestamp = strtotime ($line->timestamp);
$this->pubdate = strtotime ($line->pubdate);
$this->pubdate = $line->pubdate;
$this->path = Base::getDbDirectory () . $line->path;
$this->relativePath = $line->path;
$this->seriesIndex = $line->series_index;
@ -265,12 +265,14 @@ class Book extends Base {
}
public function getPubDate () {
if (is_null ($this->pubdate) || ($this->pubdate <= -58979923200)) {
if (empty ($this->pubdate)) {
return "";
}
else {
return date ("Y", $this->pubdate);
$dateY = (int) substr($this->pubdate, 0, 4);
if ($dateY > 102) {
return str_pad($dateY, 4, "0", STR_PAD_LEFT);
}
return "";
}
public function getComment ($withSerie = true) {