Skip to content

Commit ee37419

Browse files
committed
fix subscriptions feature for php8 and add mailhog
1 parent 788ca4c commit ee37419

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@ RUN apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev li
1818
RUN apt-get install -y locales
1919
RUN locale-gen en_GB.UTF-8
2020
RUN sed -i '/en_GB.UTF-8/s/^# //g' /etc/locale.gen && \
21-
locale-gen
21+
locale-gen
22+
RUN apt-get install -y curl
23+
# And clean up the image
24+
RUN rm -rf /var/lib/apt/lists/*
25+
26+
RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' | tar -C '/usr/local' -xvzf -
27+
ENV PATH /usr/local/go/bin:$PATH
28+
RUN go get github.com/mailhog/mhsendmail
29+
RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
30+
RUN echo 'sendmail_path = /usr/bin/mhsendmail --smtp-addr mailhog:1025' > /usr/local/etc/php/php.ini
31+
32+

classes/subscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function is_active_subscriber($token)
190190
{
191191
global $mysqli;
192192

193-
193+
// error_log(print_r($token, TRUE));
194194
$stmt = $mysqli->prepare("SELECT subscriberID, token, userID, active, expires FROM subscribers WHERE token LIKE ? LIMIT 1");
195195
$stmt->bind_param("s", $token );
196196
$stmt->execute();
@@ -202,7 +202,7 @@ public function is_active_subscriber($token)
202202
// No data found, fail gently...
203203
return false;
204204
}
205-
205+
// error_log(print_r($row, TRUE));
206206
// If account is not already active, check if we are within timeframe of exipre +2h
207207
// and active if so, otherwise,delete account and return falsev
208208
if ( $row['active'] <> 1 ) {

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,12 @@ services:
2020
MYSQL_DATABASE: server_status
2121
volumes:
2222
- ./database:/var/lib/mysql
23+
networks:
24+
- status-db
25+
mailhog:
26+
image: mailhog/mailhog
27+
ports:
28+
- "1025:1025"
29+
- "8025:8025"
2330
networks:
2431
- status-db

libs/templates/email_status_update.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@ <h2 style="text-align: center;">%service_status_update_from% %name%</h2>
5252
</tr>
5353
</tbody>
5454
</table>
55-
<p style="text-align: center;"><a href="%url%/?do=unsubscribe&amp;token=%token%"><sub><sup>%unsubscribe%</sup></sub></a></p>
55+
<p style="text-align: center;"><a href="%url%/?do=unsubscribe&amp;type=2&amp;token=%token%"><sub><sup>%unsubscribe%</sup></sub></a></p>
5656
<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 commit comments

Comments
 (0)