Merge pull request #573 from wrongecho/smell-cleanups

Smell cleanups
This commit is contained in:
Johnny
2023-01-23 21:42:11 -05:00
committed by GitHub
42 changed files with 4338 additions and 4364 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+2 -2
View File
@@ -1,4 +1,4 @@
<?php include("inc_all.php"); ?> <?php require_once("inc_all.php"); ?>
<!-- Breadcrumbs--> <!-- Breadcrumbs-->
<ol class="breadcrumb"> <ol class="breadcrumb">
@@ -22,4 +22,4 @@
<script>toastr.success('Have Fun Wozz!!')</script> <script>toastr.success('Have Fun Wozz!!')</script>
<?php include("footer.php"); ?> <?php require_once("footer.php"); ?>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (isset($_GET['category'])) { if (isset($_GET['category'])) {
$category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category'])); $category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category']));
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all_client.php"); ?> <?php include("inc_all_client.php");
<?php
//Get Asset Counts //Get Asset Counts
//All Asset Count //All Asset Count
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all_client.php"); ?> <?php include("inc_all_client.php");
<?php
if (isset($_GET['contact_id'])) { if (isset($_GET['contact_id'])) {
$contact_id = intval($_GET['contact_id']); $contact_id = intval($_GET['contact_id']);
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all_client.php"); ?> <?php include("inc_all_client.php");
<?php
$sql_files_images = mysqli_query($mysqli, "SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC"); $sql_files_images = mysqli_query($mysqli, "SELECT * FROM files WHERE file_client_id = $client_id AND (file_ext LIKE 'JPG' OR file_ext LIKE 'jpg' OR file_ext LIKE 'JPEG' OR file_ext LIKE 'jpeg' OR file_ext LIKE 'png' OR file_ext LIKE 'PNG') ORDER BY file_name ASC");
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all_client.php"); ?> <?php include("inc_all_client.php");
<?php
$sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5"); $sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = $client_id AND contact_archived_at IS NULL AND contacts.company_id = $session_company_id ORDER BY contact_updated_at, contact_created_at DESC LIMIT 5");
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all.php"); ?> <?php include("inc_all.php");
<?php
// Quick fix to prevent non-admins (i.e. techs) seeing financials - redirect to client list // Quick fix to prevent non-admins (i.e. techs) seeing financials - redirect to client list
// To be removed when we have a proper technical dashboard for techs // To be removed when we have a proper technical dashboard for techs
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("guest_header.php"); ?> <?php include("guest_header.php");
<?php
if (isset($_GET['invoice_id'], $_GET['url_key'])) { if (isset($_GET['invoice_id'], $_GET['url_key'])) {
+1 -1
View File
@@ -200,7 +200,7 @@ if (isset($_POST['login'])) {
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+2 -2
View File
@@ -7,10 +7,10 @@
if (!isset($_SESSION)) { if (!isset($_SESSION)) {
// HTTP Only cookies // HTTP Only cookies
ini_set("session.cookie_httponly", True); ini_set("session.cookie_httponly", true);
if ($config_https_only) { if ($config_https_only) {
// Tell client to only send cookie(s) over HTTPS // Tell client to only send cookie(s) over HTTPS
ini_set("session.cookie_secure", True); ini_set("session.cookie_secure", true);
} }
session_start(); session_start();
} }
+6 -9
View File
@@ -11,10 +11,10 @@ require_once ('../get_settings.php');
if (!isset($_SESSION)) { if (!isset($_SESSION)) {
// HTTP Only cookies // HTTP Only cookies
ini_set("session.cookie_httponly", True); ini_set("session.cookie_httponly", true);
if ($config_https_only) { if ($config_https_only) {
// Tell client to only send cookie(s) over HTTPS // Tell client to only send cookie(s) over HTTPS
ini_set("session.cookie_secure", True); ini_set("session.cookie_secure", true);
} }
session_start(); session_start();
} }
@@ -37,8 +37,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$_SESSION['login_message'] = 'Invalid e-mail'; $_SESSION['login_message'] = 'Invalid e-mail';
} } else {
else {
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_email = '$email' LIMIT 1"); $sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_email = '$email' LIMIT 1");
$row = mysqli_fetch_array($sql); $row = mysqli_fetch_array($sql);
if ($row['contact_auth_method'] == 'local') { if ($row['contact_auth_method'] == 'local') {
@@ -54,14 +53,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Success', log_description = 'Client contact $row[contact_email] successfully logged in locally', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $row[contact_client_id]"); mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Success', log_description = 'Client contact $row[contact_email] successfully logged in locally', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW(), log_client_id = $row[contact_client_id]");
} } else {
else {
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Failed', log_description = 'Failed client portal login attempt using $email', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW()"); mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Failed', log_description = 'Failed client portal login attempt using $email', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW()");
$_SESSION['login_message'] = 'Incorrect username or password.'; $_SESSION['login_message'] = 'Incorrect username or password.';
} }
} } else {
else {
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Failed', log_description = 'Failed client portal login attempt using $email', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW()"); mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Client Login', log_action = 'Failed', log_description = 'Failed client portal login attempt using $email', log_ip = '$ip', log_user_agent = '$user_agent', log_created_at = NOW()");
$_SESSION['login_message'] = 'Incorrect username or password.'; $_SESSION['login_message'] = 'Incorrect username or password.';
} }
@@ -70,7 +67,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['login'])) {
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
+1 -1
View File
@@ -6,7 +6,7 @@
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
+2 -4
View File
@@ -1,6 +1,4 @@
<?php include("inc_all.php"); ?> <?php include("inc_all.php");
<?php
if (isset($_GET['recurring_id'])) { if (isset($_GET['recurring_id'])) {
@@ -116,7 +114,7 @@ if (isset($_GET['recurring_id'])) {
<div class="row mb-4"> <div class="row mb-4">
<div class="col-sm-2"> <div class="col-sm-2">
<img class="img-fluid" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>"> <img class="img-fluid" alt="Company logo" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>">
</div> </div>
<div class="col-sm-10"> <div class="col-sm-10">
<h3 class="text-right"><strong>Recurring Invoice</strong><br><small class="text-secondary"><?php echo ucwords($recurring_frequency); ?>ly</small></h3> <h3 class="text-right"><strong>Recurring Invoice</strong><br><small class="text-secondary"><?php echo ucwords($recurring_frequency); ?>ly</small></h3>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark mb-3"> <div class="card card-dark mb-3">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="alert alert-warning"> <div class="alert alert-warning">
Work in Progress Work in Progress
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -3
View File
@@ -1,6 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php");
<?php
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); ?> <?php require_once("inc_all_settings.php"); ?>
<div class="card card-dark"> <div class="card card-dark">
<div class="card-header py-3"> <div class="card-header py-3">
+3 -6
View File
@@ -1,12 +1,9 @@
<?php <?php
include("inc_all_settings.php"); require_once("inc_all_settings.php");
include("database_version.php"); include("database_version.php");
include("config.php") include("config.php");
?>
<?php // Fetch the latest code changes but don't apply them
//fetch the latest code changes but don't apply them
exec("git fetch", $output, $result); exec("git fetch", $output, $result);
$latest_version = exec("git rev-parse origin/$repo_branch"); $latest_version = exec("git rev-parse origin/$repo_branch");
$current_version = exec("git rev-parse HEAD"); $current_version = exec("git rev-parse HEAD");
+3 -5
View File
@@ -1,6 +1,4 @@
<?php include("inc_all.php"); ?> <?php include("inc_all.php");
<?php
if (isset($_GET['ticket_id'])) { if (isset($_GET['ticket_id'])) {
$ticket_id = intval($_GET['ticket_id']); $ticket_id = intval($_GET['ticket_id']);
@@ -17,7 +15,7 @@ if (isset($_GET['ticket_id'])) {
if (mysqli_num_rows($sql) == 0) { if (mysqli_num_rows($sql) == 0) {
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>"; echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1><a class='btn btn-lg btn-secondary mt-3' href='tickets.php'><i class='fa fa-fw fa-arrow-left'></i> Go Back</a></center>";
include("footer.php"); include_once("footer.php");
} else { } else {
@@ -580,7 +578,7 @@ if (isset($_GET['ticket_id'])) {
?> ?>
<?php include("footer.php"); <?php include_once("footer.php");
if ($ticket_status !== "Closed") { ?> if ($ticket_status !== "Closed") { ?>
<!-- Ticket Time Tracking JS --> <!-- Ticket Time Tracking JS -->
+2 -4
View File
@@ -1,6 +1,4 @@
<?php include("inc_all.php"); ?> <?php include("inc_all.php");
<?php
$sql_recent_logins = mysqli_query($mysqli, "SELECT * FROM logs $sql_recent_logins = mysqli_query($mysqli, "SELECT * FROM logs
WHERE log_type = 'Login' OR log_type = 'Login 2FA' AND log_action = 'Success' AND log_user_id = $session_user_id WHERE log_type = 'Login' OR log_type = 'Login 2FA' AND log_action = 'Success' AND log_user_id = $session_user_id
@@ -28,7 +26,7 @@ $sql_recent_logs = mysqli_query($mysqli,"SELECT * FROM logs
<?php if (empty($session_avatar)) { ?> <?php if (empty($session_avatar)) { ?>
<i class="fas fa-user-circle fa-8x text-secondary"></i> <i class="fas fa-user-circle fa-8x text-secondary"></i>
<?php } else { ?> <?php } else { ?>
<img src="<?php echo "uploads/users/$session_user_id/$session_avatar"; ?>" class="img-fluid"> <img alt="User avatar" src="<?php echo "uploads/users/$session_user_id/$session_avatar"; ?>" class="img-fluid">
<?php } ?> <?php } ?>
<h4 class="text-secondary mt-2"><?php echo htmlentities($session_user_role_display); ?></h4> <h4 class="text-secondary mt-2"><?php echo htmlentities($session_user_role_display); ?></h4>
</center> </center>
+1 -1
View File
@@ -1,4 +1,4 @@
<?php include("inc_all_settings.php"); <?php require_once("inc_all_settings.php");
if (!empty($_GET['sb'])) { if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb'])); $sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));