Commit Graph

53 Commits

Author SHA1 Message Date
Adam Warner
c949516ee1 make use of utils.escapeHtml on the JS side of things, and html_entity_decode/htmlentities in PHP
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-06-13 18:50:36 +01:00
Adam Warner
5b71dab0c7 Change INSERT statement to INSERT OR IGNORE on adlist management as a workaround for now
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-06-06 18:27:22 +01:00
Adam Warner
efd9281fa4 Merge pull request #1442 from pi-hole/fix/null_comments_in_groups
Store NULL for empty descriptions and comments in the groups database tables
2020-06-05 19:17:57 +01:00
Adam Warner
7aa79a7a77 Merge pull request #1420 from pi-hole/tweak/improve_warnings
Improve messages on the domain management pages
2020-06-05 19:17:17 +01:00
DL6ER
a7bc6e8999 Store NULL for emtpty descriptions and comments in the groups database tables.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-05 11:53:10 +02:00
Adam Warner
981cba14f2 Use PHP builtin to split the input by space. Automatically takes into account " chars
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-06-03 16:50:33 +01:00
DL6ER
580149e91f Merge pull request #1292 from pi-hole/tweak/group_name_separators
Allow spaces in groups when wrapping names in "..."
2020-06-02 13:43:49 +02:00
DL6ER
332cff1d36 Improve warnings on the domain management pages.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-06-02 11:37:23 +02:00
Adam Warner
7700d9b44a Merge pull request #1387 from pi-hole/new/api_add_sub_get_lists
(Re-)Add API endpoints for list manipulations
2020-05-29 23:30:40 +01:00
DL6ER
cce92ccde4 Remove obsolete add.php script, use groups.php everywhere instead.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-26 23:07:20 +02:00
Adam Warner
c2a634f80f Allow for ; in adlist urls
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-26 20:58:18 +01:00
DL6ER
2fac217943 Re-implement api.php?list actions for add, sub and get.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-26 18:40:33 +02:00
DL6ER
402e56e054 Allow adding groups with spaces in them when wrapping groups names in quotation marks.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-14 18:04:31 +02:00
Adam Warner
ef13e69125 Use REPLACE into instead of INSERT into. This allows for a domain's white/blacklist status to be toggled
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
2020-05-13 22:01:58 +01:00
DL6ER
73ee91a024 Merge branch 'master' into master-to-development-v5.0
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-05-10 22:00:07 +02:00
DL6ER
81a2932f6a Merge branch 'release/v5.0' into tweak/trim_domains_input
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-28 21:12:45 +02:00
DL6ER
4889350038 Merge branch 'release/v5.0' into tweak/trim_domains_input
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-28 17:30:13 +00:00
DL6ER
84046528bf Allow ( and ) in adlist URLs.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-26 09:31:45 +02:00
DL6ER
f17b216b6b As of ICU 55.1 (released 2015-04-01) the IDNA2003 APIs are deprecated, because UTS #46 should be preferred over the obsolete IDNA 2003 variant. Implement this change. Fixes #1223
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-25 07:02:37 +02:00
DL6ER
77b421b133 Show how many domains have been added in case of an error.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-23 13:47:50 +02:00
DL6ER
7d1163ff9c Try to be clearer with the "failed to add domain" message by showing the original input when idn_to_ascii() failed and by showing both, the original and the converted domain when the conversion result itself is invalid.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-23 11:39:57 +02:00
DL6ER
14dd1350df Strip whitespaces from the beginning and end of user input to prevent errors getting triggered due to users trying to add "empty" domains.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-04-23 11:27:24 +02:00
Samu Voutilainen
39ec67829b Execute pihole through wrapper
All different exec() calls basically just calls sudo pihole,
with various different syntaxes. Using a wrapper function
allows sanitization of arguments for better safety.

Signed-off-by: Samu Voutilainen <smar@smar.fi>
2020-04-17 07:55:16 +03:00
DL6ER
57e139bcba Merge branch 'release/v5.0' into new/space-separated-item-injection 2020-03-31 21:31:41 +00:00
DL6ER
f0034b305d Check adlist URL for valid characters before adding record to the database.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-03-31 20:41:50 +00:00
Dan Schaper
aa51f014ab Fix domain and group disassociation when toggling from Black/Whitelis… (#1172)
* Fix domain and group disassociation when toggling from Black/Whitelist page

* Properly set the groups variable

Signed-off-by: trillaxe <trillax@tutanota.com>

* Trim whitespace

Signed-off-by: Dan Schaper <dan.schaper@pi-hole.net>
2020-03-05 12:59:42 -08:00
DL6ER
59085c237e Merge branch 'release/v5.0' into new/clients_comment_fields
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-18 16:44:12 +01:00
DL6ER
7274b9bca7 Only use IDN subroutines when the module is available. We have seen reports that at least DietPi is having issues with not matching PHP base and extension versions.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-16 21:16:06 +01:00
DL6ER
3c3e22bd98 Add support for client comment and timestamp fields.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-16 15:55:29 +01:00
DL6ER
32815cb7f0 Merge branch 'release/v5.0' into new/unify_domain_pages
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-16 09:13:45 +01:00
DL6ER
268a6d9144 Extract domain in addition request for all domain types, not just the exact ones.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-15 07:35:37 +01:00
DL6ER
2d975b8bac Simplify domain management by using the same page for both locations where domains can be edited. This removes a large amount of duplicated code, each prone to its own bugs.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-14 20:31:54 +01:00
DL6ER
b2cc349abf Only try to convert exact domains using the IDN library.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-14 17:27:45 +01:00
DL6ER
13b7b3d1a9 Remove redundant adlist management on settings page. This is still using CLI callbacks instead of working directly on the database.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-11 20:07:43 +01:00
DL6ER
ae470b2d3d Add ability to mass-inject space-separated domains.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-02-11 20:00:54 +01:00
DL6ER
2860ce3fc8 Merge pull request #1130 from pi-hole/new/intl_domains
Add support for international domain names
2020-02-04 21:07:28 +01:00
DL6ER
abe0b760bd Ensure we reach the end of groups.php to send SIGRTMIN to FTL.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-27 12:40:45 +00:00
Dan Schaper
89cf4b279b Merge branch 'release/v5.0' into new/intl_domains 2020-01-25 17:49:02 -08:00
DL6ER
f92812d4cd Substitute null client names by empty strings.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-19 22:32:28 +01:00
DL6ER
65be9d89ef Add support for international domain names. Note that this relies on php-intl to be installed
Signed-off-by: DL6ER <dl6er@dl6er.de>
2020-01-12 13:53:12 +01:00
DL6ER
563aaa14df Convert domains to lower-case and validate them before adding them.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-23 09:07:13 +00:00
DL6ER
050021827f Show host names (if known) on the Clients management page.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-19 16:56:44 +00:00
DL6ER
18682eb61d Also delete assignments form domains, adlists and clients to a group when it is deleted.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-17 09:56:55 +00:00
DL6ER
49be667760 Say explicitly why a "Not allowed" error comes from.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-16 10:08:35 +00:00
DL6ER
acf19c0eea Apply PSR-12 style to all new PHP files added in this pull request.
Used command: PHP_CodeSniffer/bin/phpcbf --standard=PSR12 [...].php

Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-14 20:04:26 +00:00
DL6ER
b791c29440 Use single quotes almost everywhere, use !== where appropriate, fix formatting and simplify the code in some places.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-14 12:16:01 +00:00
DL6ER
aa764ad22d Add CORS and CSRF checks to ensure unauthorized access to the backend is not possible.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-13 17:39:45 +00:00
DL6ER
3b7e50713f Remove assignment from if-statement to please CodeFactor.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-13 17:26:02 +00:00
DL6ER
cf96bed06a Address stickler complaints.
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-13 16:58:50 +00:00
DL6ER
70589fa844 Add Adlists group management
Signed-off-by: DL6ER <dl6er@dl6er.de>
2019-12-13 15:41:14 +00:00