From ec32e489eb1fe0f20243affdbabc68bb002dcca1 Mon Sep 17 00:00:00 2001 From: Adam Warner Date: Sun, 21 Apr 2024 15:37:39 +0100 Subject: [PATCH] Apply php-cs-fixer changes. We're not going to be using php for much longer, but currently `devel` is "broken" Signed-off-by: Adam Warner --- scripts/pi-hole/php/func.php | 16 +++++++------- scripts/pi-hole/php/groups.php | 38 ++++++++++++++++----------------- scripts/pi-hole/php/message.php | 2 +- scripts/pi-hole/php/network.php | 2 +- settings.php | 10 ++++----- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/scripts/pi-hole/php/func.php b/scripts/pi-hole/php/func.php index b345ca87..f29cb6d5 100644 --- a/scripts/pi-hole/php/func.php +++ b/scripts/pi-hole/php/func.php @@ -208,7 +208,7 @@ function getCustomDNSEntries() continue; } - $data = new \stdClass(); + $data = new stdClass(); $data->ip = $explodedLine[0]; $data->domain = $explodedLine[1]; $data->domains = array_slice($explodedLine, 0, -1); @@ -286,7 +286,7 @@ function addCustomDNSEntry($ip = '', $domain = '', $reload = '', $json = true, $ } return returnSuccess('', $json); - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage(), $json); } } @@ -325,7 +325,7 @@ function deleteCustomDNSEntry() pihole_execute('-a removecustomdns '.$ip.' '.$domain); return returnSuccess(); - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage()); } } @@ -342,7 +342,7 @@ function deleteAllCustomDNSEntries($reload = '') foreach ($existingEntries as $entry) { pihole_execute('-a removecustomdns '.$entry->ip.' '.$entry->domain.' '.$reload); } - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage()); } @@ -386,7 +386,7 @@ function getCustomCNAMEEntries() continue; } - $data = new \stdClass(); + $data = new stdClass(); $data->domains = array_slice($explodedLine, 0, -1); $data->domain = implode(',', $data->domains); $data->target = $explodedLine[count($explodedLine) - 1]; @@ -468,7 +468,7 @@ function addCustomCNAMEEntry($domain = '', $target = '', $reload = '', $json = t } return returnSuccess('', $json); - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage(), $json); } } @@ -507,7 +507,7 @@ function deleteCustomCNAMEEntry() pihole_execute('-a removecustomcname '.$domain.' '.$target); return returnSuccess(); - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage()); } } @@ -524,7 +524,7 @@ function deleteAllCustomCNAMEEntries($reload = '') foreach ($existingEntries as $entry) { pihole_execute('-a removecustomcname '.$entry->domain.' '.$entry->target.' '.$reload); } - } catch (\Exception $ex) { + } catch (Exception $ex) { return returnError($ex->getMessage()); } diff --git a/scripts/pi-hole/php/groups.php b/scripts/pi-hole/php/groups.php index 7cd41860..67b12509 100644 --- a/scripts/pi-hole/php/groups.php +++ b/scripts/pi-hole/php/groups.php @@ -51,7 +51,7 @@ if ($_POST['action'] == 'get_groups') { header('Content-type: application/json'); echo json_encode(array('data' => $data)); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'add_group') { @@ -93,7 +93,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'edit_group') { @@ -134,7 +134,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_group') { @@ -167,7 +167,7 @@ if ($_POST['action'] == 'get_groups') { } $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'get_clients') { @@ -247,7 +247,7 @@ if ($_POST['action'] == 'get_groups') { header('Content-type: application/json'); echo json_encode(array('data' => $data)); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'get_unconfigured_clients') { @@ -329,7 +329,7 @@ if ($_POST['action'] == 'get_groups') { header('Content-type: application/json'); echo json_encode($ips); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'add_client') { @@ -372,7 +372,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'edit_client') { @@ -443,7 +443,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_client') { @@ -481,7 +481,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'get_domains') { @@ -525,7 +525,7 @@ if ($_POST['action'] == 'get_groups') { header('Content-type: application/json'); echo json_encode(array('data' => $data)); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'add_domain' || $_POST['action'] == 'replace_domain') { @@ -693,7 +693,7 @@ if ($_POST['action'] == 'get_groups') { } $reload = true; JSON_success($msg); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'edit_domain') { @@ -778,7 +778,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_domain') { @@ -817,7 +817,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_domain_string') { @@ -869,7 +869,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'get_adlists') { @@ -897,7 +897,7 @@ if ($_POST['action'] == 'get_groups') { header('Content-type: application/json'); echo json_encode(array('data' => $data)); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'add_adlist') { @@ -978,7 +978,7 @@ if ($_POST['action'] == 'get_groups') { $msg = $added_list.'
Total: '.$total.' adlist(s) processed.'; JSON_success($msg); } - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'edit_adlist') { @@ -1059,7 +1059,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'delete_adlist') { @@ -1100,7 +1100,7 @@ if ($_POST['action'] == 'get_groups') { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } elseif ($_POST['action'] == 'add_audit') { @@ -1157,7 +1157,7 @@ if ($_POST['action'] == 'get_groups') { // Reloading isn't necessary for audit domains (no effect on blocking) $reload = false; JSON_success($msg); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } else { diff --git a/scripts/pi-hole/php/message.php b/scripts/pi-hole/php/message.php index 7ecfccea..3f54bba3 100644 --- a/scripts/pi-hole/php/message.php +++ b/scripts/pi-hole/php/message.php @@ -50,7 +50,7 @@ if ($_POST['action'] == 'delete_message' && isset($_POST['id'])) { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } else { diff --git a/scripts/pi-hole/php/network.php b/scripts/pi-hole/php/network.php index 4b570cea..be6b6881 100644 --- a/scripts/pi-hole/php/network.php +++ b/scripts/pi-hole/php/network.php @@ -57,7 +57,7 @@ if ($_POST['action'] == 'delete_network_entry' && isset($_POST['id'])) { $reload = true; JSON_success(); - } catch (\Exception $ex) { + } catch (Exception $ex) { JSON_error($ex->getMessage()); } } else { diff --git a/settings.php b/settings.php index 6ad968d9..c1c46122 100644 --- a/settings.php +++ b/settings.php @@ -457,11 +457,11 @@ if ($FTLpid !== 0) { $DHCPIPv6 = false; $DHCP_rapid_commit = false; } - if (isset($setupVars['PIHOLE_DOMAIN'])) { - $piHoleDomain = $setupVars['PIHOLE_DOMAIN']; - } else { - $piHoleDomain = 'lan'; - } +if (isset($setupVars['PIHOLE_DOMAIN'])) { + $piHoleDomain = $setupVars['PIHOLE_DOMAIN']; +} else { + $piHoleDomain = 'lan'; +} ?>