Commit Graph

28 Commits

Author SHA1 Message Date
Adam Warner
258ea04432 Add a class for better readability of list type within the code
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2019-12-08 18:47:30 +00:00
DL6ER
3a0a596b11 Implement necessary changes due to switching from individual to a common domainlist.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-08 17:42:01 +00:00
DL6ER
586224fde2 Replace PREG_SPLIT_NO_EMPTY by using trim().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-07 21:57:59 +02:00
DL6ER
838516e558 Ensure preg does not output empty array elements.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-07 21:44:01 +02:00
DL6ER
71fc7a4791 Use preg_split() instead of explode() for better space handling. Skip empty domains in add_to_table() and remove_from_table().
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-07 21:23:29 +02:00
DL6ER
7807f12d65 Fix codefactor complaints.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-06 22:08:18 +02:00
DL6ER
7fdafb2dcc Update comment and code in sub.php
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-06 22:06:44 +02:00
DL6ER
424fe7636b Call "sudo pihole restartdns reload" after having added or removed domains to notify FTL of the updated lists.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-06 22:02:36 +02:00
DL6ER
c9f5c9500a Directly modify gravity tables from the lists pages.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-05 21:55:08 +02:00
DL6ER
bc7aef744c "pihole --whiteregex" has been renamed to "pihole --white-regex". Similar for "--whitewild" -> "--white-wild".
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-08-05 21:13:53 +02:00
DL6ER
dfcfafd6d9 Implement whitelist regex support to web interface.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-07-22 21:15:50 +02:00
DL6ER
506644b671 Rewrite web interface to allow interaction with database-based lists
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-04-25 15:02:39 +02:00
Mcat12
24a22bcb55 Fix security issue when using list functionality via api.php
Remote code execution could have been triggered by activating some list
functionality (add and remove) via api.php.

Thanks to Kacper Szurek for finding this bug.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2019-03-02 13:51:29 -08:00
Michael Epstein
84f6f3dae6 - Fix the delete of blacklist/whitelist records under NGINX + PHP-FPM
- Fix multiple php warning/error messages when this scripts are executed from AJAX requests

Example errors/warnings:

2019/01/15 13:22:22 [error] 1408#1408: *2535 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined variable: api in /var/www/html/admin/scripts/pi-hole/php/sub.php on line 16
PHP message: PHP Warning:  Cannot modify header information - headers already sent by (output started at /var/www/html/admin/scripts/pi-hole/php/sub.php:8) in /var/www/html/admin/scripts/pi-hole/php/auth.php on line 81
PHP message: PHP Warning:  session_start(): Cannot start session when headers already sent in /var/www/html/admin/scripts/pi-hole/php/auth.php on line 93

Signed-off-by: Michael Epstein <mepstein@mediabox.cl>
2019-01-16 01:51:54 -03:00
Mcat12
c382bb67e6 Keep a trailing newline in the regex list when deleting an item
Fixes #874

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-12-15 20:50:36 -05:00
Mike Souza
203d41103a Add API support for list actions
Signed-off-by: Mike Souza <contact@michael-souza.com>
2018-08-26 11:56:44 -04:00
Mcat12
fbe9516cbe Fix incorrect regex removal code
If you had these in the regex list:
- example\.com
- example
- ^example.*

And you removed "example", then the list would look like this:
- \.com
- ^.*

This behavior is fixed.

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-07-08 16:27:38 -04:00
DL6ER
e8b2cbe698 Tag regex filters as "regex" to avoid the domain validation (otherwise regex lines could not get removed). Also ensure that deleting the first wildcard/regex does not hide the first exact blocking domain (this bug has been in since the very beginning of wildcard blocking)
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-30 14:42:52 +02:00
Mcat12
4259aada78 Don't leave a newline at the end of the regex file
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-29 23:03:01 -04:00
Mcat12
aef5f7c7ce Keep trailing newline in regex file after removal
Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
2018-06-28 23:16:11 -04:00
DL6ER
c0da231fa6 Force reload of the regex filters in FTLDNS after having added/removed one from the dashboard
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-24 12:42:05 +02:00
DL6ER
1935544183 Directly manipulate regex.list from PHP to avoid detour over bash. This needs read/write permissions of the PHP user on "/etc/pihole/regex.list" !
Signed-off-by: DL6ER <dl6er@dl6er.de>
2018-06-23 15:50:19 +02:00
DL6ER
4f70973cbc EUPL license (#402)
* Move whole project to EUPL, copy MIT license to scripts/vendor/ and style/vendor/

* Added header to main PHP files

* Modified scripts in scripts/pi-hole/php

* Added header to scripts/pi-hole/js files

* Added license header to our custom style script

* Slight reformulation
2017-02-18 14:20:51 +01:00
DL6ER
8080afadac Make ADD, SUB and GET compatible with the wildcard blocking list 2016-12-31 15:36:47 +00:00
Mcat12
ca9418a245 Merge branch 'devel' into restructureFolders 2016-12-30 14:44:26 -05:00
Mcat12
2f65430a4d Move PHP scripts to scripts folder 2016-12-21 21:09:58 +01:00
DL6ER
e188cb6fbc Revert "Merge pull request #267 from pi-hole/folderStructure"
This reverts commit fba3d10fa4, reversing
changes made to 4ee75f4167.
2016-12-21 17:16:52 +01:00
Mcat12
d1da1de597 Move PHP scripts to scripts folder 2016-12-19 19:44:51 -05:00