From 531bd25f27bcdf102ea224e5756449422c890ec3 Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Thu, 26 Jan 2023 22:03:31 +0000 Subject: [PATCH] Convert custom function names to camelCase --- api/v1/validate_api_key.php | 2 +- check_login.php | 2 +- client_logs.php | 2 +- functions.php | 9 +++------ get_credential.php | 2 +- guest_download_file.php | 2 +- guest_header.php | 2 +- guest_view_invoice.php | 4 ++-- guest_view_quote.php | 4 ++-- login.php | 2 +- logs.php | 2 +- portal/check_login.php | 2 +- portal/login.php | 2 +- portal/login_reset.php | 2 +- user_profile.php | 2 +- users.php | 2 +- 16 files changed, 20 insertions(+), 23 deletions(-) diff --git a/api/v1/validate_api_key.php b/api/v1/validate_api_key.php index 707f985c..6fa07065 100644 --- a/api/v1/validate_api_key.php +++ b/api/v1/validate_api_key.php @@ -17,7 +17,7 @@ header('Content-Type: application/json'); $_POST = json_decode(file_get_contents('php://input'), true); // Get user IP -$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp())); +$ip = strip_tags(mysqli_real_escape_string($mysqli, getIP())); // Get user agent $user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT'])); diff --git a/check_login.php b/check_login.php index c7515544..be452ffa 100644 --- a/check_login.php +++ b/check_login.php @@ -23,7 +23,7 @@ if (!isset($_SESSION['logged']) || !$_SESSION['logged']) { } // SESSION FINGERPRINT -$session_ip = strip_tags(mysqli_real_escape_string($mysqli,getIp())); +$session_ip = strip_tags(mysqli_real_escape_string($mysqli,getIP())); // User agent $session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); diff --git a/client_logs.php b/client_logs.php index dd33ab0f..0ba9c132 100644 --- a/client_logs.php +++ b/client_logs.php @@ -76,7 +76,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); $log_description = htmlentities($row['log_description']); $log_ip = htmlentities($row['log_ip']); $log_user_agent = htmlentities($row['log_user_agent']); - $log_user_os = get_os($log_user_agent); + $log_user_os = getOS($log_user_agent); $log_user_browser = getWebBrowser($log_user_agent); $log_created_at = $row['log_created_at']; $user_id = $row['user_id']; diff --git a/functions.php b/functions.php index 9b73411b..e58a98aa 100644 --- a/functions.php +++ b/functions.php @@ -67,7 +67,7 @@ function getUserAgent() { return $_SERVER['HTTP_USER_AGENT']; } -function getIp() { +function getIP() { if (defined("CONST_GET_IP_METHOD")) { if (CONST_GET_IP_METHOD == "HTTP_X_FORWARDED_FOR") { $ip = getenv('HTTP_X_FORWARDED_FOR'); @@ -103,7 +103,7 @@ function getWebBrowser($user_browser) { return $browser; } -function get_os($user_os) { +function getOS($user_os) { $os_platform = "Unknown OS"; $os_array = array( '/windows nt 10/i' => " Windows 10", @@ -130,7 +130,7 @@ function get_os($user_os) { return $os_platform; } -function GetDevice() { +function getDevice() { $tablet_browser = 0; $mobile_browser = 0; if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) { @@ -437,9 +437,6 @@ function getSSL($name) { function strtoAZaz09($string) { $string = ucwords(strtolower($string)); - // Replace spaces with _ - //$string = str_replace(' ', '_', $string); - // Gets rid of non-alphanumerics return preg_replace('/[^A-Za-z0-9_]/', '', $string); } diff --git a/get_credential.php b/get_credential.php index 9cfd8118..687cbf1e 100644 --- a/get_credential.php +++ b/get_credential.php @@ -30,7 +30,7 @@ include_once("config.php"); include_once("functions.php"); // IP & User Agent for logging -$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp())); +$ip = strip_tags(mysqli_real_escape_string($mysqli,getIP())); $user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); // Define wording for the user diff --git a/guest_download_file.php b/guest_download_file.php index 041e2c3f..6d069203 100644 --- a/guest_download_file.php +++ b/guest_download_file.php @@ -2,7 +2,7 @@ // Not including the guest header as we don't want any HTML output include("config.php"); include("functions.php"); -$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIp()))); +$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIP()))); $user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); if (isset($_GET['id']) && isset($_GET['key'])) { diff --git a/guest_header.php b/guest_header.php index 420dda70..0fc66cca 100644 --- a/guest_header.php +++ b/guest_header.php @@ -5,7 +5,7 @@ include("functions.php"); session_start(); -$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIp()))); +$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,getIP()))); $user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); ?> diff --git a/guest_view_invoice.php b/guest_view_invoice.php index 4a96350a..df3c074f 100644 --- a/guest_view_invoice.php +++ b/guest_view_invoice.php @@ -65,10 +65,10 @@ if (isset($_GET['invoice_id'], $_GET['url_key'])) { //Set Currency Format $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY); - $ip = strip_tags(mysqli_real_escape_string($mysqli,getIp())); + $ip = strip_tags(mysqli_real_escape_string($mysqli,getIP())); $session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); - $os = strip_tags(mysqli_real_escape_string($mysqli,get_os($session_user_agent))); + $os = strip_tags(mysqli_real_escape_string($mysqli,getOS($session_user_agent))); $browser = strip_tags(mysqli_real_escape_string($mysqli,getWebBrowser($session_user_agent))); //Set Badge color based off of invoice status diff --git a/guest_view_quote.php b/guest_view_quote.php index d2a05c4f..dba3dc65 100644 --- a/guest_view_quote.php +++ b/guest_view_quote.php @@ -64,10 +64,10 @@ if (isset($_GET['quote_id'], $_GET['url_key'])) { //Set Currency Format $currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY); - $ip = strip_tags(mysqli_real_escape_string($mysqli,getIp())); + $ip = strip_tags(mysqli_real_escape_string($mysqli,getIP())); $session_user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT'])); - $os = strip_tags(mysqli_real_escape_string($mysqli,get_os($session_user_agent))); + $os = strip_tags(mysqli_real_escape_string($mysqli,getOS($session_user_agent))); $browser = strip_tags(mysqli_real_escape_string($mysqli,getWebBrowser($session_user_agent))); //Update status to Viewed only if invoice_status = "Sent" diff --git a/login.php b/login.php index a4ebd497..0a702103 100644 --- a/login.php +++ b/login.php @@ -10,7 +10,7 @@ require_once("functions.php"); require_once("rfc6238.php"); // IP & User Agent for logging -$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp())); +$ip = strip_tags(mysqli_real_escape_string($mysqli, getIP())); $user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT'])); // Block brute force password attacks - check recent failed login attempts for this IP diff --git a/logs.php b/logs.php index 9f61a707..8274a395 100644 --- a/logs.php +++ b/logs.php @@ -141,7 +141,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $log_description = htmlentities($row['log_description']); $log_ip = htmlentities($row['log_ip']); $log_user_agent = htmlentities($row['log_user_agent']); - $log_user_os = get_os($log_user_agent); + $log_user_os = getOS($log_user_agent); $log_user_browser = getWebBrowser($log_user_agent); $log_created_at = $row['log_created_at']; $user_id = $row['user_id']; diff --git a/portal/check_login.php b/portal/check_login.php index b42c7180..d09b9e83 100644 --- a/portal/check_login.php +++ b/portal/check_login.php @@ -21,7 +21,7 @@ if (!$_SESSION['client_logged_in']) { } // SESSION FINGERPRINT -$session_ip = strip_tags(mysqli_real_escape_string($mysqli, getIp())); +$session_ip = strip_tags(mysqli_real_escape_string($mysqli, getIP())); // Get user agent $session_user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT'])); diff --git a/portal/login.php b/portal/login.php index eb3d2758..ceecafe6 100644 --- a/portal/login.php +++ b/portal/login.php @@ -19,7 +19,7 @@ if (!isset($_SESSION)) { session_start(); } -$ip = strip_tags(mysqli_real_escape_string($mysqli, getIp())); +$ip = strip_tags(mysqli_real_escape_string($mysqli, getIP())); $user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT'])); $sql_settings = mysqli_query($mysqli, "SELECT config_azure_client_id FROM settings WHERE company_id = '1'"); diff --git a/portal/login_reset.php b/portal/login_reset.php index bf80ad35..c0c1dd5b 100644 --- a/portal/login_reset.php +++ b/portal/login_reset.php @@ -24,7 +24,7 @@ if (!isset($_SESSION)) { session_start(); } -$ip = strip_tags(mysqli_real_escape_string($mysqli,getIp())); +$ip = strip_tags(mysqli_real_escape_string($mysqli,getIP())); $user_agent = strip_tags(mysqli_real_escape_string($mysqli, $_SERVER['HTTP_USER_AGENT'])); $company_sql = mysqli_query($mysqli, "SELECT company_name FROM companies WHERE company_id = '1'"); diff --git a/user_profile.php b/user_profile.php index 988461a9..e8245fbb 100644 --- a/user_profile.php +++ b/user_profile.php @@ -156,7 +156,7 @@ $sql_recent_logs = mysqli_query($mysqli, "SELECT * FROM logs $log_id = $row['log_id']; $log_ip = htmlentities($row['log_ip']); $log_user_agent = htmlentities($row['log_user_agent']); - $log_user_os = get_os($log_user_agent); + $log_user_os = getOS($log_user_agent); $log_user_browser = getWebBrowser($log_user_agent); $log_created_at = $row['log_created_at']; diff --git a/users.php b/users.php index ceef5db1..c0168ac0 100644 --- a/users.php +++ b/users.php @@ -99,7 +99,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $log_created_at = $row['log_created_at']; $log_ip = htmlentities($row['log_ip']); $log_user_agent = htmlentities($row['log_user_agent']); - $log_user_os = get_os($log_user_agent); + $log_user_os = getOS($log_user_agent); $log_user_browser = getWebBrowser($log_user_agent); $last_login = "$log_user_os
$log_user_browser
$log_ip"; if (empty($last_login)) {