File tree Expand file tree Collapse file tree 3 files changed +4
-39
lines changed
Expand file tree Collapse file tree 3 files changed +4
-39
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,10 @@ Comment Extension for Mecha
44Release Notes
55-------------
66
7+ ### master
8+
9+ - Removed default spam filter. This feature can be created as a separate extension (#2 )
10+
711### 1.18.1
812
913 - Improved default XSS filter. Now will also filter HTML attribute names started with ` on ` and HTML attribute values started with ` javascript: ` .
Original file line number Diff line number Diff line change @@ -123,40 +123,6 @@ function set($any) {
123123 if ($ content === \Session::get ('comment.content ' )) {
124124 \Alert::error ('You have sent that comment already. ' );
125125 ++$ error ;
126- } else {
127- // Block user by IP address
128- if (!empty ($ guard ['x ' ]['ip ' ])) {
129- $ ip = \Client::IP ();
130- foreach ($ guard ['x ' ]['ip ' ] as $ v ) {
131- if ($ v === $ ip ) {
132- \Alert::error ('Blocked IP address: %s ' , $ ip );
133- ++$ error ;
134- break ;
135- }
136- }
137- }
138- // Block user by UA keyword(s)
139- if (!empty ($ guard ['x ' ]['ua ' ])) {
140- $ ua = \Client::UA ();
141- foreach ($ guard ['x ' ]['ua ' ] as $ v ) {
142- if (false !== \stripos ($ ua , $ v )) {
143- \Alert::error ('Blocked user agent: %s ' , $ ua );
144- ++$ error ;
145- break ;
146- }
147- }
148- }
149- // Check for spam keyword(s) in comment
150- if (!empty ($ guard ['x ' ]['query ' ])) {
151- $ words = ($ author ?? "" ) . ($ email ?? "" ) . ($ link ?? "" ) . ($ content ?? "" );
152- foreach ($ guard ['x ' ]['query ' ] as $ v ) {
153- if (false !== \stripos ($ words , $ v )) {
154- \Alert::error ('Please choose another word: %s ' , $ v );
155- ++$ error ;
156- break ;
157- }
158- }
159- }
160126 }
161127 // Store comment to file
162128 $ t = \time ();
Original file line number Diff line number Diff line change 2626 'email ' => 3 , // `a@b`
2727 'link ' => 8 , // `http://a`
2828 'content ' => 2
29- ],
30- 'x ' => [
31- 'query ' => ['f*ck ' ], // Block by word(s)
32- 'ip ' => [], // Block by IP address(es)
33- 'ua ' => [] // Block by user agent word(s)
3429 ]
3530 ]
3631];
You can’t perform that action at this time.
0 commit comments