1 |
<?php
|
1 |
<?php
|
2 |
//
|
2 |
//
|
3 |
// mateuszbb - minimalist bulletin board forum. MIT license.
|
3 |
// mateuszbb - minimalist bulletin board forum. MIT license.
|
4 |
//
|
4 |
//
|
5 |
// VERSION 20240123
|
5 |
// VERSION 20240123
|
6 |
//
|
6 |
//
|
7 |
// Copyright (C) 2021-2024 Mateusz Viste
|
7 |
// Copyright (C) 2021-2024 Mateusz Viste
|
8 |
//
|
8 |
//
|
9 |
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 |
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
10 |
// of this software and associated documentation files (the “Software”), to
|
10 |
// of this software and associated documentation files (the “Software”), to
|
11 |
// deal in the Software without restriction, including without limitation the
|
11 |
// deal in the Software without restriction, including without limitation the
|
12 |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
12 |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
13 |
// sell copies of the Software, and to permit persons to whom the Software is
|
13 |
// sell copies of the Software, and to permit persons to whom the Software is
|
14 |
// furnished to do so, subject to the following conditions:
|
14 |
// furnished to do so, subject to the following conditions:
|
15 |
//
|
15 |
//
|
16 |
// The above copyright notice and this permission notice shall be included in
|
16 |
// The above copyright notice and this permission notice shall be included in
|
17 |
// all copies or substantial portions of the Software.
|
17 |
// all copies or substantial portions of the Software.
|
18 |
//
|
18 |
//
|
19 |
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 |
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 |
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21 |
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
22 |
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 |
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
23 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
23 |
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
24 |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
24 |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
25 |
// IN THE SOFTWARE.
|
25 |
// IN THE SOFTWARE.
|
26 |
|
26 |
|
27 |
global $TRIP_SALT;
|
27 |
global $TRIP_SALT;
|
28 |
global $INITYEAR;
|
28 |
global $INITYEAR;
|
29 |
global $DATADIR;
|
29 |
global $DATADIR;
|
30 |
global $NICE_URLS;
|
30 |
global $NICE_URLS;
|
31 |
global $STR;
|
31 |
global $STR;
|
32 |
global $LANG;
|
32 |
global $LANG;
|
33 |
global $TZ;
|
33 |
global $TZ;
|
34 |
global $DATE_FORMAT;
|
34 |
global $DATE_FORMAT;
|
35 |
global $MAINPAGE_MAXTHREADS;
|
35 |
global $MAINPAGE_MAXTHREADS;
|
36 |
global $MAINPAGE_MAXINACT;
|
36 |
global $MAINPAGE_MAXINACT;
|
37 |
global $LOCK_DELAY;
|
37 |
global $LOCK_DELAY;
|
38 |
global $EDIT_ALLOWED_MINUTES;
|
38 |
global $EDIT_ALLOWED_MINUTES;
|
39 |
global $MAXDAILYPOSTS;
|
39 |
global $MAXDAILYPOSTS;
|
40 |
|
40 |
|
41 |
include 'mateuszbb-config.php';
|
41 |
include 'mateuszbb-config.php';
|
42 |
|
42 |
|
43 |
|
43 |
|
44 |
// *** TRANSLATION STRINGS *****************************************
|
44 |
// *** TRANSLATION STRINGS *****************************************
|
45 |
|
45 |
|
46 |
$STR = array();
|
46 |
$STR = array();
|
47 |
$STR['en']['opnewthread'] = 'open a new thread';
|
47 |
$STR['en']['opnewthread'] = 'open a new thread';
|
48 |
$STR['en']['newthread'] = 'New thread';
|
48 |
$STR['en']['newthread'] = 'New thread';
|
49 |
$STR['en']['latestentry'] = 'latest entry:';
|
49 |
$STR['en']['latestentry'] = 'latest entry:';
|
50 |
$STR['en']['searchterm'] = 'searched term:';
|
50 |
$STR['en']['searchterm'] = 'searched term:';
|
51 |
$STR['en']['noresults'] = 'No results';
|
51 |
$STR['en']['noresults'] = 'No results';
|
52 |
$STR['en']['reply'] = 'reply';
|
52 |
$STR['en']['reply'] = 'reply';
|
53 |
$STR['en']['jumptoend'] = 'jump to end';
|
53 |
$STR['en']['jumptoend'] = 'jump to end';
|
54 |
$STR['en']['listthreads'] = 'list of threads';
|
54 |
$STR['en']['listthreads'] = 'list of threads';
|
55 |
$STR['en']['author'] = 'author:';
|
55 |
$STR['en']['author'] = 'author:';
|
56 |
$STR['en']['address'] = 'address:';
|
56 |
$STR['en']['address'] = 'address:';
|
57 |
$STR['en']['date'] = 'date:';
|
57 |
$STR['en']['date'] = 'date:';
|
58 |
$STR['en']['nameornick'] = 'your name or nick';
|
58 |
$STR['en']['nameornick'] = 'your name or nick';
|
59 |
$STR['en']['threadsubj'] = 'subject';
|
59 |
$STR['en']['threadsubj'] = 'subject';
|
60 |
$STR['en']['yourmsg'] = 'Your message';
|
60 |
$STR['en']['yourmsg'] = 'Your message';
|
61 |
$STR['en']['cancel'] = 'cancel';
|
61 |
$STR['en']['cancel'] = 'cancel';
|
62 |
$STR['en']['send'] = 'send';
|
62 |
$STR['en']['send'] = 'send';
|
63 |
$STR['en']['archives'] = 'archives';
|
63 |
$STR['en']['archives'] = 'archives';
|
64 |
$STR['en']['backtocur'] = 'go back to current threads';
|
64 |
$STR['en']['backtocur'] = 'go back to current threads';
|
65 |
$STR['en']['search'] = 'search';
|
65 |
$STR['en']['search'] = 'search';
|
66 |
$STR['en']['password'] = 'password';
|
66 |
$STR['en']['password'] = 'password';
|
67 |
$STR['en']['optional'] = 'optional';
|
67 |
$STR['en']['optional'] = 'optional';
|
68 |
$STR['en']['passhelp'] = 'Providing a password here will generate a unique digital signature on your message.';
|
68 |
$STR['en']['passhelp'] = 'Providing a password here will generate a unique digital signature on your message.';
|
69 |
$STR['en']['locked'] = "Thread locked due to inactivity since over {$LOCK_DELAY} days.";
|
69 |
$STR['en']['locked'] = "Thread locked due to inactivity since over {$LOCK_DELAY} days.";
|
70 |
$STR['en']['captcha'][1] = 'check the FIRST box';
|
70 |
$STR['en']['captcha'][1] = 'check the FIRST box';
|
71 |
$STR['en']['captcha'][2] = 'check the MIDDLE box';
|
71 |
$STR['en']['captcha'][2] = 'check the MIDDLE box';
|
72 |
$STR['en']['captcha'][3] = 'check the LAST box';
|
72 |
$STR['en']['captcha'][3] = 'check the LAST box';
|
73 |
$STR['en']['captcha'][4] = 'check the FIRST and LAST boxes';
|
73 |
$STR['en']['captcha'][4] = 'check the FIRST and LAST boxes';
|
74 |
$STR['en']['captcha'][5] = 'check the TWO LAST boxes';
|
74 |
$STR['en']['captcha'][5] = 'check the TWO LAST boxes';
|
75 |
|
75 |
|
76 |
// DE translations by Robert Riebisch
|
76 |
// DE translations by Robert Riebisch
|
77 |
$STR['de']['opnewthread'] = 'Neues Thema eröffnen';
|
77 |
$STR['de']['opnewthread'] = 'Neues Thema eröffnen';
|
78 |
$STR['de']['newthread'] = 'Neues Thema';
|
78 |
$STR['de']['newthread'] = 'Neues Thema';
|
79 |
$STR['de']['latestentry'] = 'Neuester Eintrag:';
|
79 |
$STR['de']['latestentry'] = 'Neuester Eintrag:';
|
80 |
$STR['de']['searchterm'] = 'Gesuchter Begriff:';
|
80 |
$STR['de']['searchterm'] = 'Gesuchter Begriff:';
|
81 |
$STR['de']['noresults'] = 'Keine Ergebnisse';
|
81 |
$STR['de']['noresults'] = 'Keine Ergebnisse';
|
82 |
$STR['de']['reply'] = 'Antworten';
|
82 |
$STR['de']['reply'] = 'Antworten';
|
83 |
$STR['de']['jumptoend'] = 'Zum Ende springen';
|
83 |
$STR['de']['jumptoend'] = 'Zum Ende springen';
|
84 |
$STR['de']['listthreads'] = 'Liste der Themen';
|
84 |
$STR['de']['listthreads'] = 'Liste der Themen';
|
85 |
$STR['de']['author'] = 'Autor:';
|
85 |
$STR['de']['author'] = 'Autor:';
|
86 |
$STR['de']['address'] = 'Adresse:';
|
86 |
$STR['de']['address'] = 'Adresse:';
|
87 |
$STR['de']['date'] = 'Zeitpunkt:';
|
87 |
$STR['de']['date'] = 'Zeitpunkt:';
|
88 |
$STR['de']['nameornick'] = 'Dein Name oder Spitzname';
|
88 |
$STR['de']['nameornick'] = 'Dein Name oder Spitzname';
|
89 |
$STR['de']['threadsubj'] = 'Thema';
|
89 |
$STR['de']['threadsubj'] = 'Thema';
|
90 |
$STR['de']['yourmsg'] = 'Deine Nachricht';
|
90 |
$STR['de']['yourmsg'] = 'Deine Nachricht';
|
91 |
$STR['de']['cancel'] = 'Abbrechen';
|
91 |
$STR['de']['cancel'] = 'Abbrechen';
|
92 |
$STR['de']['send'] = 'Senden';
|
92 |
$STR['de']['send'] = 'Senden';
|
93 |
$STR['de']['archives'] = 'Archiv';
|
93 |
$STR['de']['archives'] = 'Archiv';
|
94 |
$STR['de']['backtocur'] = 'Zurück zu den aktuellen Themen';
|
94 |
$STR['de']['backtocur'] = 'Zurück zu den aktuellen Themen';
|
95 |
$STR['de']['search'] = 'Suchbegriff';
|
95 |
$STR['de']['search'] = 'Suchbegriff';
|
96 |
$STR['de']['password'] = 'Kennwort';
|
96 |
$STR['de']['password'] = 'Kennwort';
|
97 |
$STR['de']['optional'] = 'optional';
|
97 |
$STR['de']['optional'] = 'optional';
|
98 |
$STR['de']['passhelp'] = 'Wenn du hier ein Kennwort eingibst, wird deine Nachricht mit einer eindeutigen digitalen Signatur versehen.';
|
98 |
$STR['de']['passhelp'] = 'Wenn du hier ein Kennwort eingibst, wird deine Nachricht mit einer eindeutigen digitalen Signatur versehen.';
|
99 |
$STR['de']['locked'] = "Thema wegen Inaktivität seit über {$LOCK_DELAY} Tagen gesperrt.";
|
99 |
$STR['de']['locked'] = "Thema wegen Inaktivität seit über {$LOCK_DELAY} Tagen gesperrt.";
|
100 |
$STR['de']['captcha'][1] = 'Kreuze das ERSTE Kästchen an';
|
100 |
$STR['de']['captcha'][1] = 'Kreuze das ERSTE Kästchen an';
|
101 |
$STR['de']['captcha'][2] = 'Kreuze das MITTLERE Kästchen an';
|
101 |
$STR['de']['captcha'][2] = 'Kreuze das MITTLERE Kästchen an';
|
102 |
$STR['de']['captcha'][3] = 'Kreuze das LETZTE Kästchen an';
|
102 |
$STR['de']['captcha'][3] = 'Kreuze das LETZTE Kästchen an';
|
103 |
$STR['de']['captcha'][4] = 'Kreuze das ERSTE und LETZTE Kästchen an';
|
103 |
$STR['de']['captcha'][4] = 'Kreuze das ERSTE und LETZTE Kästchen an';
|
104 |
$STR['de']['captcha'][5] = 'Kreuze die beiden LETZTEN Kästchen an';
|
104 |
$STR['de']['captcha'][5] = 'Kreuze die beiden LETZTEN Kästchen an';
|
105 |
|
105 |
|
106 |
// PL translations by Mateusz Viste
|
106 |
// PL translations by Mateusz Viste
|
107 |
$STR['pl']['opnewthread'] = 'stwórz nowy wątek';
|
107 |
$STR['pl']['opnewthread'] = 'stwórz nowy wątek';
|
108 |
$STR['pl']['newthread'] = 'Nowy wątek';
|
108 |
$STR['pl']['newthread'] = 'Nowy wątek';
|
109 |
$STR['pl']['latestentry'] = 'ostatni wpis:';
|
109 |
$STR['pl']['latestentry'] = 'ostatni wpis:';
|
110 |
$STR['pl']['searchterm'] = 'szukane wyrażenie:';
|
110 |
$STR['pl']['searchterm'] = 'szukane wyrażenie:';
|
111 |
$STR['pl']['noresults'] = 'Brak wyników';
|
111 |
$STR['pl']['noresults'] = 'Brak wyników';
|
112 |
$STR['pl']['reply'] = 'odpowiedz';
|
112 |
$STR['pl']['reply'] = 'odpowiedz';
|
113 |
$STR['pl']['jumptoend'] = 'skocz do końca';
|
113 |
$STR['pl']['jumptoend'] = 'skocz do końca';
|
114 |
$STR['pl']['listthreads'] = 'lista wątków';
|
114 |
$STR['pl']['listthreads'] = 'lista wątków';
|
115 |
$STR['pl']['author'] = 'autor:';
|
115 |
$STR['pl']['author'] = 'autor:';
|
116 |
$STR['pl']['address'] = 'adres:';
|
116 |
$STR['pl']['address'] = 'adres:';
|
117 |
$STR['pl']['date'] = 'data:';
|
117 |
$STR['pl']['date'] = 'data:';
|
118 |
$STR['pl']['nameornick'] = 'imię, nazwisko lub pseudonim';
|
118 |
$STR['pl']['nameornick'] = 'imię, nazwisko lub pseudonim';
|
119 |
$STR['pl']['threadsubj'] = 'tytuł wątku';
|
119 |
$STR['pl']['threadsubj'] = 'tytuł wątku';
|
120 |
$STR['pl']['yourmsg'] = 'Twoja wiadomość';
|
120 |
$STR['pl']['yourmsg'] = 'Twoja wiadomość';
|
121 |
$STR['pl']['cancel'] = 'anuluj';
|
121 |
$STR['pl']['cancel'] = 'anuluj';
|
122 |
$STR['pl']['send'] = 'wyślij';
|
122 |
$STR['pl']['send'] = 'wyślij';
|
123 |
$STR['pl']['archives'] = 'archiwum';
|
123 |
$STR['pl']['archives'] = 'archiwum';
|
124 |
$STR['pl']['backtocur'] = 'powrót do bieżących wątków';
|
124 |
$STR['pl']['backtocur'] = 'powrót do bieżących wątków';
|
125 |
$STR['pl']['search'] = 'szukaj';
|
125 |
$STR['pl']['search'] = 'szukaj';
|
126 |
$STR['pl']['password'] = 'hasło';
|
126 |
$STR['pl']['password'] = 'hasło';
|
127 |
$STR['pl']['optional'] = 'opcjonalne';
|
127 |
$STR['pl']['optional'] = 'opcjonalne';
|
128 |
$STR['pl']['passhelp'] = 'Podanie hasła pozwoli wygenerować unikalny podpis elektroniczny przy twojej wiadomości.';
|
128 |
$STR['pl']['passhelp'] = 'Podanie hasła pozwoli wygenerować unikalny podpis elektroniczny przy twojej wiadomości.';
|
129 |
$STR['pl']['locked'] = "Wątek zamknięty z powodu braku aktywności od ponad {$LOCK_DELAY} dni.";
|
129 |
$STR['pl']['locked'] = "Wątek zamknięty z powodu braku aktywności od ponad {$LOCK_DELAY} dni.";
|
130 |
$STR['pl']['captcha'][1] = 'zaznacz PIERWSZE pole';
|
130 |
$STR['pl']['captcha'][1] = 'zaznacz PIERWSZE pole';
|
131 |
$STR['pl']['captcha'][2] = 'zaznacz ŚRODKOWE pole';
|
131 |
$STR['pl']['captcha'][2] = 'zaznacz ŚRODKOWE pole';
|
132 |
$STR['pl']['captcha'][3] = 'zaznacz OSTATNIE pole';
|
132 |
$STR['pl']['captcha'][3] = 'zaznacz OSTATNIE pole';
|
133 |
$STR['pl']['captcha'][4] = 'zaznacz PIERWSZE i OSTATNIE pole';
|
133 |
$STR['pl']['captcha'][4] = 'zaznacz PIERWSZE i OSTATNIE pole';
|
134 |
$STR['pl']['captcha'][5] = 'zaznacz DWA OSTATNIE pola';
|
134 |
$STR['pl']['captcha'][5] = 'zaznacz DWA OSTATNIE pola';
|
135 |
|
135 |
|
136 |
// pt-BR translations courtesty of Luzemário Dantas
|
136 |
// pt-BR translations courtesty of Luzemário Dantas
|
137 |
$STR['pt']['opnewthread'] = 'abrir novo tópico';
|
137 |
$STR['pt']['opnewthread'] = 'abrir novo tópico';
|
138 |
$STR['pt']['newthread'] = 'Novo tópico';
|
138 |
$STR['pt']['newthread'] = 'Novo tópico';
|
139 |
$STR['pt']['latestentry'] = 'entrada mais recente:';
|
139 |
$STR['pt']['latestentry'] = 'entrada mais recente:';
|
140 |
$STR['pt']['searchterm'] = 'termo pesquisado:';
|
140 |
$STR['pt']['searchterm'] = 'termo pesquisado:';
|
141 |
$STR['pt']['noresults'] = 'Sem resultados';
|
141 |
$STR['pt']['noresults'] = 'Sem resultados';
|
142 |
$STR['pt']['reply'] = 'responder';
|
142 |
$STR['pt']['reply'] = 'responder';
|
143 |
$STR['pt']['jumptoend'] = 'ir para o final';
|
143 |
$STR['pt']['jumptoend'] = 'ir para o final';
|
144 |
$STR['pt']['listthreads'] = 'lista de tópicos';
|
144 |
$STR['pt']['listthreads'] = 'lista de tópicos';
|
145 |
$STR['pt']['author'] = 'autor:';
|
145 |
$STR['pt']['author'] = 'autor:';
|
146 |
$STR['pt']['address'] = 'endereço:';
|
146 |
$STR['pt']['address'] = 'endereço:';
|
147 |
$STR['pt']['date'] = 'data:';
|
147 |
$STR['pt']['date'] = 'data:';
|
148 |
$STR['pt']['nameornick'] = 'seu nome ou apelido';
|
148 |
$STR['pt']['nameornick'] = 'seu nome ou apelido';
|
149 |
$STR['pt']['threadsubj'] = 'assunto';
|
149 |
$STR['pt']['threadsubj'] = 'assunto';
|
150 |
$STR['pt']['yourmsg'] = 'Sua mensagem';
|
150 |
$STR['pt']['yourmsg'] = 'Sua mensagem';
|
151 |
$STR['pt']['cancel'] = 'cancelar';
|
151 |
$STR['pt']['cancel'] = 'cancelar';
|
152 |
$STR['pt']['send'] = 'enviar';
|
152 |
$STR['pt']['send'] = 'enviar';
|
153 |
$STR['pt']['archives'] = 'arquivos';
|
153 |
$STR['pt']['archives'] = 'arquivos';
|
154 |
$STR['pt']['backtocur'] = 'voltar ao tópico atuai';
|
154 |
$STR['pt']['backtocur'] = 'voltar ao tópico atuai';
|
155 |
$STR['pt']['search'] = 'pesquisar';
|
155 |
$STR['pt']['search'] = 'pesquisar';
|
156 |
$STR['pt']['password'] = 'senha';
|
156 |
$STR['pt']['password'] = 'senha';
|
157 |
$STR['pt']['optional'] = 'opcional';
|
157 |
$STR['pt']['optional'] = 'opcional';
|
158 |
$STR['pt']['passhelp'] = 'Fornecer uma senha aqui vai gerar uma assinatura digital única na sua mensagem.';
|
158 |
$STR['pt']['passhelp'] = 'Fornecer uma senha aqui vai gerar uma assinatura digital única na sua mensagem.';
|
159 |
$STR['pt']['locked'] = "Este tópico está bloqueado porque está inativo há mais de {$LOCK_DELAY} dias."; // translated by google translate, wording might be poor
|
159 |
$STR['pt']['locked'] = "Este tópico está bloqueado porque está inativo há mais de {$LOCK_DELAY} dias."; // translated by google translate, wording might be poor
|
160 |
$STR['pt']['captcha'][1] = 'marque a PRIMEIRA caixa';
|
160 |
$STR['pt']['captcha'][1] = 'marque a PRIMEIRA caixa';
|
161 |
$STR['pt']['captcha'][2] = 'marque a caixa do MEIO';
|
161 |
$STR['pt']['captcha'][2] = 'marque a caixa do MEIO';
|
162 |
$STR['pt']['captcha'][3] = 'marque a ÚLTIMA caixa';
|
162 |
$STR['pt']['captcha'][3] = 'marque a ÚLTIMA caixa';
|
163 |
$STR['pt']['captcha'][4] = 'marque a PRIMEIRA e ÚLTIMA caixas';
|
163 |
$STR['pt']['captcha'][4] = 'marque a PRIMEIRA e ÚLTIMA caixas';
|
164 |
$STR['pt']['captcha'][5] = 'marque as DUAS ÚLTIMAS caixas';
|
164 |
$STR['pt']['captcha'][5] = 'marque as DUAS ÚLTIMAS caixas';
|
165 |
|
165 |
|
166 |
// *****************************************************************
|
166 |
// *****************************************************************
|
167 |
|
167 |
|
168 |
|
168 |
|
169 |
function data_dluga($timestamp) {
|
169 |
function data_dluga($timestamp) {
|
170 |
global $DATE_FORMAT;
|
170 |
global $DATE_FORMAT;
|
171 |
return(date($DATE_FORMAT, $timestamp));
|
171 |
return(date($DATE_FORMAT, $timestamp));
|
172 |
}
|
172 |
}
|
173 |
|
173 |
|
174 |
|
174 |
|
175 |
function selfurl($params = '') {
|
175 |
function selfurl($params = '') {
|
176 |
global $SELFURL;
|
176 |
global $SELFURL;
|
177 |
$r = $SELFURL;
|
177 |
$r = $SELFURL;
|
178 |
if (!empty($params)) {
|
178 |
if (!empty($params)) {
|
179 |
if (strrchr($SELFURL, '?')) {
|
179 |
if (strrchr($SELFURL, '?')) {
|
180 |
$r .= '&';
|
180 |
$r .= '&';
|
181 |
} else {
|
181 |
} else {
|
182 |
$r .= '?';
|
182 |
$r .= '?';
|
183 |
}
|
183 |
}
|
184 |
$r .= $params;
|
184 |
$r .= $params;
|
185 |
}
|
185 |
}
|
186 |
return($r);
|
186 |
return($r);
|
187 |
}
|
187 |
}
|
188 |
|
188 |
|
189 |
|
189 |
|
190 |
// returns an array with the list of languages requested by the browser, in
|
190 |
// returns an array with the list of languages requested by the browser, in
|
191 |
// the order of preference
|
191 |
// the order of preference
|
192 |
function getpreflang() {
|
192 |
function getpreflang() {
|
193 |
$res = array();
|
193 |
$res = array();
|
194 |
if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) return($res);
|
194 |
if (! isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) return($res);
|
195 |
$langlist = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
195 |
$langlist = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
196 |
foreach ($langlist as $lang) {
|
196 |
foreach ($langlist as $lang) {
|
197 |
$res[] = strtolower(substr($lang, 0, 2));
|
197 |
$res[] = strtolower(substr($lang, 0, 2));
|
198 |
}
|
198 |
}
|
199 |
return(array_unique($res));
|
199 |
return(array_unique($res));
|
200 |
}
|
200 |
}
|
201 |
|
201 |
|
202 |
|
202 |
|
203 |
function mateuszbb_rss() {
|
203 |
function mateuszbb_rss() {
|
204 |
global $DATADIR;
|
204 |
global $DATADIR;
|
205 |
global $RSS_TITLE;
|
205 |
global $RSS_TITLE;
|
206 |
global $NICE_URLS;
|
206 |
global $NICE_URLS;
|
207 |
|
207 |
|
208 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
|
208 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
|
209 |
if (! $db) {
|
209 |
if (! $db) {
|
210 |
echo "SQL ERROR: ACCESS DENIED\n";
|
210 |
echo "SQL ERROR: ACCESS DENIED\n";
|
211 |
return false;
|
211 |
return false;
|
212 |
}
|
212 |
}
|
213 |
$sqlres = $db->query('SELECT thread, msgid, author FROM rss ORDER BY msgid DESC, thread DESC LIMIT 100;');
|
213 |
$sqlres = $db->query('SELECT thread, msgid, author FROM rss ORDER BY msgid DESC, thread DESC LIMIT 100;');
|
214 |
if (! $sqlres) {
|
214 |
if (! $sqlres) {
|
215 |
echo "SQL ERROR: QUERY FAILED\n";
|
215 |
echo "SQL ERROR: QUERY FAILED\n";
|
216 |
return false;
|
216 |
return false;
|
217 |
}
|
217 |
}
|
218 |
|
218 |
|
219 |
header('content-type: application/rss+xml');
|
219 |
header('content-type: application/rss+xml');
|
220 |
|
220 |
|
221 |
echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
|
221 |
echo '<?xml version="1.0" encoding="utf-8" ?>' . "\n";
|
222 |
echo '<rss version="2.0">' . "\n";
|
222 |
echo '<rss version="2.0">' . "\n";
|
223 |
echo "<channel>\n";
|
223 |
echo "<channel>\n";
|
224 |
echo "<title>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</title>\n";
|
224 |
echo "<title>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</title>\n";
|
225 |
echo "<link>" . selfurl(). "</link>\n";
|
225 |
echo "<link>" . selfurl(). "</link>\n";
|
226 |
echo "<description>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</description>\n";
|
226 |
echo "<description>" . htmlspecialchars($RSS_TITLE, ENT_XML1) . "</description>\n";
|
227 |
|
227 |
|
228 |
while ($row = $sqlres->fetchArray()) {
|
228 |
while ($row = $sqlres->fetchArray()) {
|
229 |
$rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
|
229 |
$rawtitle = file_get_contents($DATADIR . 'threads/' . $row['thread'] . '/title.txt');
|
230 |
if (empty($rawtitle)) continue;
|
230 |
if (empty($rawtitle)) continue;
|
231 |
$title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
|
231 |
$title = htmlspecialchars($rawtitle, ENT_XML1, 'UTF-8');
|
232 |
$author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
|
232 |
$author = htmlspecialchars($row['author'], ENT_XML1, 'UTF-8');
|
233 |
if ($NICE_URLS) {
|
233 |
if ($NICE_URLS) {
|
234 |
$link = selfurl();
|
234 |
$link = selfurl();
|
235 |
if (substr($link, -1) !== '/') $link .= '/';
|
235 |
if (substr($link, -1) !== '/') $link .= '/';
|
236 |
$link .= "{$row['thread']}";
|
236 |
$link .= "{$row['thread']}";
|
237 |
} else {
|
237 |
} else {
|
238 |
$link = selfurl('thread=' . $row['thread']);
|
238 |
$link = selfurl('thread=' . $row['thread']);
|
239 |
}
|
239 |
}
|
240 |
$link .= '#' . $row['msgid'];
|
240 |
$link .= '#' . $row['msgid'];
|
241 |
echo "<item>\n";
|
241 |
echo "<item>\n";
|
242 |
echo "<title>{$author} @ '{$title}'</title>\n";
|
242 |
echo "<title>{$author} @ '{$title}'</title>\n";
|
243 |
echo "<link>" . htmlspecialchars($link, ENT_XML1) . "</link>\n";
|
243 |
echo "<link>" . htmlspecialchars($link, ENT_XML1) . "</link>\n";
|
244 |
echo "<description>{$author} @ '{$title}'</description>\n";
|
244 |
echo "<description>{$author} @ '{$title}'</description>\n";
|
245 |
echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
|
245 |
echo "<pubDate>" . date('r', $row['msgid']) . "</pubDate>\n";
|
246 |
echo "<guid>" . htmlspecialchars($link, ENT_XML1) . "</guid>\n";
|
246 |
echo "<guid>" . htmlspecialchars($link, ENT_XML1) . "</guid>\n";
|
247 |
echo "</item>\n";
|
247 |
echo "</item>\n";
|
248 |
}
|
248 |
}
|
249 |
$db->close();
|
249 |
$db->close();
|
250 |
|
250 |
|
251 |
echo "</channel>\n";
|
251 |
echo "</channel>\n";
|
252 |
echo "</rss>\n";
|
252 |
echo "</rss>\n";
|
253 |
return true;
|
253 |
return true;
|
254 |
}
|
254 |
}
|
255 |
|
255 |
|
256 |
|
256 |
|
257 |
function formularz($thread = 0, $postid = 0, $msg = '') {
|
257 |
function formularz($thread = 0, $postid = 0, $msg = '') {
|
258 |
global $STR;
|
258 |
global $STR;
|
259 |
global $LANG;
|
259 |
global $LANG;
|
260 |
global $NICE_URLS;
|
260 |
global $NICE_URLS;
|
261 |
|
261 |
|
262 |
if ($thread == 0) {
|
262 |
if ($thread == 0) {
|
263 |
echo '<form class="minibb" method="POST" action="' . selfurl() . '#title" id="formularz">' . "\n";
|
263 |
echo '<form class="minibb" method="POST" action="' . selfurl() . '#title" id="formularz">' . "\n";
|
264 |
echo '<input type="hidden" name="action" value="createthread">' . "\n";
|
264 |
echo '<input type="hidden" name="action" value="createthread">' . "\n";
|
265 |
} else {
|
265 |
} else {
|
266 |
echo '<form class="minibb" method="POST" action="' . selfurl() . '" id="formularz">' . "\n";
|
266 |
echo '<form class="minibb" method="POST" action="' . selfurl() . '" id="formularz">' . "\n";
|
267 |
echo '<input type="hidden" name="thread" value="' . $thread . '">' . "\n";
|
267 |
echo '<input type="hidden" name="thread" value="' . $thread . '">' . "\n";
|
268 |
if ($postid > 0) {
|
268 |
if ($postid > 0) {
|
269 |
echo '<input type="hidden" name="action" value="editpost">' . "\n";
|
269 |
echo '<input type="hidden" name="action" value="editpost">' . "\n";
|
270 |
echo '<input type="hidden" name="postid" value="' . $postid . '">' . "\n";
|
270 |
echo '<input type="hidden" name="postid" value="' . $postid . '">' . "\n";
|
271 |
} else {
|
271 |
} else {
|
272 |
echo '<input type="hidden" name="action" value="newpost">' . "\n";
|
272 |
echo '<input type="hidden" name="action" value="newpost">' . "\n";
|
273 |
}
|
273 |
}
|
274 |
}
|
274 |
}
|
275 |
|
275 |
|
276 |
echo '<div class="minibb-formfields">' . "\n";
|
276 |
echo '<div class="minibb-formfields">' . "\n";
|
277 |
echo '<div class="minibb-formlabelgroup"><p>' . $STR[$LANG]['nameornick'] . '</p><input type="text" name="username" pattern=".*[^\s].*" minlength="1" maxlength="40" autofill="username" title="' . $STR[$LANG]['nameornick'];
|
277 |
echo '<div class="minibb-formlabelgroup"><p>' . $STR[$LANG]['nameornick'] . '</p><input type="text" name="username" pattern=".*[^\s].*" minlength="1" maxlength="40" autofill="username" title="' . $STR[$LANG]['nameornick'];
|
278 |
if (!empty($msg)) echo '" value="' . htmlspecialchars($msg['author']) . '"';
|
278 |
if (!empty($msg)) echo '" value="' . htmlspecialchars($msg['author']) . '"';
|
279 |
echo '" required></div><div class="minibb-formlabelgroup"><p>' . $STR[$LANG]['password'] . ' (<span title="' . $STR[$LANG]['passhelp'] . '" style="text-decoration-line: underline; text-decoration-style: dotted;">' . $STR[$LANG]['optional'] . '</span>)</p><input type="password" name="password" maxlength="40" autofill="current-password"></div>' . "\n";
|
279 |
echo '" required></div><div class="minibb-formlabelgroup"><p>' . $STR[$LANG]['password'] . ' (<span title="' . $STR[$LANG]['passhelp'] . '" style="text-decoration-line: underline; text-decoration-style: dotted;">' . $STR[$LANG]['optional'] . '</span>)</p><input type="password" name="password" maxlength="40" autofill="current-password"></div>' . "\n";
|
280 |
if ($thread == 0) {
|
280 |
if ($thread == 0) {
|
281 |
echo '<div class="minibb-formlabelgroup" style="width: 100%;">' . "\n";
|
281 |
echo '<div class="minibb-formlabelgroup" style="width: 100%;">' . "\n";
|
282 |
echo "<p>" . $STR[$LANG]['threadsubj'] . "</p>\n";
|
282 |
echo "<p>" . $STR[$LANG]['threadsubj'] . "</p>\n";
|
283 |
echo '<input type="text" name="title" title="' . $STR[$LANG]['threadsubj'] . '" maxlength="64" pattern=".*[^\s].*" required>' . "\n";
|
283 |
echo '<input type="text" name="title" title="' . $STR[$LANG]['threadsubj'] . '" maxlength="64" pattern=".*[^\s].*" required>' . "\n";
|
284 |
echo "</div>\n";
|
284 |
echo "</div>\n";
|
285 |
}
|
285 |
}
|
286 |
echo '<textarea name="msg" placeholder="' . $STR[$LANG]['yourmsg'] . '">' . "\n";
|
286 |
echo '<textarea name="msg" placeholder="' . $STR[$LANG]['yourmsg'] . '">' . "\n";
|
287 |
if (!empty($msg)) echo htmlspecialchars($msg['msg']);
|
287 |
if (!empty($msg)) echo htmlspecialchars($msg['msg']);
|
288 |
echo "</textarea><br>\n";
|
288 |
echo "</textarea><br>\n";
|
289 |
echo "</div>\n";
|
289 |
echo "</div>\n";
|
290 |
// --- CAPTCHA ---
|
290 |
// --- CAPTCHA ---
|
291 |
$capid = rand(1, 5);
|
291 |
$capid = rand(1, 5);
|
292 |
echo '<div class="minibb-formcaptcha">' . $STR[$LANG]['captcha'][$capid] . ': <span class="minibb-cboxgroup"><input type="checkbox" name=c1><input type="checkbox" name=c2><input type="checkbox" name=c3></span>' . "\n";
|
292 |
echo '<div class="minibb-formcaptcha">' . $STR[$LANG]['captcha'][$capid] . ': <span class="minibb-cboxgroup"><input type="checkbox" name=c1><input type="checkbox" name=c2><input type="checkbox" name=c3></span>' . "\n";
|
293 |
echo '<input type="hidden" name="capid" value="' . $capid . '">';
|
293 |
echo '<input type="hidden" name="capid" value="' . $capid . '">';
|
294 |
// ---------------
|
294 |
// ---------------
|
295 |
echo '<div class="minibb-formbtns">' . "\n";
|
295 |
echo '<div class="minibb-formbtns">' . "\n";
|
296 |
$link = selfurl();
|
296 |
$link = selfurl();
|
297 |
if ($postid > 0) {
|
297 |
if ($postid > 0) {
|
298 |
$link = selfurl("thread=" . $thread);
|
298 |
$link = selfurl("thread=" . $thread);
|
299 |
if ($NICE_URLS) $link = $thread;
|
299 |
if ($NICE_URLS) $link = $thread;
|
300 |
$link .= '#' . $postid;
|
300 |
$link .= '#' . $postid;
|
301 |
}
|
301 |
}
|
302 |
echo '<a href="' . $link . '">' . $STR[$LANG]['cancel'] . '</a> <input type="submit" value="' . $STR[$LANG]['send'] . '">' . "\n";
|
302 |
echo '<a href="' . $link . '">' . $STR[$LANG]['cancel'] . '</a> <input type="submit" value="' . $STR[$LANG]['send'] . '">' . "\n";
|
303 |
echo "</div>\n";
|
303 |
echo "</div>\n";
|
304 |
echo "</div>\n";
|
304 |
echo "</div>\n";
|
305 |
echo '</form>';
|
305 |
echo '</form>';
|
306 |
}
|
306 |
}
|
307 |
|
307 |
|
308 |
function wyswietl_watek_w_liscie($threadid, $tytul, $lastauthor, $lastupdate) {
|
308 |
function wyswietl_watek_w_liscie($threadid, $tytul, $lastauthor, $lastupdate) {
|
309 |
global $NICE_URLS;
|
309 |
global $NICE_URLS;
|
310 |
global $STR;
|
310 |
global $STR;
|
311 |
global $LANG;
|
311 |
global $LANG;
|
312 |
|
312 |
|
313 |
echo '<a href="';
|
313 |
echo '<a href="';
|
314 |
if (!$NICE_URLS) {
|
314 |
if (!$NICE_URLS) {
|
315 |
echo selfurl("thread=$threadid");
|
315 |
echo selfurl("thread=$threadid");
|
316 |
} else {
|
316 |
} else {
|
317 |
echo $threadid;
|
317 |
echo $threadid;
|
318 |
}
|
318 |
}
|
319 |
echo '" class="minibb-threaditem">' . "\n";
|
319 |
echo '" class="minibb-threaditem">' . "\n";
|
320 |
echo '<h2>' . htmlspecialchars($tytul) . "</h2>\n";
|
320 |
echo '<h2>' . htmlspecialchars($tytul) . "</h2>\n";
|
321 |
echo '<p>' . $STR[$LANG]['latestentry'] . ' ' . htmlspecialchars($lastauthor) . ', ' . htmlspecialchars(data_dluga($lastupdate)) . "</p>\n";
|
321 |
echo '<p>' . $STR[$LANG]['latestentry'] . ' ' . htmlspecialchars($lastauthor) . ', ' . htmlspecialchars(data_dluga($lastupdate)) . "</p>\n";
|
322 |
echo "</a>\n";
|
322 |
echo "</a>\n";
|
323 |
}
|
323 |
}
|
324 |
|
324 |
|
325 |
function sprawdz_captcha($CAPARR) {
|
325 |
function sprawdz_captcha($CAPARR) {
|
326 |
//echo "<!-- capid={$CAPARR['capid']} c1={$CAPARR['c1']} c2={$CAPARR['c2']} c3={$CAPARR['c3']}-->\n";
|
326 |
//echo "<!-- capid={$CAPARR['capid']} c1={$CAPARR['c1']} c2={$CAPARR['c2']} c3={$CAPARR['c3']}-->\n";
|
327 |
switch ($CAPARR['capid']) {
|
327 |
switch ($CAPARR['capid']) {
|
328 |
case 1:
|
328 |
case 1:
|
329 |
if (($CAPARR['c1']) && (!$CAPARR['c2']) && (!$CAPARR['c3'])) return(true);
|
329 |
if (($CAPARR['c1']) && (!$CAPARR['c2']) && (!$CAPARR['c3'])) return(true);
|
330 |
break;
|
330 |
break;
|
331 |
case 2:
|
331 |
case 2:
|
332 |
if ((!$CAPARR['c1']) && ($CAPARR['c2']) && (!$CAPARR['c3'])) return(true);
|
332 |
if ((!$CAPARR['c1']) && ($CAPARR['c2']) && (!$CAPARR['c3'])) return(true);
|
333 |
break;
|
333 |
break;
|
334 |
case 3:
|
334 |
case 3:
|
335 |
if ((!$CAPARR['c1']) && (!$CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
335 |
if ((!$CAPARR['c1']) && (!$CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
336 |
break;
|
336 |
break;
|
337 |
case 4:
|
337 |
case 4:
|
338 |
if (($CAPARR['c1']) && (!$CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
338 |
if (($CAPARR['c1']) && (!$CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
339 |
break;
|
339 |
break;
|
340 |
case 5:
|
340 |
case 5:
|
341 |
if ((!$CAPARR['c1']) && ($CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
341 |
if ((!$CAPARR['c1']) && ($CAPARR['c2']) && ($CAPARR['c3'])) return(true);
|
342 |
break;
|
342 |
break;
|
343 |
}
|
343 |
}
|
344 |
return(false);
|
344 |
return(false);
|
345 |
}
|
345 |
}
|
346 |
|
346 |
|
347 |
|
347 |
|
348 |
// zwraca akcję na podstawie globalnych POST lub GET
|
348 |
// zwraca akcję na podstawie globalnych POST lub GET
|
349 |
function getvar_action() {
|
349 |
function getvar_action() {
|
350 |
if (!empty($_POST['action'])) return $_POST['action'];
|
350 |
if (!empty($_POST['action'])) return $_POST['action'];
|
351 |
if (!empty($_GET['action'])) return $_GET['action'];
|
351 |
if (!empty($_GET['action'])) return $_GET['action'];
|
352 |
return('');
|
352 |
return('');
|
353 |
}
|
353 |
}
|
354 |
|
354 |
|
355 |
function getvar_thread() {
|
355 |
function getvar_thread() {
|
356 |
if (!empty($_POST['thread'])) return intval($_POST['thread']);
|
356 |
if (!empty($_POST['thread'])) return intval($_POST['thread']);
|
357 |
if (!empty($_GET['thread'])) return intval($_GET['thread']);
|
357 |
if (!empty($_GET['thread'])) return intval($_GET['thread']);
|
358 |
return(-1);
|
358 |
return(-1);
|
359 |
}
|
359 |
}
|
360 |
|
360 |
|
361 |
function getvar_archiveyear() {
|
361 |
function getvar_archiveyear() {
|
362 |
if (!empty($_POST['arch'])) return intval($_POST['arch']);
|
362 |
if (!empty($_POST['arch'])) return intval($_POST['arch']);
|
363 |
if (!empty($_GET['arch'])) return intval($_GET['arch']);
|
363 |
if (!empty($_GET['arch'])) return intval($_GET['arch']);
|
364 |
return(-1);
|
364 |
return(-1);
|
365 |
}
|
365 |
}
|
366 |
|
366 |
|
367 |
|
367 |
|
368 |
// funkcja która zapisuje nowe wiadomości
|
368 |
// funkcja która zapisuje nowe wiadomości
|
369 |
function mateuszbb_preprocess() {
|
369 |
function mateuszbb_preprocess() {
|
370 |
global $TRIP_SALT;
|
370 |
global $TRIP_SALT;
|
371 |
global $DATADIR;
|
371 |
global $DATADIR;
|
372 |
global $NICE_URLS;
|
372 |
global $NICE_URLS;
|
373 |
global $ERRSTR; // zmienna zawierająca komunikat błędu (jeśli jakiś wystąpił)
|
373 |
global $ERRSTR; // zmienna zawierająca komunikat błędu (jeśli jakiś wystąpił)
|
374 |
global $STR;
|
374 |
global $STR;
|
375 |
global $LANG;
|
375 |
global $LANG;
|
376 |
global $MAXDAILYPOSTS;
|
376 |
global $MAXDAILYPOSTS;
|
377 |
global $EDIT_ALLOWED_MINUTES;
|
377 |
global $EDIT_ALLOWED_MINUTES;
|
378 |
|
378 |
|
379 |
$action = getvar_action();
|
379 |
$action = getvar_action();
|
380 |
$thread = getvar_thread();
|
380 |
$thread = getvar_thread();
|
381 |
$archiveyear = getvar_archiveyear();
|
381 |
$archiveyear = getvar_archiveyear();
|
382 |
|
382 |
|
383 |
// negotiate language, unless forced by configuration
|
383 |
// negotiate language, unless forced by configuration
|
384 |
if (empty($LANG)) {
|
384 |
if (empty($LANG)) {
|
385 |
$LANG = 'en'; // preselect english as default language
|
385 |
$LANG = 'en'; // preselect english as default language
|
386 |
foreach (getpreflang() as $l) {
|
386 |
foreach (getpreflang() as $l) {
|
387 |
if (!empty($STR[$l])) {
|
387 |
if (!empty($STR[$l])) {
|
388 |
$LANG = $l;
|
388 |
$LANG = $l;
|
389 |
break;
|
389 |
break;
|
390 |
}
|
390 |
}
|
391 |
}
|
391 |
}
|
392 |
} else { // if language forced by configuration then make sure it is supported
|
392 |
} else { // if language forced by configuration then make sure it is supported
|
393 |
if (empty($STR[$LANG])) $LANG = 'en'; // fall back to 'en' on error
|
393 |
if (empty($STR[$LANG])) $LANG = 'en'; // fall back to 'en' on error
|
394 |
}
|
394 |
}
|
395 |
|
395 |
|
396 |
// write access: check how many messages the user posted during last 24h
|
396 |
// write access: check how many messages the user posted during last 24h
|
397 |
if (($action === 'createthread') || ($action === 'newpost')) {
|
397 |
if (($action === 'createthread') || ($action === 'newpost')) {
|
398 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3');
|
398 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3');
|
399 |
if ($db) {
|
399 |
if ($db) {
|
400 |
$db->exec('DELETE FROM ip_msg_counters24h WHERE msgid < strftime(\'%s\', \'now\') - 24*3600;');
|
400 |
$db->exec('DELETE FROM ip_msg_counters24h WHERE msgid < strftime(\'%s\', \'now\') - 24*3600;');
|
401 |
$count24h = intval($db->querySingle("SELECT count(*) FROM ip_msg_counters24h WHERE ipaddr = '{$_SERVER['REMOTE_ADDR']}'"));
|
401 |
$count24h = intval($db->querySingle("SELECT count(*) FROM ip_msg_counters24h WHERE ipaddr = '{$_SERVER['REMOTE_ADDR']}'"));
|
402 |
$db->close();
|
402 |
$db->close();
|
403 |
if ($count24h >= $MAXDAILYPOSTS) {
|
403 |
if ($count24h >= $MAXDAILYPOSTS) {
|
404 |
$ERRSTR = "BŁĄD: Z TWOJEGO ADRESU NAPISANO JUŻ {$count24h} WIADOMOŚCI W PRZECIĄGU OSTATNICH 24H. SPRÓBUJ PONOWNIE ZA JAKIŚ CZAS.";
|
404 |
$ERRSTR = "BŁĄD: Z TWOJEGO ADRESU NAPISANO JUŻ {$count24h} WIADOMOŚCI W PRZECIĄGU OSTATNICH 24H. SPRÓBUJ PONOWNIE ZA JAKIŚ CZAS.";
|
405 |
$action = '';
|
405 |
$action = '';
|
406 |
}
|
406 |
}
|
407 |
}
|
407 |
}
|
408 |
}
|
408 |
}
|
409 |
|
409 |
|
410 |
// edit post becomes newpost, it was different just to avoid 24h counters
|
410 |
// edit post becomes newpost, it was different just to avoid 24h counters
|
411 |
if ($action === 'editpost') $action = 'newpost';
|
411 |
if ($action === 'editpost') $action = 'newpost';
|
412 |
|
412 |
|
413 |
// new thread creation (+switch to read thread)
|
413 |
// new thread creation (+switch to read thread)
|
414 |
if ($action === 'createthread') {
|
414 |
if ($action === 'createthread') {
|
415 |
// captcha check
|
415 |
// captcha check
|
416 |
if (!sprawdz_captcha($_POST)) {
|
416 |
if (!sprawdz_captcha($_POST)) {
|
417 |
echo "<p>BŁĄD: NIEPRAWIDŁOWE CAPTCHA</p>\n";
|
417 |
echo "<p>BŁĄD: NIEPRAWIDŁOWE CAPTCHA</p>\n";
|
418 |
goto DONE;
|
418 |
goto DONE;
|
419 |
}
|
419 |
}
|
420 |
//
|
420 |
//
|
421 |
$thread = time();
|
421 |
$thread = time();
|
422 |
if (empty($_POST['username']) || (empty($_POST['msg'])) || (empty($_POST['title']))) {
|
422 |
if (empty($_POST['username']) || (empty($_POST['msg'])) || (empty($_POST['title']))) {
|
423 |
echo '<p>BŁĄD: pusty nick, wiadomość lub tytuł</p>' . "\n";
|
423 |
echo '<p>BŁĄD: pusty nick, wiadomość lub tytuł</p>' . "\n";
|
424 |
goto DONE;
|
424 |
goto DONE;
|
425 |
}
|
425 |
}
|
426 |
if (!mkdir($DATADIR . 'threads/' . $thread, 0755, true)) {
|
426 |
if (!mkdir($DATADIR . 'threads/' . $thread, 0755, true)) {
|
427 |
echo '<p>BŁĄD: nie zdołano utworzyć wątku nr ' . $thread . "</p>\n";
|
427 |
echo '<p>BŁĄD: nie zdołano utworzyć wątku nr ' . $thread . "</p>\n";
|
428 |
goto DONE;
|
428 |
goto DONE;
|
429 |
}
|
429 |
}
|
430 |
// zapisz tytuł
|
430 |
// zapisz tytuł
|
431 |
file_put_contents($DATADIR . 'threads/' . $thread . '/title.txt', trim($_POST['title']));
|
431 |
file_put_contents($DATADIR . 'threads/' . $thread . '/title.txt', trim($_POST['title']));
|
432 |
// ustaw co trzeba żeby zapisać wiadomość
|
432 |
// ustaw co trzeba żeby zapisać wiadomość
|
433 |
$action = 'newpost';
|
433 |
$action = 'newpost';
|
434 |
}
|
434 |
}
|
435 |
|
435 |
|
436 |
// nowy post do istniejącego wątku
|
436 |
// nowy post do istniejącego wątku
|
437 |
if (($action === 'newpost') && ($thread >= 0) && (!empty($_POST['msg'])) && (!empty($_POST['username']))) {
|
437 |
if (($action === 'newpost') && ($thread >= 0) && (!empty($_POST['msg'])) && (!empty($_POST['username']))) {
|
438 |
// is it really about a NEW post or about EDITING an existing one?
|
438 |
// is it really about a NEW post or about EDITING an existing one?
|
439 |
if (empty($_POST['postid'])) {
|
439 |
if (empty($_POST['postid'])) {
|
440 |
$postid = time();
|
440 |
$postid = time();
|
441 |
} else { // editing an existing post
|
441 |
} else { // editing an existing post
|
442 |
$msg = loadmsg($_POST['thread'], $_POST['postid']);
|
442 |
$msg = loadmsg($_POST['thread'], $_POST['postid']);
|
443 |
if (!is_art_edition_allowed($_POST['postid'], $msg)) {
|
443 |
if (!is_art_edition_allowed($_POST['postid'], $msg)) {
|
444 |
$action = '';
|
444 |
$action = '';
|
445 |
$ERRSTR = "NOT ALLOWED";
|
445 |
$ERRSTR = "NOT ALLOWED";
|
446 |
goto DONE;
|
446 |
goto DONE;
|
447 |
}
|
447 |
}
|
448 |
$postid = $_POST['postid'];
|
448 |
$postid = $_POST['postid'];
|
449 |
}
|
449 |
}
|
450 |
|
450 |
|
451 |
if (!sprawdz_captcha($_POST)) {
|
451 |
if (!sprawdz_captcha($_POST)) {
|
452 |
$ERRSTR = "BŁĄD: NIEPRAWIDŁOWE CAPTCHA";
|
452 |
$ERRSTR = "BŁĄD: NIEPRAWIDŁOWE CAPTCHA";
|
453 |
goto DONE;
|
453 |
goto DONE;
|
454 |
}
|
454 |
}
|
455 |
// nadpisz lastauthor i lastupdate
|
455 |
// nadpisz lastauthor i lastupdate
|
456 |
$lastupdate = array('lastupdate' => $postid, 'lastauthor' => trim($_POST['username']));
|
456 |
$lastupdate = array('lastupdate' => $postid, 'lastauthor' => trim($_POST['username']));
|
457 |
file_put_contents($DATADIR . 'threads/' . $thread . '/lastupdate', serialize($lastupdate));
|
457 |
file_put_contents($DATADIR . 'threads/' . $thread . '/lastupdate', serialize($lastupdate));
|
458 |
// oblicz tripkod, jeśli hasło zostało ustawione
|
458 |
// oblicz tripkod, jeśli hasło zostało ustawione
|
459 |
$tripsig = '';
|
459 |
$tripsig = '';
|
460 |
if (!empty(trim($_POST['password']))) {
|
460 |
if (!empty(trim($_POST['password']))) {
|
461 |
$tripsig = hash('whirlpool', trim($_POST['username']) . '#' . trim($_POST['password']) . $TRIP_SALT);
|
461 |
$tripsig = hash('whirlpool', trim($_POST['username']) . '#' . trim($_POST['password']) . $TRIP_SALT);
|
462 |
}
|
462 |
}
|
463 |
// wygeneruj klucz do edycji postu i prześlij go przeglądarce przez ciasteczko (chyba że przeglądarka już ma klucz)
|
463 |
// wygeneruj klucz do edycji postu i prześlij go przeglądarce przez ciasteczko (chyba że przeglądarka już ma klucz)
|
464 |
if (!empty($EDIT_ALLOWED_MINUTES)) {
|
464 |
if (!empty($EDIT_ALLOWED_MINUTES)) {
|
465 |
if (!empty($_COOKIE['mateuszbbkey'])) {
|
465 |
if (!empty($_COOKIE['mateuszbbkey'])) {
|
466 |
$artkey = $_COOKIE['mateuszbbkey'];
|
466 |
$artkey = $_COOKIE['mateuszbbkey'];
|
467 |
} else {
|
467 |
} else {
|
468 |
$artkey = bin2hex(random_bytes(128));
|
468 |
$artkey = bin2hex(random_bytes(128));
|
469 |
setcookie('mateuszbbkey', $artkey, array('secure' => true, 'httponly' => true, 'samesite' => 'Lax'));
|
469 |
setcookie('mateuszbbkey', $artkey, array('secure' => false, 'httponly' => true, 'samesite' => 'Lax'));
|
470 |
}
|
470 |
}
|
471 |
}
|
471 |
}
|
472 |
// zapisz wiadomość
|
472 |
// zapisz wiadomość
|
473 |
$msg = array('author' => trim($_POST['username']), 'ip' => $_SERVER['REMOTE_ADDR'], 'trip' => $tripsig, 'msg' => trim($_POST['msg']), 'key' => password_hash($artkey, PASSWORD_DEFAULT));
|
473 |
$msg = array('author' => trim($_POST['username']), 'ip' => $_SERVER['REMOTE_ADDR'], 'trip' => $tripsig, 'msg' => trim($_POST['msg']), 'key' => password_hash($artkey, PASSWORD_DEFAULT));
|
474 |
file_put_contents($DATADIR . 'threads/' . $thread . '/' . $postid, serialize($msg));
|
474 |
file_put_contents($DATADIR . 'threads/' . $thread . '/' . $postid, serialize($msg));
|
475 |
// zaktualizuj metadane dot. ostatniego wpisu, ostatniego autora i ilości wpisów dla tego IP w ciągu ostatniej godziny, ale tylko dla nowych wpisów (nie dla edycji)
|
475 |
// zaktualizuj metadane dot. ostatniego wpisu, ostatniego autora i ilości wpisów dla tego IP w ciągu ostatniej godziny, ale tylko dla nowych wpisów (nie dla edycji)
|
476 |
if (empty($_POST['postid'])) {
|
476 |
if (empty($_POST['postid'])) {
|
477 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3');
|
477 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3');
|
478 |
if ($db) {
|
478 |
if ($db) {
|
479 |
$db->exec('CREATE TABLE IF NOT EXISTS newest (thread INTEGER PRIMARY KEY, lastupdate INTEGER NOT NULL, lastauthor TEXT NOT NULL);');
|
479 |
$db->exec('CREATE TABLE IF NOT EXISTS newest (thread INTEGER PRIMARY KEY, lastupdate INTEGER NOT NULL, lastauthor TEXT NOT NULL);');
|
480 |
$db->exec('CREATE INDEX IF NOT EXISTS lastupdated ON newest (lastupdate);');
|
480 |
$db->exec('CREATE INDEX IF NOT EXISTS lastupdated ON newest (lastupdate);');
|
481 |
$db->exec('CREATE TABLE IF NOT EXISTS ip_msg_counters24h (threadid INTEGER NOT NULL, msgid INTEGER NOT NULL, ipaddr TEXT NOT NULL);');
|
481 |
$db->exec('CREATE TABLE IF NOT EXISTS ip_msg_counters24h (threadid INTEGER NOT NULL, msgid INTEGER NOT NULL, ipaddr TEXT NOT NULL);');
|
482 |
$db->exec('CREATE TABLE IF NOT EXISTS rss (thread INTEGER NOT NULL, msgid INTEGER NOT NULL, author TEXT NOT NULL);');
|
482 |
$db->exec('CREATE TABLE IF NOT EXISTS rss (thread INTEGER NOT NULL, msgid INTEGER NOT NULL, author TEXT NOT NULL);');
|
483 |
$db->exec('CREATE INDEX IF NOT EXISTS rss_msgid ON rss (msgid);');
|
483 |
$db->exec('CREATE INDEX IF NOT EXISTS rss_msgid ON rss (msgid);');
|
484 |
$login_escaped = $db->escapeString(trim($_POST['username']));
|
484 |
$login_escaped = $db->escapeString(trim($_POST['username']));
|
485 |
$db->exec("INSERT OR REPLACE INTO newest (thread, lastupdate, lastauthor) VALUES ({$thread}, {$postid}, '{$login_escaped}');");
|
485 |
$db->exec("INSERT OR REPLACE INTO newest (thread, lastupdate, lastauthor) VALUES ({$thread}, {$postid}, '{$login_escaped}');");
|
486 |
$db->exec("INSERT INTO rss (thread, msgid, author) VALUES ({$thread}, {$postid}, '{$login_escaped}');");
|
486 |
$db->exec("INSERT INTO rss (thread, msgid, author) VALUES ({$thread}, {$postid}, '{$login_escaped}');");
|
487 |
$db->exec("INSERT INTO ip_msg_counters24h (threadid, msgid, ipaddr) VALUES ({$thread}, {$postid}, '{$_SERVER['REMOTE_ADDR']}');");
|
487 |
$db->exec("INSERT INTO ip_msg_counters24h (threadid, msgid, ipaddr) VALUES ({$thread}, {$postid}, '{$_SERVER['REMOTE_ADDR']}');");
|
488 |
$db->close();
|
488 |
$db->close();
|
489 |
} else {
|
489 |
} else {
|
490 |
echo "SQL ERROR WHILE WRITING STATS\n";
|
490 |
echo "SQL ERROR WHILE WRITING STATS\n";
|
491 |
}
|
491 |
}
|
492 |
}
|
492 |
}
|
493 |
// przekieruj
|
493 |
// przekieruj
|
494 |
if ($NICE_URLS) {
|
494 |
if ($NICE_URLS) {
|
495 |
$newurl = "{$thread}#{$postid}";
|
495 |
$newurl = "{$thread}#{$postid}";
|
496 |
} else {
|
496 |
} else {
|
497 |
$newurl = selfurl("thread={$thread}") . "#{$postid}";
|
497 |
$newurl = selfurl("thread={$thread}") . "#{$postid}";
|
498 |
}
|
498 |
}
|
499 |
header("Location: {$newurl}");
|
499 |
header("Location: {$newurl}");
|
500 |
echo "<html><head></head><body><a href=\"{$newurl}\">KLIKNIJ TUTAJ</a></body></html>\n";
|
500 |
echo "<html><head></head><body><a href=\"{$newurl}\">KLIKNIJ TUTAJ</a></body></html>\n";
|
501 |
exit();
|
501 |
exit();
|
502 |
}
|
502 |
}
|
503 |
|
503 |
|
504 |
DONE:
|
504 |
DONE:
|
505 |
|
505 |
|
506 |
}
|
506 |
}
|
507 |
|
507 |
|
508 |
|
508 |
|
509 |
function mateuszbb_tytulwatku($id) {
|
509 |
function mateuszbb_tytulwatku($id) {
|
510 |
global $DATADIR;
|
510 |
global $DATADIR;
|
511 |
return file_get_contents($DATADIR . 'threads/' . $id . '/title.txt');
|
511 |
return file_get_contents($DATADIR . 'threads/' . $id . '/title.txt');
|
512 |
}
|
512 |
}
|
513 |
|
513 |
|
514 |
|
514 |
|
515 |
// returns an array of last n threads with most recent activity that had activity
|
515 |
// returns an array of last n threads with most recent activity that had activity
|
516 |
// in last maxinact days. returns false on error or empty set.
|
516 |
// in last maxinact days. returns false on error or empty set.
|
517 |
// the returned result, when not false, is an array of arrays, where each
|
517 |
// the returned result, when not false, is an array of arrays, where each
|
518 |
// leaf array represents one thread
|
518 |
// leaf array represents one thread
|
519 |
function mateuszbb_getactivethreads($n, $maxinact = -1) {
|
519 |
function mateuszbb_getactivethreads($n, $maxinact = -1) {
|
520 |
global $DATADIR;
|
520 |
global $DATADIR;
|
521 |
$result = array();
|
521 |
$result = array();
|
522 |
|
522 |
|
523 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
|
523 |
$db = new SQLite3($DATADIR . 'mateuszbb.sqlite3', SQLITE3_OPEN_READONLY);
|
524 |
if (! $db) return(false);
|
524 |
if (! $db) return(false);
|
525 |
|
525 |
|
526 |
$minupdatedate = 0;
|
526 |
$minupdatedate = 0;
|
527 |
if ($maxinact >= 0) $minupdatedate = time() - (intval($maxinact) * 86400);
|
527 |
if ($maxinact >= 0) $minupdatedate = time() - (intval($maxinact) * 86400);
|
528 |
|
528 |
|
529 |
$sqlquery = 'SELECT thread, lastupdate, lastauthor FROM newest WHERE lastupdate > ' . $minupdatedate . ' ORDER BY lastupdate DESC LIMIT ' . intval($n) . ';';
|
529 |
$sqlquery = 'SELECT thread, lastupdate, lastauthor FROM newest WHERE lastupdate > ' . $minupdatedate . ' ORDER BY lastupdate DESC LIMIT ' . intval($n) . ';';
|
530 |
|
530 |
|
531 |
$sqlres = $db->query($sqlquery);
|
531 |
$sqlres = $db->query($sqlquery);
|
532 |
if (! $sqlres) {
|
532 |
if (! $sqlres) {
|
533 |
$db->close();
|
533 |
$db->close();
|
534 |
return(false);
|
534 |
return(false);
|
535 |
}
|
535 |
}
|
536 |
|
536 |
|
537 |
// kopiuj wpisy do nowej tablicy
|
537 |
// kopiuj wpisy do nowej tablicy
|
538 |
while ($row = $sqlres->fetchArray()) {
|
538 |
while ($row = $sqlres->fetchArray()) {
|
539 |
$result[] = $row;
|
539 |
$result[] = $row;
|
540 |
}
|
540 |
}
|
541 |
|
541 |
|
542 |
$db->close();
|
542 |
$db->close();
|
543 |
return($result);
|
543 |
return($result);
|
544 |
}
|
544 |
}
|
545 |
|
545 |
|
546 |
|
546 |
|
547 |
// returns true if post can be edited by current user
|
547 |
// returns true if post can be edited by current user
|
548 |
function is_art_edition_allowed($timestamp, $msg) {
|
548 |
function is_art_edition_allowed($timestamp, $msg) {
|
549 |
global $EDIT_ALLOWED_MINUTES;
|
549 |
global $EDIT_ALLOWED_MINUTES;
|
550 |
if ($EDIT_ALLOWED_MINUTES >= 0) {
|
550 |
if ($EDIT_ALLOWED_MINUTES >= 0) {
|
551 |
if (((time() - $timestamp) / 60) >= $EDIT_ALLOWED_MINUTES) return(false); // only posts from last x minutes can be edited
|
551 |
if (((time() - $timestamp) / 60) >= $EDIT_ALLOWED_MINUTES) return(false); // only posts from last x minutes can be edited
|
552 |
}
|
552 |
}
|
553 |
if (empty($_COOKIE['mateuszbbkey'])) return(false);
|
553 |
if (empty($_COOKIE['mateuszbbkey'])) return(false);
|
554 |
if (empty($msg['key'])) return(false);
|
554 |
if (empty($msg['key'])) return(false);
|
555 |
return(password_verify($_COOKIE['mateuszbbkey'], $msg['key']));
|
555 |
return(password_verify($_COOKIE['mateuszbbkey'], $msg['key']));
|
556 |
}
|
556 |
}
|
557 |
|
557 |
|
558 |
|
558 |
|
559 |
function loadmsg($threadid, $postid) {
|
559 |
function loadmsg($threadid, $postid) {
|
560 |
global $DATADIR;
|
560 |
global $DATADIR;
|
561 |
$fname = $DATADIR . 'threads/' . $threadid . '/' . $postid;
|
561 |
$fname = $DATADIR . 'threads/' . $threadid . '/' . $postid;
|
562 |
if (!file_exists($fname)) return(false);
|
562 |
if (!file_exists($fname)) return(false);
|
563 |
return(unserialize(file_get_contents($fname)));
|
563 |
return(unserialize(file_get_contents($fname)));
|
564 |
}
|
564 |
}
|
565 |
|
565 |
|
566 |
|
566 |
|
567 |
// wyświetlanie UI itd
|
567 |
// wyświetlanie UI itd
|
568 |
function mateuszbb_start() {
|
568 |
function mateuszbb_start() {
|
569 |
global $TRIP_SALT;
|
569 |
global $TRIP_SALT;
|
570 |
global $ERRSTR;
|
570 |
global $ERRSTR;
|
571 |
global $DATADIR;
|
571 |
global $DATADIR;
|
572 |
global $INITYEAR;
|
572 |
global $INITYEAR;
|
573 |
global $LANG;
|
573 |
global $LANG;
|
574 |
global $STR;
|
574 |
global $STR;
|
575 |
global $NICE_URLS;
|
575 |
global $NICE_URLS;
|
576 |
global $SEARCH_API_URL;
|
576 |
global $SEARCH_API_URL;
|
577 |
global $TZ;
|
577 |
global $TZ;
|
578 |
global $LOCK_DELAY;
|
578 |
global $LOCK_DELAY;
|
579 |
global $MAINPAGE_MAXTHREADS;
|
579 |
global $MAINPAGE_MAXTHREADS;
|
580 |
global $MAINPAGE_MAXINACT;
|
580 |
global $MAINPAGE_MAXINACT;
|
581 |
|
581 |
|
582 |
// read global variables
|
582 |
// read global variables
|
583 |
$action = getvar_action();
|
583 |
$action = getvar_action();
|
584 |
$thread = getvar_thread();
|
584 |
$thread = getvar_thread();
|
585 |
$archiveyear = getvar_archiveyear();
|
585 |
$archiveyear = getvar_archiveyear();
|
586 |
|
586 |
|
587 |
// ustaw strefę czasową, jeśli jakaś jest skonfigurowana
|
587 |
// ustaw strefę czasową, jeśli jakaś jest skonfigurowana
|
588 |
if (!empty($TZ)) date_default_timezone_set($TZ);
|
588 |
if (!empty($TZ)) date_default_timezone_set($TZ);
|
589 |
|
589 |
|
590 |
// wyświetl błąd, jeśli jakiś wystąpił w mateuszbb_preprocess()
|
590 |
// wyświetl błąd, jeśli jakiś wystąpił w mateuszbb_preprocess()
|
591 |
if (!empty($ERRSTR)) {
|
591 |
if (!empty($ERRSTR)) {
|
592 |
echo "<p class=\"minibb-errstr\">{$ERRSTR}</p>\n";
|
592 |
echo "<p class=\"minibb-errstr\">{$ERRSTR}</p>\n";
|
593 |
$action = '';
|
593 |
$action = '';
|
594 |
echo '<p><a href="./">Wróć do głównej strony</a></p>' . "\n";
|
594 |
echo '<p><a href="./">Wróć do głównej strony</a></p>' . "\n";
|
595 |
goto DONE;
|
595 |
goto DONE;
|
596 |
}
|
596 |
}
|
597 |
|
597 |
|
598 |
// szukanie
|
598 |
// szukanie
|
599 |
if (isset($_POST['szukaj']) && (!empty(trim($_POST['szukaj'])))) {
|
599 |
if (isset($_POST['szukaj']) && (!empty(trim($_POST['szukaj'])))) {
|
600 |
$q = trim($_POST['szukaj']);
|
600 |
$q = trim($_POST['szukaj']);
|
601 |
$query = $SEARCH_API_URL . urlencode($q);
|
601 |
$query = $SEARCH_API_URL . urlencode($q);
|
602 |
echo '<p>' . $STR[$LANG]['searchterm'] . ' ' . htmlentities($q) . '</p>';
|
602 |
echo '<p>' . $STR[$LANG]['searchterm'] . ' ' . htmlentities($q) . '</p>';
|
603 |
$results = file_get_contents($query);
|
603 |
$results = file_get_contents($query);
|
604 |
$resarr = json_decode($results, true)['items'];
|
604 |
$resarr = json_decode($results, true)['items'];
|
605 |
|
605 |
|
606 |
$licznik = 0;
|
606 |
$licznik = 0;
|
607 |
foreach ($resarr as $r) {
|
607 |
foreach ($resarr as $r) {
|
608 |
if (mb_substr($r['link'], -1) === '/') continue;
|
608 |
if (mb_substr($r['link'], -1) === '/') continue;
|
609 |
if (strlen($r['link']) <= strlen(selfurl())) continue;
|
609 |
if (strlen($r['link']) <= strlen(selfurl())) continue;
|
610 |
echo '<a href=' . $r['link'] . ' class="minibb-searchresult">';
|
610 |
echo '<a href=' . $r['link'] . ' class="minibb-searchresult">';
|
611 |
echo "<div><h1>{$r['title']}</h1><p>{$r['htmlSnippet']}</p></div></a>\n";
|
611 |
echo "<div><h1>{$r['title']}</h1><p>{$r['htmlSnippet']}</p></div></a>\n";
|
612 |
$licznik++;
|
612 |
$licznik++;
|
613 |
}
|
613 |
}
|
614 |
|
614 |
|
615 |
if ($licznik == 0) echo "<p>" . $STR[$LANG]['noresults'] . "</p>\n";
|
615 |
if ($licznik == 0) echo "<p>" . $STR[$LANG]['noresults'] . "</p>\n";
|
616 |
|
616 |
|
617 |
goto DONE;
|
617 |
goto DONE;
|
618 |
}
|
618 |
}
|
619 |
|
619 |
|
620 |
// edit post
|
620 |
// edit post
|
621 |
if ($action === 'editpostform') {
|
621 |
if ($action === 'editpostform') {
|
622 |
$msg = loadmsg($_POST['thread'], $_POST['post']);
|
622 |
$msg = loadmsg($_POST['thread'], $_POST['post']);
|
623 |
if (is_art_edition_allowed($_POST['post'], $msg)) {
|
623 |
if (is_art_edition_allowed($_POST['post'], $msg)) {
|
624 |
formularz(intval($_POST['thread']), intval($_POST['post']), $msg);
|
624 |
formularz(intval($_POST['thread']), intval($_POST['post']), $msg);
|
625 |
} else {
|
625 |
} else {
|
626 |
echo "<p>Link expired</p>\n";
|
626 |
echo "<p>Link expired</p>\n";
|
627 |
}
|
627 |
}
|
628 |
GOTO DONE;
|
628 |
GOTO DONE;
|
629 |
}
|
629 |
}
|
630 |
|
630 |
|
631 |
// new thread form
|
631 |
// new thread form
|
632 |
if ($action === 'newthread') {
|
632 |
if ($action === 'newthread') {
|
633 |
echo '<h2 class="minibb-threadtitle">' . $STR[$LANG]['newthread'] . '</h2>' . "\n";
|
633 |
echo '<h2 class="minibb-threadtitle">' . $STR[$LANG]['newthread'] . '</h2>' . "\n";
|
634 |
formularz();
|
634 |
formularz();
|
635 |
goto DONE;
|
635 |
goto DONE;
|
636 |
}
|
636 |
}
|
637 |
|
637 |
|
638 |
// zobacz listę wątków (main page)
|
638 |
// zobacz listę wątków (main page)
|
639 |
if ((empty($action)) && ($thread < 0) && ($archiveyear <= 0)) {
|
639 |
if ((empty($action)) && ($thread < 0) && ($archiveyear <= 0)) {
|
640 |
// display the main page header if any is defined
|
640 |
// display the main page header if any is defined
|
641 |
if (file_exists($DATADIR . 'mateuszbb-main-head.html')) {
|
641 |
if (file_exists($DATADIR . 'mateuszbb-main-head.html')) {
|
642 |
readfile($DATADIR . 'mateuszbb-main-head.html');
|
642 |
readfile($DATADIR . 'mateuszbb-main-head.html');
|
643 |
}
|
643 |
}
|
644 |
// list wątków
|
644 |
// list wątków
|
645 |
echo '<div class="minibb-toolbar" style="justify-content: space-between;">';
|
645 |
echo '<div class="minibb-toolbar" style="justify-content: space-between;">';
|
646 |
echo '<form action="' . selfurl() . '" method="POST"><input type="text" name="szukaj" placeholder="' . $STR[$LANG]['search'] . '"></form>';
|
646 |
echo '<form action="' . selfurl() . '" method="POST"><input type="text" name="szukaj" placeholder="' . $STR[$LANG]['search'] . '"></form>';
|
647 |
echo '<a href="' . selfurl('action=newthread') . '#formularz">' . $STR[$LANG]['opnewthread'] . '</a>';
|
647 |
echo '<a href="' . selfurl('action=newthread') . '#formularz">' . $STR[$LANG]['opnewthread'] . '</a>';
|
648 |
echo "</div>\n";
|
648 |
echo "</div>\n";
|
649 |
|
649 |
|
650 |
$lista_watkow = mateuszbb_getactivethreads($MAINPAGE_MAXTHREADS, $MAINPAGE_MAXINACT);
|
650 |
$lista_watkow = mateuszbb_getactivethreads($MAINPAGE_MAXTHREADS, $MAINPAGE_MAXINACT);
|
651 |
if ($lista_watkow === false) {
|
651 |
if ($lista_watkow === false) {
|
652 |
echo "<p>NO ENTRIES FOUND</p>";
|
652 |
echo "<p>NO ENTRIES FOUND</p>";
|
653 |
} else {
|
653 |
} else {
|
654 |
foreach ($lista_watkow as $row) {
|
654 |
foreach ($lista_watkow as $row) {
|
655 |
$title = mateuszbb_tytulwatku($row['thread']);
|
655 |
$title = mateuszbb_tytulwatku($row['thread']);
|
656 |
if (empty($title)) {
|
656 |
if (empty($title)) {
|
657 |
echo "<!-- BŁĄD: nie zdołano załadować wątku nr {$row['thread']} -->\n";
|
657 |
echo "<!-- BŁĄD: nie zdołano załadować wątku nr {$row['thread']} -->\n";
|
658 |
continue;
|
658 |
continue;
|
659 |
}
|
659 |
}
|
660 |
wyswietl_watek_w_liscie($row['thread'], $title, $row['lastauthor'], $row['lastupdate']);
|
660 |
wyswietl_watek_w_liscie($row['thread'], $title, $row['lastauthor'], $row['lastupdate']);
|
661 |
}
|
661 |
}
|
662 |
}
|
662 |
}
|
663 |
|
663 |
|
664 |
echo '<div style="display: flex; justify-content: space-between; font-size: 0.9em; opacity: 0.8; margin: 0.6em 0.5em 0 0.5em;">' . "\n";
|
664 |
echo '<div style="display: flex; justify-content: space-between; font-size: 0.9em; opacity: 0.8; margin: 0.6em 0.5em 0 0.5em;">' . "\n";
|
665 |
echo '<div>' . $STR[$LANG]['archives'] . ':';
|
665 |
echo '<div>' . $STR[$LANG]['archives'] . ':';
|
666 |
for ($y = $INITYEAR; $y <= intval(gmdate('Y')); $y++) {
|
666 |
for ($y = $INITYEAR; $y <= intval(gmdate('Y')); $y++) {
|
667 |
if ($NICE_URLS) {
|
667 |
if ($NICE_URLS) {
|
668 |
echo " <a href=\"{$y}\">{$y}</a>";
|
668 |
echo " <a href=\"{$y}\">{$y}</a>";
|
669 |
} else {
|
669 |
} else {
|
670 |
echo ' <a href="' . selfurl("arch={$y}") . '">' . $y . '</a>';
|
670 |
echo ' <a href="' . selfurl("arch={$y}") . '">' . $y . '</a>';
|
671 |
}
|
671 |
}
|
672 |
}
|
672 |
}
|
673 |
echo "</div>\n";
|
673 |
echo "</div>\n";
|
674 |
echo '<a href="rss.php"><img style="height: 1em;" src="mateuszbb_rss.svg" alt="RSS"></a>' . "\n";
|
674 |
echo '<a href="rss.php"><img style="height: 1em;" src="mateuszbb_rss.svg" alt="RSS"></a>' . "\n";
|
675 |
echo "</div>\n";
|
675 |
echo "</div>\n";
|
676 |
|
676 |
|
677 |
// display the main page footer if any is defined
|
677 |
// display the main page footer if any is defined
|
678 |
if (file_exists($DATADIR . 'mateuszbb-main-foot.html')) {
|
678 |
if (file_exists($DATADIR . 'mateuszbb-main-foot.html')) {
|
679 |
readfile($DATADIR . 'mateuszbb-main-foot.html');
|
679 |
readfile($DATADIR . 'mateuszbb-main-foot.html');
|
680 |
}
|
680 |
}
|
681 |
|
681 |
|
682 |
goto DONE;
|
682 |
goto DONE;
|
683 |
}
|
683 |
}
|
684 |
|
684 |
|
685 |
// wyświetl archiwum
|
685 |
// wyświetl archiwum
|
686 |
if ($archiveyear > 0) {
|
686 |
if ($archiveyear > 0) {
|
687 |
echo '<div class="minibb-toolbar" id="title"><a href="' . selfurl() . '">' . $STR[$LANG]['backtocur'] . '</a></div>' . "\n";
|
687 |
echo '<div class="minibb-toolbar" id="title"><a href="' . selfurl() . '">' . $STR[$LANG]['backtocur'] . '</a></div>' . "\n";
|
688 |
echo '<h2 class="minibb-threadtitle">' . $STR[$LANG]['archives'] . " {$archiveyear}</h2>\n";
|
688 |
echo '<h2 class="minibb-threadtitle">' . $STR[$LANG]['archives'] . " {$archiveyear}</h2>\n";
|
689 |
$threads = scandir($DATADIR . 'threads/', SCANDIR_SORT_ASCENDING);
|
689 |
$threads = scandir($DATADIR . 'threads/', SCANDIR_SORT_ASCENDING);
|
690 |
foreach ($threads as $t) {
|
690 |
foreach ($threads as $t) {
|
691 |
if (!preg_match('/^[0-9][0-9]*$/', $t)) continue; // skip anything that is not a thread id
|
691 |
if (!preg_match('/^[0-9][0-9]*$/', $t)) continue; // skip anything that is not a thread id
|
692 |
if (intval(gmdate('Y', $t)) != $archiveyear) continue; // skip threads out of the targeted year
|
692 |
if (intval(gmdate('Y', $t)) != $archiveyear) continue; // skip threads out of the targeted year
|
693 |
$title = file_get_contents($DATADIR . 'threads/' . $t . '/title.txt');
|
693 |
$title = file_get_contents($DATADIR . 'threads/' . $t . '/title.txt');
|
694 |
$link = $t;
|
694 |
$link = $t;
|
695 |
if (! $NICE_URLS) $link = selfurl("thread={$t}");
|
695 |
if (! $NICE_URLS) $link = selfurl("thread={$t}");
|
696 |
echo '<span style="font-family: monospace;">[' . gmdate("Y-m-d", $t) . "]</span> <a href=\"{$link}\">{$title}</a><br>\n";
|
696 |
echo '<span style="font-family: monospace;">[' . gmdate("Y-m-d", $t) . "]</span> <a href=\"{$link}\">{$title}</a><br>\n";
|
697 |
}
|
697 |
}
|
698 |
goto DONE;
|
698 |
goto DONE;
|
699 |
}
|
699 |
}
|
700 |
|
700 |
|
701 |
// zobacz wątek
|
701 |
// zobacz wątek
|
702 |
if ((empty($action)) && ($thread >= 0)) {
|
702 |
if ((empty($action)) && ($thread >= 0)) {
|
703 |
// załaduj listę postów (i zapamiętaj ostatnią pozycję)
|
703 |
// załaduj listę postów (i zapamiętaj ostatnią pozycję)
|
704 |
$listapostow = scandir($DATADIR . 'threads/' . $thread . '/');
|
704 |
$listapostow = scandir($DATADIR . 'threads/' . $thread . '/');
|
705 |
// usuń pozycje które nie są żadnym msgid (np. title.txt) i zapamiętaj ostatni msgid
|
705 |
// usuń pozycje które nie są żadnym msgid (np. title.txt) i zapamiętaj ostatni msgid
|
706 |
$posty = array();
|
706 |
$posty = array();
|
707 |
foreach ($listapostow as $p) {
|
707 |
foreach ($listapostow as $p) {
|
708 |
if (!preg_match('/^[0-9][0-9]*$/', $p)) continue; // skip anything that is not a messageid
|
708 |
if (!preg_match('/^[0-9][0-9]*$/', $p)) continue; // skip anything that is not a messageid
|
709 |
$posty[] = $p;
|
709 |
$posty[] = $p;
|
710 |
$ostatnipost = $p;
|
710 |
$ostatnipost = $p;
|
711 |
}
|
711 |
}
|
712 |
// is this thread locked?
|
712 |
// is this thread locked?
|
713 |
$islocked = false;
|
713 |
$islocked = false;
|
714 |
if (($LOCK_DELAY >= 0) && ((time() - intval($ostatnipost)) / 86400 >= $LOCK_DELAY)) $islocked = true;
|
714 |
if (($LOCK_DELAY >= 0) && ((time() - intval($ostatnipost)) / 86400 >= $LOCK_DELAY)) $islocked = true;
|
715 |
// toolbar (ostatni wątek / odpowiedz / powrót do forum)
|
715 |
// toolbar (ostatni wątek / odpowiedz / powrót do forum)
|
716 |
echo '<div class="minibb-toolbar" id="title">';
|
716 |
echo '<div class="minibb-toolbar" id="title">';
|
717 |
echo '<a href="#' . $ostatnipost . '">' . $STR[$LANG]['jumptoend'] . '</a>';
|
717 |
echo '<a href="#' . $ostatnipost . '">' . $STR[$LANG]['jumptoend'] . '</a>';
|
718 |
if (! $islocked) echo ' <a href="#formularz">' . $STR[$LANG]['reply'] . '</a>';
|
718 |
if (! $islocked) echo ' <a href="#formularz">' . $STR[$LANG]['reply'] . '</a>';
|
719 |
echo ' <a href="' . selfurl() . '">' . $STR[$LANG]['listthreads'] . '</a></div>' . "\n";
|
719 |
echo ' <a href="' . selfurl() . '">' . $STR[$LANG]['listthreads'] . '</a></div>' . "\n";
|
720 |
// wyświetl tytuł wątku
|
720 |
// wyświetl tytuł wątku
|
721 |
echo '<h2 class="minibb-threadtitle">' . htmlspecialchars(file_get_contents($DATADIR . 'threads/' . $thread . '/title.txt')) . "</h2>\n";
|
721 |
echo '<h2 class="minibb-threadtitle">' . htmlspecialchars(file_get_contents($DATADIR . 'threads/' . $thread . '/title.txt')) . "</h2>\n";
|
722 |
// "thread is locked"
|
722 |
// "thread is locked"
|
723 |
if ($islocked) echo '<p class="minibb-islockedmsg">' . $STR[$LANG]['locked'] . "</p>\n";
|
723 |
if ($islocked) echo '<p class="minibb-islockedmsg">' . $STR[$LANG]['locked'] . "</p>\n";
|
724 |
// wyświetl listę postów
|
724 |
// wyświetl listę postów
|
725 |
foreach ($posty as $p) {
|
725 |
foreach ($posty as $p) {
|
726 |
$msg = loadmsg($thread, $p);
|
726 |
$msg = loadmsg($thread, $p);
|
727 |
echo '<div class="minibb-post" id="' . $p . '">' . "\n";
|
727 |
echo '<div class="minibb-post" id="' . $p . '">' . "\n";
|
728 |
echo '<div class="minibb-postheader"><a href="#' . $p . '" style="text-decoration: inherit; color: inherit;"><div class="minibb-postauthor">' . "\n";
|
728 |
echo '<div class="minibb-postheader"><a href="#' . $p . '" style="text-decoration: inherit; color: inherit;"><div class="minibb-postauthor">' . "\n";
|
729 |
echo $STR[$LANG]['author'] . ' ' . htmlspecialchars($msg['author']) . "<br>\n";
|
729 |
echo $STR[$LANG]['author'] . ' ' . htmlspecialchars($msg['author']) . "<br>\n";
|
730 |
echo $STR[$LANG]['address'] . ' ' . htmlspecialchars($msg['ip']) . "<br>\n";
|
730 |
echo $STR[$LANG]['address'] . ' ' . htmlspecialchars($msg['ip']) . "<br>\n";
|
731 |
echo $STR[$LANG]['date'] . ' ' . htmlspecialchars(data_dluga($p)) . "</div></a>\n";
|
731 |
echo $STR[$LANG]['date'] . ' ' . htmlspecialchars(data_dluga($p)) . "</div></a>\n";
|
732 |
if (!empty($msg['trip'])) {
|
732 |
if (!empty($msg['trip'])) {
|
733 |
echo '<div class="minibb-trip">';
|
733 |
echo '<div class="minibb-trip">';
|
734 |
echo chunk_split($msg['trip'], 16, "\n");
|
734 |
echo chunk_split($msg['trip'], 16, "\n");
|
735 |
echo "</div>\n";
|
735 |
echo "</div>\n";
|
736 |
}
|
736 |
}
|
737 |
echo "</div>\n";
|
737 |
echo "</div>\n";
|
738 |
|
738 |
|
739 |
// symbole html
|
739 |
// symbole html
|
740 |
$bodyprocessed = htmlspecialchars($msg['msg']);
|
740 |
$bodyprocessed = htmlspecialchars($msg['msg']);
|
741 |
|
741 |
|
742 |
// ludzie czasem dodają znaczniki [img] do obrazków, usuń je (ale tylko jeśli są na początku linii)
|
742 |
// ludzie czasem dodają znaczniki [img] do obrazków, usuń je (ale tylko jeśli są na początku linii)
|
743 |
$bodyprocessed = preg_replace('~^(\[img\])(.*)(\[/img\])~m', '$2', $bodyprocessed);
|
743 |
$bodyprocessed = preg_replace('~^(\[img\])(.*)(\[/img\])~m', '$2', $bodyprocessed);
|
744 |
|
744 |
|
745 |
// dodaj podgląd pod linki do obrazków, ale tylko jeśli link jest sam w linijce
|
745 |
// dodaj podgląd pod linki do obrazków, ale tylko jeśli link jest sam w linijce
|
746 |
$bodyprocessed = preg_replace('~^(http[s]?://[^<>[:space:]]+[[:alnum:]/]\.(jpg|png))($|[\r\n]{1,2})~m', "$1\n<img src=\"$1\">\n", $bodyprocessed);
|
746 |
$bodyprocessed = preg_replace('~^(http[s]?://[^<>[:space:]]+[[:alnum:]/]\.(jpg|png))($|[\r\n]{1,2})~m', "$1\n<img src=\"$1\">\n", $bodyprocessed);
|
747 |
|
747 |
|
748 |
// olinkuj linki
|
748 |
// olinkuj linki
|
749 |
$bodyprocessed = preg_replace("~([^\"]|^)(http[s]?://[^<>[:space:]]+[[:alnum:]/=])~", "$1<a href=\"$2\">$2</a>", $bodyprocessed);
|
749 |
$bodyprocessed = preg_replace("~([^\"]|^)(http[s]?://[^<>[:space:]]+[[:alnum:]/=])~", "$1<a href=\"$2\">$2</a>", $bodyprocessed);
|
750 |
|
750 |
|
751 |
// oflaguj cytaty (linijki zaczynające się od ">")
|
751 |
// oflaguj cytaty (linijki zaczynające się od ">")
|
752 |
$bodyprocessed = preg_replace('/^(>.*)[\r]?\n/m', '<blockquote>$1</blockquote>', $bodyprocessed);
|
752 |
$bodyprocessed = preg_replace('/^(>.*)[\r]?\n/m', '<blockquote>$1</blockquote>', $bodyprocessed);
|
753 |
|
753 |
|
754 |
echo '<div class="minibb-postbody">';
|
754 |
echo '<div class="minibb-postbody">';
|
755 |
// czy mogę edytować?
|
755 |
// czy mogę edytować?
|
756 |
if (is_art_edition_allowed($p, $msg)) {
|
756 |
if (is_art_edition_allowed($p, $msg)) {
|
757 |
echo '<form class="editbtn" method="POST" action="' . selfurl() . '"><input type="hidden" name="action" value="editpostform"><input type="hidden" name="post" value="' . $p . '"><input type="hidden" name="thread" value="' . $thread . '"><input type="submit" value="EDIT"></form>';
|
757 |
echo '<form class="editbtn" method="POST" action="' . selfurl() . '"><input type="hidden" name="action" value="editpostform"><input type="hidden" name="post" value="' . $p . '"><input type="hidden" name="thread" value="' . $thread . '"><input type="submit" value="EDIT"></form>';
|
758 |
}
|
758 |
}
|
759 |
echo $bodyprocessed . "</div>\n";
|
759 |
echo $bodyprocessed . "</div>\n";
|
760 |
echo "</div>\n";
|
760 |
echo "</div>\n";
|
761 |
}
|
761 |
}
|
762 |
// formularz odpowiedzi albo komunikat o zamknięciu
|
762 |
// formularz odpowiedzi albo komunikat o zamknięciu
|
763 |
if ($islocked) {
|
763 |
if ($islocked) {
|
764 |
echo '<p class="minibb-islockedmsg">' . $STR[$LANG]['locked'] . "</p>\n";
|
764 |
echo '<p class="minibb-islockedmsg">' . $STR[$LANG]['locked'] . "</p>\n";
|
765 |
} else {
|
765 |
} else {
|
766 |
formularz($thread);
|
766 |
formularz($thread);
|
767 |
}
|
767 |
}
|
768 |
goto DONE;
|
768 |
goto DONE;
|
769 |
}
|
769 |
}
|
770 |
|
770 |
|
771 |
DONE:
|
771 |
DONE:
|
772 |
}
|
772 |
}
|
773 |
?>
|
773 |
?>
|
774 |
|
774 |
|