Skip to content

Commit

Permalink
fix subscriptions feature for php8 and add mailhog
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen-MLR committed Apr 10, 2024
1 parent 788ca4c commit ee37419
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 locale-gen en_GB.UTF-8
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


4 changes: 2 additions & 2 deletions classes/subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public function is_active_subscriber($token)
{
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();
Expand All @@ -202,7 +202,7 @@ public function is_active_subscriber($token)
// 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 ) {
Expand Down
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ services:
MYSQL_DATABASE: server_status
volumes:
- ./database:/var/lib/mysql
networks:
- status-db
mailhog:
image: mailhog/mailhog
ports:
- "1025:1025"
- "8025:8025"
networks:
- status-db
2 changes: 1 addition & 1 deletion libs/templates/email_status_update.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ <h2 style="text-align: center;">%service_status_update_from% %name%</h2>
</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>

0 comments on commit ee37419

Please sign in to comment.