fix subscriptions feature for php8 and add mailhog

This commit is contained in:
Steffen Müller 2024-04-10 15:42:19 +02:00
parent 788ca4ccd0
commit ee37419582
No known key found for this signature in database
GPG Key ID: 4BDF257D564FDEC0
4 changed files with 22 additions and 4 deletions

View File

@ -19,3 +19,14 @@ RUN apt-get install -y locales
RUN locale-gen en_GB.UTF-8
RUN sed -i '/en_GB.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
RUN apt-get install -y curl
# And clean up the image
RUN rm -rf /var/lib/apt/lists/*
RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' | tar -C '/usr/local' -xvzf -
ENV PATH /usr/local/go/bin:$PATH
RUN go get github.com/mailhog/mhsendmail
RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
RUN echo 'sendmail_path = /usr/bin/mhsendmail --smtp-addr mailhog:1025' > /usr/local/etc/php/php.ini

View File

@ -190,7 +190,7 @@ Class Subscriber
{
global $mysqli;
// error_log(print_r($token, TRUE));
$stmt = $mysqli->prepare("SELECT subscriberID, token, userID, active, expires FROM subscribers WHERE token LIKE ? LIMIT 1");
$stmt->bind_param("s", $token );
$stmt->execute();
@ -202,7 +202,7 @@ Class Subscriber
// No data found, fail gently...
return false;
}
// error_log(print_r($row, TRUE));
// If account is not already active, check if we are within timeframe of exipre +2h
// and active if so, otherwise,delete account and return falsev
if ( $row['active'] <> 1 ) {

View File

@ -22,3 +22,10 @@ services:
- ./database:/var/lib/mysql
networks:
- status-db
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"
networks:
- status-db

View File

@ -52,5 +52,5 @@
</tr>
</tbody>
</table>
<p style="text-align: center;"><a href="%url%/?do=unsubscribe&amp;token=%token%"><sub><sup>%unsubscribe%</sup></sub></a></p>
<p style="text-align: center;"><a href="%url%/?do=unsubscribe&amp;type=2&amp;token=%token%"><sub><sup>%unsubscribe%</sup></sub></a></p>
<p style="text-align: center;"><a href="%url%"><img src="%url%/favicon/apple-icon-57x57.png" alt="" />&nbsp;%powered_by%&nbsp;Server-Status</a></p>