mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Change 'timestamp' properties on objects to more descriptive names
This commit is contained in:
parent
18f761929a
commit
dbefba6b94
32 changed files with 74 additions and 74 deletions
|
@ -7,7 +7,7 @@ CREATE TABLE `NewsletterSubscribers` (
|
||||||
`IsConfirmed` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
`IsConfirmed` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
||||||
`IsSubscribedToNewsletter` tinyint(1) unsigned NOT NULL DEFAULT 1,
|
`IsSubscribedToNewsletter` tinyint(1) unsigned NOT NULL DEFAULT 1,
|
||||||
`IsSubscribedToSummary` tinyint(1) unsigned NOT NULL DEFAULT 1,
|
`IsSubscribedToSummary` tinyint(1) unsigned NOT NULL DEFAULT 1,
|
||||||
`Timestamp` datetime NOT NULL,
|
`Created` datetime NOT NULL,
|
||||||
PRIMARY KEY (`NewsletterSubscriberId`),
|
PRIMARY KEY (`NewsletterSubscriberId`),
|
||||||
UNIQUE KEY `Uuid_UNIQUE` (`Uuid`),
|
UNIQUE KEY `Uuid_UNIQUE` (`Uuid`),
|
||||||
UNIQUE KEY `Email_UNIQUE` (`Email`)
|
UNIQUE KEY `Email_UNIQUE` (`Email`)
|
||||||
|
|
|
@ -3,8 +3,8 @@ CREATE TABLE `Patrons` (
|
||||||
`IsAnonymous` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
`IsAnonymous` tinyint(1) unsigned NOT NULL DEFAULT 0,
|
||||||
`AlternateName` varchar(80) DEFAULT NULL,
|
`AlternateName` varchar(80) DEFAULT NULL,
|
||||||
`IsSubscribedToEmails` tinyint(1) NOT NULL DEFAULT 1,
|
`IsSubscribedToEmails` tinyint(1) NOT NULL DEFAULT 1,
|
||||||
`Timestamp` datetime NOT NULL,
|
`Created` datetime NOT NULL,
|
||||||
`DeactivatedTimestamp` datetime DEFAULT NULL,
|
`Ended` datetime DEFAULT NULL,
|
||||||
PRIMARY KEY (`UserId`),
|
PRIMARY KEY (`UserId`),
|
||||||
KEY `index2` (`IsAnonymous`,`DeactivatedTimestamp`)
|
KEY `index2` (`IsAnonymous`,`Ended`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
CREATE TABLE `Payments` (
|
CREATE TABLE `Payments` (
|
||||||
`PaymentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`PaymentId` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`UserId` int(10) unsigned DEFAULT NULL,
|
`UserId` int(10) unsigned DEFAULT NULL,
|
||||||
`Timestamp` datetime NOT NULL,
|
`Created` datetime NOT NULL,
|
||||||
`ChannelId` tinyint(4) unsigned NOT NULL,
|
`ChannelId` tinyint(4) unsigned NOT NULL,
|
||||||
`TransactionId` varchar(80) NOT NULL,
|
`TransactionId` varchar(80) NOT NULL,
|
||||||
`Amount` decimal(7,2) unsigned NOT NULL,
|
`Amount` decimal(7,2) unsigned NOT NULL,
|
||||||
`Fee` decimal(7,2) unsigned NOT NULL DEFAULT 0.00,
|
`Fee` decimal(7,2) unsigned NOT NULL DEFAULT 0.00,
|
||||||
`IsRecurring` tinyint(1) unsigned NOT NULL,
|
`IsRecurring` tinyint(1) unsigned NOT NULL,
|
||||||
PRIMARY KEY (`PaymentId`),
|
PRIMARY KEY (`PaymentId`),
|
||||||
KEY `index2` (`UserId`,`Amount`,`Timestamp`,`IsRecurring`)
|
KEY `index2` (`UserId`,`Amount`,`Created`,`IsRecurring`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=828 DEFAULT CHARSET=utf8mb4;
|
) ENGINE=InnoDB AUTO_INCREMENT=828 DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
CREATE TABLE `PendingPayments` (
|
CREATE TABLE `PendingPayments` (
|
||||||
`Timestamp` datetime NOT NULL,
|
`Created` datetime NOT NULL,
|
||||||
`ChannelId` tinyint(4) unsigned NOT NULL,
|
`ChannelId` tinyint(4) unsigned NOT NULL,
|
||||||
`TransactionId` varchar(80) NOT NULL,
|
`TransactionId` varchar(80) NOT NULL,
|
||||||
`ProcessedOn` datetime DEFAULT NULL
|
`ProcessedOn` datetime DEFAULT NULL
|
||||||
|
|
|
@ -2,7 +2,7 @@ CREATE TABLE `Users` (
|
||||||
`UserId` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`UserId` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`Email` varchar(80) DEFAULT NULL,
|
`Email` varchar(80) DEFAULT NULL,
|
||||||
`Name` varchar(255) DEFAULT NULL,
|
`Name` varchar(255) DEFAULT NULL,
|
||||||
`Timestamp` datetime NOT NULL,
|
`Created` datetime NOT NULL,
|
||||||
`Uuid` char(36) NOT NULL,
|
`Uuid` char(36) NOT NULL,
|
||||||
PRIMARY KEY (`UserId`),
|
PRIMARY KEY (`UserId`),
|
||||||
UNIQUE KEY `idxEmail` (`Email`)
|
UNIQUE KEY `idxEmail` (`Email`)
|
||||||
|
|
|
@ -21,7 +21,7 @@ class AtomFeed extends Feed{
|
||||||
|
|
||||||
protected function GetXmlString(): string{
|
protected function GetXmlString(): string{
|
||||||
if($this->XmlString === null){
|
if($this->XmlString === null){
|
||||||
$feed = Template::AtomFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'subtitle' => $this->Subtitle, 'updatedTimestamp' => $this->Updated, 'entries' => $this->Entries]);
|
$feed = Template::AtomFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'subtitle' => $this->Subtitle, 'updated' => $this->Updated, 'entries' => $this->Entries]);
|
||||||
|
|
||||||
$this->XmlString = $this->CleanXmlString($feed);
|
$this->XmlString = $this->CleanXmlString($feed);
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ class AtomFeed extends Feed{
|
||||||
foreach($this->Entries as $entry){
|
foreach($this->Entries as $entry){
|
||||||
$obj = new StdClass();
|
$obj = new StdClass();
|
||||||
if(is_a($entry, 'Ebook')){
|
if(is_a($entry, 'Ebook')){
|
||||||
$obj->Updated = $entry->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z');
|
$obj->Updated = $entry->Modified->format('Y-m-d\TH:i:s\Z');
|
||||||
$obj->Id = SITE_URL . $entry->Url;
|
$obj->Id = SITE_URL . $entry->Url;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -53,8 +53,8 @@ class Ebook{
|
||||||
public $Contributors = []; // Array of Contributors
|
public $Contributors = []; // Array of Contributors
|
||||||
public $ContributorsHtml;
|
public $ContributorsHtml;
|
||||||
public $TitleWithCreditsHtml = '';
|
public $TitleWithCreditsHtml = '';
|
||||||
public $Timestamp;
|
public $Created;
|
||||||
public $ModifiedTimestamp;
|
public $Modified;
|
||||||
public $TextUrl;
|
public $TextUrl;
|
||||||
public $TextSinglePageUrl;
|
public $TextSinglePageUrl;
|
||||||
public $TocEntries = null; // A list of non-Roman ToC entries ONLY IF the work has the 'se:is-a-collection' metadata element, null otherwise
|
public $TocEntries = null; // A list of non-Roman ToC entries ONLY IF the work has the 'se:is-a-collection' metadata element, null otherwise
|
||||||
|
@ -151,7 +151,7 @@ class Ebook{
|
||||||
if(stripos($this->RepoFilesystemPath, '.git') === false){
|
if(stripos($this->RepoFilesystemPath, '.git') === false){
|
||||||
$gitFolderPath = $gitFolderPath . '/.git';
|
$gitFolderPath = $gitFolderPath . '/.git';
|
||||||
}
|
}
|
||||||
$hash = substr(sha1($this->GitCommits[0]->Timestamp->format('U') . ' ' . $this->GitCommits[0]->Message), 0, 8);
|
$hash = substr(sha1($this->GitCommits[0]->Created->format('U') . ' ' . $this->GitCommits[0]->Message), 0, 8);
|
||||||
$this->CoverImageUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . $hash . '-cover.jpg';
|
$this->CoverImageUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . $hash . '-cover.jpg';
|
||||||
if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-cover.avif')){
|
if(file_exists(WEB_ROOT . '/images/covers/' . $this->UrlSafeIdentifier . '-cover.avif')){
|
||||||
$this->CoverImageAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . $hash . '-cover.avif';
|
$this->CoverImageAvifUrl = '/images/covers/' . $this->UrlSafeIdentifier . '-' . $hash . '-cover.avif';
|
||||||
|
@ -186,12 +186,12 @@ class Ebook{
|
||||||
|
|
||||||
$date = $xml->xpath('/package/metadata/dc:date');
|
$date = $xml->xpath('/package/metadata/dc:date');
|
||||||
if($date !== false && sizeof($date) > 0){
|
if($date !== false && sizeof($date) > 0){
|
||||||
$this->Timestamp = new DateTime((string)$date[0]);
|
$this->Created = new DateTime((string)$date[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$modifiedDate = $xml->xpath('/package/metadata/meta[@property="dcterms:modified"]');
|
$modifiedDate = $xml->xpath('/package/metadata/meta[@property="dcterms:modified"]');
|
||||||
if($modifiedDate !== false && sizeof($modifiedDate) > 0){
|
if($modifiedDate !== false && sizeof($modifiedDate) > 0){
|
||||||
$this->ModifiedTimestamp = new DateTime((string)$modifiedDate[0]);
|
$this->Modified = new DateTime((string)$modifiedDate[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get SE tags
|
// Get SE tags
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
use Safe\DateTimeImmutable;
|
use Safe\DateTimeImmutable;
|
||||||
|
|
||||||
class GitCommit{
|
class GitCommit{
|
||||||
public $Timestamp;
|
public $Created;
|
||||||
public $Message;
|
public $Message;
|
||||||
public $Hash;
|
public $Hash;
|
||||||
|
|
||||||
public function __construct(string $unixTimestamp, string $hash, string $message){
|
public function __construct(string $unixTimestamp, string $hash, string $message){
|
||||||
$this->Timestamp = new DateTimeImmutable('@' . $unixTimestamp);
|
$this->Created = new DateTimeImmutable('@' . $unixTimestamp);
|
||||||
$this->Message = $message;
|
$this->Message = $message;
|
||||||
$this->Hash = $hash;
|
$this->Hash = $hash;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,10 +50,10 @@ class Library{
|
||||||
|
|
||||||
case SORT_NEWEST:
|
case SORT_NEWEST:
|
||||||
usort($matches, function($a, $b){
|
usort($matches, function($a, $b){
|
||||||
if($a->Timestamp < $b->Timestamp){
|
if($a->Created < $b->Created){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
elseif($a->Timestamp == $b->Timestamp){
|
elseif($a->Created == $b->Created){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
|
@ -11,7 +11,7 @@ class NewsletterSubscriber extends PropertiesBase{
|
||||||
public $IsConfirmed = false;
|
public $IsConfirmed = false;
|
||||||
public $IsSubscribedToSummary = true;
|
public $IsSubscribedToSummary = true;
|
||||||
public $IsSubscribedToNewsletter = true;
|
public $IsSubscribedToNewsletter = true;
|
||||||
public $Timestamp;
|
public $Created;
|
||||||
protected $Url = null;
|
protected $Url = null;
|
||||||
|
|
||||||
protected function GetUrl(): string{
|
protected function GetUrl(): string{
|
||||||
|
@ -27,10 +27,10 @@ class NewsletterSubscriber extends PropertiesBase{
|
||||||
|
|
||||||
$uuid = Uuid::uuid4();
|
$uuid = Uuid::uuid4();
|
||||||
$this->Uuid = $uuid->toString();
|
$this->Uuid = $uuid->toString();
|
||||||
$this->Timestamp = new DateTime();
|
$this->Created = new DateTime();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Db::Query('INSERT into NewsletterSubscribers (Email, Uuid, FirstName, LastName, IsConfirmed, IsSubscribedToNewsletter, IsSubscribedToSummary, Timestamp) values (?, ?, ?, ?, ?, ?, ?, ?);', [$this->Email, $this->Uuid, $this->FirstName, $this->LastName, false, $this->IsSubscribedToNewsletter, $this->IsSubscribedToSummary, $this->Timestamp]);
|
Db::Query('INSERT into NewsletterSubscribers (Email, Uuid, FirstName, LastName, IsConfirmed, IsSubscribedToNewsletter, IsSubscribedToSummary, Created) values (?, ?, ?, ?, ?, ?, ?, ?);', [$this->Email, $this->Uuid, $this->FirstName, $this->LastName, false, $this->IsSubscribedToNewsletter, $this->IsSubscribedToSummary, $this->Created]);
|
||||||
}
|
}
|
||||||
catch(PDOException $ex){
|
catch(PDOException $ex){
|
||||||
if($ex->errorInfo[1] == 1062){
|
if($ex->errorInfo[1] == 1062){
|
||||||
|
|
|
@ -11,7 +11,7 @@ class OpdsAcquisitionFeed extends OpdsFeed{
|
||||||
|
|
||||||
protected function GetXmlString(): string{
|
protected function GetXmlString(): string{
|
||||||
if($this->XmlString === null){
|
if($this->XmlString === null){
|
||||||
$this->XmlString = $this->CleanXmlString(Template::OpdsAcquisitionFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'parentUrl' => $this->Parent ? $this->Parent->Url : null, 'updatedTimestamp' => $this->Updated, 'isCrawlable' => $this->IsCrawlable, 'subtitle' => $this->Subtitle, 'entries' => $this->Entries]));
|
$this->XmlString = $this->CleanXmlString(Template::OpdsAcquisitionFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'parentUrl' => $this->Parent ? $this->Parent->Url : null, 'updated' => $this->Updated, 'isCrawlable' => $this->IsCrawlable, 'subtitle' => $this->Subtitle, 'entries' => $this->Entries]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->XmlString;
|
return $this->XmlString;
|
||||||
|
|
|
@ -11,24 +11,24 @@ class OpdsFeed extends AtomFeed{
|
||||||
$this->Stylesheet = '/feeds/opds/style';
|
$this->Stylesheet = '/feeds/opds/style';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function SaveUpdatedTimestamp(string $entryId, DateTime $updatedTimestamp): void{
|
protected function SaveUpdated(string $entryId, DateTime $updated): void{
|
||||||
// Only save the updated timestamp for the given entry ID in this file
|
// Only save the updated timestamp for the given entry ID in this file
|
||||||
foreach($this->Entries as $entry){
|
foreach($this->Entries as $entry){
|
||||||
if(is_a($entry, 'OpdsNavigationEntry')){
|
if(is_a($entry, 'OpdsNavigationEntry')){
|
||||||
if($entry->Id == SITE_URL . $entryId){
|
if($entry->Id == SITE_URL . $entryId){
|
||||||
$entry->Updated = $updatedTimestamp;
|
$entry->Updated = $updated;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->Updated = $updatedTimestamp;
|
$this->Updated = $updated;
|
||||||
|
|
||||||
$this->XmlString = null;
|
$this->XmlString = null;
|
||||||
file_put_contents($this->Path, $this->GetXmlString());
|
file_put_contents($this->Path, $this->GetXmlString());
|
||||||
|
|
||||||
// Do we have any parents of our own to update?
|
// Do we have any parents of our own to update?
|
||||||
if($this->Parent !== null){
|
if($this->Parent !== null){
|
||||||
$this->Parent->SaveUpdatedTimestamp($this->Id, $updatedTimestamp);
|
$this->Parent->SaveUpdated($this->Id, $updated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class OpdsFeed extends AtomFeed{
|
||||||
$this->Updated = new DateTime();
|
$this->Updated = new DateTime();
|
||||||
|
|
||||||
if($this->Parent !== null){
|
if($this->Parent !== null){
|
||||||
$this->Parent->SaveUpdatedTimestamp($this->Id, $this->Updated);
|
$this->Parent->SaveUpdated($this->Id, $this->Updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save our own file
|
// Save our own file
|
||||||
|
|
|
@ -31,7 +31,7 @@ class OpdsNavigationFeed extends OpdsFeed{
|
||||||
|
|
||||||
protected function GetXmlString(): string{
|
protected function GetXmlString(): string{
|
||||||
if($this->XmlString === null){
|
if($this->XmlString === null){
|
||||||
$this->XmlString = $this->CleanXmlString(Template::OpdsNavigationFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'parentUrl' => $this->Parent ? $this->Parent->Url : null, 'updatedTimestamp' => $this->Updated, 'subtitle' => $this->Subtitle, 'entries' => $this->Entries]));
|
$this->XmlString = $this->CleanXmlString(Template::OpdsNavigationFeed(['id' => $this->Id, 'url' => $this->Url, 'title' => $this->Title, 'parentUrl' => $this->Parent ? $this->Parent->Url : null, 'updated' => $this->Updated, 'subtitle' => $this->Subtitle, 'entries' => $this->Entries]));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->XmlString;
|
return $this->XmlString;
|
||||||
|
|
|
@ -7,8 +7,8 @@ class Patron extends PropertiesBase{
|
||||||
public $IsAnonymous;
|
public $IsAnonymous;
|
||||||
public $AlternateName;
|
public $AlternateName;
|
||||||
public $IsSubscribedToEmail;
|
public $IsSubscribedToEmail;
|
||||||
public $Timestamp = null;
|
public $Created = null;
|
||||||
public $DeactivatedTimestamp = null;
|
public $Ended = null;
|
||||||
|
|
||||||
public static function Get(?int $userId): Patron{
|
public static function Get(?int $userId): Patron{
|
||||||
$result = Db::Query('SELECT * from Patrons where UserId = ?', [$userId], 'Patron');
|
$result = Db::Query('SELECT * from Patrons where UserId = ?', [$userId], 'Patron');
|
||||||
|
@ -31,9 +31,9 @@ class Patron extends PropertiesBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Create(bool $sendEmail = true): void{
|
public function Create(bool $sendEmail = true): void{
|
||||||
$this->Timestamp = new DateTime();
|
$this->Created = new DateTime();
|
||||||
|
|
||||||
Db::Query('INSERT into Patrons (Timestamp, UserId, IsAnonymous, AlternateName, IsSubscribedToEmail) values(?, ?, ?, ?, ?);', [$this->Timestamp, $this->UserId, $this->IsAnonymous, $this->AlternateName, $this->IsSubscribedToEmail]);
|
Db::Query('INSERT into Patrons (Created, UserId, IsAnonymous, AlternateName, IsSubscribedToEmail) values(?, ?, ?, ?, ?);', [$this->Created, $this->UserId, $this->IsAnonymous, $this->AlternateName, $this->IsSubscribedToEmail]);
|
||||||
|
|
||||||
if($sendEmail){
|
if($sendEmail){
|
||||||
$this->SendWelcomeEmail();
|
$this->SendWelcomeEmail();
|
||||||
|
@ -41,9 +41,9 @@ class Patron extends PropertiesBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Reactivate(bool $sendEmail = true): void{
|
public function Reactivate(bool $sendEmail = true): void{
|
||||||
Db::Query('UPDATE Patrons set Timestamp = utc_timestamp(), DeactivatedTimestamp = null, IsAnonymous = ?, IsSubscribedToEmail = ?, AlternateName = ? where UserId = ?;', [$this->IsAnonymous, $this->IsSubscribedToEmail, $this->AlternateName, $this->UserId]);
|
Db::Query('UPDATE Patrons set Created = utc_timestamp(), Ended = null, IsAnonymous = ?, IsSubscribedToEmail = ?, AlternateName = ? where UserId = ?;', [$this->IsAnonymous, $this->IsSubscribedToEmail, $this->AlternateName, $this->UserId]);
|
||||||
$this->Timestamp = new DateTime();
|
$this->Created = new DateTime();
|
||||||
$this->DeactivatedTimestamp = null;
|
$this->Ended = null;
|
||||||
|
|
||||||
if($sendEmail){
|
if($sendEmail){
|
||||||
$this->SendWelcomeEmail();
|
$this->SendWelcomeEmail();
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Payment extends PropertiesBase{
|
||||||
public $PaymentId;
|
public $PaymentId;
|
||||||
protected $User = null;
|
protected $User = null;
|
||||||
public $UserId = null;
|
public $UserId = null;
|
||||||
public $Timestamp;
|
public $Created;
|
||||||
public $ChannelId;
|
public $ChannelId;
|
||||||
public $TransactionId;
|
public $TransactionId;
|
||||||
public $Amount;
|
public $Amount;
|
||||||
|
@ -33,7 +33,7 @@ class Payment extends PropertiesBase{
|
||||||
}
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Db::Query('INSERT into Payments (UserId, Timestamp, ChannelId, TransactionId, Amount, Fee, IsRecurring) values(?, ?, ?, ?, ?, ?, ?);', [$this->UserId, $this->Timestamp, $this->ChannelId, $this->TransactionId, $this->Amount, $this->Fee, $this->IsRecurring]);
|
Db::Query('INSERT into Payments (UserId, Created, ChannelId, TransactionId, Amount, Fee, IsRecurring) values(?, ?, ?, ?, ?, ?, ?);', [$this->UserId, $this->Created, $this->ChannelId, $this->TransactionId, $this->Amount, $this->Fee, $this->IsRecurring]);
|
||||||
}
|
}
|
||||||
catch(PDOException $ex){
|
catch(PDOException $ex){
|
||||||
if($ex->errorInfo[1] == 1062){
|
if($ex->errorInfo[1] == 1062){
|
||||||
|
|
|
@ -15,7 +15,7 @@ class RssFeed extends Feed{
|
||||||
|
|
||||||
protected function GetXmlString(): string{
|
protected function GetXmlString(): string{
|
||||||
if($this->XmlString === null){
|
if($this->XmlString === null){
|
||||||
$feed = Template::RssFeed(['url' => $this->Url, 'description' => $this->Description, 'title' => $this->Title, 'entries' => $this->Entries, 'updatedTimestamp' => (new DateTime())->format('r')]);
|
$feed = Template::RssFeed(['url' => $this->Url, 'description' => $this->Description, 'title' => $this->Title, 'entries' => $this->Entries, 'updated' => (new DateTime())->format('r')]);
|
||||||
|
|
||||||
$this->XmlString = $this->CleanXmlString($feed);
|
$this->XmlString = $this->CleanXmlString($feed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class User extends PropertiesBase{
|
||||||
protected $DisplayName = null;
|
protected $DisplayName = null;
|
||||||
public $Email;
|
public $Email;
|
||||||
protected $DisplayEmail;
|
protected $DisplayEmail;
|
||||||
public $Timestamp;
|
public $Created;
|
||||||
public $Uuid;
|
public $Uuid;
|
||||||
|
|
||||||
public static function Get(?int $userId): User{
|
public static function Get(?int $userId): User{
|
||||||
|
@ -46,10 +46,10 @@ class User extends PropertiesBase{
|
||||||
public function Create(): void{
|
public function Create(): void{
|
||||||
$uuid = Uuid::uuid4();
|
$uuid = Uuid::uuid4();
|
||||||
$this->Uuid = $uuid->toString();
|
$this->Uuid = $uuid->toString();
|
||||||
$this->Timestamp = new DateTime();
|
$this->Created = new DateTime();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Db::Query('INSERT into Users (Email, Name, Uuid, Timestamp) values (?, ?, ?, ?);', [$this->Email, $this->Name, $this->Uuid, $this->Timestamp]);
|
Db::Query('INSERT into Users (Email, Name, Uuid, Created) values (?, ?, ?, ?);', [$this->Email, $this->Name, $this->Uuid, $this->Created]);
|
||||||
}
|
}
|
||||||
catch(PDOException $ex){
|
catch(PDOException $ex){
|
||||||
if($ex->errorInfo[1] == 1062){
|
if($ex->errorInfo[1] == 1062){
|
||||||
|
|
|
@ -3,5 +3,5 @@
|
||||||
require_once('/standardebooks.org/web/lib/Core.php');
|
require_once('/standardebooks.org/web/lib/Core.php');
|
||||||
|
|
||||||
// Delete unconfirmed newsletter subscribers who are more than a week old
|
// Delete unconfirmed newsletter subscribers who are more than a week old
|
||||||
Db::Query('DELETE from NewsletterSubscribers where IsConfirmed = false and datediff(utc_timestamp(), Timestamp) >= 7');
|
Db::Query('DELETE from NewsletterSubscribers where IsConfirmed = false and datediff(utc_timestamp(), Created) >= 7');
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -57,8 +57,8 @@ foreach($contentFiles as $path){
|
||||||
|
|
||||||
$ebook = new Ebook($ebookWwwFilesystemPath);
|
$ebook = new Ebook($ebookWwwFilesystemPath);
|
||||||
|
|
||||||
$allEbooks[$ebook->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
$allEbooks[$ebook->Modified->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
||||||
$newestEbooks[$ebook->Timestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
$newestEbooks[$ebook->Created->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
||||||
|
|
||||||
foreach($ebook->Tags as $tag){
|
foreach($ebook->Tags as $tag){
|
||||||
// Add the book's subjects to the main subjects list
|
// Add the book's subjects to the main subjects list
|
||||||
|
@ -67,7 +67,7 @@ foreach($contentFiles as $path){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort this ebook by subject
|
// Sort this ebook by subject
|
||||||
$ebooksBySubject[$tag->Name][$ebook->Timestamp->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
$ebooksBySubject[$tag->Name][$ebook->Created->format('Y-m-d\TH:i:s\Z') . ' ' . $ebook->Identifier] = $ebook;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(\Exception $ex){
|
catch(\Exception $ex){
|
||||||
|
|
|
@ -133,7 +133,7 @@ try{
|
||||||
$payment->User = null;
|
$payment->User = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$payment->Timestamp = DateTime::createFromFormat('n/j/Y', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Created On"]]'))->getText()));
|
$payment->Created = DateTime::createFromFormat('n/j/Y', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Created On"]]'))->getText()));
|
||||||
$payment->TransactionId = trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "ID"]]'))->getText());
|
$payment->TransactionId = trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "ID"]]'))->getText());
|
||||||
$payment->IsRecurring = sizeof($headerRow->findElements(WebDriverBy::xpath('//td[contains(., "Recurring")]'))) > 0;
|
$payment->IsRecurring = sizeof($headerRow->findElements(WebDriverBy::xpath('//td[contains(., "Recurring")]'))) > 0;
|
||||||
$payment->Amount = floatval(str_replace('$', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Total Amount"]]'))->getText())));
|
$payment->Amount = floatval(str_replace('$', '', trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Total Amount"]]'))->getText())));
|
||||||
|
@ -157,7 +157,7 @@ try{
|
||||||
|
|
||||||
// If this payment isn't anonymous, does it put us in the Patrons Circle?
|
// If this payment isn't anonymous, does it put us in the Patrons Circle?
|
||||||
if($payment->User !== null){
|
if($payment->User !== null){
|
||||||
if(($payment->IsRecurring && $payment->Amount >= 10 && $payment->Timestamp >= $lastMonth) || ($payment->Amount >= 100 && $payment->Timestamp >= $lastYear)){
|
if(($payment->IsRecurring && $payment->Amount >= 10 && $payment->Created >= $lastMonth) || ($payment->Amount >= 100 && $payment->Created >= $lastYear)){
|
||||||
// This payment is eligible for the Patrons Circle.
|
// This payment is eligible for the Patrons Circle.
|
||||||
// Are we already a patron?
|
// Are we already a patron?
|
||||||
try{
|
try{
|
||||||
|
@ -170,7 +170,7 @@ try{
|
||||||
$patron->User = $payment->User;
|
$patron->User = $payment->User;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($patron->Timestamp === null || $patron->DeactivatedTimestamp !== null){
|
if($patron->Created === null || $patron->Ended !== null){
|
||||||
// If we're a new patron, or an old patron that was deactivated,
|
// If we're a new patron, or an old patron that was deactivated,
|
||||||
// re-enable them as a patron in the system
|
// re-enable them as a patron in the system
|
||||||
$patron->IsAnonymous = (trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Attribution"]]'))->getText()) == 'Private');
|
$patron->IsAnonymous = (trim($detailsRow->findElement(WebDriverBy::xpath('//td[preceding-sibling::td[normalize-space(.) = "Attribution"]]'))->getText()) == 'Private');
|
||||||
|
@ -182,11 +182,11 @@ try{
|
||||||
catch(Exception $ex){
|
catch(Exception $ex){
|
||||||
}
|
}
|
||||||
|
|
||||||
if($patron->Timestamp === null){
|
if($patron->Created === null){
|
||||||
$log->Write('Adding donor as patron ...');
|
$log->Write('Adding donor as patron ...');
|
||||||
$patron->Create();
|
$patron->Create();
|
||||||
}
|
}
|
||||||
elseif($patron->DeactivatedTimestamp !== null){
|
elseif($patron->Ended !== null){
|
||||||
$log->Write('Reactivating donor as patron ...');
|
$log->Write('Reactivating donor as patron ...');
|
||||||
$patron->Reactivate();
|
$patron->Reactivate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,16 @@ require_once('/standardebooks.org/web/lib/Core.php');
|
||||||
|
|
||||||
Db::Query('
|
Db::Query('
|
||||||
update Patrons
|
update Patrons
|
||||||
set DeactivatedTimestamp = utc_timestamp()
|
set Ended = utc_timestamp()
|
||||||
where UserId not in
|
where UserId not in
|
||||||
(
|
(
|
||||||
select distinct UserId from Payments where
|
select distinct UserId from Payments where
|
||||||
UserId is not null
|
UserId is not null
|
||||||
and
|
and
|
||||||
(
|
(
|
||||||
(IsRecurring = 1 and Amount >= 10 and Timestamp > utc_timestamp() - interval 45 day)
|
(IsRecurring = 1 and Amount >= 10 and Created > utc_timestamp() - interval 45 day)
|
||||||
or
|
or
|
||||||
(IsRecurring = 0 and Amount >= 100 and Timestamp > utc_timestamp() - interval 1 year)
|
(IsRecurring = 0 and Amount >= 100 and Created > utc_timestamp() - interval 1 year)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
');
|
');
|
||||||
|
|
|
@ -12,7 +12,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
||||||
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
||||||
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
||||||
<updated><?= $updatedTimestamp->format('Y-m-d\TH:i:s\Z') ?></updated>
|
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
|
||||||
<author>
|
<author>
|
||||||
<name>Standard Ebooks</name>
|
<name>Standard Ebooks</name>
|
||||||
<uri><?= SITE_URL ?></uri>
|
<uri><?= SITE_URL ?></uri>
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
<uri><?= SITE_URL . Formatter::ToPlainXmlText($entry->AuthorsUrl) ?></uri>
|
<uri><?= SITE_URL . Formatter::ToPlainXmlText($entry->AuthorsUrl) ?></uri>
|
||||||
</author>
|
</author>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<published><?= $entry->Timestamp->format('Y-m-d\TH:i:s\Z') ?></published>
|
<published><?= $entry->Created->format('Y-m-d\TH:i:s\Z') ?></published>
|
||||||
<updated><?= $entry->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z') ?></updated>
|
<updated><?= $entry->Modified->format('Y-m-d\TH:i:s\Z') ?></updated>
|
||||||
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>
|
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>
|
||||||
<summary type="text"><?= Formatter::ToPlainXmlText($entry->Description) ?></summary>
|
<summary type="text"><?= Formatter::ToPlainXmlText($entry->Description) ?></summary>
|
||||||
<content type="html"><?= Formatter::ToPlainXmlText($entry->LongDescription) ?></content>
|
<content type="html"><?= Formatter::ToPlainXmlText($entry->LongDescription) ?></content>
|
||||||
|
|
|
@ -9,7 +9,7 @@ $startDate = new DateTime('2022-07-01');
|
||||||
$endDate = new DateTime('2022-07-31');
|
$endDate = new DateTime('2022-07-31');
|
||||||
$autoHide = $autoHide ?? true;
|
$autoHide = $autoHide ?? true;
|
||||||
$showDonateButton = $showDonateButton ?? true;
|
$showDonateButton = $showDonateButton ?? true;
|
||||||
$current = (Db::Query('SELECT count(*) as PatronCount from Patrons where Timestamp >= ?', [$startDate]))[0]->PatronCount;
|
$current = (Db::Query('SELECT count(*) as PatronCount from Patrons where Created >= ?', [$startDate]))[0]->PatronCount;
|
||||||
$target = 70;
|
$target = 70;
|
||||||
$stretchCurrent = 0;
|
$stretchCurrent = 0;
|
||||||
$stretchTarget = 20;
|
$stretchTarget = 20;
|
||||||
|
|
|
@ -11,9 +11,9 @@
|
||||||
<? if($author->NacoafUrl !== null){ ?><schema:sameAs><?= Formatter::ToPlainXmlText($author->NacoafUrl) ?></schema:sameAs><? } ?>
|
<? if($author->NacoafUrl !== null){ ?><schema:sameAs><?= Formatter::ToPlainXmlText($author->NacoafUrl) ?></schema:sameAs><? } ?>
|
||||||
</author>
|
</author>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
<published><?= $entry->Timestamp->format('Y-m-d\TH:i:s\Z') ?></published>
|
<published><?= $entry->Created->format('Y-m-d\TH:i:s\Z') ?></published>
|
||||||
<dc:issued><?= $entry->Timestamp->format('Y-m-d\TH:i:s\Z') ?></dc:issued>
|
<dc:issued><?= $entry->Created->format('Y-m-d\TH:i:s\Z') ?></dc:issued>
|
||||||
<updated><?= $entry->ModifiedTimestamp->format('Y-m-d\TH:i:s\Z') ?></updated>
|
<updated><?= $entry->Modified->format('Y-m-d\TH:i:s\Z') ?></updated>
|
||||||
<dc:language><?= Formatter::ToPlainXmlText($entry->Language) ?></dc:language>
|
<dc:language><?= Formatter::ToPlainXmlText($entry->Language) ?></dc:language>
|
||||||
<dc:publisher>Standard Ebooks</dc:publisher>
|
<dc:publisher>Standard Ebooks</dc:publisher>
|
||||||
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>
|
<rights>Public domain in the United States. Users located outside of the United States must check their local laws before using this ebook. Original content released to the public domain via the Creative Commons CC0 1.0 Universal Public Domain Dedication.</rights>
|
||||||
|
|
|
@ -26,7 +26,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
||||||
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
||||||
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
||||||
<updated><?= $updatedTimestamp->format('Y-m-d\TH:i:s\Z') ?></updated>
|
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
|
||||||
<? if($isCrawlable){ ?><fh:complete/><? } ?>
|
<? if($isCrawlable){ ?><fh:complete/><? } ?>
|
||||||
<author>
|
<author>
|
||||||
<name>Standard Ebooks</name>
|
<name>Standard Ebooks</name>
|
||||||
|
|
|
@ -17,7 +17,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
<title><?= Formatter::ToPlainXmlText($title) ?></title>
|
||||||
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
<? if($subtitle !== null){ ?><subtitle><?= Formatter::ToPlainXmlText($subtitle) ?></subtitle><? } ?>
|
||||||
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
<icon><?= SITE_URL ?>/images/logo.png</icon>
|
||||||
<updated><?= $updatedTimestamp->format('Y-m-d\TH:i:s\Z') ?></updated>
|
<updated><?= $updated->format('Y-m-d\TH:i:s\Z') ?></updated>
|
||||||
<author>
|
<author>
|
||||||
<name>Standard Ebooks</name>
|
<name>Standard Ebooks</name>
|
||||||
<uri><?= SITE_URL ?></uri>
|
<uri><?= SITE_URL ?></uri>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<title><?= Formatter::ToPlainXmlText($entry->Title) ?>, by <?= Formatter::ToPlainXmlText(strip_tags($entry->AuthorsHtml)) ?></title>
|
<title><?= Formatter::ToPlainXmlText($entry->Title) ?>, by <?= Formatter::ToPlainXmlText(strip_tags($entry->AuthorsHtml)) ?></title>
|
||||||
<link><?= SITE_URL . Formatter::ToPlainXmlText($entry->Url) ?></link>
|
<link><?= SITE_URL . Formatter::ToPlainXmlText($entry->Url) ?></link>
|
||||||
<description><?= Formatter::ToPlainXmlText($entry->Description) ?></description>
|
<description><?= Formatter::ToPlainXmlText($entry->Description) ?></description>
|
||||||
<pubDate><?= $entry->Timestamp->format('r') ?></pubDate>
|
<pubDate><?= $entry->Created->format('r') ?></pubDate>
|
||||||
<guid><?= Formatter::ToPlainXmlText(preg_replace('/^url:/ius', '', $entry->Identifier)) ?></guid>
|
<guid><?= Formatter::ToPlainXmlText(preg_replace('/^url:/ius', '', $entry->Identifier)) ?></guid>
|
||||||
<? foreach($entry->Tags as $tag){ ?>
|
<? foreach($entry->Tags as $tag){ ?>
|
||||||
<category domain="https://standardebooks.org/vocab/subjects"><?= Formatter::ToPlainXmlText($tag->Name) ?></category>
|
<category domain="https://standardebooks.org/vocab/subjects"><?= Formatter::ToPlainXmlText($tag->Name) ?></category>
|
||||||
|
|
|
@ -12,7 +12,7 @@ print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||||
<description><?= Formatter::ToPlainXmlText($description) ?></description>
|
<description><?= Formatter::ToPlainXmlText($description) ?></description>
|
||||||
<language>en-US</language>
|
<language>en-US</language>
|
||||||
<copyright>https://creativecommons.org/publicdomain/zero/1.0/</copyright>
|
<copyright>https://creativecommons.org/publicdomain/zero/1.0/</copyright>
|
||||||
<lastBuildDate><?= $updatedTimestamp ?></lastBuildDate>
|
<lastBuildDate><?= $updated ?></lastBuildDate>
|
||||||
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
|
||||||
<atom:link href="<?= SITE_URL . Formatter::ToPlainXmlText($url) ?>" rel="self" type="application/rss+xml"/>
|
<atom:link href="<?= SITE_URL . Formatter::ToPlainXmlText($url) ?>" rel="self" type="application/rss+xml"/>
|
||||||
<atom:link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" />
|
<atom:link href="<?= SITE_URL ?>/ebooks/opensearch" rel="search" type="application/opensearchdescription+xml" />
|
||||||
|
|
|
@ -12,7 +12,7 @@ $patronsCircle = Db::Query('SELECT if(p.AlternateName is not null, p.AlternateNa
|
||||||
on p.UserId = u.UserId
|
on p.UserId = u.UserId
|
||||||
where
|
where
|
||||||
p.IsAnonymous = false
|
p.IsAnonymous = false
|
||||||
and p.DeactivatedTimestamp is null
|
and p.Ended is null
|
||||||
order by regexp_substr(SortedName, "[\\\p{Lu}][\\\p{L}\-]+$") asc;
|
order by regexp_substr(SortedName, "[\\\p{Lu}][\\\p{L}\-]+$") asc;
|
||||||
');
|
');
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ $anonymousPatronCount = Db::Query('SELECT sum(cnt) as AnonymousPatronCount
|
||||||
UserId is null
|
UserId is null
|
||||||
and
|
and
|
||||||
(
|
(
|
||||||
(Amount >= 100 and Timestamp >= utc_timestamp() - interval 1 year)
|
(Amount >= 100 and Created >= utc_timestamp() - interval 1 year)
|
||||||
or
|
or
|
||||||
(Amount >= 10 and IsRecurring = true and Timestamp >= utc_timestamp() - interval 30 day)
|
(Amount >= 10 and IsRecurring = true and Created >= utc_timestamp() - interval 30 day)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
union all
|
union all
|
||||||
|
@ -36,7 +36,7 @@ $anonymousPatronCount = Db::Query('SELECT sum(cnt) as AnonymousPatronCount
|
||||||
where
|
where
|
||||||
IsAnonymous = true
|
IsAnonymous = true
|
||||||
and
|
and
|
||||||
DeactivatedTimestamp is null
|
Ended is null
|
||||||
)
|
)
|
||||||
) x
|
) x
|
||||||
')[0]->AnonymousPatronCount;
|
')[0]->AnonymousPatronCount;
|
||||||
|
|
|
@ -190,8 +190,8 @@ catch(Exceptions\InvalidEbookException $ex){
|
||||||
<meta property="schema:image" content="<?= Formatter::ToPlainText(SITE_URL . $ebook->DistCoverUrl) ?>"/>
|
<meta property="schema:image" content="<?= Formatter::ToPlainText(SITE_URL . $ebook->DistCoverUrl) ?>"/>
|
||||||
<meta property="schema:thumbnailUrl" content="<?= Formatter::ToPlainText(SITE_URL . $ebook->Url . '/downloads/cover-thumbnail.jpg') ?>"/>
|
<meta property="schema:thumbnailUrl" content="<?= Formatter::ToPlainText(SITE_URL . $ebook->Url . '/downloads/cover-thumbnail.jpg') ?>"/>
|
||||||
<meta property="schema:inLanguage" content="<?= Formatter::ToPlainText($ebook->Language) ?>"/>
|
<meta property="schema:inLanguage" content="<?= Formatter::ToPlainText($ebook->Language) ?>"/>
|
||||||
<meta property="schema:datePublished" content="<?= Formatter::ToPlainText($ebook->Timestamp->format('Y-m-d')) ?>"/>
|
<meta property="schema:datePublished" content="<?= Formatter::ToPlainText($ebook->Created->format('Y-m-d')) ?>"/>
|
||||||
<meta property="schema:dateModified" content="<?= Formatter::ToPlainText($ebook->ModifiedTimestamp->format('Y-m-d')) ?>"/>
|
<meta property="schema:dateModified" content="<?= Formatter::ToPlainText($ebook->Modified->format('Y-m-d')) ?>"/>
|
||||||
<div property="schema:potentialAction" typeof="http://schema.org/ReadAction">
|
<div property="schema:potentialAction" typeof="http://schema.org/ReadAction">
|
||||||
<meta property="schema:actionStatus" content="http://schema.org/PotentialActionStatus"/>
|
<meta property="schema:actionStatus" content="http://schema.org/PotentialActionStatus"/>
|
||||||
<div property="schema:target" typeof="schema:EntryPoint">
|
<div property="schema:target" typeof="schema:EntryPoint">
|
||||||
|
@ -298,7 +298,7 @@ catch(Exceptions\InvalidEbookException $ex){
|
||||||
<ol>
|
<ol>
|
||||||
<? foreach($ebook->GitCommits as $commit){ ?>
|
<? foreach($ebook->GitCommits as $commit){ ?>
|
||||||
<li>
|
<li>
|
||||||
<time datetime="<?= $commit->Timestamp->format(DateTime::RFC3339) ?>"><?= $commit->Timestamp->format('M j, Y') ?></time>
|
<time datetime="<?= $commit->Created->format(DateTime::RFC3339) ?>"><?= $commit->Created->format('M j, Y') ?></time>
|
||||||
<p><a href="<?= Formatter::ToPlainText($ebook->GitHubUrl) ?>/commit/<?= Formatter::ToPlainText($commit->Hash) ?>"><?= Formatter::ToPlainText($commit->Message) ?></a></p>
|
<p><a href="<?= Formatter::ToPlainText($ebook->GitHubUrl) ?>/commit/<?= Formatter::ToPlainText($commit->Hash) ?>"><?= Formatter::ToPlainText($commit->Message) ?></a></p>
|
||||||
</li>
|
</li>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
|
|
|
@ -44,7 +44,7 @@ try{
|
||||||
$payment = new Payment();
|
$payment = new Payment();
|
||||||
$payment->ChannelId = PAYMENT_CHANNEL_FA;
|
$payment->ChannelId = PAYMENT_CHANNEL_FA;
|
||||||
$payment->TransactionId = $transactionId;
|
$payment->TransactionId = $transactionId;
|
||||||
$payment->Timestamp = new DateTime();
|
$payment->Created = new DateTime();
|
||||||
$payment->IsRecurring = stripos($data->subject, 'recurring') !== false;
|
$payment->IsRecurring = stripos($data->subject, 'recurring') !== false;
|
||||||
preg_match('/Amount: \$([\d\.]+)/u', $data->html, $matches);
|
preg_match('/Amount: \$([\d\.]+)/u', $data->html, $matches);
|
||||||
if(sizeof($matches) == 2){
|
if(sizeof($matches) == 2){
|
||||||
|
@ -54,7 +54,7 @@ try{
|
||||||
$payment->Create();
|
$payment->Create();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
Db::Query('INSERT into PendingPayments (Timestamp, ChannelId, TransactionId) values (utc_timestamp(), ?, ?);', [PAYMENT_CHANNEL_FA, $transactionId]);
|
Db::Query('INSERT into PendingPayments (Created, ChannelId, TransactionId) values (utc_timestamp(), ?, ?);', [PAYMENT_CHANNEL_FA, $transactionId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$log->Write('Donation ID: ' . $transactionId);
|
$log->Write('Donation ID: ' . $transactionId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue