Add poll system for Patrons Circle

This commit is contained in:
Alex Cabal 2022-06-29 16:51:45 -05:00
parent 3555d53615
commit 2ef5ce6551
44 changed files with 717 additions and 98 deletions

View file

@ -258,6 +258,16 @@ Define webroot /standardebooks.org/web
# Newsletter
RewriteRule ^/newsletter$ /newsletter/subscribers/new.php
RewriteRule ^/newsletter/subscribers/([^\./]+?)/(delete|confirm)$ /newsletter/subscribers/$2.php?uuid=$1
# Polls
RewriteRule ^/patrons-circle/polls/([^/]+)$ /patrons-circle/polls/get.php?pollurlname=$1
RewriteRule ^/patrons-circle/polls/([^/]+)/votes/(new|success)$ /patrons-circle/polls/votes/$2.php?pollurlname=$1
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^get$/"
RewriteRule ^/patrons-circle/polls/([^/]+)/votes$ /patrons-circle/polls/votes/index.php?pollurlname=$1
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^post$/"
RewriteRule ^/patrons-circle/polls/([^/]+)/votes$ /patrons-circle/polls/votes/post.php?pollurlname=$1
</VirtualHost>
<VirtualHost *:80>

View file

@ -257,4 +257,14 @@ Define webroot /standardebooks.org/web
# Newsletter
RewriteRule ^/newsletter$ /newsletter/subscribers/new.php
RewriteRule ^/newsletter/subscribers/([^\./]+?)/(delete|confirm)$ /newsletter/subscribers/$2.php?uuid=$1
# Polls
RewriteRule ^/patrons-circle/polls/([^/]+)$ /patrons-circle/polls/get.php?pollurlname=$1
RewriteRule ^/patrons-circle/polls/([^/]+)/votes/(new|success)$ /patrons-circle/polls/votes/$2.php?pollurlname=$1
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^get$/"
RewriteRule ^/patrons-circle/polls/([^/]+)/votes$ /patrons-circle/polls/votes/index.php?pollurlname=$1
RewriteCond expr "tolower(%{REQUEST_METHOD}) =~ /^post$/"
RewriteRule ^/patrons-circle/polls/([^/]+)/votes$ /patrons-circle/polls/votes/post.php?pollurlname=$1
</VirtualHost>

View file

@ -19,6 +19,12 @@ parameters:
- '#Method Ebook::NullIfEmpty\(\) has parameter \$elements with no type specified.#'
- '#Method HttpInput::GetHttpVar\(\) has no return type specified.#'
- '#Method HttpInput::GetHttpVar\(\) has parameter \$default with no type specified.#'
# Ignore errors caused by access to our PropertiesBase pattern
- '#Access to protected property .+#'
# Ignore symbols that PHPStan can't find
- '#Constant EMAIL_SMTP_USERNAME not found.#'
level:
7
paths:

View file

@ -0,0 +1,8 @@
CREATE TABLE `PollItems` (
`PollItemId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`PollId` int(10) unsigned NOT NULL,
`Name` varchar(255) NOT NULL,
`Description` text DEFAULT NULL,
`SortOrder` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`PollItemId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

11
config/sql/se/Polls.sql Normal file
View file

@ -0,0 +1,11 @@
CREATE TABLE `Polls` (
`PollId` int(11) unsigned NOT NULL AUTO_INCREMENT,
`Created` datetime NOT NULL,
`Name` varchar(255) NOT NULL,
`UrlName` varchar(255) NOT NULL,
`Description` text DEFAULT NULL,
`Start` datetime DEFAULT NULL,
`End` datetime DEFAULT NULL,
PRIMARY KEY (`PollId`),
UNIQUE KEY `idxUnique` (`UrlName`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

6
config/sql/se/Votes.sql Normal file
View file

@ -0,0 +1,6 @@
CREATE TABLE `Votes` (
`UserId` int(11) unsigned NOT NULL,
`PollItemId` int(11) unsigned NOT NULL,
`Created` datetime NOT NULL,
UNIQUE KEY `idxUnique` (`PollItemId`,`UserId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;