diff --git a/install/includes/core/core_class.php b/install/includes/core/core_class.php index 58d2b1d83..d508f2037 100644 --- a/install/includes/core/core_class.php +++ b/install/includes/core/core_class.php @@ -39,33 +39,33 @@ class Core } // Validate First Name - if (isset($_POST['firstname']) && !empty($_POST['firstname'])) { + if (isset($data['firstname']) && !empty($data['firstname'])) { $counter++; } // Validate Last Name - if (isset($_POST['lastname']) && !empty($_POST['lastname'])) { + if (isset($data['lastname']) && !empty($data['lastname'])) { $counter++; } // Validate Username - if (isset($_POST['username']) && !empty($_POST['username'])) { + if (isset($data['username']) && !empty($data['username'])) { $counter++; } // Validate Callsign - if (isset($_POST['callsign']) && !empty($_POST['callsign'])) { + if (isset($data['callsign']) && !empty($data['callsign'])) { $counter++; } // Validate Password - if (isset($_POST['password']) && !empty($_POST['password'])) { + if (isset($data['password']) && !empty($data['password'])) { $counter++; } // Validate Locator - if (isset($_POST['userlocator']) && !empty($_POST['userlocator'])) { - $locator = $_POST['userlocator']; + if (isset($data['userlocator']) && !empty($data['userlocator'])) { + $locator = $data['userlocator']; if (preg_match('/^[A-R]{2}[0-9]{2}[A-X]{2}$/i', $locator)) { $counter++; } else { @@ -76,19 +76,19 @@ class Core } // Validate Confirm Password - if (isset($_POST['cnfm_password']) && !empty($_POST['cnfm_password'])) { + if (isset($data['cnfm_password']) && !empty($data['cnfm_password'])) { $counter++; } // Validate Email Address - if (isset($_POST['user_email']) && filter_var($_POST['user_email'], FILTER_VALIDATE_EMAIL)) { + if (isset($data['user_email']) && filter_var($data['user_email'], FILTER_VALIDATE_EMAIL)) { $counter++; } else { $errors[] = "Invalid Email Address."; } // Validate Timezone - if (isset($_POST['timezone']) && is_numeric($_POST['timezone'])) { + if (isset($data['timezone']) && is_numeric($data['timezone'])) { $counter++; } @@ -100,12 +100,6 @@ class Core } } - // Function to show an error - function show_message($type, $message) - { - return $message; - } - // Function to write the config file function write_config($data) { @@ -138,7 +132,11 @@ class Core // Write the file if (fwrite($handle, $new)) { - return true; + if(file_exists($output_path)) { + return true; + } else { + return false; + } } else { return false; } @@ -188,7 +186,11 @@ class Core // Write the file if (fwrite($handle, $new)) { - return true; + if(file_exists($output_path)) { + return true; + } else { + return false; + } } else { return false; } diff --git a/install/includes/interface_assets/triggers.php b/install/includes/interface_assets/triggers.php index 0d5b5d7c7..0e78cb5cf 100644 --- a/install/includes/interface_assets/triggers.php +++ b/install/includes/interface_assets/triggers.php @@ -19,32 +19,51 @@ if ($_POST['database_check'] ?? false == true) { */ // config_file() -// if ($core->validate_post($_POST) == true) { if ($_POST['run_config_file'] ?? false == true) { sleep(1); $data = json_decode($_POST['data'], true); - $result = $core->write_configfile($data); - echo $result ? 'success' : 'error'; + if ($core->validate_post($data)) { + if($core->write_configfile($data)) { + $result = 'success'; + } else { + $result = 'error'; + } + } else { + $result = 'error'; + } + echo $result; exit; } if ($_POST['run_database_file'] ?? false == true) { sleep(1); $data = json_decode($_POST['data'], true); - $result = $core->write_config($data); - echo $result ? 'success' : 'error'; + if ($core->validate_post($data)) { + if($core->write_config($data)) { + $result = 'success'; + } else { + $result = 'error'; + } + } else { + $result = 'error'; + } + echo $result; exit; } if ($_POST['run_database_tables'] ?? false == true) { $data = json_decode($_POST['data'], true); - $result = $database->create_tables($data); + if ($core->validate_post($data)) { + $result = $database->create_tables($data); + } else { + $result = 'error'; + } echo $result ? 'success' : 'error'; exit; } -if ($_POST['run_installer_lock'] ?? false) { +if ($_POST['run_installer_lock'] ?? false == true) { exec('touch .lock', $output, $return_var); if ($return_var === 0 && file_exists('.lock')) { echo 'success'; @@ -53,6 +72,3 @@ if ($_POST['run_installer_lock'] ?? false) { } exit; } - - -// } \ No newline at end of file diff --git a/install/run.php b/install/run.php index 1c99a2c60..c671a3d53 100644 --- a/install/run.php +++ b/install/run.php @@ -38,6 +38,7 @@ +
@@ -45,27 +46,30 @@