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

@ -18,4 +18,15 @@ RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev li
RUN apt-get install -y locales RUN apt-get install -y locales
RUN locale-gen en_GB.UTF-8 RUN locale-gen en_GB.UTF-8
RUN sed -i '/en_GB.UTF-8/s/^# //g' /etc/locale.gen && \ RUN sed -i '/en_GB.UTF-8/s/^# //g' /etc/locale.gen && \
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; 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 = $mysqli->prepare("SELECT subscriberID, token, userID, active, expires FROM subscribers WHERE token LIKE ? LIMIT 1");
$stmt->bind_param("s", $token ); $stmt->bind_param("s", $token );
$stmt->execute(); $stmt->execute();
@ -202,7 +202,7 @@ Class Subscriber
// No data found, fail gently... // No data found, fail gently...
return false; return false;
} }
// error_log(print_r($row, TRUE));
// If account is not already active, check if we are within timeframe of exipre +2h // 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 // and active if so, otherwise,delete account and return falsev
if ( $row['active'] <> 1 ) { if ( $row['active'] <> 1 ) {

View File

@ -20,5 +20,12 @@ services:
MYSQL_DATABASE: server_status MYSQL_DATABASE: server_status
volumes: volumes:
- ./database:/var/lib/mysql - ./database:/var/lib/mysql
networks:
- status-db
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"
networks: networks:
- status-db - status-db

View File

@ -52,5 +52,5 @@
</tr> </tr>
</tbody> </tbody>
</table> </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> <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>