Tidy codestyle - spaces between parenthesis and curly braces

This commit is contained in:
Marcus Hill 2023-01-21 17:09:39 +00:00
parent 7f3ec8ccda
commit 2c3ebb3bbb
164 changed files with 2156 additions and 2156 deletions

View File

@ -39,7 +39,7 @@
<select class="form-control select2" name="currency_code" required>
<option value="">- Currency -</option>
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if($session_company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<?php } ?>
</select>
</div>

View File

@ -1,6 +1,6 @@
<?php include("inc_all_settings.php");
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "account_name";
@ -27,7 +27,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="card-body">
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control col-md-4" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Accounts">
<input type="search" class="form-control col-md-4" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Accounts">
<div class="input-group-append">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
@ -36,7 +36,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=account_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=account_currency_code&o=<?php echo $disp; ?>">Currency</a></th>
@ -47,7 +47,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']);
$opening_balance = $row['opening_balance'];
@ -80,7 +80,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAccountModal<?php echo $account_id; ?>">Edit</a>
<?php if($balance == 0){ //Cannot Archive an Account until it reaches 0 Balance ?>
<?php if ($balance == 0) { //Cannot Archive an Account until it reaches 0 Balance ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="post.php?archive_account=<?php echo $account_id; ?>">Archive</a>
<?php } ?>

View File

@ -63,7 +63,7 @@ $key = bin2hex(random_bytes(78));
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $session_company_id ORDER BY client_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$client_id = $row['client_id'];
$client_name = htmlentities($row['client_name']);
?>

View File

@ -49,12 +49,12 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$calendar_id = $row['calendar_id'];
$calendar_name = htmlentities($row['calendar_name']);
$calendar_color = htmlentities($row['calendar_color']);
?>
<option <?php if($config_default_calendar == $calendar_id){ echo "selected"; } ?> data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> <?php echo $calendar_name; ?>" value="<?php echo $calendar_id; ?>"><?php echo $calendar_name; ?></option>
<option <?php if ($config_default_calendar == $calendar_id) { echo "selected"; } ?> data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color; ?>;'></i> <?php echo $calendar_name; ?>" value="<?php echo $calendar_id; ?>"><?php echo $calendar_name; ?></option>
<?php
}
@ -105,7 +105,7 @@
<div class="tab-pane fade" id="pills-attendees">
<?php if(isset($client_id)){ ?>
<?php if (isset($client_id)) { ?>
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
@ -122,7 +122,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$client_id = $row['client_id'];
$client_name = htmlentities($row['client_name']);
$contact_email = htmlentities($row['contact_email']);
@ -138,7 +138,7 @@
<?php } ?>
<?php if(!empty($config_smtp_host)){ ?>
<?php if (!empty($config_smtp_host)) { ?>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing" name="email_event" value="1" >
<label class="custom-control-label" for="customControlAutosizing">Email Event</label>

View File

@ -51,12 +51,12 @@
<?php
$sql_calendars_select = mysqli_query($mysqli,"SELECT * FROM calendars WHERE company_id = $session_company_id ORDER BY calendar_name ASC");
while($row = mysqli_fetch_array($sql_calendars_select)){
while ($row = mysqli_fetch_array($sql_calendars_select)) {
$calendar_id_select = $row['calendar_id'];
$calendar_name_select = htmlentities($row['calendar_name']);
$calendar_color_select = htmlentities($row['calendar_color']);
?>
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color_select; ?>;'></i> <?php echo $calendar_name_select; ?>"<?php if($calendar_id == $calendar_id_select){ echo "selected"; } ?> value="<?php echo $calendar_id_select; ?>"><?php echo $calendar_name_select; ?></option>
<option data-content="<i class='fa fa-circle mr-2' style='color:<?php echo $calendar_color_select; ?>;'></i> <?php echo $calendar_name_select; ?>"<?php if ($calendar_id == $calendar_id_select) { echo "selected"; } ?> value="<?php echo $calendar_id_select; ?>"><?php echo $calendar_name_select; ?></option>
<?php
}
@ -91,11 +91,11 @@
<span class="input-group-text"><i class="fa fa-fw fa-recycle"></i></span>
</div>
<select class="form-control select2" name="repeat">
<option <?php if(empty($event_repeat)){ echo "selected"; } ?> value="">Never</option>
<option <?php if($event_repeat == "Day"){ echo "selected"; } ?>>Day</option>
<option <?php if($event_repeat == "Week"){ echo "selected"; } ?>>Week</option>
<option <?php if($event_repeat == "Month"){ echo "selected"; } ?>>Month</option>
<option <?php if($event_repeat == "Year"){ echo "selected"; } ?>>Year</option>
<option <?php if (empty($event_repeat)) { echo "selected"; } ?> value="">Never</option>
<option <?php if ($event_repeat == "Day") { echo "selected"; } ?>>Day</option>
<option <?php if ($event_repeat == "Week") { echo "selected"; } ?>>Week</option>
<option <?php if ($event_repeat == "Month") { echo "selected"; } ?>>Month</option>
<option <?php if ($event_repeat == "Year") { echo "selected"; } ?>>Year</option>
</select>
</div>
</div>
@ -104,7 +104,7 @@
<div class="tab-pane fade" id="pills-attendees<?php echo $event_id; ?>">
<?php if(isset($_GET['client_id'])){ ?>
<?php if (isset($_GET['client_id'])) { ?>
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
@ -121,12 +121,12 @@
<?php
$sql_clients = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN contacts ON primary_contact = contact_id WHERE clients.company_id = $session_company_id ORDER BY client_name ASC");
while($row = mysqli_fetch_array($sql_clients)){
while ($row = mysqli_fetch_array($sql_clients)) {
$client_id_select = $row['client_id'];
$client_name_select = htmlentities($row['client_name']);
$contact_email_select = htmlentities($row['contact_email']);
?>
<option <?php if($client_id == $client_id_select){ echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
<option <?php if ($client_id == $client_id_select) { echo "selected"; } ?> value="<?php echo $client_id_select; ?>"><?php echo $client_name_select; ?></option>
<?php
}
@ -137,7 +137,7 @@
<?php } ?>
<?php if(!empty($config_smtp_host)){ ?>
<?php if (!empty($config_smtp_host)) { ?>
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="customControlAutosizing<?php echo $event_id; ?>" name="email_event" value="1" >
<label class="custom-control-label" for="customControlAutosizing<?php echo $event_id; ?>">Email Event</label>

View File

@ -4,7 +4,7 @@
<?php
if(isset($_GET['calendar_id'])){
if (isset($_GET['calendar_id'])) {
$calendar_selected_id = intval($_GET['calendar_id']);
}
@ -23,7 +23,7 @@ if(isset($_GET['calendar_id'])){
<?php
//loop through IDs and create a modal for each
$sql = mysqli_query($mysqli,"SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = $row['event_id'];
$event_title = htmlentities($row['event_title']);
$event_description = htmlentities($row['event_description']);
@ -75,7 +75,7 @@ while($row = mysqli_fetch_array($sql)){
events: [
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM events LEFT JOIN calendars ON event_calendar_id = calendar_id WHERE calendars.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['event_id']);
$event_title = json_encode($row['event_title']);
$event_start = json_encode($row['event_start']);
@ -91,7 +91,7 @@ while($row = mysqli_fetch_array($sql)){
<?php
//Invoices Created
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN invoices ON client_id = invoice_client_id WHERE clients.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['invoice_id']);
$event_title = json_encode($row['invoice_prefix'] . $row['invoice_number'] . " " . $row['invoice_scope']);
$event_start = json_encode($row['invoice_date']);
@ -103,7 +103,7 @@ while($row = mysqli_fetch_array($sql)){
<?php
//Quotes Created
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN quotes ON client_id = quote_client_id WHERE clients.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['quote_id']);
$event_title = json_encode($row['quote_prefix'] . $row['quote_number'] . " " . $row['quote_scope']);
$event_start = json_encode($row['quote_date']);
@ -115,7 +115,7 @@ while($row = mysqli_fetch_array($sql)){
<?php
//Tickets Created
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN tickets ON client_id = ticket_client_id WHERE clients.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['ticket_id']);
$event_title = json_encode($row['ticket_prefix'] . $row['ticket_number'] . " " . $row['ticket_subject']);
$event_start = json_encode($row['ticket_created_at']);
@ -129,7 +129,7 @@ while($row = mysqli_fetch_array($sql)){
<?php
//Vendors Added Created
$sql = mysqli_query($mysqli,"SELECT * FROM clients LEFT JOIN vendors ON client_id = vendor_client_id WHERE vendor_template = 0 AND clients.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['vendor_id']);
$event_title = json_encode($row['vendor_name']);
$event_start = json_encode($row['vendor_created_at']);
@ -141,7 +141,7 @@ while($row = mysqli_fetch_array($sql)){
<?php
//Clients Added
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE clients.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['client_id']);
$event_title = json_encode($row['client_name']);
$event_start = json_encode($row['client_created_at']);

View File

@ -1,12 +1,12 @@
<?php include("inc_all_settings.php");
if(isset($_GET['category'])){
if (isset($_GET['category'])) {
$category = strip_tags(mysqli_real_escape_string($mysqli,$_GET['category']));
}else{
$category = "Expense";
}
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "category_name";
@ -32,7 +32,7 @@ $sql_colors_used = mysqli_query($mysqli,"SELECT category_color FROM categories
AND company_id = $session_company_id"
);
while($color_used_row = mysqli_fetch_array($sql_colors_used)){
while ($color_used_row = mysqli_fetch_array($sql_colors_used)) {
$colors_used_array[] = $color_used_row['category_color'];
}
$colors_diff = array_diff($colors_array,$colors_used_array);
@ -53,7 +53,7 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
<div class="row">
<div class="col-sm-4 mb-2">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Categories">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Categories">
<div class="input-group-append">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
@ -61,10 +61,10 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
</div>
<div class="col-sm-8">
<div class="btn-group float-right">
<a href="?category=Expense" class="btn <?php if($category == 'Expense'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Expense</a>
<a href="?category=Income" class="btn <?php if($category == 'Income'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Income</a>
<a href="?category=Referral" class="btn <?php if($category == 'Referral'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Referral</a>
<a href="?category=Payment Method" class="btn <?php if($category == 'Payment Method'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Payment Method</a>
<a href="?category=Expense" class="btn <?php if ($category == 'Expense') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Expense</a>
<a href="?category=Income" class="btn <?php if ($category == 'Income') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Income</a>
<a href="?category=Referral" class="btn <?php if ($category == 'Referral') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Referral</a>
<a href="?category=Payment Method" class="btn <?php if ($category == 'Payment Method') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">Payment Method</a>
</div>
</div>
</div>
@ -72,7 +72,7 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=category_name&o=<?php echo $disp; ?>">Name</a></th>
<th>Color</th>
@ -82,7 +82,7 @@ $colors_diff = array_diff($colors_array,$colors_used_array);
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$category_id = $row['category_id'];
$category_name = htmlentities($row['category_name']);
$category_color = htmlentities($row['category_color']);

View File

@ -1,9 +1,9 @@
<?php
if(!isset($_SESSION)){
if (!isset($_SESSION)) {
// HTTP Only cookies
ini_set("session.cookie_httponly", True);
if($config_https_only){
if ($config_https_only) {
// Tell client to only send cookie(s) over HTTPS
ini_set("session.cookie_secure", True);
}
@ -11,12 +11,12 @@ if(!isset($_SESSION)){
}
//Check to see if setup is enabled
if(!isset($config_enable_setup) || $config_enable_setup == 1){
if (!isset($config_enable_setup) || $config_enable_setup == 1) {
header("Location: setup.php");
exit;
}
if(!$_SESSION['logged']){
if (!$_SESSION['logged']) {
header("Location: login.php");
die;
}
@ -38,9 +38,9 @@ $session_avatar = $row['user_avatar'];
$session_token = $row['user_token'];
$session_company_id = $row['user_default_company'];
$session_user_role = $row['user_role'];
if($session_user_role == 3){
if ($session_user_role == 3) {
$session_user_role_display = "Administrator";
}elseif($session_user_role == 2){
}elseif ($session_user_role == 2) {
$session_user_role_display = "Technician";
}else{
$session_user_role_display = "Accountant";
@ -49,13 +49,13 @@ if($session_user_role == 3){
//LOAD USER COMPANY ACCESS PERMISSIONS
$session_user_company_access_sql = mysqli_query($mysqli,"SELECT company_id FROM user_companies WHERE user_id = $session_user_id");
$session_user_company_access_array = array();
while($row = mysqli_fetch_array($session_user_company_access_sql)){
while ($row = mysqli_fetch_array($session_user_company_access_sql)) {
$session_user_company_access_array[] = $row['company_id'];
}
$session_user_company_access = implode(',',$session_user_company_access_array);
//Check to see if user has rights to company Prevents User from access a company he is not allowed to have access to.
if(!in_array($session_company_id,$session_user_company_access_array)){
if (!in_array($session_company_id,$session_user_company_access_array)) {
session_start();
session_destroy();
header('Location: login.php');
@ -76,7 +76,7 @@ $iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad");
if($iPod || $iPhone || $iPad){
if ($iPod || $iPhone || $iPad) {
$session_map_source = "apple";
}else{
$session_map_source = "google";

View File

@ -65,7 +65,7 @@
<?php
$referral_sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Referral' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($referral_sql)){
while ($row = mysqli_fetch_array($referral_sql)) {
$referral = htmlentities($row['category_name']);
?>
<option><?php echo $referral; ?></option>
@ -155,7 +155,7 @@
<select class="form-control select2" name="country">
<option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?>
<option <?php if($session_company_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
<?php } ?>
</select>
</div>
@ -227,7 +227,7 @@
<div class="tab-pane fade" id="pills-additional">
<?php if($config_module_enable_accounting){ ?>
<?php if ($config_module_enable_accounting) { ?>
<div class="form-group">
<label>Currency <strong class="text-danger">*</strong></label>
<div class="input-group">
@ -237,7 +237,7 @@
<select class="form-control select2" name="currency_code" required>
<option value="">- Currency -</option>
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if($session_company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<option <?php if ($session_company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<?php } ?>
</select>
</div>
@ -251,7 +251,7 @@
</div>
<select class="form-control select2" name="net_terms">
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
<option <?php if($config_default_net_terms == $net_term_value){ echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
<option <?php if ($config_default_net_terms == $net_term_value) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
<?php } ?>
</select>
</div>
@ -277,7 +277,7 @@
<?php
$sql_tags_select = mysqli_query($mysqli,"SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
while($row = mysqli_fetch_array($sql_tags_select)){
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = $row['tag_id'];
$tag_name_select = htmlentities($row['tag_name']);
$tag_color_select = htmlentities($row['tag_color']);
@ -312,9 +312,9 @@
<script>
// Checks/prompts that the primary contact field (required) is populated
function promptPrimaryContact(){
function promptPrimaryContact() {
let primaryContactField = document.getElementById("primaryContact").value;
if (primaryContactField == null || primaryContactField === ""){
if (primaryContactField == null || primaryContactField === "") {
document.getElementById("contactNavPill").click();
}
}

View File

@ -2,7 +2,7 @@
<div class="modal-dialog">
<div class="modal-content bg-dark">
<div class="modal-header">
<h5 class="modal-title"><i class="fa fa-fw fa-desktop"></i> New <?php if(!empty($_GET['type'])){ echo ucwords(strip_tags($_GET['type'])); }else{ echo "Asset"; } ?></h5>
<h5 class="modal-title"><i class="fa fa-fw fa-desktop"></i> New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags($_GET['type'])); }else{ echo "Asset"; } ?></h5>
<button type="button" class="close text-white" data-dismiss="modal">
<span>&times;</span>
</button>
@ -64,7 +64,7 @@
</div>
<?php //Do not display Make Model or Serial if Virtual is selected
if($_GET['type'] !== 'virtual'){ ?>
if ($_GET['type'] !== 'virtual') { ?>
<div class="form-group">
<label>Make </label>
<div class="input-group">
@ -96,7 +96,7 @@
</div>
<?php } ?>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'other'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
<div class="form-group">
<label>Operating System</label>
<div class="input-group">
@ -123,7 +123,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$location_id = $row['location_id'];
$location_name = htmlentities($row['location_name']);
?>
@ -136,7 +136,7 @@
</div>
</div>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
<div class="form-group">
<label>Assigned To</label>
<div class="input-group">
@ -148,7 +148,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
?>
@ -188,7 +188,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$network_id = $row['network_id'];
$network_name = htmlentities($row['network_name']);
$network = htmlentities($row['network']);
@ -238,7 +238,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id AND vendor_template = 0 ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
?>
@ -261,7 +261,7 @@
</div>
</div>
<?php if($_GET['type'] !== 'virtual'){ ?>
<?php if ($_GET['type'] !== 'virtual') { ?>
<div class="form-group">
<label>Purchase Date</label>
<div class="input-group">

View File

@ -55,14 +55,14 @@
</div>
<select class="form-control select2" name="type" required>
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
<option <?php if($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
<?php } ?>
</select>
</div>
</div>
<?php //Do not display Make Model or Serial if Virtual is selected
if($asset_type !== 'virtual'){ ?>
if ($asset_type !== 'virtual') { ?>
<div class="form-group">
<label>Make </label>
<div class="input-group">
@ -94,7 +94,7 @@
</div>
<?php } ?>
<?php if($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other'){ ?>
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
<div class="form-group">
<label>Operating System</label>
<div class="input-group">
@ -121,11 +121,11 @@
<?php
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql_locations)){
while ($row = mysqli_fetch_array($sql_locations)) {
$location_id_select = $row['location_id'];
$location_name_select = htmlentities($row['location_name']);
?>
<option <?php if($asset_location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<?php
}
@ -134,7 +134,7 @@
</div>
</div>
<?php if($asset_type !== 'Firewall/Router' && $asset_type !== 'Switch' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Server' && $asset_type !== 'Virtual Machine'){ ?>
<?php if ($asset_type !== 'Firewall/Router' && $asset_type !== 'Switch' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Server' && $asset_type !== 'Virtual Machine') { ?>
<div class="form-group">
<label>Assigned To</label>
<div class="input-group">
@ -146,7 +146,7 @@
<?php
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
?>
@ -168,7 +168,7 @@
</div>
<select class="form-control select2" name="status">
<?php foreach($asset_status_array as $asset_status_select) { ?>
<option <?php if($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<?php } ?>
</select>
</div>
@ -185,13 +185,13 @@
<?php
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
while($row = mysqli_fetch_array($sql_networks)){
while ($row = mysqli_fetch_array($sql_networks)) {
$network_id_select = $row['network_id'];
$network_name_select = htmlentities($row['network_name']);
$network_select = htmlentities($row['network']);
?>
<option <?php if($asset_network_id == $network_id_select){ echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
<?php
}
@ -235,11 +235,11 @@
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id AND vendor_template = 0 ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id_select = $row['vendor_id'];
$vendor_name_select = htmlentities($row['vendor_name']);
?>
<option <?php if($asset_vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<?php
}
@ -258,7 +258,7 @@
</div>
</div>
<?php if($asset_type !== 'Virtual Machine'){ ?>
<?php if ($asset_type !== 'Virtual Machine') { ?>
<div class="form-group">
<label>Purchase Date</label>
<div class="input-group">

View File

@ -10,7 +10,7 @@
<div class="modal-body bg-white">
<?php
while($row = mysqli_fetch_array($sql_related_documents)){
while ($row = mysqli_fetch_array($sql_related_documents)) {
$related_document_id = $row['document_id'];
$related_document_name = htmlentities($row['document_name']);
?>

View File

@ -56,14 +56,14 @@
</div>
<select class="form-control select2" name="type" required>
<?php foreach($asset_types_array as $asset_type_select => $asset_icon_select) { ?>
<option <?php if($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
<option <?php if ($asset_type_select == $asset_type) { echo "selected"; } ?>><?php echo $asset_type_select; ?></option>
<?php } ?>
</select>
</div>
</div>
<?php //Do not display Make Model or Serial if Virtual is selected
if($asset_type !== 'virtual'){ ?>
if ($asset_type !== 'virtual') { ?>
<div class="form-group">
<label>Make </label>
<div class="input-group">
@ -95,7 +95,7 @@
</div>
<?php } ?>
<?php if($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other'){ ?>
<?php if ($asset_type !== 'Phone' && $asset_type !== 'Mobile Phone' && $asset_type !== 'Tablet' && $asset_type !== 'Access Point' && $asset_type !== 'Printer' && $asset_type !== 'Camera' && $asset_type !== 'TV' && $asset_type !== 'Other') { ?>
<div class="form-group">
<label>Operating System</label>
<div class="input-group">
@ -122,11 +122,11 @@
<?php
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql_locations)){
while ($row = mysqli_fetch_array($sql_locations)) {
$location_id_select = $row['location_id'];
$location_name_select = htmlentities($row['location_name']);
?>
<option <?php if($asset_location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<option <?php if ($asset_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<?php
}
@ -146,12 +146,12 @@
<?php
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$asset_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id_select = $row['contact_id'];
$contact_name_select = htmlentities($row['contact_name']);
?>
<option <?php if($asset_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
<?php echo $contact_name_select; ?> <?php if(!empty($row['contact_archived_at'])){ echo " (Archived " . date('Y-m-d',strtotime($row['contact_archived_at'])) .")"; } ?>
<option <?php if ($asset_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>">
<?php echo $contact_name_select; ?> <?php if (!empty($row['contact_archived_at'])) { echo " (Archived " . date('Y-m-d',strtotime($row['contact_archived_at'])) .")"; } ?>
</option>
<?php
@ -169,7 +169,7 @@
</div>
<select class="form-control select2" name="status">
<?php foreach($asset_status_array as $asset_status_select) { ?>
<option <?php if($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<option <?php if ($asset_status_select == $asset_status) { echo "selected"; } ?>><?php echo $asset_status_select; ?></option>
<?php } ?>
</select>
</div>
@ -186,13 +186,13 @@
<?php
$sql_networks = mysqli_query($mysqli,"SELECT * FROM networks WHERE (network_archived_at > '$asset_created_at' OR network_archived_at IS NULL) AND network_client_id = $client_id ORDER BY network_name ASC");
while($row = mysqli_fetch_array($sql_networks)){
while ($row = mysqli_fetch_array($sql_networks)) {
$network_id_select = $row['network_id'];
$network_name_select = htmlentities($row['network_name']);
$network_select = htmlentities($row['network']);
?>
<option <?php if($asset_network_id == $network_id_select){ echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
<option <?php if ($asset_network_id == $network_id_select) { echo "selected"; } ?> value="<?php echo $network_id_select; ?>"><?php echo $network_name_select; ?> - <?php echo $network_select; ?></option>
<?php
}
@ -236,11 +236,11 @@
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE (vendor_archived_at > '$asset_created_at' OR vendor_archived_at IS NULL) AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id_select = $row['vendor_id'];
$vendor_name_select = htmlentities($row['vendor_name']);
?>
<option <?php if($asset_vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<option <?php if ($asset_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<?php
}
@ -259,7 +259,7 @@
</div>
</div>
<?php if($asset_type !== 'Virtual Machine'){ ?>
<?php if ($asset_type !== 'Virtual Machine') { ?>
<div class="form-group">
<label>Purchase Date</label>
<div class="input-group">

View File

@ -76,7 +76,7 @@
<?php
$sql_network_select = mysqli_query($mysqli,"SELECT * FROM networks WHERE network_archived_at IS NULL AND network_client_id = $client_id ORDER BY network_name ASC");
while($row = mysqli_fetch_array($sql_network_select)){
while ($row = mysqli_fetch_array($sql_network_select)) {
$network_id = $row['network_id'];
$network_name = htmlentities($row['network_name']);
$network = htmlentities($row['network']);

View File

@ -11,7 +11,7 @@
<div class="modal-body bg-white">
<?php
// Query is run from client_assets.php
while($row = mysqli_fetch_array($sql_tickets)){
while ($row = mysqli_fetch_array($sql_tickets)) {
$ticket_id = $row['ticket_id'];
$ticket_prefix = htmlentities($row['ticket_prefix']);
$ticket_number = htmlentities($row['ticket_number']);

View File

@ -31,22 +31,22 @@ $row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT COUNT(*) AS count FROM as
AND asset_archived_at IS NULL AND asset_client_id = $client_id"));
$other_count = $row['count'];
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "asset_name";
}
//Asset Type from GET
if(isset($_GET['type']) && ($_GET['type']) == 'workstation'){
if (isset($_GET['type']) && ($_GET['type']) == 'workstation') {
$type_query = "asset_type = 'desktop' OR asset_type = 'laptop'";
}elseif(isset($_GET['type']) && ($_GET['type']) == 'server'){
}elseif (isset($_GET['type']) && ($_GET['type']) == 'server') {
$type_query = "asset_type = 'server'";
}elseif(isset($_GET['type']) && ($_GET['type']) == 'virtual'){
}elseif (isset($_GET['type']) && ($_GET['type']) == 'virtual') {
$type_query = "asset_type = 'Virtual Machine'";
}elseif(isset($_GET['type']) && ($_GET['type']) == 'network'){
}elseif (isset($_GET['type']) && ($_GET['type']) == 'network') {
$type_query = "asset_type = 'Firewall/Router' OR asset_type = 'Switch' OR asset_type = 'Access Point'";
}elseif(isset($_GET['type']) && ($_GET['type']) == 'other'){
}elseif (isset($_GET['type']) && ($_GET['type']) == 'other') {
$type_query = "asset_type NOT LIKE 'laptop' AND asset_type NOT LIKE 'desktop' AND asset_type NOT LIKE 'server' AND asset_type NOT LIKE 'virtual machine' AND asset_type NOT LIKE 'firewall/router' AND asset_type NOT LIKE 'switch' AND asset_type NOT LIKE 'access point'";
}else{
$type_query = "asset_type LIKE '%'";
@ -75,7 +75,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-desktop"></i> Assets</h3>
<div class="card-tools">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal"><i class="fas fa-fw fa-plus"></i> New <?php if(!empty($_GET['type'])){ echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?></button>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addAssetModal"><i class="fas fa-fw fa-plus"></i> New <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?></button>
</div>
</div>
<div class="card-body">
@ -86,7 +86,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search <?php if(!empty($_GET['type'])){ echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?>s">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search <?php if (!empty($_GET['type'])) { echo ucwords(strip_tags(htmlentities($_GET['type']))); }else{ echo "Asset"; } ?>s">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -94,30 +94,30 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
<div class="col-sm-6">
<div class="btn-group btn-group-lg">
<a href="?<?php echo $url_query_strings_sb; ?>&type=" class="btn <?php if($_GET['type'] == 'all' || empty($_GET['type'])){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All Assets <span class="right badge badge-light"><?php echo $all_count; ?></span></a>
<a href="?<?php echo $url_query_strings_sb; ?>&type=" class="btn <?php if ($_GET['type'] == 'all' || empty($_GET['type'])) { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>">All Assets <span class="right badge badge-light"><?php echo $all_count; ?></span></a>
<?php
if($workstation_count > 0){ ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=workstation" class="btn <?php if($_GET['type'] == 'workstation'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-desktop"></i> Workstations <span class="right badge badge-light"><?php echo $workstation_count; ?></span></a>
if ($workstation_count > 0) { ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=workstation" class="btn <?php if ($_GET['type'] == 'workstation') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-desktop"></i> Workstations <span class="right badge badge-light"><?php echo $workstation_count; ?></span></a>
<?php
} ?>
<?php
if($server_count > 0){ ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=server" class="btn <?php if($_GET['type'] == 'server'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-server"></i> Servers <span class="right badge badge-light"><?php echo $server_count; ?></span></a>
if ($server_count > 0) { ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=server" class="btn <?php if ($_GET['type'] == 'server') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-server"></i> Servers <span class="right badge badge-light"><?php echo $server_count; ?></span></a>
<?php
} ?>
<?php
if($virtual_count > 0){ ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=virtual" class="btn <?php if($_GET['type'] == 'virtual'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-cloud"></i> Virtual <span class="right badge badge-light"><?php echo $virtual_count; ?></span></a>
if ($virtual_count > 0) { ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=virtual" class="btn <?php if ($_GET['type'] == 'virtual') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-cloud"></i> Virtual <span class="right badge badge-light"><?php echo $virtual_count; ?></span></a>
<?php
} ?>
<?php
if($network_count > 0){ ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=network" class="btn <?php if($_GET['type'] == 'network'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-network-wired"></i> Network <span class="right badge badge-light"><?php echo $network_count; ?></span></a>
if ($network_count > 0) { ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=network" class="btn <?php if ($_GET['type'] == 'network') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-network-wired"></i> Network <span class="right badge badge-light"><?php echo $network_count; ?></span></a>
<?php
} ?>
<?php
if($network_count > 0){ ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=other" class="btn <?php if($_GET['type'] == 'other'){ echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-tag"></i> Other <span class="right badge badge-light"><?php echo $other_count; ?></span></a>
if ($network_count > 0) { ?>
<a href="?<?php echo $url_query_strings_sb; ?>&type=other" class="btn <?php if ($_GET['type'] == 'other') { echo 'btn-primary'; }else{ echo 'btn-default'; } ?>"><i class="fa fa-fw fa-tag"></i> Other <span class="right badge badge-light"><?php echo $other_count; ?></span></a>
<?php
} ?>
</div>
@ -135,23 +135,23 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table border table-hover">
<thead class="thead-light <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_name&o=<?php echo $disp; ?>">Name</a></th>
<?php if($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers'){ ?>
<?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_type&o=<?php echo $disp; ?>">Type</a></th>
<?php } ?>
<?php if($_GET['type'] !== 'virtual'){ ?>
<?php if ($_GET['type'] !== 'virtual') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_make&o=<?php echo $disp; ?>">Make/Model</a></th>
<?php } ?>
<?php if($_GET['type'] !== 'virtual'){ ?>
<?php if ($_GET['type'] !== 'virtual') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_serial&o=<?php echo $disp; ?>">Serial Number</a></th>
<?php } ?>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'other'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_os&o=<?php echo $disp; ?>">Operating System</a></th>
<?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=asset_install_date&o=<?php echo $disp; ?>">Install Date</a></th>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'servers' && $_GET['type'] !== 'other') { ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Assigned To</a></th>
<?php } ?>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Location</a></th>
@ -162,26 +162,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$asset_id = $row['asset_id'];
$asset_type = htmlentities($row['asset_type']);
$asset_name = htmlentities($row['asset_name']);
$asset_make = htmlentities($row['asset_make']);
$asset_model = htmlentities($row['asset_model']);
$asset_serial = htmlentities($row['asset_serial']);
if(empty($asset_serial)){
if (empty($asset_serial)) {
$asset_serial_display = "-";
}else{
$asset_serial_display = $asset_serial;
}
$asset_os = htmlentities($row['asset_os']);
if(empty($asset_os)){
if (empty($asset_os)) {
$asset_os_display = "-";
}else{
$asset_os_display = $asset_os;
}
$asset_ip = htmlentities($row['asset_ip']);
if(empty($asset_ip)){
if (empty($asset_ip)) {
$asset_ip_display = "-";
}else{
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text='$asset_ip'><i class='far fa-copy text-secondary'></i></button>";
@ -191,7 +191,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$asset_purchase_date = $row['asset_purchase_date'];
$asset_warranty_expire = $row['asset_warranty_expire'];
$asset_install_date = $row['asset_install_date'];
if(empty($asset_install_date)){
if (empty($asset_install_date)) {
$asset_install_date_display = "-";
}else{
$asset_install_date_display = $asset_install_date;
@ -203,41 +203,41 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$asset_contact_id = $row['asset_contact_id'];
$asset_network_id = $row['asset_network_id'];
if($asset_type == 'Laptop'){
if ($asset_type == 'Laptop') {
$device_icon = "laptop";
}elseif($asset_type == 'Desktop'){
}elseif ($asset_type == 'Desktop') {
$device_icon = "desktop";
}elseif($asset_type == 'Server'){
}elseif ($asset_type == 'Server') {
$device_icon = "server";
}elseif($asset_type == 'Printer'){
}elseif ($asset_type == 'Printer') {
$device_icon = "print";
}elseif($asset_type == 'Camera'){
}elseif ($asset_type == 'Camera') {
$device_icon = "video";
}elseif($asset_type == 'Switch' || $asset_type == 'Firewall/Router'){
}elseif ($asset_type == 'Switch' || $asset_type == 'Firewall/Router') {
$device_icon = "network-wired";
}elseif($asset_type == 'Access Point'){
}elseif ($asset_type == 'Access Point') {
$device_icon = "wifi";
}elseif($asset_type == 'Phone'){
}elseif ($asset_type == 'Phone') {
$device_icon = "phone";
}elseif($asset_type == 'Mobile Phone'){
}elseif ($asset_type == 'Mobile Phone') {
$device_icon = "mobile-alt";
}elseif($asset_type == 'Tablet'){
}elseif ($asset_type == 'Tablet') {
$device_icon = "tablet-alt";
}elseif($asset_type == 'TV'){
}elseif ($asset_type == 'TV') {
$device_icon = "tv";
}elseif($asset_type == 'Virtual Machine'){
}elseif ($asset_type == 'Virtual Machine') {
$device_icon = "cloud";
}else{
$device_icon = "tag";
}
$contact_name = $row['contact_name'];
if(empty($contact_name)){
if (empty($contact_name)) {
$contact_name = "-";
}
$location_name = $row['location_name'];
if(empty($location_name)){
if (empty($location_name)) {
$location_name = "-";
}
@ -264,7 +264,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<i class="fa fa-fw text-secondary fa-<?php echo $device_icon; ?> mr-2"></i>
<a class="text-secondary" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>"><?php echo $asset_name; ?></a>
<?php
if($login_id > 0){
if ($login_id > 0) {
?>
<button type="button" class="btn btn-link btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key text-dark"></i></button>
@ -304,20 +304,20 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
?>
</th>
<?php if($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers'){ ?>
<?php if ($_GET['type'] !== 'virtual' && $_GET['type'] !== 'servers') { ?>
<td><?php echo $asset_type; ?></td>
<?php } ?>
<?php if($_GET['type'] !== 'virtual'){ ?>
<?php if ($_GET['type'] !== 'virtual') { ?>
<td><?php echo "$asset_make $asset_model"; ?></td>
<?php } ?>
<?php if($_GET['type'] !== 'virtual'){ ?>
<?php if ($_GET['type'] !== 'virtual') { ?>
<td><?php echo $asset_serial_display; ?></td>
<?php } ?>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'other'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other') { ?>
<td><?php echo $asset_os_display; ?></td>
<?php } ?>
<td><?php echo $asset_install_date_display; ?></td>
<?php if($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'servers'){ ?>
<?php if ($_GET['type'] !== 'network' && $_GET['type'] !== 'other' && $_GET['type'] !== 'servers') { ?>
<td><?php echo $contact_name; ?></td>
<?php } ?>
<td><?php echo $location_name; ?></td>
@ -329,13 +329,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addAssetInterfaceModal<?php echo $asset_id; ?>">Interfaces</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">Copy</a>
<?php if($document_count > 0){ ?>
<?php if ($document_count > 0) { ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetDocumentsModal<?php echo $asset_id; ?>">Documents (<?php echo $document_count; ?>)</a>
<?php } ?>
<?php if($ticket_count > 0){ ?>
<?php if ($ticket_count > 0) { ?>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#assetTicketsModal<?php echo $asset_id; ?>">Tickets (<?php echo $ticket_count; ?>)</a>
<?php } ?>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">Archive</a>
<a class="dropdown-item text-danger" href="post.php?delete_asset=<?php echo $asset_id; ?>">Delete</a>

View File

@ -74,7 +74,7 @@
<option value="">- Domain -</option>
<?php
$domains_sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
while($domain_row = mysqli_fetch_array($domains_sql)){
while ($domain_row = mysqli_fetch_array($domains_sql)) {
$domain_id = $domain_row['domain_id'];
$domain_name = htmlentities($domain_row['domain_name']);
echo "<option value=\"$domain_id\">$domain_name</option>";

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "certificate_name";
@ -33,7 +33,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Certificates">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Certificates">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -51,7 +51,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=certificate_domain&o=<?php echo $disp; ?>">Domain</a></th>
@ -63,7 +63,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$certificate_id = $row['certificate_id'];
$certificate_name = htmlentities($row['certificate_name']);
$certificate_domain = htmlentities($row['certificate_domain']);
@ -83,7 +83,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" onclick="populateCertificateEditModal(<?php echo $client_id, ",", $certificate_id ?>)" data-target="#editCertificateModal">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_certificate=<?php echo $certificate_id; ?>">Delete</a>
<?php } ?>
@ -115,7 +115,7 @@ include("client_certificate_add_modal.php");
jQuery.get(
"ajax.php",
{certificate_get_json_details: 'true', client_id: client_id, certificate_id: certificate_id},
function(data){
function(data) {
// If we get a response from post.php, parse it as JSON
const response = JSON.parse(data);
@ -145,7 +145,7 @@ include("client_certificate_add_modal.php");
// Populate domain dropdown
domains.forEach(domain => {
if(parseInt(domain.domain_id) == parseInt(certificate.certificate_domain_id)){
if (parseInt(domain.domain_id) == parseInt(certificate.certificate_domain_id)) {
// Selected domain
domainDropdown[domainDropdown.length] = new Option(domain.domain_name, domain.domain_id, true, true);
}
@ -162,14 +162,14 @@ include("client_certificate_add_modal.php");
function fetchSSL(type)
{
// Get the domain name input & issued/expire/key fields, based on whether this is a new cert or updating an existing
if(type == 'new'){
if (type == 'new') {
var domain = document.getElementById("domain").value;
var issuedBy = document.getElementById("issuedBy");
var expire = document.getElementById("expire");
var publicKey = document.getElementById("publicKey");
}
if(type == 'edit'){
if (type == 'edit') {
var domain = document.getElementById("editDomain").value;
var issuedBy = document.getElementById("editIssuedBy");
var expire = document.getElementById("editExpire");
@ -180,11 +180,11 @@ include("client_certificate_add_modal.php");
jQuery.get(
"ajax.php",
{certificate_fetch_parse_json_details: 'TRUE', domain: domain},
function(data){
function(data) {
//If we get a response from post.php, parse it as JSON
const ssl_data = JSON.parse(data);
if(ssl_data.success == "TRUE"){
if (ssl_data.success == "TRUE") {
// Fill the form fields with the cert data
issuedBy.value = ssl_data.issued_by;
expire.value = ssl_data.expire;

View File

@ -41,7 +41,7 @@
<input type="text" class="form-control" name="name" placeholder="Full Name" required autofocus>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="primary_contact" value="1" <?php if($primary_contact == 0){ echo "checked"; } ?>>
<input type="checkbox" name="primary_contact" value="1" <?php if ($primary_contact == 0) { echo "checked"; } ?>>
</div>
</div>
</div>
@ -120,7 +120,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$location_id = $row['location_id'];
$location_name = htmlentities($row['location_name']);
?>

View File

@ -2,7 +2,7 @@
<?php
if(isset($_GET['contact_id'])){
if (isset($_GET['contact_id'])) {
$contact_id = intval($_GET['contact_id']);
$sql = mysqli_query($mysqli,"SELECT * FROM contacts
@ -24,14 +24,14 @@ if(isset($_GET['contact_id'])){
$contact_notes = htmlentities($row['contact_notes']);
$contact_important = intval($row['contact_important']);
$contact_created_at = $row['contact_created_at'];
if($contact_id == $primary_contact){
if ($contact_id == $primary_contact) {
$primary_contact_display = "<small class='text-success'>Primary Contact</small>";
}else{
$primary_contact_display = FALSE;
}
$contact_location_id = $row['contact_location_id'];
$location_name = htmlentities($row['location_name']);
if(empty($location_name)){
if (empty($location_name)) {
$location_name_display = "-";
}else{
$location_name_display = $location_name;
@ -65,7 +65,7 @@ if(isset($_GET['contact_id'])){
<div class="card card-dark">
<div class="card-body">
<div class="text-center">
<?php if(!empty($contact_photo)){ ?>
<?php if (!empty($contact_photo)) { ?>
<img class="img-fluid img-circle p-3" alt="contact_photo" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
<?php }else{ ?>
<span class="fa-stack fa-4x">
@ -76,19 +76,19 @@ if(isset($_GET['contact_id'])){
</div>
<hr>
<h3><?php echo $contact_name; ?></h3>
<?php if(!empty($contact_title)){ ?>
<?php if (!empty($contact_title)) { ?>
<div class="mb-3 text-secondary"><?php echo $contact_title; ?></div>
<?php } ?>
<?php if(!empty($contact_title)){ ?>
<?php if (!empty($contact_title)) { ?>
<div class="mb-1"><i class="fa fa-fw fa-map-marker-alt text-secondary mr-3"></i><?php echo $location_name_display; ?></div>
<?php } ?>
<?php if(!empty($contact_email)){ ?>
<?php if (!empty($contact_email)) { ?>
<div><i class="fa fa-fw fa-envelope text-secondary mr-3"></i><a href='mailto:<?php echo $contact_email; ?>'><?php echo $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button></div>
<?php } ?>
<?php if(!empty($contact_phone)){ ?>
<?php if (!empty($contact_phone)) { ?>
<div class="mb-2"><i class="fa fa-fw fa-phone text-secondary mr-3"></i><?php echo "$contact_phone $contact_phone_extention"; ?></div>
<?php } ?>
<?php if(!empty($contact_mobile)){ ?>
<?php if (!empty($contact_mobile)) { ?>
<div class="mb-2"><i class="fa fa-fw fa-mobile-alt text-secondary mr-3"></i><?php echo $contact_mobile; ?></div>
<?php } ?>
<div class="mb-2"><i class="fa fa-fw fa-clock text-secondary mr-3"></i><?php echo date('Y-m-d',strtotime($contact_created_at)); ?></div>
@ -122,7 +122,7 @@ if(isset($_GET['contact_id'])){
</ol>
<div class="card card-dark <?php if($asset_count == 0){ echo "d-none"; } ?>">
<div class="card card-dark <?php if ($asset_count == 0) { echo "d-none"; } ?>">
<div class="card-header">
<h3 class="card-title"><i class="fa fa-fw fa-desktop"></i> Assets</h3>
</div>
@ -144,26 +144,26 @@ if(isset($_GET['contact_id'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_related_assets)){
while ($row = mysqli_fetch_array($sql_related_assets)) {
$asset_id = $row['asset_id'];
$asset_type = htmlentities($row['asset_type']);
$asset_name = htmlentities($row['asset_name']);
$asset_make = htmlentities($row['asset_make']);
$asset_model = htmlentities($row['asset_model']);
$asset_serial = htmlentities($row['asset_serial']);
if(empty($asset_serial)){
if (empty($asset_serial)) {
$asset_serial_display = "-";
}else{
$asset_serial_display = $asset_serial;
}
$asset_os = htmlentities($row['asset_os']);
if(empty($asset_os)){
if (empty($asset_os)) {
$asset_os_display = "-";
}else{
$asset_os_display = $asset_os;
}
$asset_ip = htmlentities($row['asset_ip']);
if(empty($asset_ip)){
if (empty($asset_ip)) {
$asset_ip_display = "-";
}else{
$asset_ip_display = "$asset_ip<button class='btn btn-sm' data-clipboard-text='$asset_ip'><i class='far fa-copy text-secondary'></i></button>";
@ -173,7 +173,7 @@ if(isset($_GET['contact_id'])){
$asset_purchase_date = $row['asset_purchase_date'];
$asset_warranty_expire = $row['asset_warranty_expire'];
$asset_install_date = $row['asset_install_date'];
if(empty($asset_install_date)){
if (empty($asset_install_date)) {
$asset_install_date_display = "-";
}else{
$asset_install_date_display = $asset_install_date;
@ -184,29 +184,29 @@ if(isset($_GET['contact_id'])){
$asset_location_id = $row['asset_location_id'];
$asset_network_id = $row['asset_network_id'];
if($asset_type == 'Laptop'){
if ($asset_type == 'Laptop') {
$device_icon = "laptop";
}elseif($asset_type == 'Desktop'){
}elseif ($asset_type == 'Desktop') {
$device_icon = "desktop";
}elseif($asset_type == 'Server'){
}elseif ($asset_type == 'Server') {
$device_icon = "server";
}elseif($asset_type == 'Printer'){
}elseif ($asset_type == 'Printer') {
$device_icon = "print";
}elseif($asset_type == 'Camera'){
}elseif ($asset_type == 'Camera') {
$device_icon = "video";
}elseif($asset_type == 'Switch' || $asset_type == 'Firewall/Router'){
}elseif ($asset_type == 'Switch' || $asset_type == 'Firewall/Router') {
$device_icon = "network-wired";
}elseif($asset_type == 'Access Point'){
}elseif ($asset_type == 'Access Point') {
$device_icon = "wifi";
}elseif($asset_type == 'Phone'){
}elseif ($asset_type == 'Phone') {
$device_icon = "phone";
}elseif($asset_type == 'Mobile Phone'){
}elseif ($asset_type == 'Mobile Phone') {
$device_icon = "mobile-alt";
}elseif($asset_type == 'Tablet'){
}elseif ($asset_type == 'Tablet') {
$device_icon = "tablet-alt";
}elseif($asset_type == 'TV'){
}elseif ($asset_type == 'TV') {
$device_icon = "tv";
}elseif($asset_type == 'Virtual Machine'){
}elseif ($asset_type == 'Virtual Machine') {
$device_icon = "cloud";
}else{
$device_icon = "tag";
@ -230,7 +230,7 @@ if(isset($_GET['contact_id'])){
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addAssetInterfaceModal<?php echo $asset_id; ?>">Interfaces</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editAssetModal<?php echo $asset_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#copyAssetModal<?php echo $asset_id; ?>">Copy</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_asset=<?php echo $asset_id; ?>">Archive</a>
<a class="dropdown-item text-danger" href="post.php?delete_asset=<?php echo $asset_id; ?>">Delete</a>
@ -260,7 +260,7 @@ if(isset($_GET['contact_id'])){
<div class="card card-dark <?php if($login_count == 0){ echo "d-none"; } ?>">
<div class="card card-dark <?php if ($login_count == 0) { echo "d-none"; } ?>">
<div class="card-header">
<h3 class="card-title"><i class="fa fa-fw fa-key"></i> Passwords</h3>
</div>
@ -280,17 +280,17 @@ if(isset($_GET['contact_id'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_related_logins)){
while ($row = mysqli_fetch_array($sql_related_logins)) {
$login_id = $row['login_id'];
$login_name = htmlentities($row['login_name']);
$login_uri = htmlentities($row['login_uri']);
if(empty($login_uri)){
if (empty($login_uri)) {
$login_uri_display = "-";
}else{
$login_uri_display = "$login_uri<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_uri'><i class='far fa-copy text-secondary'></i></button><a href='https://$login_uri' target='_blank'><i class='fa fa-external-link-alt text-secondary'></i></a>";
}
$login_username = htmlentities($row['login_username']);
if(empty($login_username)){
if (empty($login_username)) {
$login_username_display = "-";
}else{
$login_username_display = "$login_username<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_username'><i class='far fa-copy text-secondary'></i></button>";
@ -298,7 +298,7 @@ if(isset($_GET['contact_id'])){
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
$login_otp_secret = htmlentities($row['login_otp_secret']);
$login_id_with_secret = '"' . $row['login_id'] . '","' . $row['login_otp_secret'] . '"';
if(empty($login_otp_secret)){
if (empty($login_otp_secret)) {
$otp_display = "-";
}else{
$otp_display = "<span onmouseenter='showOTP($login_id_with_secret)'><i class='far fa-clock'></i> <span id='otp_$login_id'><i>Hover..</i></span></span>";
@ -331,7 +331,7 @@ if(isset($_GET['contact_id'])){
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">Share</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_login=<?php echo $login_id; ?>">Delete</a>
<?php } ?>

View File

@ -33,7 +33,7 @@
<?php
while($row = mysqli_fetch_array($sql_related_assets)){
while ($row = mysqli_fetch_array($sql_related_assets)) {
$asset_id = $row['asset_id'];
$asset_type = htmlentities($row['asset_type']);
$asset_name = htmlentities($row['asset_name']);
@ -56,7 +56,7 @@
<ul>
<?php
while($row = mysqli_fetch_array($sql_related_logins)){
while ($row = mysqli_fetch_array($sql_related_logins)) {
$login_id = $row['login_id'];
$login_name = htmlentities($row['login_name']);
$login_uri = htmlentities($row['login_uri']);
@ -82,7 +82,7 @@
<ul>
<?php
while($row = mysqli_fetch_array($sql_related_software)){
while ($row = mysqli_fetch_array($sql_related_software)) {
$software_id = $row['software_id'];
$software_name = htmlentities($row['software_name']);
$software_type = htmlentities($row['software_type']);
@ -103,7 +103,7 @@
<ul>
<?php
while($row = mysqli_fetch_array($sql_related_tickets)){
while ($row = mysqli_fetch_array($sql_related_tickets)) {
$ticket_id = $row['ticket_id'];
$ticket_prefix = htmlentities($row['ticket_prefix']);
$ticket_number = $row['ticket_number'];

View File

@ -43,7 +43,7 @@
<input type="text" class="form-control" name="name" placeholder="Full Name" value="<?php echo $contact_name; ?>" required>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="primary_contact" value="1" <?php if($contact_id == $primary_contact){ echo "checked"; } ?>>
<input type="checkbox" name="primary_contact" value="1" <?php if ($contact_id == $primary_contact) { echo "checked"; } ?>>
</div>
</div>
</div>
@ -58,7 +58,7 @@
<input type="text" class="form-control" name="title" placeholder="Title" value="<?php echo $contact_title; ?>">
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="contact_important" value="1" <?php if($contact_important == 1){ echo "checked"; } ?>>
<input type="checkbox" name="contact_important" value="1" <?php if ($contact_important == 1) { echo "checked"; } ?>>
</div>
</div>
</div>
@ -122,11 +122,11 @@
<?php
$sql_locations = mysqli_query($mysqli,"SELECT * FROM locations WHERE (location_archived_at > '$contact_created_at' OR location_archived_at IS NULL) AND location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql_locations)){
while ($row = mysqli_fetch_array($sql_locations)) {
$location_id_select = $row['location_id'];
$location_name_select = htmlentities($row['location_name']);
?>
<option <?php if($contact_location_id == $location_id_select){ echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<option <?php if ($contact_location_id == $location_id_select) { echo "selected"; } ?> value="<?php echo $location_id_select; ?>"><?php echo $location_name_select; ?></option>
<?php
}
@ -147,13 +147,13 @@
</div>
<select class="form-control select2" name="auth_method">
<option value="">- None -</option>
<option value="local" <?php if($auth_method == "local") {echo "selected";} ?>>Local</option>
<option value="azure" <?php if($auth_method == "azure") {echo "selected";} ?>>Azure</option>
<option value="local" <?php if ($auth_method == "local") {echo "selected";} ?>>Local</option>
<option value="azure" <?php if ($auth_method == "azure") {echo "selected";} ?>>Azure</option>
</select>
</div>
</div>
<?php if($auth_method == "local") { ?>
<?php if ($auth_method == "local") { ?>
<div class="form-group">
<label>Password</label>
@ -180,7 +180,7 @@
<div class="tab-pane fade" id="pills-photo<?php echo $contact_id; ?>">
<div class="mb-3 text-center">
<?php if(!empty($contact_photo)){ ?>
<?php if (!empty($contact_photo)) { ?>
<img class="img-fluid" alt="contact_photo" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
<?php }else{ ?>
<span class="fa-stack fa-4x">

View File

@ -2,11 +2,11 @@
<?php
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
//Phone Numbers
$n = preg_replace("/[^0-9]/", '',$q);
if(empty($n)){
if (empty($n)) {
$n = $q;
}
}else{
@ -15,7 +15,7 @@ if(isset($_GET['q'])){
$n = "";
}
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "contact_name";
@ -56,7 +56,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Contacts">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Contacts">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -75,7 +75,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table border">
<thead class="thead-light <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="thead-light <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th class="text-center"><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=contact_department&o=<?php echo $disp; ?>">Department</a></th>
@ -89,36 +89,36 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_title = htmlentities($row['contact_title']);
if(empty($contact_title)){
if (empty($contact_title)) {
$contact_title_display = "-";
}else{
$contact_title_display = "<small class='text-secondary'>$contact_title</small>";
}
$contact_department =htmlentities($row['contact_department']);
if(empty($contact_department)){
if (empty($contact_department)) {
$contact_department_display = "-";
}else{
$contact_department_display = $contact_department;
}
$contact_phone = formatPhoneNumber($row['contact_phone']);
if(empty($contact_phone)){
if (empty($contact_phone)) {
$contact_phone_display = "-";
}else{
$contact_phone_display = "$contact_phone";
}
$contact_extension = htmlentities($row['contact_extension']);
$contact_mobile = formatPhoneNumber($row['contact_mobile']);
if(empty($contact_mobile)){
if (empty($contact_mobile)) {
$contact_mobile_display = "-";
}else{
$contact_mobile_display = "$contact_mobile";
}
$contact_email = htmlentities($row['contact_email']);
if(empty($contact_email)){
if (empty($contact_email)) {
$contact_email_display = "-";
}else{
$contact_email_display = "<a href='mailto:$contact_email'>$contact_email</a><button class='btn btn-sm clipboardjs' data-clipboard-text='$contact_email'><i class='far fa-copy text-secondary'></i></button>";
@ -128,14 +128,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$contact_notes = htmlentities($row['contact_notes']);
$contact_important = intval($row['contact_important']);
$contact_created_at = $row['contact_created_at'];
if($contact_id == $primary_contact){
if ($contact_id == $primary_contact) {
$primary_contact_display = "<small class='text-success'>Primary Contact</small>";
}else{
$primary_contact_display = FALSE;
}
$contact_location_id = $row['contact_location_id'];
$location_name = htmlentities($row['location_name']);
if(empty($location_name)){
if (empty($location_name)) {
$location_name_display = "-";
}else{
$location_name_display = $location_name;
@ -162,7 +162,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tr>
<th class="text-center">
<a class="text-dark" href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">
<?php if(!empty($contact_photo)){ ?>
<?php if (!empty($contact_photo)) { ?>
<img class="img-size-50 img-circle" src="<?php echo "uploads/clients/$session_company_id/$client_id/$contact_photo"; ?>">
@ -183,7 +183,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $contact_department_display; ?></td>
<td><?php echo $contact_email_display; ?></td>
<td><?php echo $contact_phone_display; ?> <?php if(!empty($contact_extension)){ echo "x$contact_extension"; } ?></td>
<td><?php echo $contact_phone_display; ?> <?php if (!empty($contact_extension)) { echo "x$contact_extension"; } ?></td>
<td><?php echo $contact_mobile_display; ?></td>
<td><?php echo $location_name_display; ?></td>
<td>
@ -194,7 +194,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="dropdown-menu">
<a class="dropdown-item" href="client_contact_details.php?client_id=<?php echo $client_id; ?>&contact_id=<?php echo $contact_id; ?>">View Details</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editContactModal<?php echo $contact_id; ?>">Edit</a>
<?php if($session_user_role == 3 && $contact_id !== $primary_contact) { ?>
<?php if ($session_user_role == 3 && $contact_id !== $primary_contact) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_contact=<?php echo $contact_id; ?>">Archive</a>
<div class="dropdown-divider"></div>

View File

@ -1,6 +1,6 @@
<script>
function validateClientNameDelete(client_id){
if (document.getElementById("clientNameProvided" + client_id).value === document.getElementById("clientName" + client_id).value){
function validateClientNameDelete(client_id) {
if (document.getElementById("clientNameProvided" + client_id).value === document.getElementById("clientName" + client_id).value) {
document.getElementById("clientDeleteButton" + client_id).className = "btn btn-danger btn-lg px-5";
}
else{

View File

@ -21,7 +21,7 @@
<option value="">- Select Template -</option>
<?php
$sql_document_templates = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_template = 1 AND company_id = $session_company_id AND document_archived_at IS NULL ORDER BY document_name ASC");
while($row = mysqli_fetch_array($sql_document_templates)){
while ($row = mysqli_fetch_array($sql_document_templates)) {
$document_template_id = $row['document_id'];
$document_template_name = htmlentities($row['document_name']);
@ -55,12 +55,12 @@
<option value="0">/</option>
<?php
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
while($row = mysqli_fetch_array($sql_folders)){
while ($row = mysqli_fetch_array($sql_folders)) {
$folder_id = $row['folder_id'];
$folder_name = htmlentities($row['folder_name']);
?>
<option <?php if($_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option>
<option <?php if ($_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option>
<?php
}
?>

View File

@ -28,12 +28,12 @@
<option value="0">/</option>
<?php
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
while($row = mysqli_fetch_array($sql_folders)){
while ($row = mysqli_fetch_array($sql_folders)) {
$folder_id = $row['folder_id'];
$folder_name = htmlentities($row['folder_name']);
?>
<option <?php if($_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option>
<option <?php if ($_GET['folder_id'] == $folder_id) echo "selected"; ?> value="<?php echo $folder_id ?>"><?php echo $folder_name; ?></option>
<?php
}
?>

View File

@ -2,7 +2,7 @@
<?php
if(isset($_GET['document_id'])){
if (isset($_GET['document_id'])) {
$document_id = intval($_GET['document_id']);
}
@ -33,7 +33,7 @@ $document_folder_id = $row['document_folder_id'];
<li class="breadcrumb-item">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>">Documents</a>
</li>
<?php if($document_folder_id > 0){ ?>
<?php if ($document_folder_id > 0) { ?>
<li class="breadcrumb-item">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $document_folder_id; ?>"><i class="fas fa-folder-open"></i> <?php echo $folder_name; ?></a>
</li>

View File

@ -28,11 +28,11 @@
<option value="0">/</option>
<?php
$sql_folders_select = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
while($row = mysqli_fetch_array($sql_folders_select)){
while ($row = mysqli_fetch_array($sql_folders_select)) {
$folder_id_select = $row['folder_id'];
$folder_name_select = htmlentities($row['folder_name']);
?>
<option <?php if($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
<option <?php if ($folder_id_select == $document_folder_id) echo "selected"; ?> value="<?php echo $folder_id_select ?>"><?php echo $folder_name_select; ?></option>
<?php
}
?>

View File

@ -3,7 +3,7 @@
<?php
if(isset($_GET['document_id'])){
if (isset($_GET['document_id'])) {
$document_id = intval($_GET['document_id']);
}

View File

@ -3,14 +3,14 @@
<?php
// Sort by
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "document_name";
}
// Search query SQL snippet
if(!empty($q)){
if (!empty($q)) {
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
}else{
$query_snippet = ""; // empty
@ -48,7 +48,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<form autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo intval($client_id); ?>">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search templates">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search templates">
<div class="input-group-append">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
@ -58,7 +58,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_name&o=<?php echo $disp; ?>">Template Name</a>
@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$document_id = $row['document_id'];
$document_name = htmlentities($row['document_name']);
$document_content = $row['document_content'];
@ -100,7 +100,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentTemplateModal<?php echo $document_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_document=<?php echo $document_id; ?>">Delete</a>
<?php } ?>

View File

@ -3,21 +3,21 @@
<?php
// Folder
if(!empty($_GET['folder_id'])){
if (!empty($_GET['folder_id'])) {
$folder = intval($_GET['folder_id']);
}else{
$folder = 0;
}
// Sort by
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "document_name";
}
// Search query SQL snippet
if(!empty($q)){
if (!empty($q)) {
$query_snippet = "AND (MATCH(document_content_raw) AGAINST ('$q') OR document_name LIKE '%$q%')";
}else{
$query_snippet = ""; // empty
@ -28,7 +28,7 @@ $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o
// Folder ID
$get_folder_id = 0;
if(!empty($_GET['folder_id'])){
if (!empty($_GET['folder_id'])) {
$get_folder_id = intval($_GET['folder_id']);
}
@ -79,11 +79,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<ul class="nav nav-pills flex-column bg-light">
<li class="nav-item">
<a class="nav-link <?php if($get_folder_id == 0){ echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
<a class="nav-link <?php if ($get_folder_id == 0) { echo "active"; } ?>" href="?client_id=<?php echo $client_id; ?>&folder_id=0">/</a>
</li>
<?php
$sql_folders = mysqli_query($mysqli,"SELECT * FROM folders WHERE folder_client_id = $client_id ORDER BY folder_name ASC");
while($row = mysqli_fetch_array($sql_folders)){
while ($row = mysqli_fetch_array($sql_folders)) {
$folder_id = $row['folder_id'];
$folder_name = htmlentities($row['folder_name']);
@ -95,9 +95,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<li class="nav-item">
<div class="row">
<div class="col-10">
<a class="nav-link <?php if($get_folder_id == $folder_id){ echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>">
<a class="nav-link <?php if ($get_folder_id == $folder_id) { echo "active"; } ?> " href="?client_id=<?php echo $client_id; ?>&folder_id=<?php echo $folder_id; ?>">
<?php
if($get_folder_id == $folder_id){ ?>
if ($get_folder_id == $folder_id) { ?>
<i class="fas fa-fw fa-folder-open"></i>
<?php
}else{
@ -105,7 +105,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<i class="fas fa-fw fa-folder"></i>
<?php } ?>
<?php echo $folder_name; ?> <?php if($num_documents > 0){ echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
<?php echo $folder_name; ?> <?php if ($num_documents > 0) { echo "<span class='badge badge-pill badge-dark float-right mt-1'>$num_documents</span>"; } ?>
</a>
</div>
<div class="col-2">
@ -115,7 +115,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#renameFolderModal<?php echo $folder_id; ?>">Rename</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_folder=<?php echo $folder_id; ?>">Delete</a>
<?php } ?>
@ -139,7 +139,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<input type="hidden" name="client_id" value="<?php echo intval($client_id); ?>">
<input type="hidden" name="folder_id" value="<?php echo $get_folder_id; ?>">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Documents">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Documents">
<div class="input-group-append">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
@ -149,7 +149,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="table-responsive">
<table class="table table-striped table-sm table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>
<a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=document_name&o=<?php echo $disp; ?>">Name</a>
@ -168,7 +168,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$document_id = $row['document_id'];
$document_name = htmlentities($row['document_name']);
$document_content = $row['document_content'];
@ -192,7 +192,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editDocumentModal<?php echo $document_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Document', $document_id"; ?>)">Share</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_document=<?php echo $document_id; ?>">Delete</a>
<?php } ?>

View File

@ -32,7 +32,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
?>
@ -56,7 +56,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_archived_at IS NULL AND vendor_client_id = $client_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
?>

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "domain_name";
@ -34,7 +34,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Domains">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Domains">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -52,7 +52,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=domain_name&o=<?php echo $disp; ?>">Domain</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Registrar</a></th>
@ -64,21 +64,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$domain_id = $row['domain_id'];
$domain_name = htmlentities($row['domain_name']);
$domain_registrar = htmlentities($row['domain_registrar']);
$domain_webhost = htmlentities($row['domain_webhost']);
$domain_expire = htmlentities($row['domain_expire']);
$domain_registrar_name = htmlentities($row['vendor_name']);
if(empty($domain_registrar_name)){
if (empty($domain_registrar_name)) {
$domain_registrar_name = "-";
}
$sql_domain_webhost = mysqli_query($mysqli,"SELECT vendor_name FROM vendors WHERE vendor_id = $domain_webhost");
$row = mysqli_fetch_array($sql_domain_webhost);
$domain_webhost_name = htmlentities($row['vendor_name']);
if(empty($domain_webhost_name)){
if (empty($domain_webhost_name)) {
$domain_webhost_name = "-";
}
@ -95,7 +95,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" onclick="populateDomainEditModal(<?php echo $client_id, ",", $domain_id ?>)" data-target="#editDomainModal">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_domain=<?php echo $domain_id; ?>">Delete</a>
<?php } ?>
@ -127,7 +127,7 @@ include("client_domain_add_modal.php");
jQuery.get(
"ajax.php",
{domain_get_json_details: 'true', client_id: client_id, domain_id: domain_id},
function(data){
function(data) {
// If we get a response from post.php, parse it as JSON
const response = JSON.parse(data);
@ -161,7 +161,7 @@ include("client_domain_add_modal.php");
// Populate dropdown
vendors.forEach(vendor => {
if(parseInt(vendor.vendor_id) == parseInt(domain.domain_registrar)){
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_registrar)) {
// Selected domain
registrarDropdown[registrarDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
}
@ -182,7 +182,7 @@ include("client_domain_add_modal.php");
// Populate dropdown
vendors.forEach(vendor => {
if(parseInt(vendor.vendor_id) == parseInt(domain.domain_webhost)){
if (parseInt(vendor.vendor_id) == parseInt(domain.domain_webhost)) {
// Selected domain
webhostDropdown[webhostDropdown.length] = new Option(vendor.vendor_name, vendor.vendor_id, true, true);
}

View File

@ -60,10 +60,10 @@
<?php
$referral_sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Referral' AND (category_archived_at > '$client_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($referral_sql)){
while ($row = mysqli_fetch_array($referral_sql)) {
$referral = htmlentities($row['category_name']);
?>
<option <?php if($client_referral == $referral){ echo "selected"; } ?> > <?php echo $referral; ?></option>
<option <?php if ($client_referral == $referral) { echo "selected"; } ?> > <?php echo $referral; ?></option>
<?php
}
@ -85,7 +85,7 @@
</div>
</div>
<?php if($config_module_enable_accounting){ ?>
<?php if ($config_module_enable_accounting) { ?>
<div class="form-group">
<label>Currency <strong class="text-danger">*</strong></label>
<div class="input-group">
@ -95,7 +95,7 @@
<select class="form-control select2" name="currency_code" required>
<option value="">- Currency -</option>
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if($client_currency_code == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<option <?php if ($client_currency_code == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<?php } ?>
</select>
</div>
@ -110,7 +110,7 @@
<select class="form-control select2" name="net_terms">
<option value="">- Net Terms -</option>
<?php foreach($net_terms_array as $net_term_value => $net_term_name) { ?>
<option <?php if($net_term_value == $client_net_terms) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
<option <?php if ($net_term_value == $client_net_terms) { echo "selected"; } ?> value="<?php echo $net_term_value; ?>"><?php echo $net_term_name; ?></option>
<?php } ?>
</select>
</div>
@ -140,7 +140,7 @@
$sql_tags_select = mysqli_query($mysqli,"SELECT * FROM tags WHERE tag_type = 1 AND company_id = $session_company_id ORDER BY tag_name ASC");
while($row = mysqli_fetch_array($sql_tags_select)){
while ($row = mysqli_fetch_array($sql_tags_select)) {
$tag_id_select = $row['tag_id'];
$tag_name_select = htmlentities($row['tag_name']);
$tag_color_select = htmlentities($row['tag_color']);
@ -149,7 +149,7 @@
?>
<li class="list-group-item">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="tags[]" value="<?php echo $tag_id_select; ?>" <?php if(in_array($tag_id_select, $client_tag_id_array)){ echo "checked"; } ?>>
<input type="checkbox" class="form-check-input" name="tags[]" value="<?php echo $tag_id_select; ?>" <?php if (in_array($tag_id_select, $client_tag_id_array)) { echo "checked"; } ?>>
<label class="form-check-label ml-2 badge bg-<?php echo $tag_color_select; ?>"><?php echo "<i class='fa fw fa-$tag_icon_select'></i>"; ?> <?php echo $tag_name_select; ?></label>
</div>
</li>

View File

@ -4,7 +4,7 @@
<?php
if(isset($_GET['calendar_id'])){
if (isset($_GET['calendar_id'])) {
$calendar_selected_id = intval($_GET['calendar_id']);
}
@ -23,7 +23,7 @@ if(isset($_GET['calendar_id'])){
<?php
//loop through IDs and create a modal for each
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = $row['event_id'];
$event_title = htmlentities($row['event_title']);
$event_description = htmlentities($row['event_description']);
@ -72,7 +72,7 @@ while($row = mysqli_fetch_array($sql)){
events: [
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM calendars LEFT JOIN events ON calendar_id = event_calendar_id WHERE event_client_id = $client_id AND calendars.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$event_id = json_encode($row['event_id']);
$event_title = json_encode($row['event_title']);
$event_start = json_encode($row['event_start']);

View File

@ -20,7 +20,7 @@ $num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_
<div class="card-body">
<?php
if($num_of_files == 0){
if ($num_of_files == 0) {
echo "<div style='text-align: center;'><h3 class='text-secondary'>No Records Here</h3></div>";
}
@ -31,7 +31,7 @@ $num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_
<?php
while($row = mysqli_fetch_array($sql_files_images)){
while ($row = mysqli_fetch_array($sql_files_images)) {
$file_id = $row['file_id'];
$file_name = htmlentities($row['file_name']);
$file_reference_name = htmlentities($row['file_reference_name']);
@ -68,22 +68,22 @@ $num_of_files = mysqli_num_rows($sql_files_images) + mysqli_num_rows($sql_files_
<table class="table">
<?php
while($row = mysqli_fetch_array($sql_files_other)){
while ($row = mysqli_fetch_array($sql_files_other)) {
$file_id = $row['file_id'];
$file_name = htmlentities($row['file_name']);
$file_reference_name = htmlentities($row['file_reference_name']);
$file_ext = htmlentities($row['file_ext']);
if($file_ext == 'pdf'){
if ($file_ext == 'pdf') {
$file_icon = "file-pdf";
}elseif($file_ext == 'gz' || $file_ext == 'tar' || $file_ext == 'zip' || $file_ext == '7z' || $file_ext == 'rar'){
}elseif ($file_ext == 'gz' || $file_ext == 'tar' || $file_ext == 'zip' || $file_ext == '7z' || $file_ext == 'rar') {
$file_icon = "file-archive";
}elseif($file_ext == 'txt'){
}elseif ($file_ext == 'txt') {
$file_icon = "file-alt";
}elseif($file_ext == 'doc' || $file_ext == 'docx'){
}elseif ($file_ext == 'doc' || $file_ext == 'docx') {
$file_icon = "file-word";
}elseif($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods'){
}elseif ($file_ext == 'xls' || $file_ext == 'xlsx' || $file_ext == 'ods') {
$file_icon = "file-excel";
}elseif($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg'){
}elseif ($file_ext == 'mp3' || $file_ext == 'wav' || $file_ext == 'ogg') {
$file_icon = "file-audio";
}else{
$file_icon = "file";

View File

@ -2,14 +2,14 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "invoice_number";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
@ -41,7 +41,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Invoices">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Invoices">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -59,7 +59,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_number&o=<?php echo $disp; ?>">Number</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_scope&o=<?php echo $disp; ?>">Scope</a></th>
@ -74,12 +74,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
$invoice_scope = htmlentities($row['invoice_scope']);
if(empty($invoice_scope)){
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
}else{
$invoice_scope_display = $invoice_scope;
@ -93,22 +93,22 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$category_id = $row['category_id'];
$category_name = htmlentities($row['category_name']);
if(($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) < time() ){
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) < time() ) {
$overdue_color = "text-danger font-weight-bold";
}else{
$overdue_color = "";
}
//Set Badge color based off of invoice status
if($invoice_status == "Sent"){
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning";
}elseif($invoice_status == "Viewed"){
}elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
}elseif($invoice_status == "Partial"){
}elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
}elseif($invoice_status == "Paid"){
}elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
}elseif($invoice_status == "Cancelled"){
}elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
}else{
$invoice_badge_color = "secondary";
@ -134,7 +134,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<?php if(!empty($config_smtp_host)){ ?>
<?php if (!empty($config_smtp_host)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send</a>
<div class="dropdown-divider"></div>
<?php } ?>

View File

@ -38,7 +38,7 @@
<input type="text" class="form-control" name="name" placeholder="Name of location" required autofocus>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="primary_location" value="1" <?php if($primary_location == 0){ echo "checked"; } ?>>
<input type="checkbox" name="primary_location" value="1" <?php if ($primary_location == 0) { echo "checked"; } ?>>
</div>
</div>
</div>
@ -93,7 +93,7 @@
<select class="form-control select2" name="country">
<option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?>
<option <?php if($session_company_country == $country_name){ echo "selected"; } ?> ><?php echo $country_name; ?></option>
<option <?php if ($session_company_country == $country_name) { echo "selected"; } ?> ><?php echo $country_name; ?></option>
<?php } ?>
</select>
</div>
@ -114,7 +114,7 @@
<?php
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_archived_at IS NULL AND contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
?>

View File

@ -40,7 +40,7 @@
<input type="text" class="form-control" name="name" placeholder="Name of location" value="<?php echo $location_name; ?>" required>
<div class="input-group-append">
<div class="input-group-text">
<input type="checkbox" name="primary_location" value="1" <?php if($location_id == $primary_location){ echo "checked"; } ?>>
<input type="checkbox" name="primary_location" value="1" <?php if ($location_id == $primary_location) { echo "checked"; } ?>>
</div>
</div>
</div>
@ -95,7 +95,7 @@
<select class="form-control select2" name="country">
<option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?>
<option <?php if($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
<option <?php if ($location_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
<?php } ?>
</select>
</div>
@ -116,12 +116,12 @@
<?php
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE (contact_archived_at > '$location_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id_select = $row['contact_id'];
$contact_name_select = htmlentities($row['contact_name']);
?>
<option <?php if($location_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
<option <?php if ($location_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
<?php
}
@ -159,7 +159,7 @@
<div class="tab-pane fade" id="pills-photo<?php echo $location_id; ?>">
<div class="mb-3" style="text-align: center;">
<?php if(!empty($location_photo)){ ?>
<?php if (!empty($location_photo)) { ?>
<img class="img-fluid" src="<?php echo "uploads/clients/$session_company_id/$client_id/$location_photo"; ?>">
<?php } ?>
</div>

View File

@ -2,11 +2,11 @@
<?php
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$q);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $q;
}
}else{
@ -14,7 +14,7 @@ if(isset($_GET['q'])){
$phone_query = "";
}
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "location_name";
@ -47,7 +47,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Locations">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Locations">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -66,7 +66,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=location_address&o=<?php echo $disp; ?>">Address</a></th>
@ -78,7 +78,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$location_id = $row['location_id'];
$location_name = htmlentities($row['location_name']);
$location_country = htmlentities($row['location_country']);
@ -87,13 +87,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$location_state = htmlentities($row['location_state']);
$location_zip = htmlentities($row['location_zip']);
$location_phone = formatPhoneNumber($row['location_phone']);
if(empty($location_phone)){
if (empty($location_phone)) {
$location_phone_display = "-";
}else{
$location_phone_display = $location_phone;
}
$location_hours = htmlentities($row['location_hours']);
if(empty($location_hours)){
if (empty($location_hours)) {
$location_hours_display = "-";
}else{
$location_hours_display = $location_hours;
@ -102,7 +102,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$location_notes = htmlentities($row['location_notes']);
$location_created_at = $row['location_created_at'];
$location_contact_id = $row['location_contact_id'];
if($location_id == $primary_location){
if ($location_id == $primary_location) {
$primary_location_display = "<p class='text-success'>Primary Location</p>";
}else{
$primary_location_display = "";
@ -125,7 +125,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLocationModal<?php echo $location_id; ?>">Edit</a>
<?php if($session_user_role == 3 && $location_id !== $primary_location) { ?>
<?php if ($session_user_role == 3 && $location_id !== $primary_location) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?archive_location=<?php echo $location_id; ?>">Archive</a>
<a class="dropdown-item text-danger" href="post.php?delete_location=<?php echo $location_id; ?>">Delete</a>

View File

@ -103,7 +103,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
?>
@ -127,7 +127,7 @@
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
?>
@ -151,7 +151,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$asset_id = $row['asset_id'];
$asset_name = htmlentities($row['asset_name']);
?>
@ -175,7 +175,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$software_id = $row['software_id'];
$software_name = htmlentities($row['software_name']);
?>

View File

@ -109,11 +109,11 @@
<?php
$sql_contacts = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id_select = $row['contact_id'];
$contact_name_select = htmlentities($row['contact_name']);
?>
<option <?php if($login_contact_id == $contact_id_select){ echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
<option <?php if ($login_contact_id == $contact_id_select) { echo "selected"; } ?> value="<?php echo $contact_id_select; ?>"><?php echo $contact_name_select; ?></option>
<?php
}
@ -133,11 +133,11 @@
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = $client_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id_select = $row['vendor_id'];
$vendor_name_select = htmlentities($row['vendor_name']);
?>
<option <?php if($login_vendor_id == $vendor_id_select){ echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<option <?php if ($login_vendor_id == $vendor_id_select) { echo "selected"; } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<?php
}
@ -157,11 +157,11 @@
<?php
$sql_assets = mysqli_query($mysqli,"SELECT * FROM assets WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
while($row = mysqli_fetch_array($sql_assets)){
while ($row = mysqli_fetch_array($sql_assets)) {
$asset_id_select = $row['asset_id'];
$asset_name_select = htmlentities($row['asset_name']);
?>
<option <?php if($login_asset_id == $asset_id_select){ echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
<option <?php if ($login_asset_id == $asset_id_select) { echo "selected"; } ?> value="<?php echo $asset_id_select; ?>"><?php echo $asset_name_select; ?></option>
<?php
}
@ -181,11 +181,11 @@
<?php
$sql_software = mysqli_query($mysqli,"SELECT * FROM software WHERE software_client_id = $client_id ORDER BY software_name ASC");
while($row = mysqli_fetch_array($sql_software)){
while ($row = mysqli_fetch_array($sql_software)) {
$software_id_select = $row['software_id'];
$software_name_select = htmlentities($row['software_name']);
?>
<option <?php if($login_software_id == $software_id_select){ echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
<option <?php if ($login_software_id == $software_id_select) { echo "selected"; } ?> value="<?php echo $software_id_select; ?>"><?php echo $software_name_select; ?></option>
<?php
}

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "login_name";
@ -34,7 +34,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Passwords">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Passwords">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -53,7 +53,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=login_username&o=<?php echo $disp; ?>">Username</a></th>
@ -66,17 +66,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$login_id = $row['login_id'];
$login_name = htmlentities($row['login_name']);
$login_uri = htmlentities($row['login_uri']);
if(empty($login_uri)){
if (empty($login_uri)) {
$login_uri_display = "-";
}else{
$login_uri_display = "$login_uri<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_uri'><i class='far fa-copy text-secondary'></i></button><a href='https://$login_uri' target='_blank'><i class='fa fa-external-link-alt text-secondary'></i></a>";
}
$login_username = htmlentities($row['login_username']);
if(empty($login_username)){
if (empty($login_username)) {
$login_username_display = "-";
}else{
$login_username_display = "$login_username<button class='btn btn-sm clipboardjs' data-clipboard-text='$login_username'><i class='far fa-copy text-secondary'></i></button>";
@ -84,7 +84,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$login_password = htmlentities(decryptLoginEntry($row['login_password']));
$login_otp_secret = htmlentities($row['login_otp_secret']);
$login_id_with_secret = '"' . $row['login_id'] . '","' . $row['login_otp_secret'] . '"';
if(empty($login_otp_secret)){
if (empty($login_otp_secret)) {
$otp_display = "-";
}else{
$otp_display = "<span onmouseenter='showOTP($login_id_with_secret)'><i class='far fa-clock'></i> <span id='otp_$login_id'><i>Hover..</i></span></span>";
@ -117,7 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editLoginModal<?php echo $login_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#shareModal" onclick="populateShareModal(<?php echo "$client_id, 'Login', $login_id"; ?>)">Share</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_login=<?php echo $login_id; ?>">Delete</a>
<?php } ?>
@ -141,12 +141,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
<script>
function showOTP(id, secret){
function showOTP(id, secret) {
//Send a GET request to ajax.php as ajax.php?get_totp_token=true&totp_secret=SECRET
jQuery.get(
"ajax.php",
{get_totp_token: 'true', totp_secret: secret},
function(data){
function(data) {
//If we get a response from post.php, parse it as JSON
const token = JSON.parse(data);
@ -156,7 +156,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
);
}
function generatePassword(){
function generatePassword() {
document.getElementById("password").value = "<?php echo bin2hex(random_bytes(8)); ?>"
}
</script>

View File

@ -2,14 +2,14 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "log_id";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
@ -40,7 +40,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Logs">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Logs">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -55,7 +55,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive border">
<table class="table table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_created_at&o=<?php echo $disp; ?>">Timestamp</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">User</a></th>
@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$log_id = $row['log_id'];
$log_type = htmlentities($row['log_type']);
$log_action = htmlentities($row['log_action']);
@ -81,7 +81,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$log_created_at = $row['log_created_at'];
$user_id = $row['user_id'];
$user_name = htmlentities($row['user_name']);
if(empty($user_name)){
if (empty($user_name)) {
$user_name_display = "-";
}else{
$user_name_display = $user_name;

View File

@ -72,7 +72,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM locations WHERE location_archived_at IS NULL AND location_client_id = $client_id ORDER BY location_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$location_id = $row['location_id'];
$location_name = htmlentities($row['location_name']);
?>

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "network_name";
@ -35,7 +35,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Networks">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Networks">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -53,7 +53,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=network_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=network_vlan&o=<?php echo $disp; ?>">vLAN</a></th>
@ -67,11 +67,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$network_id = $row['network_id'];
$network_name = htmlentities($row['network_name']);
$network_vlan = htmlentities($row['network_vlan']);
if(empty($network_vlan)){
if (empty($network_vlan)) {
$network_vlan_display = "-";
}else{
$network_vlan_display = $network_vlan;
@ -79,14 +79,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$network = htmlentities($row['network']);
$network_gateway = htmlentities($row['network_gateway']);
$network_dhcp_range = htmlentities($row['network_dhcp_range']);
if(empty($network_dhcp_range)){
if (empty($network_dhcp_range)) {
$network_dhcp_range_display = "-";
}else{
$network_dhcp_range_display = $network_dhcp_range;
}
$network_location_id = $row['network_location_id'];
$location_name = htmlentities($row['location_name']);
if(empty($location_name)){
if (empty($location_name)) {
$location_name_display = "-";
}else{
$location_name_display = $location_name;
@ -109,7 +109,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" onclick="populateNetworkEditModal(<?php echo $client_id, ",", $network_id ?>)" data-target="#editNetworkModal">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_network=<?php echo $network_id; ?>">Delete</a>
<?php } ?>
@ -145,7 +145,7 @@ function populateNetworkEditModal(client_id, network_id) {
jQuery.get(
"ajax.php",
{network_get_json_details: 'true', client_id: client_id, network_id: network_id},
function(data){
function(data) {
// If we get a response from post.php, parse it as JSON
const response = JSON.parse(data);
@ -175,7 +175,7 @@ function populateNetworkEditModal(client_id, network_id) {
// Populate location dropdown
locations.forEach(location => {
if(parseInt(location.location_id) == parseInt(network.network_location_id)){
if (parseInt(location.location_id) == parseInt(network.network_location_id)) {
locationDropdown[locationDropdown.length] = new Option(location.location_name, location.location_id, true, true);
}
else{

View File

@ -44,7 +44,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
</div>
<?php if(mysqli_num_rows($sql_important_contacts) > 0 ){ ?>
<?php if (mysqli_num_rows($sql_important_contacts) > 0 ) { ?>
<div class="col-md-4">
@ -57,7 +57,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<table class="table table-borderless table-sm">
<?php
while($row = mysqli_fetch_array($sql_important_contacts)){
while ($row = mysqli_fetch_array($sql_important_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_title = htmlentities($row['contact_title']);
@ -74,10 +74,10 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<small class="text-secondary"><?php echo $contact_title; ?></small>
</td>
<td>
<?php if(!empty($contact_phone)){ ?>
<?php if (!empty($contact_phone)) { ?>
<?php echo "<i class='fa fa-fw fa-phone text-secondary'></i> $contact_phone $contact_extension"; ?>
<?php } ?>
<?php if(!empty($contact_mobile)){ ?>
<?php if (!empty($contact_mobile)) { ?>
<br>
<div class="text-secondary"><i class='fa fa-fw fa-mobile-alt text-secondary'></i> <?php echo "$contact_mobile"; ?></div>
<?php } ?>
@ -94,7 +94,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php } ?>
<?php if(mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ){ ?>
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ) { ?>
<div class="col-md-3">
<div class="card card-dark mb-3">
@ -105,7 +105,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_updated_at = $row['contact_updated_at'];
@ -121,7 +121,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
$vendor_updated_at = $row['vendor_updated_at'];
@ -140,7 +140,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
</div>
<?php } ?>
<?php if(mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ){ ?>
<?php if (mysqli_num_rows($sql_contacts) > 0 || mysqli_num_rows($sql_vendors) > 0 ) { ?>
<div class="col-md-3">
@ -152,7 +152,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_updated_at = $row['contact_updated_at'];
@ -168,7 +168,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
$vendor_updated_at = $row['vendor_updated_at'];
@ -198,7 +198,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_domains_expiring)){
while ($row = mysqli_fetch_array($sql_domains_expiring)) {
$domain_id = $row['domain_id'];
$domain_name = htmlentities($row['domain_name']);
$domain_expire = $row['domain_expire'];
@ -215,7 +215,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_asset_warranties_expiring)){
while ($row = mysqli_fetch_array($sql_asset_warranties_expiring)) {
$asset_id = $row['asset_id'];
$asset_name = htmlentities($row['asset_name']);
$asset_warranty_expire = $row['asset_warranty_expire'];
@ -234,7 +234,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<?php
while($row = mysqli_fetch_array($sql_asset_retire)){
while ($row = mysqli_fetch_array($sql_asset_retire)) {
$asset_id = $row['asset_id'];
$asset_name = htmlentities($row['asset_name']);
$asset_install_date = $row['asset_install_date'];
@ -254,7 +254,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
</div>
</div>
<?php if(mysqli_num_rows($sql_tickets_stale) > 0){ ?>
<?php if (mysqli_num_rows($sql_tickets_stale) > 0) { ?>
<!-- Stale Tickets -->
@ -267,7 +267,7 @@ $sql_domains_expiring = mysqli_query($mysqli,"SELECT * FROM domains
<tbody>
<?php
while($row = mysqli_fetch_array($sql_tickets_stale)){
while ($row = mysqli_fetch_array($sql_tickets_stale)) {
$ticket_id = $row['ticket_id'];
$ticket_prefix = htmlentities($row['ticket_prefix']);
$ticket_number = $row['ticket_number'];

View File

@ -2,14 +2,14 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "payment_date";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
@ -39,7 +39,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Payments">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Payments">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -57,7 +57,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=payment_date&o=<?php echo $disp; ?>">Payment Date</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_date&o=<?php echo $disp; ?>">Invoice Date</a></th>
@ -72,7 +72,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
@ -83,7 +83,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$payment_date = $row['payment_date'];
$payment_method = htmlentities($row['payment_method']);
$payment_reference = htmlentities($row['payment_reference']);
if(empty($payment_reference)){
if (empty($payment_reference)) {
$payment_reference_display = "-";
}else{
$payment_reference_display = $payment_reference;

View File

@ -2,14 +2,14 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "quote_number";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
@ -41,7 +41,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Quotes">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Quotes">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -59,7 +59,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_number&o=<?php echo $disp; ?>">Number</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=quote_scope&o=<?php echo $disp; ?>">Scope</a></th>
@ -73,12 +73,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$quote_id = $row['quote_id'];
$quote_prefix = htmlentities($row['quote_prefix']);
$quote_number = htmlentities($row['quote_number']);
$quote_scope = htmlentities($row['quote_scope']);
if(empty($quote_scope)){
if (empty($quote_scope)) {
$quote_scope_display = "-";
}else{
$quote_scope_display = $quote_scope;
@ -92,15 +92,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$category_name = htmlentities($row['category_name']);
//Set Badge color based off of quote status
if($quote_status == "Sent"){
if ($quote_status == "Sent") {
$quote_badge_color = "warning text-white";
}elseif($quote_status == "Viewed"){
}elseif ($quote_status == "Viewed") {
$quote_badge_color = "primary";
}elseif($quote_status == "Accepted"){
}elseif ($quote_status == "Accepted") {
$quote_badge_color = "success";
}elseif($quote_status == "Declined"){
}elseif ($quote_status == "Declined") {
$quote_badge_color = "danger";
}elseif($quote_status == "Invoiced"){
}elseif ($quote_status == "Invoiced") {
$quote_badge_color = "info";
}else{
$quote_badge_color = "secondary";
@ -128,7 +128,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editQuoteModal<?php echo $quote_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addQuoteCopyModal<?php echo $quote_id; ?>">Copy</a>
<div class="dropdown-divider"></div>
<?php if(!empty($config_smtp_host)){ ?>
<?php if (!empty($config_smtp_host)) { ?>
<a class="dropdown-item" href="post.php?email_quote=<?php echo $quote_id; ?>">Send</a>
<div class="dropdown-divider"></div>
<?php } ?>

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "recurring_id";
@ -35,7 +35,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Recurring Invoices">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Recurring Invoices">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -53,7 +53,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=recurring_number&o=<?php echo $disp; ?>">Number</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=recurring_scope&o=<?php echo $disp; ?>">Scope</a></th>
@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$recurring_id = $row['recurring_id'];
$recurring_prefix = htmlentities($row['recurring_prefix']);
$recurring_number = htmlentities($row['recurring_number']);
@ -77,7 +77,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$recurring_frequency = htmlentities($row['recurring_frequency']);
$recurring_status = htmlentities($row['recurring_status']);
$recurring_last_sent = $row['recurring_last_sent'];
if($recurring_last_sent == 0){
if ($recurring_last_sent == 0) {
$recurring_last_sent = "-";
}
$recurring_next_date = $row['recurring_next_date'];
@ -86,7 +86,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$recurring_created_at = $row['recurring_created_at'];
$category_id = $row['category_id'];
$category_name = htmlentities($row['category_name']);
if($recurring_status == 1){
if ($recurring_status == 1) {
$status = "Active";
$status_badge_color = "success";
}else{

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "scheduled_ticket_subject";
@ -42,7 +42,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Scheduled Tickets">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Scheduled Tickets">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -93,7 +93,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<a class="dropdown-item" href="#" data-toggle="modal"
data-target="#editScheduledTicketModal" onclick="populateScheduledTicketEditModal(<?php echo $client_id, ",", $scheduled_ticket_id ?>)">Edit</a>
<?php
if($session_user_role == 3){
if ($session_user_role == 3) {
?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger"

View File

@ -100,7 +100,7 @@
<select multiple class="form-control" id="contacts" name="contacts[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
echo "<option value=\"$contact_id\">$contact_name</option>";
@ -114,7 +114,7 @@
<select multiple class="form-control" id="vendors" name="vendors[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_template = 0 AND vendor_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
echo "<option value=\"$vendor_id\">$vendor_name</option>";
@ -128,7 +128,7 @@
<select multiple class="form-control" id="documents" name="documents[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$document_id = $row['document_id'];
$document_name = htmlentities($row['document_name']);
echo "<option value=\"$document_id\">$document_name</option>";
@ -152,7 +152,7 @@
<select multiple class="form-control" id="assets" name="assets[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$asset_id = $row['asset_id'];
$asset_name = htmlentities($row['asset_name']);
echo "<option value=\"$asset_id\">$asset_name</option>";
@ -168,7 +168,7 @@
<select multiple class="form-control" id="logins" name="logins[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$login_id = $row['login_id'];
$login_name = htmlentities($row['login_name']);
echo "<option value=\"$login_id\">$login_name</option>";
@ -189,7 +189,7 @@
<select multiple class="form-control" id="domains" name="domains[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$domain_id = $row['domain_id'];
$domain_name = htmlentities($row['domain_name']);
echo "<option value=\"$domain_id\">$domain_name</option>";
@ -205,7 +205,7 @@
<select multiple class="form-control" id="certificates" name="certificates[]">
<?php
$sql = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id = '$client_id'");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$cert_id = $row['certificate_id'];
$cert_name = htmlentities($row['certificate_name']);
$cert_domain = htmlentities($row['certificate_domain']);

View File

@ -72,9 +72,9 @@
<span class="input-group-text"><i class="fa fa-fw fa-thermometer-half"></i></span>
</div>
<select class="form-control select2" name="importance" required>
<option <?php if($service_importance == 'Low'){ echo "selected"; } ?> >Low</option>
<option <?php if($service_importance == 'Medium'){ echo "selected"; } ?> >Medium</option>
<option <?php if($service_importance == 'High'){ echo "selected"; } ?> >High</option>
<option <?php if ($service_importance == 'Low') { echo "selected"; } ?> >Low</option>
<option <?php if ($service_importance == 'Medium') { echo "selected"; } ?> >Medium</option>
<option <?php if ($service_importance == 'High') { echo "selected"; } ?> >High</option>
</select>
</div>
</div>
@ -107,11 +107,11 @@
// NOTE: These are called $sql_all and $row_all for a reason - anything overwriting $sql or $row will break the current while loop we are in from client_services.php
$sql_all = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$contact_id = $row_all['contact_id'];
$contact_name = htmlentities($row_all['contact_name']);
if(in_array($contact_id, $selected_ids)){
if (in_array($contact_id, $selected_ids)) {
echo "<option value=\"$contact_id\" selected>$contact_name</option>";
}
else{
@ -129,11 +129,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_vendors,MYSQLI_ASSOC), "vendor_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM vendors WHERE vendor_template = 0 AND vendor_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$vendor_id = $row_all['vendor_id'];
$vendor_name = htmlentities($row_all['vendor_name']);
if(in_array($vendor_id, $selected_ids)){
if (in_array($vendor_id, $selected_ids)) {
echo "<option value=\"$vendor_id\" selected>$vendor_name</option>";
}
else{
@ -151,11 +151,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_docs,MYSQLI_ASSOC), "document_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$document_id = $row_all['document_id'];
$document_name = htmlentities($row_all['document_name']);
if(in_array($document_id, $selected_ids)){
if (in_array($document_id, $selected_ids)) {
echo "<option value=\"$document_id\" selected>$document_name</option>";
}
else{
@ -184,11 +184,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_assets,MYSQLI_ASSOC), "asset_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$asset_id = $row_all['asset_id'];
$asset_name = htmlentities($row_all['asset_name']);
if(in_array($asset_id, $selected_ids)){
if (in_array($asset_id, $selected_ids)) {
echo "<option value=\"$asset_id\" selected>$asset_name</option>";
}
else{
@ -208,11 +208,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_logins,MYSQLI_ASSOC), "login_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$login_id = $row_all['login_id'];
$login_name = htmlentities($row_all['login_name']);
if(in_array($login_id, $selected_ids)){
if (in_array($login_id, $selected_ids)) {
echo "<option value=\"$login_id\" selected>$login_name</option>";
}
else{
@ -237,11 +237,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_domains,MYSQLI_ASSOC), "domain_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM domains WHERE domain_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$domain_id = $row_all['domain_id'];
$domain_name = htmlentities($row_all['domain_name']);
if(in_array($domain_id, $selected_ids)){
if (in_array($domain_id, $selected_ids)) {
echo "<option value=\"$domain_id\" selected>$domain_name</option>";
}
else{
@ -261,11 +261,11 @@
$selected_ids = array_column(mysqli_fetch_all($sql_certificates,MYSQLI_ASSOC), "certificate_id");
$sql_all = mysqli_query($mysqli, "SELECT * FROM certificates WHERE certificate_client_id = '$client_id'");
while($row_all = mysqli_fetch_array($sql_all)){
while ($row_all = mysqli_fetch_array($sql_all)) {
$cert_id = $row_all['certificate_id'];
$cert_name = htmlentities($row_all['certificate_name']);
if(in_array($cert_id, $selected_ids)){
if (in_array($cert_id, $selected_ids)) {
echo "<option value=\"$cert_id\" selected>$cert_name</option>";
}
else{

View File

@ -23,15 +23,15 @@
<!-- Assets -->
<?php
if(mysqli_num_rows($sql_assets) > 0){ ?>
if (mysqli_num_rows($sql_assets) > 0) { ?>
<h5><i class="nav-icon fas fa-desktop"></i> Assets</h5>
<ul>
<?php
// Reset the $sql_assets pointer to the start - as we've already cycled through once
mysqli_data_seek($sql_assets, 0);
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['asset_ip'])){
while ($row = mysqli_fetch_array($sql_assets)) {
if (!empty($row['asset_ip'])) {
$ip = '('.$row["asset_ip"].')';
}
else{
@ -47,7 +47,7 @@
<!-- Networks -->
<?php
if($sql_assets){
if ($sql_assets) {
$networks = [];
@ -55,8 +55,8 @@
mysqli_data_seek($sql_assets, 0);
// Get networks linked to assets - push name to array
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['network_name'])){
while ($row = mysqli_fetch_array($sql_assets)) {
if (!empty($row['network_name'])) {
$network_data = "$row[network_name]:$row[network_vlan]";
array_push($networks, $network_data);
}
@ -66,12 +66,12 @@
$networks = array_unique($networks);
// Display
if(!empty($networks)){ ?>
if (!empty($networks)) { ?>
<h5><i class="nav-icon fas fa-network-wired"></i> Networks</h5>
<ul>
<?php
}
foreach($networks as $network){
foreach($networks as $network) {
$network = explode(":", $network);
echo "<li><a href=\"client_networks.php?client_id=$client_id&q=$network[0]\">$network[0] </a>(VLAN $network[1])</li>";
}
@ -84,7 +84,7 @@
<!-- Locations -->
<?php
if($sql_assets){
if ($sql_assets) {
$location_names = [];
@ -92,8 +92,8 @@
mysqli_data_seek($sql_assets, 0);
// Get locations linked to assets - push their name and vlan to arrays
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['location_name'])){
while ($row = mysqli_fetch_array($sql_assets)) {
if (!empty($row['location_name'])) {
array_push($location_names, $row['location_name']);
}
}
@ -102,12 +102,12 @@
$location_names = array_unique($location_names);
// Display
if(!empty($location_names)){ ?>
if (!empty($location_names)) { ?>
<h5><i class="nav-icon fas fa-map-marker-alt"></i> Locations</h5>
<ul>
<?php
}
foreach($location_names as $location){
foreach($location_names as $location) {
echo "<li><a href=\"client_locations.php?client_id=$client_id&q=$location\">$location</a></li>";
}
?>
@ -118,7 +118,7 @@
<!-- Domains -->
<?php
if(mysqli_num_rows($sql_domains) > 0){ ?>
if (mysqli_num_rows($sql_domains) > 0) { ?>
<h5><i class="nav-icon fas fa-globe"></i> Domains</h5>
<ul>
<?php
@ -126,8 +126,8 @@
mysqli_data_seek($sql_domains, 0);
// Showing linked domains
while($row = mysqli_fetch_array($sql_domains)){
if(!empty($row['domain_name'])){
while ($row = mysqli_fetch_array($sql_domains)) {
if (!empty($row['domain_name'])) {
echo "<li><a href=\"client_domains.php?client_id=$client_id&q=$row[domain_name]\">$row[domain_name]</a></li>";
}
}
@ -139,7 +139,7 @@
<!-- Certificates -->
<?php
if(mysqli_num_rows($sql_certificates) > 0){ ?>
if (mysqli_num_rows($sql_certificates) > 0) { ?>
<h5><i class="nav-icon fas fa-lock"></i> Certificates</h5>
<ul>
<?php
@ -147,8 +147,8 @@
mysqli_data_seek($sql_certificates, 0);
// Showing linked certs
while($row = mysqli_fetch_array($sql_certificates)){
if(!empty($row['certificate_name'])){
while ($row = mysqli_fetch_array($sql_certificates)) {
if (!empty($row['certificate_name'])) {
echo "<li><a href=\"client_certificates.php?client_id=$client_id&q=$row[certificate_name]\">$row[certificate_name] ($row[certificate_domain])</a></li>";
}
}
@ -173,11 +173,11 @@
// Reset the $sql_vendors pointer to the start
mysqli_data_seek($sql_vendors, 0);
if(mysqli_num_rows($sql_vendors) > 0){ ?>
if (mysqli_num_rows($sql_vendors) > 0) { ?>
<h5><i class="nav-icon fas fa-users"></i> Vendors</h5>
<ul>
<?php
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
echo "<li><a href=\"client_vendors.php?client_id=$client_id&q=$row[vendor_name]\">$row[vendor_name]</a></li>";
}
?>
@ -188,14 +188,14 @@
<!-- Contacts -->
<?php
if(mysqli_num_rows($sql_contacts) > 0){ ?>
if (mysqli_num_rows($sql_contacts) > 0) { ?>
<h5><i class="nav-icon fas fa-building"></i> Contacts</h5>
<ul>
<?php
// Reset the $sql_contacts pointer to the start
mysqli_data_seek($sql_contacts, 0);
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
echo "<li><a href=\"client_contacts.php?client_id=$client_id&q=$row[contact_name]\">$row[contact_name]</a></li>";
}
?>
@ -206,7 +206,7 @@
<!-- Logins -->
<?php
if(mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_logins) > 0){ ?>
if (mysqli_num_rows($sql_assets) > 0 || mysqli_num_rows($sql_logins) > 0) { ?>
<h5><i class="nav-icon fas fa-key"></i> Logins</h5>
<ul>
<?php
@ -215,15 +215,15 @@
mysqli_data_seek($sql_logins, 0);
// Showing logins linked to assets
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['login_name'])){
while ($row = mysqli_fetch_array($sql_assets)) {
if (!empty($row['login_name'])) {
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
}
}
// Showing explicitly linked logins
while($row = mysqli_fetch_array($sql_logins)){
if(!empty($row['login_name'])){
while ($row = mysqli_fetch_array($sql_logins)) {
if (!empty($row['login_name'])) {
echo "<li><a href=\"client_logins.php?client_id=$client_id&q=$row[login_name]\">$row[login_name]</a></li>";
}
}
@ -235,7 +235,7 @@
<!-- URLs -->
<?php
if($sql_logins || $sql_assets){ ?>
if ($sql_logins || $sql_assets) { ?>
<h5><i class="nav-icon fas fa-link"></i> URLs</h5>
<ul>
<?php
@ -243,8 +243,8 @@
mysqli_data_seek($sql_logins, 0);
// Showing URLs linked to logins
while($row = mysqli_fetch_array($sql_logins)){
if(!empty($row['login_uri'])){
while ($row = mysqli_fetch_array($sql_logins)) {
if (!empty($row['login_uri'])) {
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
}
}
@ -253,8 +253,8 @@
mysqli_data_seek($sql_assets, 0);
// Show URLs linked to assets, that also have logins
while($row = mysqli_fetch_array($sql_assets)){
if(!empty($row['login_uri'])){
while ($row = mysqli_fetch_array($sql_assets)) {
if (!empty($row['login_uri'])) {
echo "<li><a href=\"https://$row[login_uri]\">$row[login_uri]</a></li>";
}
}
@ -266,14 +266,14 @@
<!-- Documents -->
<?php
if(mysqli_num_rows($sql_docs) > 0){ ?>
if (mysqli_num_rows($sql_docs) > 0) { ?>
<h5><i class="nav-icon fas fa-file-alt"></i> Documents</h5>
<ul>
<?php
// Reset the $sql_docs pointer to the start
mysqli_data_seek($sql_docs, 0);
while($row = mysqli_fetch_array($sql_docs)){
while ($row = mysqli_fetch_array($sql_docs)) {
echo "<li><a href=\"client_documents.php?client_id=$client_id&q=$row[document_name]\">$row[document_name]</a></li>";
}
?>

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "service_name";
@ -34,7 +34,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<form autocomplete="off">
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="input-group">
<input type="search" class="form-control " name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Services">
<input type="search" class="form-control " name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Services">
<div class="input-group-append">
<button class="btn btn-secondary"><i class="fa fa-search"></i></button>
</div>
@ -44,7 +44,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark">Name</a></th>
<th><a class="text-dark">Category</a></th>
@ -57,7 +57,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$service_id = $row['service_id'];
$service_name = htmlentities($row['service_name']);
$service_description = htmlentities($row['service_description']);
@ -69,11 +69,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$service_review_due = $row['service_review_due'];
// Service Importance
if($service_importance == "High"){
if ($service_importance == "High") {
$service_importance_display = "<span class='p-2 badge badge-danger'>$service_importance</span>";
}elseif($service_importance == "Medium"){
}elseif ($service_importance == "Medium") {
$service_importance_display = "<span class='p-2 badge badge-warning'>$service_importance</span>";
}elseif($service_importance == "Low"){
}elseif ($service_importance == "Low") {
$service_importance_display = "<span class='p-2 badge badge-info'>$service_importance</span>";
}else{
$service_importance_display = "-";
@ -96,7 +96,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editServiceModal<?php echo $service_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_service=<?php echo $service_id; ?>">Delete</a>
<?php } ?>

View File

@ -2,11 +2,11 @@
<?php
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$q);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $q;
}
}else{
@ -42,7 +42,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Shared Items">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Shared Items">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -54,7 +54,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th>Item Name</th>
<th>Item Type</th>
@ -67,7 +67,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$item_id = $row['item_id'];
$item_active = htmlentities($row['item_active']);
$item_key = htmlentities($row['item_key']);
@ -79,17 +79,17 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$item_created_at = $row['item_created_at'];
$item_expire_at = $row['item_expire_at'];
if($item_type == 'Login'){
if ($item_type == 'Login') {
$share_item_sql = mysqli_query($mysqli, "SELECT login_name FROM logins WHERE login_id = '$item_related_id' AND login_client_id = '$client_id'");
$share_item = mysqli_fetch_array($share_item_sql);
$item_name = htmlentities($share_item['login_name']);
}
elseif($item_type == 'Document'){
elseif ($item_type == 'Document') {
$share_item_sql = mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = '$item_related_id' AND document_client_id = '$client_id'");
$share_item = mysqli_fetch_array($share_item_sql);
$item_name = htmlentities($share_item['document_name']);
}
elseif($item_type == 'File'){
elseif ($item_type == 'File') {
$share_item_sql = mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = '$item_related_id' AND file_client_id = '$client_id'");
$share_item = mysqli_fetch_array($share_item_sql);
$item_name = htmlentities($share_item['file_name']);
@ -104,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo "$item_views / $item_view_limit" ?></td>
<td><?php echo $item_expire_at ?></td>
<td>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>

View File

@ -17,19 +17,19 @@
</li>
<li class="nav-item mt-3">
<a href="client_overview.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_overview.php") { echo "active"; } ?>">
<a href="client_overview.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_overview.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-tachometer-alt"></i>
<p>Overview</p>
</a>
</li>
<li class="nav-item">
<a href="client_contacts.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_contacts.php" || basename($_SERVER["PHP_SELF"]) == "client_contact_details.php") { echo "active"; } ?>">
<a href="client_contacts.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_contacts.php" || basename($_SERVER["PHP_SELF"]) == "client_contact_details.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-users"></i>
<p>
Contacts
<?php
if($num_contacts > 0){ ?>
if ($num_contacts > 0) { ?>
<span class="right badge badge-light"><?php echo $num_contacts; ?></span>
<?php } ?>
</p>
@ -37,12 +37,12 @@
</li>
<li class="nav-item">
<a href="client_locations.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_locations.php") { echo "active"; } ?>">
<a href="client_locations.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_locations.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-map-marker-alt"></i>
<p>
Locations
<?php
if($num_locations > 0){ ?>
if ($num_locations > 0) { ?>
<span class="right badge badge-light"><?php echo $num_locations; ?></span>
<?php } ?>
</p>
@ -52,12 +52,12 @@
<li class="nav-header mt-3">ASSETS</li>
<li class="nav-item">
<a href="client_assets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_assets.php") { echo "active"; } ?>">
<a href="client_assets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_assets.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-desktop"></i>
<p>
Assets
<?php
if($num_assets > 0){ ?>
if ($num_assets > 0) { ?>
<span class="right badge badge-light"><?php echo $num_assets; ?></span>
<?php } ?>
</p>
@ -65,12 +65,12 @@
</li>
<li class="nav-item">
<a href="client_software.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_software.php") { echo "active"; } ?>">
<a href="client_software.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_software.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-cube"></i>
<p>
Licenses
<?php
if($num_software > 0){ ?>
if ($num_software > 0) { ?>
<span class="right badge badge-light"><?php echo $num_software; ?></span>
<?php } ?>
</p>
@ -78,12 +78,12 @@
</li>
<li class="nav-item">
<a href="client_logins.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_logins.php") { echo "active"; } ?>">
<a href="client_logins.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_logins.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-key"></i>
<p>
Passwords
<?php
if($num_logins > 0){ ?>
if ($num_logins > 0) { ?>
<span class="right badge badge-light"><?php echo $num_logins; ?></span>
<?php } ?>
</p>
@ -91,12 +91,12 @@
</li>
<li class="nav-item">
<a href="client_networks.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_networks.php") { echo "active"; } ?>">
<a href="client_networks.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_networks.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-network-wired"></i>
<p>
Networks
<?php
if($num_networks > 0){ ?>
if ($num_networks > 0) { ?>
<span class="right badge badge-light"><?php echo $num_networks; ?></span>
<?php } ?>
</p>
@ -104,17 +104,17 @@
</li>
<li class="nav-item">
<a href="client_certificates.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_certificates.php") { echo "active"; } ?>">
<a href="client_certificates.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_certificates.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-lock"></i>
<p>
Certificates
<?php
if($num_certificates > 0){ ?>
if ($num_certificates > 0) { ?>
<span class="right badge badge-light"><?php echo $num_certificates; ?></span>
<?php } ?>
<?php if($num_certs_expiring > 0){ ?>
<?php if ($num_certs_expiring > 0) { ?>
<span class="right fa fa-fw fa-circle text-warning"></span>
<?php } ?>
</p>
@ -122,17 +122,17 @@
</li>
<li class="nav-item">
<a href="client_domains.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_domains.php") { echo "active"; } ?>">
<a href="client_domains.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_domains.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-globe"></i>
<p>
Domains
<?php
if($num_domains > 0){ ?>
if ($num_domains > 0) { ?>
<span class="right badge badge-light"><?php echo $num_domains; ?></span>
<?php } ?>
<?php if($num_domains_expiring > 0){ ?>
<?php if ($num_domains_expiring > 0) { ?>
<span class="right fa fa-fw fa-circle text-warning"></span>
<?php } ?>
@ -142,19 +142,19 @@
<li class="nav-header mt-3">SUPPORT</li>
<?php if($config_module_enable_ticketing == 1){ ?>
<?php if ($config_module_enable_ticketing == 1) { ?>
<li class="nav-item">
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_tickets.php" || basename($_SERVER["PHP_SELF"]) == "client_scheduled_tickets.php" ) { echo "active"; } ?>">
<a href="client_tickets.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_tickets.php" || basename($_SERVER["PHP_SELF"]) == "client_scheduled_tickets.php" ) { echo "active"; } ?>">
<i class="nav-icon fas fa-life-ring"></i>
<p>
Tickets
<?php
if($num_active_tickets > 0){ ?>
if ($num_active_tickets > 0) { ?>
<span class="right badge badge-light"><?php echo $num_active_tickets; ?></span>
<?php } ?>
<?php if($num_active_tickets > 0){ ?>
<?php if ($num_active_tickets > 0) { ?>
<span class="right fa fa-fw fa-circle text-danger"></span>
<?php } ?>
@ -164,12 +164,12 @@
<?php } ?>
<li class="nav-item">
<a href="client_services.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_services.php") { echo "active"; } ?>">
<a href="client_services.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_services.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-stream"></i>
<p>
Services
<?php
if($num_services > 0){ ?>
if ($num_services > 0) { ?>
<span class="right badge badge-light"><?php echo $num_services; ?></span>
<?php } ?>
</p>
@ -177,12 +177,12 @@
</li>
<li class="nav-item">
<a href="client_vendors.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_vendors.php") { echo "active"; } ?>">
<a href="client_vendors.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_vendors.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-building"></i>
<p>
Vendors
<?php
if($num_vendors > 0){ ?>
if ($num_vendors > 0) { ?>
<span class="right badge badge-light"><?php echo $num_vendors; ?></span>
<?php } ?>
</p>
@ -190,12 +190,12 @@
</li>
<li class="nav-item">
<a href="client_events.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_events.php") { echo "active"; } ?>">
<a href="client_events.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_events.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-calendar"></i>
<p>
Events
<?php
if($num_events > 0){ ?>
if ($num_events > 0) { ?>
<span class="right badge badge-light"><?php echo $num_events; ?></span>
<?php } ?>
</p>
@ -203,12 +203,12 @@
</li>
<li class="nav-item">
<a href="client_files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_files.php") { echo "active"; } ?>">
<a href="client_files.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_files.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-paperclip"></i>
<p>
Files
<?php
if($num_files > 0){ ?>
if ($num_files > 0) { ?>
<span class="right badge badge-light"><?php echo $num_files; ?></span>
<?php } ?>
</p>
@ -216,34 +216,34 @@
</li>
<li class="nav-item">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_documents.php" || basename($_SERVER["PHP_SELF"]) == "client_document_details.php") { echo "active"; } ?>">
<a href="client_documents.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_documents.php" || basename($_SERVER["PHP_SELF"]) == "client_document_details.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-file-alt"></i>
<p>
Documents
<?php
if($num_documents > 0){ ?>
if ($num_documents > 0) { ?>
<span class="right badge badge-light"><?php echo $num_documents; ?></span>
<?php } ?>
</p>
</a>
</li>
<?php if($session_user_role == 1 || $session_user_role > 2 && $config_module_enable_accounting == 1){ ?>
<?php if ($session_user_role == 1 || $session_user_role > 2 && $config_module_enable_accounting == 1) { ?>
<li class="nav-header mt-3">ACCOUNTING</li>
<li class="nav-item">
<a href="client_invoices.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_invoices.php") { echo "active"; } ?>">
<a href="client_invoices.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_invoices.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-file"></i>
<p>
Invoices
<?php
if($num_invoices > 0){ ?>
if ($num_invoices > 0) { ?>
<span class="right badge badge-light"><?php echo $num_invoices; ?></span>
<?php } ?>
<?php if($num_invoices_open > 0){ ?>
<?php if ($num_invoices_open > 0) { ?>
<span class="right fa fa-fw fa-circle text-danger"></span>
<?php } ?>
@ -252,12 +252,12 @@
</li>
<li class="nav-item">
<a href="client_recurring_invoices.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_recurring_invoices.php") { echo "active"; } ?>">
<a href="client_recurring_invoices.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_recurring_invoices.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-sync-alt"></i>
<p>
Recurring
<?php
if($num_recurring > 0){ ?>
if ($num_recurring > 0) { ?>
<span class="right badge badge-light"><?php echo $num_recurring; ?></span>
<?php } ?>
</p>
@ -265,12 +265,12 @@
</li>
<li class="nav-item">
<a href="client_quotes.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_quotes.php") { echo "active"; } ?>">
<a href="client_quotes.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_quotes.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-file"></i>
<p>
Quotes
<?php
if($num_quotes > 0){ ?>
if ($num_quotes > 0) { ?>
<span class="right badge badge-light"><?php echo $num_quotes; ?></span>
<?php } ?>
</p>
@ -278,12 +278,12 @@
</li>
<li class="nav-item">
<a href="client_payments.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_payments.php") { echo "active"; } ?>">
<a href="client_payments.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_payments.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-credit-card"></i>
<p>
Payments
<?php
if($num_payments > 0){ ?>
if ($num_payments > 0) { ?>
<span class="right badge badge-light"><?php echo $num_payments; ?></span>
<?php } ?>
</p>
@ -291,12 +291,12 @@
</li>
<li class="nav-item">
<a href="client_trips.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_trips.php") { echo "active"; } ?>">
<a href="client_trips.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_trips.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-route"></i>
<p>
Trips
<?php
if($num_trips > 0){ ?>
if ($num_trips > 0) { ?>
<span class="right badge badge-light"><?php echo $num_trips; ?></span>
<?php } ?>
</p>
@ -308,14 +308,14 @@
<li class="nav-header mt-3">MORE</li>
<li class="nav-item">
<a href="client_shared_items.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_shared_items.php") { echo "active"; } ?>">
<a href="client_shared_items.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_shared_items.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-share"></i>
<p>Shared Links</p>
</a>
</li>
<li class="nav-item">
<a href="client_logs.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if(basename($_SERVER["PHP_SELF"]) == "client_logs.php") { echo "active"; } ?>">
<a href="client_logs.php?client_id=<?php echo $client_id; ?>" class="nav-link <?php if (basename($_SERVER["PHP_SELF"]) == "client_logs.php") { echo "active"; } ?>">
<i class="nav-icon fas fa-eye"></i>
<p>Audit Logs</p>
</a>

View File

@ -2,7 +2,7 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "software_name";
@ -35,7 +35,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Licenses">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Licenses">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -53,7 +53,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=software_name&o=<?php echo $disp; ?>">Software</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=software_type&o=<?php echo $disp; ?>">Type</a></th>
@ -66,7 +66,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$software_id = $row['software_id'];
$software_name = htmlentities($row['software_name']);
$software_version = htmlentities($row['software_version']);
@ -88,7 +88,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
// Asset Licenses
$asset_licenses_sql = mysqli_query($mysqli,"SELECT asset_id FROM software_assets WHERE software_id = $software_id");
$asset_licenses_array = array();
while($row = mysqli_fetch_array($asset_licenses_sql)){
while ($row = mysqli_fetch_array($asset_licenses_sql)) {
$asset_licenses_array[] = $row['asset_id'];
$seat_count = $seat_count + 1;
}
@ -97,7 +97,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
// Contact Licenses
$contact_licenses_sql = mysqli_query($mysqli,"SELECT contact_id FROM software_contacts WHERE software_id = $software_id");
$contact_licenses_array = array();
while($row = mysqli_fetch_array($contact_licenses_sql)){
while ($row = mysqli_fetch_array($contact_licenses_sql)) {
$contact_licenses_array[] = $row['contact_id'];
$seat_count = $seat_count + 1;
}
@ -113,7 +113,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo "$seat_count / $software_seats"; ?></td>
<td>
<?php
if($login_id > 0){
if ($login_id > 0) {
?>
<button type="button" class="btn btn-dark btn-sm" data-toggle="modal" data-target="#viewPasswordModal<?php echo $login_id; ?>"><i class="fas fa-key"></i></button>
@ -160,7 +160,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editSoftwareModal<?php echo $software_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_software=<?php echo $software_id; ?>">Delete</a>
<?php } ?>

View File

@ -138,7 +138,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$asset_id = $row['asset_id'];
$asset_name = htmlentities($row['asset_name']);
$asset_type = htmlentities($row['asset_type']);
@ -171,7 +171,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_email = htmlentities($row['contact_email']);

View File

@ -64,7 +64,7 @@
</div>
<select class="form-control select2" name="type" required>
<?php foreach($software_types_array as $software_type_select) { ?>
<option <?php if($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
<option <?php if ($software_type == $software_type_select) { echo "selected"; } ?>><?php echo $software_type_select; ?></option>
<?php } ?>
</select>
</div>
@ -79,7 +79,7 @@
<select class="form-control select2" name="license_type">
<option value="">- Select a License Type -</option>
<?php foreach($license_types_array as $license_type_select) { ?>
<option <?php if($license_type_select == $software_license_type){ echo "selected"; } ?>><?php echo $license_type_select; ?></option>
<option <?php if ($license_type_select == $software_license_type) { echo "selected"; } ?>><?php echo $license_type_select; ?></option>
<?php } ?>
</select>
</div>
@ -138,7 +138,7 @@
<?php
$sql_assets_select = mysqli_query($mysqli,"SELECT * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id WHERE asset_client_id = $client_id ORDER BY asset_name ASC");
while($row = mysqli_fetch_array($sql_assets_select)){
while ($row = mysqli_fetch_array($sql_assets_select)) {
$asset_id_select = $row['asset_id'];
$asset_name_select = htmlentities($row['asset_name']);
$asset_type_select = htmlentities($row['asset_type']);
@ -147,7 +147,7 @@
?>
<li class="list-group-item">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="assets[]" value="<?php echo $asset_id_select; ?>" <?php if(in_array($asset_id_select,$asset_licenses_array)){ echo "checked"; } ?>>
<input type="checkbox" class="form-check-input" name="assets[]" value="<?php echo $asset_id_select; ?>" <?php if (in_array($asset_id_select,$asset_licenses_array)) { echo "checked"; } ?>>
<label class="form-check-label ml-2"><?php echo "$asset_name_select - $contact_name_select"; ?></label>
</div>
</li>
@ -171,7 +171,7 @@
<?php
$sql_contacts_select = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_client_id = $client_id ORDER BY contact_name ASC");
while($row = mysqli_fetch_array($sql_contacts_select)){
while ($row = mysqli_fetch_array($sql_contacts_select)) {
$contact_id_select = $row['contact_id'];
$contact_name_select = htmlentities($row['contact_name']);
$contact_email_select = htmlentities($row['contact_email']);
@ -179,7 +179,7 @@
?>
<li class="list-group-item">
<div class="form-check">
<input type="checkbox" class="form-check-input" name="contacts[]" value="<?php echo $contact_id_select; ?>" <?php if(in_array("$contact_id_select",$contact_licenses_array)){ echo "checked"; } ?>>
<input type="checkbox" class="form-check-input" name="contacts[]" value="<?php echo $contact_id_select; ?>" <?php if (in_array("$contact_id_select",$contact_licenses_array)) { echo "checked"; } ?>>
<label class="form-check-label ml-2"><?php echo "$contact_name_select - $contact_email_select"; ?></label>
</div>
</li>

View File

@ -2,14 +2,14 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "ticket_number";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
@ -55,7 +55,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Tickets">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Tickets">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -73,7 +73,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_number&o=<?php echo $disp; ?>">Number</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=ticket_subject&o=<?php echo $disp; ?>">Subject</a></th>
@ -90,7 +90,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$ticket_id = $row['ticket_id'];
$ticket_prefix = htmlentities($row['ticket_prefix']);
$ticket_number = htmlentities($row['ticket_number']);
@ -101,7 +101,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$ticket_created_at = $row['ticket_created_at'];
$ticket_updated_at = $row['ticket_updated_at'];
if (empty($ticket_updated_at)) {
if($ticket_status == "Closed"){
if ($ticket_status == "Closed") {
$ticket_updated_at_display = "<p>Never</p>";
}
else{
@ -112,26 +112,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
$ticket_closed_at = $row['ticket_closed_at'];
if($ticket_status == "Open"){
if ($ticket_status == "Open") {
$ticket_status_display = "<span class='p-2 badge badge-primary'>$ticket_status</span>";
}elseif($ticket_status == "Working"){
}elseif ($ticket_status == "Working") {
$ticket_status_display = "<span class='p-2 badge badge-success'>$ticket_status</span>";
}else{
$ticket_status_display = "<span class='p-2 badge badge-secondary'>$ticket_status</span>";
}
if($ticket_priority == "High"){
if ($ticket_priority == "High") {
$ticket_priority_display = "<span class='p-2 badge badge-danger'>$ticket_priority</span>";
}elseif($ticket_priority == "Medium"){
}elseif ($ticket_priority == "Medium") {
$ticket_priority_display = "<span class='p-2 badge badge-warning'>$ticket_priority</span>";
}elseif($ticket_priority == "Low"){
}elseif ($ticket_priority == "Low") {
$ticket_priority_display = "<span class='p-2 badge badge-info'>$ticket_priority</span>";
}else{
$ticket_priority_display = "-";
}
$ticket_assigned_to = $row['ticket_assigned_to'];
if (empty($ticket_assigned_to)) {
if($ticket_status == "Closed"){
if ($ticket_status == "Closed") {
$ticket_assigned_to_display = "<p>Not Assigned</p>";
}
else{
@ -142,7 +142,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
if(empty($contact_name)){
if (empty($contact_name)) {
$contact_display = "-";
}else{
$contact_display = "$contact_name<br><small class='text-secondary'>$contact_email</small>";
@ -165,14 +165,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $ticket_updated_at_display; ?></td>
<td><?php echo $ticket_created_at; ?></td>
<td>
<?php if($ticket_status !== "Closed") { ?>
<?php if ($ticket_status !== "Closed") { ?>
<div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
<i class="fas fa-ellipsis-h"></i>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editTicketModal<?php echo $ticket_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_ticket=<?php echo $ticket_id; ?>">Delete</a>
<?php } ?>

View File

@ -2,20 +2,20 @@
<?php
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "trip_date";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
//Date From and Date To Filter
if(isset($_GET['dtf'])){
if (isset($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}else{
@ -52,7 +52,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Trips">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Trips">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -71,7 +71,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=trip_date&o=<?php echo $disp; ?>">Date</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Driver</a></th>
@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$trip_id = $row['trip_id'];
$trip_date = $row['trip_date'];
$trip_purpose = htmlentities($row['trip_purpose']);
@ -96,13 +96,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$round_trip = htmlentities($row['round_trip']);
$client_id = $row['trip_client_id'];
if($round_trip == 1){
if ($round_trip == 1) {
$round_trip_display = "<i class='fa fa-fw fa-sync-alt text-secondary'></i>";
}else{
$round_trip_display = "";
}
$user_name = htmlentities($row['user_name']);
if(empty($user_name)){
if (empty($user_name)) {
$user_name_display = "-";
}else{
$user_name_display = $user_name;

View File

@ -2,11 +2,11 @@
<?php
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$q);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $q;
}
}else{
@ -14,7 +14,7 @@ if(isset($_GET['q'])){
$phone_query = "";
}
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "vendor_name";
@ -53,7 +53,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Vendors Templates">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Vendors Templates">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -65,7 +65,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_description&o=<?php echo $disp; ?>">Description</a></th>
@ -76,18 +76,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
$vendor_description = htmlentities($row['vendor_description']);
if(empty($vendor_description)){
if (empty($vendor_description)) {
$vendor_description_display = "-";
}else{
$vendor_description_display = $vendor_description;
}
$vendor_account_number = htmlentities($row['vendor_account_number']);
$vendor_contact_name = htmlentities($row['vendor_contact_name']);
if(empty($vendor_contact_name)){
if (empty($vendor_contact_name)) {
$vendor_contact_name_display = "-";
}else{
$vendor_contact_name_display = $vendor_contact_name;
@ -107,7 +107,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<i class="fa fa-fw fa-building text-secondary"></i>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editVendorTemplateModal<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></a>
<?php
if(!empty($vendor_account_number)){
if (!empty($vendor_account_number)) {
?>
<br>
<small class="text-secondary"><?php echo $vendor_account_number; ?></small>
@ -118,7 +118,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $vendor_description_display; ?></td>
<td>
<?php
if(!empty($vendor_contact_name)){
if (!empty($vendor_contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><?php echo $vendor_contact_name_display; ?>
<br>
@ -128,7 +128,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($vendor_phone)){
if (!empty($vendor_phone)) {
?>
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $vendor_phone; ?>
<br>
@ -136,7 +136,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($vendor_email)){
if (!empty($vendor_email)) {
?>
<i class="fa fa-fw fa-envelope text-secondary mr-2 mb-2"></i><?php echo $vendor_email; ?>
<br>
@ -151,7 +151,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorTemplateModal<?php echo $vendor_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_vendor=<?php echo $vendor_id; ?>">Delete</a>
<?php } ?>

View File

@ -2,11 +2,11 @@
<?php
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,$_GET['q']));
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$q);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $q;
}
}else{
@ -14,7 +14,7 @@ if(isset($_GET['q'])){
$phone_query = "";
}
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "vendor_name";
@ -60,7 +60,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="col-md-4">
<div class="input-group mb-3 mb-md-0">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Vendors">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Vendors">
<div class="input-group-append">
<button class="btn btn-dark"><i class="fa fa-search"></i></button>
</div>
@ -79,7 +79,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th>
<th><a class="text-secondary" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_description&o=<?php echo $disp; ?>">Description</a></th>
@ -90,18 +90,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
$vendor_description = htmlentities($row['vendor_description']);
if(empty($vendor_description)){
if (empty($vendor_description)) {
$vendor_description_display = "-";
}else{
$vendor_description_display = $vendor_description;
}
$vendor_account_number = htmlentities($row['vendor_account_number']);
$vendor_contact_name = htmlentities($row['vendor_contact_name']);
if(empty($vendor_contact_name)){
if (empty($vendor_contact_name)) {
$vendor_contact_name_display = "-";
}else{
$vendor_contact_name_display = $vendor_contact_name;
@ -122,7 +122,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<i class="fa fa-fw fa-building text-secondary"></i>
<a class="text-dark" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>"><?php echo $vendor_name; ?></a>
<?php
if(!empty($vendor_account_number)){
if (!empty($vendor_account_number)) {
?>
<br>
<small class="text-secondary"><?php echo $vendor_account_number; ?></small>
@ -133,7 +133,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $vendor_description_display; ?></td>
<td>
<?php
if(!empty($vendor_contact_name)){
if (!empty($vendor_contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><?php echo $vendor_contact_name_display; ?>
<br>
@ -143,7 +143,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($vendor_phone)){
if (!empty($vendor_phone)) {
?>
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $vendor_phone; ?>
<br>
@ -151,7 +151,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($vendor_email)){
if (!empty($vendor_email)) {
?>
<i class="fa fa-fw fa-envelope text-secondary mr-2 mb-2"></i><?php echo $vendor_email; ?>
<br>
@ -166,7 +166,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editVendorModal<?php echo $vendor_id; ?>">Edit</a>
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?delete_vendor=<?php echo $vendor_id; ?>">Delete</a>
<?php } ?>

View File

@ -3,7 +3,7 @@
include("inc_all.php");
//Paging
if(isset($_GET['p'])){
if (isset($_GET['p'])) {
$p = intval($_GET['p']);
$record_from = (($p)-1)*$_SESSION['records_per_page'];
$record_to = $_SESSION['records_per_page'];
@ -14,11 +14,11 @@ if(isset($_GET['p'])){
}
//Custom Query Filter
if(isset($_GET['query'])){
if (isset($_GET['query'])) {
$query = strip_tags(mysqli_real_escape_string($mysqli,$_GET['query']));
//Phone Numbers
$phone_query = preg_replace("/[^0-9]/", '',$query);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $query;
}
}else{
@ -27,15 +27,15 @@ if(isset($_GET['query'])){
}
//Column Filter
if(!empty($_GET['sortby'])){
if (!empty($_GET['sortby'])) {
$sortby = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sortby']));
}else{
$sortby = "client_accessed_at";
}
//Column Order Filter
if(isset($_GET['order'])){
if($_GET['order'] == 'ASC'){
if (isset($_GET['order'])) {
if ($_GET['order'] == 'ASC') {
$order = "ASC";
$order_display = "DESC";
}else{
@ -47,38 +47,38 @@ if(isset($_GET['order'])){
$order_display = "ASC";
}
if(empty($_GET['canned_date'])) {
if (empty($_GET['canned_date'])) {
//Prevents lots of undefined variable errors.
// $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00
$_GET['canned_date'] = 'custom';
}
//Date Filter
if($_GET['canned_date'] == "custom" && !empty($_GET['date_from'])){
if ($_GET['canned_date'] == "custom" && !empty($_GET['date_from'])) {
$date_from = strip_tags(mysqli_real_escape_string($mysqli,$_GET['date_from']));
$date_to = strip_tags(mysqli_real_escape_string($mysqli,$_GET['date_to']));
}elseif($_GET['canned_date'] == "today"){
}elseif ($_GET['canned_date'] == "today") {
$date_from = date('Y-m-d');
$date_to = date('Y-m-d');
}elseif($_GET['canned_date'] == "yesterday"){
}elseif ($_GET['canned_date'] == "yesterday") {
$date_from = date('Y-m-d',strtotime("yesterday"));
$date_to = date('Y-m-d',strtotime("yesterday"));
}elseif($_GET['canned_date'] == "thisweek"){
}elseif ($_GET['canned_date'] == "thisweek") {
$date_from = date('Y-m-d',strtotime("monday this week"));
$date_to = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastweek"){
}elseif ($_GET['canned_date'] == "lastweek") {
$date_from = date('Y-m-d',strtotime("monday last week"));
$date_to = date('Y-m-d',strtotime("sunday last week"));
}elseif($_GET['canned_date'] == "thismonth"){
}elseif ($_GET['canned_date'] == "thismonth") {
$date_from = date('Y-m-01');
$date_to = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastmonth"){
}elseif ($_GET['canned_date'] == "lastmonth") {
$date_from = date('Y-m-d',strtotime("first day of last month"));
$date_to = date('Y-m-d',strtotime("last day of last month"));
}elseif($_GET['canned_date'] == "thisyear"){
}elseif ($_GET['canned_date'] == "thisyear") {
$date_from = date('Y-01-01');
$date_to = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastyear"){
}elseif ($_GET['canned_date'] == "lastyear") {
$date_from = date('Y-m-d',strtotime("first day of january last year"));
$date_to = date('Y-m-d',strtotime("last day of december last year"));
}else{
@ -108,7 +108,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="card-header py-2">
<h3 class="card-title mt-2"><i class="fa fa-fw fa-users"></i> Clients</h3>
<div class="card-tools">
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addClientModal"><i class="fas fa-fw fa-plus"></i> New Client</button>
<?php } ?>
</div>
@ -119,7 +119,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="query" value="<?php if(isset($query)){echo strip_tags(htmlentities($query));} ?>" placeholder="Search Clients" autofocus>
<input type="search" class="form-control" name="query" value="<?php if (isset($query)) {echo strip_tags(htmlentities($query));} ?>" placeholder="Search Clients" autofocus>
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@ -127,21 +127,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['date_from'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['date_from'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="custom">Custom</option>
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="custom">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
@ -163,19 +163,19 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-hover table-borderless">
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=client_name&order=<?php echo $order_display; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=location_city&order=<?php echo $order_display; ?>">Address </a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sortby; ?>&sortby=contact_name&order=<?php echo $order_display; ?>">Contact</a></th>
<?php if($session_user_role == 3 || $session_user_role == 1 && $config_module_enable_accounting == 1) { ?> <th class="text-right">Billing</th> <?php } ?>
<?php if($session_user_role == 3) { ?> <th class="text-center">Action</th> <?php } ?>
<?php if ($session_user_role == 3 || $session_user_role == 1 && $config_module_enable_accounting == 1) { ?> <th class="text-right">Billing</th> <?php } ?>
<?php if ($session_user_role == 3) { ?> <th class="text-center">Action</th> <?php } ?>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$client_id = $row['client_id'];
$client_name = htmlentities($row['client_name']);
$client_type = htmlentities($row['client_type']);
@ -185,7 +185,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$location_city = htmlentities($row['location_city']);
$location_state = htmlentities($row['location_state']);
$location_zip = htmlentities($row['location_zip']);
if(empty($location_address) && empty($location_city) && empty($location_state) && empty($location_zip)){
if (empty($location_address) && empty($location_city) && empty($location_state) && empty($location_zip)) {
$location_address_display = "-";
}else{
$location_address_display = "$location_address<br>$location_city $location_state $location_zip";
@ -211,18 +211,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$client_tag_name_display_array = array();
$client_tag_id_array = array();
$sql_client_tags = mysqli_query($mysqli,"SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_tags.client_id = $client_id");
while($row = mysqli_fetch_array($sql_client_tags)){
while ($row = mysqli_fetch_array($sql_client_tags)) {
$client_tag_id = $row['tag_id'];
$client_tag_name = htmlentities($row['tag_name']);
$client_tag_color = htmlentities($row['tag_color']);
$client_tag_icon = htmlentities($row['tag_icon']);
if(empty($client_tag_icon)){
if (empty($client_tag_icon)) {
$client_tag_icon = "tag";
}
$client_tag_id_array[] = $client_tag_id;
if(empty($client_tag_color)){
if (empty($client_tag_color)) {
$client_tag_name_display_array[] = "<small class='text-secondary'>$client_tag_name</small> ";
}else{
$client_tag_name_display_array[] = "<span class='badge bg-$client_tag_color'><i class='fa fa-fw fa-$client_tag_icon'></i> $client_tag_name</span> ";
@ -243,7 +243,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$balance = $invoice_amounts - $amount_paid;
//set Text color on balance
if($balance > 0){
if ($balance > 0) {
$balance_text_color = "text-danger font-weight-bold";
}else{
$balance_text_color = "";
@ -268,13 +268,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td>
<strong><a href="client_overview.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a></strong>
<?php
if(!empty($client_type)){
if (!empty($client_type)) {
?>
<br>
<small class="text-secondary"><?php echo $client_type; ?></small>
<?php } ?>
<?php
if(!empty($client_tags_display)){
if (!empty($client_tags_display)) {
?>
<br>
<?php echo $client_tags_display; ?>
@ -285,12 +285,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<td><?php echo $location_address_display; ?></td>
<td>
<?php
if(empty($contact_name) && empty($contact_phone) && empty($contact_mobile) && empty($client_email)){
if (empty($contact_name) && empty($contact_phone) && empty($contact_mobile) && empty($client_email)) {
echo "-";
}
?>
<?php
if(!empty($contact_name)){
if (!empty($contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary mr-2 mb-2"></i><strong><?php echo $contact_name; ?></strong>
<br>
@ -300,15 +300,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($contact_phone)){
if (!empty($contact_phone)) {
?>
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $contact_phone; ?> <?php if(!empty($contact_extension)){ echo "x$contact_extension"; } ?>
<i class="fa fa-fw fa-phone text-secondary mr-2 mb-2"></i><?php echo $contact_phone; ?> <?php if (!empty($contact_extension)) { echo "x$contact_extension"; } ?>
<br>
<?php
}
?>
<?php
if(!empty($contact_mobile)){
if (!empty($contact_mobile)) {
?>
<i class="fa fa-fw fa-mobile-alt text-secondary mr-2"></i><?php echo $contact_mobile; ?>
<br>
@ -316,7 +316,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
}
?>
<?php
if(!empty($contact_email)){
if (!empty($contact_email)) {
?>
<i class="fa fa-fw fa-envelope text-secondary mr-2"></i><a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button>
<?php
@ -325,7 +325,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</td>
<!-- Show Billing for Admin/Accountant roles only and if accounting module is enabled -->
<?php if($session_user_role == 3 || $session_user_role == 1 && $config_module_enable_accounting == 1) { ?>
<?php if ($session_user_role == 3 || $session_user_role == 1 && $config_module_enable_accounting == 1) { ?>
<td class="text-right">
<span class="text-secondary">Balance</span> <span class="<?php echo $balance_text_color; ?>"><?php echo numfmt_format_currency($currency_format, $balance, $session_company_currency); ?></span>
<br>

View File

@ -1,6 +1,6 @@
<?php include("inc_all_settings.php");
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "company_name";
@ -32,7 +32,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<form autocomplete="off">
<div class="input-group">
<input type="search" class="form-control col-md-4" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Companies">
<input type="search" class="form-control col-md-4" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Companies">
<div class="input-group-append">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
@ -41,7 +41,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th class="text-center"><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=company_name&o=<?php echo $disp; ?>">Name</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=company_address&o=<?php echo $disp; ?>">Address</a></th>
@ -54,7 +54,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$company_id = $row['company_id'];
$company_name = htmlentities($row['company_name']);
$company_country = htmlentities($row['company_country']);
@ -78,7 +78,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tr>
<td class="text-center">
<a class="text-dark" href="#" data-toggle="modal" data-target="#editCompanyModal<?php echo $company_id; ?>">
<?php if(!empty($company_logo)){ ?>
<?php if (!empty($company_logo)) { ?>
<img height="48" width="48" class="img-fluid rounded-circle" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>">
<?php }else{ ?>
<span class="fa-stack fa-2x">

View File

@ -102,7 +102,7 @@
<select class="form-control select2" name="country">
<option value="">- Country -</option>
<?php foreach($countries_array as $country_name) { ?>
<option <?php if($company_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
<option <?php if ($company_country == $country_name) { echo "selected"; } ?>><?php echo $country_name; ?></option>
<?php } ?>
</select>
</div>
@ -155,7 +155,7 @@
<select class="form-control select2" name="locale" required>
<option value="">- Select a Locale -</option>
<?php foreach($locales_array as $locale_code => $locale_name) { ?>
<option <?php if($company_locale == $locale_code){ echo "selected"; } ?> value="<?php echo $locale_code; ?>"><?php echo "$locale_code - $locale_name"; ?></option>
<option <?php if ($company_locale == $locale_code) { echo "selected"; } ?> value="<?php echo $locale_code; ?>"><?php echo "$locale_code - $locale_name"; ?></option>
<?php } ?>
</select>
</div>
@ -170,7 +170,7 @@
<select class="form-control select2" name="currency_code" required>
<option value="">- Currency -</option>
<?php foreach($currencies_array as $currency_code => $currency_name) { ?>
<option <?php if($company_currency == $currency_code){ echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<option <?php if ($company_currency == $currency_code) { echo "selected"; } ?> value="<?php echo $currency_code; ?>"><?php echo "$currency_code - $currency_name"; ?></option>
<?php } ?>
</select>
</div>

View File

@ -8,7 +8,7 @@
$sql_companies = mysqli_query($mysqli,"SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id");
while($row = mysqli_fetch_array($sql_companies)){
while ($row = mysqli_fetch_array($sql_companies)) {
$company_id = $row['company_id'];
$company_name = $row['company_name'];
$company_phone = formatPhoneNumber($row['company_phone']);
@ -36,7 +36,7 @@ while($row = mysqli_fetch_array($sql_companies)){
// Set Currency Format
$currency_format = numfmt_create($company_locale, NumberFormatter::CURRENCY);
if($config_enable_cron == 1){
if ($config_enable_cron == 1) {
//Logging
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Cron', log_action = 'Started', log_description = 'Cron started for $company_name', company_id = $company_id");
@ -47,7 +47,7 @@ while($row = mysqli_fetch_array($sql_companies)){
$domainAlertArray = [1,7,14,30,90,120];
foreach($domainAlertArray as $day){
foreach($domainAlertArray as $day) {
//Get Domains Expiring
$sql = mysqli_query($mysqli,"SELECT * FROM domains
@ -56,7 +56,7 @@ while($row = mysqli_fetch_array($sql_companies)){
AND domains.company_id = $company_id"
);
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$domain_id = $row['domain_id'];
$domain_name = mysqli_real_escape_string($mysqli,$row['domain_name']);
$domain_expire = $row['domain_expire'];
@ -73,7 +73,7 @@ while($row = mysqli_fetch_array($sql_companies)){
$certificateAlertArray = [1,7,14,30,90,120];
foreach($certificateAlertArray as $day){
foreach($certificateAlertArray as $day) {
//Get Certs Expiring
$sql = mysqli_query($mysqli,"SELECT * FROM certificates
@ -82,7 +82,7 @@ while($row = mysqli_fetch_array($sql_companies)){
AND certificates.company_id = $company_id"
);
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$certificate_id = $row['certificate_id'];
$certificate_name = mysqli_real_escape_string($mysqli,$row['certificate_name']);
$certificate_domain = $row['certificate_domain'];
@ -100,7 +100,7 @@ while($row = mysqli_fetch_array($sql_companies)){
$warranty_alert_array = [1,7,14,30,90,120];
foreach($warranty_alert_array as $day){
foreach($warranty_alert_array as $day) {
//Get Asset Warranty Expiring
$sql = mysqli_query($mysqli,"SELECT * FROM assets
@ -109,7 +109,7 @@ while($row = mysqli_fetch_array($sql_companies)){
AND assets.company_id = $company_id"
);
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$asset_id = $row['asset_id'];
$asset_name = mysqli_real_escape_string($mysqli,$row['asset_name']);
$asset_warranty_expire = $row['asset_warranty_expire'];
@ -131,8 +131,8 @@ while($row = mysqli_fetch_array($sql_companies)){
// Get scheduled tickets for today
$sql_scheduled_tickets = mysqli_query($mysqli, "SELECT * FROM scheduled_tickets WHERE scheduled_ticket_next_run = '$today_text'");
if(mysqli_num_rows($sql_scheduled_tickets) > 0){
while($row = mysqli_fetch_array($sql_scheduled_tickets)){
if (mysqli_num_rows($sql_scheduled_tickets) > 0) {
while ($row = mysqli_fetch_array($sql_scheduled_tickets)) {
$schedule_id = $row['scheduled_ticket_id'];
$subject = mysqli_real_escape_string($mysqli,$row['scheduled_ticket_subject']);
$details = mysqli_real_escape_string($mysqli,$row['scheduled_ticket_details']);
@ -156,24 +156,24 @@ while($row = mysqli_fetch_array($sql_companies)){
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Ticket', log_action = 'Create', log_description = 'System created scheduled $frequency ticket - $subject', log_created_at = NOW(), log_client_id = $client_id, company_id = $company_id, log_user_id = $created_id");
// Set the next run date
if($frequency == "weekly"){
if ($frequency == "weekly") {
// Note: We seemingly have to initialize a new datetime for each loop to avoid stacking the dates
$now = new DateTime();
$next_run = date_add($now, date_interval_create_from_date_string('1 week'));
}
elseif($frequency == "monthly"){
elseif ($frequency == "monthly") {
$now = new DateTime();
$next_run = date_add($now, date_interval_create_from_date_string('1 month'));
}
elseif($frequency == "quarterly"){
elseif ($frequency == "quarterly") {
$now = new DateTime();
$next_run = date_add($now, date_interval_create_from_date_string('3 months'));
}
elseif($frequency == "biannually"){
elseif ($frequency == "biannually") {
$now = new DateTime();
$next_run = date_add($now, date_interval_create_from_date_string('6 months'));
}
elseif($frequency == "annually"){
elseif ($frequency == "annually") {
$now = new DateTime();
$next_run = date_add($now, date_interval_create_from_date_string('12 months'));
}
@ -201,7 +201,7 @@ while($row = mysqli_fetch_array($sql_companies)){
//$invoiceAlertArray = [$config_invoice_overdue_reminders];
$invoiceAlertArray = [30,60,90,120,150,180,210,240,270,300,330,360,390,420,450,480,510,540,570,590,620];
foreach($invoiceAlertArray as $day){
foreach($invoiceAlertArray as $day) {
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
LEFT JOIN clients ON invoice_client_id = client_id
@ -214,7 +214,7 @@ while($row = mysqli_fetch_array($sql_companies)){
ORDER BY invoice_number DESC"
);
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = $row['invoice_prefix'];
$invoice_number = $row['invoice_number'];
@ -259,7 +259,7 @@ while($row = mysqli_fetch_array($sql_companies)){
//Loop through all recurring that match today's date and is active
$sql_recurring = mysqli_query($mysqli,"SELECT * FROM recurring LEFT JOIN clients ON client_id = recurring_client_id WHERE recurring_next_date = CURDATE() AND recurring_status = 1 AND recurring.company_id = $company_id");
while($row = mysqli_fetch_array($sql_recurring)){
while ($row = mysqli_fetch_array($sql_recurring)) {
$recurring_id = $row['recurring_id'];
$recurring_scope = $row['recurring_scope'];
$recurring_frequency = $row['recurring_frequency'];
@ -294,7 +294,7 @@ while($row = mysqli_fetch_array($sql_companies)){
//Copy Items from original recurring invoice to new invoice
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id ORDER BY item_id ASC");
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_id = $row['item_id'];
$item_name = mysqli_real_escape_string($mysqli,$row['item_name']); //SQL Escape incase of ,
$item_description = mysqli_real_escape_string($mysqli,$row['item_description']); //SQL Escape incase of ,
@ -318,7 +318,7 @@ while($row = mysqli_fetch_array($sql_companies)){
mysqli_query($mysqli,"UPDATE recurring SET recurring_last_sent = CURDATE(), recurring_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_frequency), recurring_updated_at = NOW() WHERE recurring_id = $recurring_id");
if($config_recurring_auto_send_invoice == 1){
if ($config_recurring_auto_send_invoice == 1) {
$sql = mysqli_query($mysqli,"SELECT * FROM invoices
LEFT JOIN clients ON invoice_client_id = client_id
LEFT JOIN contacts ON contact_id = primary_contact

View File

@ -114,13 +114,13 @@ $vendors_added = $row['vendors_added'];
<select onchange="this.form.submit()" class="form-control" name="year">
<?php
while($row = mysqli_fetch_array($sql_years_select)){
while ($row = mysqli_fetch_array($sql_years_select)) {
$year_select = $row['all_years'];
if(empty($year_select)){
if (empty($year_select)) {
$year_select = date('Y');
}
?>
<option <?php if($year == $year_select){ echo "selected"; } ?> > <?php echo $year_select; ?></option>
<option <?php if ($year == $year_select) { echo "selected"; } ?> > <?php echo $year_select; ?></option>
<?php
}
@ -326,7 +326,7 @@ $vendors_added = $row['vendors_added'];
<table class="table">
<tbody>
<?php
while($row = mysqli_fetch_array($sql_accounts)){
while ($row = mysqli_fetch_array($sql_accounts)) {
$account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']);
$opening_balance = $row['opening_balance'];
@ -349,7 +349,7 @@ $vendors_added = $row['vendors_added'];
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
if($balance == ''){
if ($balance == '') {
$balance = '0.00';
}
?>
@ -386,7 +386,7 @@ $vendors_added = $row['vendors_added'];
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql_latest_invoice_payments)){
while ($row = mysqli_fetch_array($sql_latest_invoice_payments)) {
$payment_date = $row['payment_date'];
$payment_amount = floatval($row['payment_amount']);
$invoice_prefix = htmlentities($row['invoice_prefix']);
@ -429,7 +429,7 @@ $vendors_added = $row['vendors_added'];
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql_latest_expenses)){
while ($row = mysqli_fetch_array($sql_latest_expenses)) {
$expense_date = $row['expense_date'];
$expense_amount = floatval($row['expense_amount']);
$vendor_name = htmlentities($row['vendor_name']);
@ -505,7 +505,7 @@ var myLineChart = new Chart(ctx, {
$income_for_month = $payments_for_month + $revenues_for_month;
if($income_for_month > 0 && $income_for_month > $largest_income_month){
if ($income_for_month > 0 && $income_for_month > $largest_income_month) {
$largest_income_month = $income_for_month;
}
@ -544,7 +544,7 @@ var myLineChart = new Chart(ctx, {
$income_for_month = $payments_for_month + $revenues_for_month;
if($income_for_month > 0 && $income_for_month > $largest_income_month){
if ($income_for_month > 0 && $income_for_month > $largest_income_month) {
$largest_income_month = $income_for_month;
}
@ -580,7 +580,7 @@ var myLineChart = new Chart(ctx, {
$row = mysqli_fetch_array($sql_projected);
$invoice_for_month = $row['invoice_amount_for_month'];
if($invoice_for_month > 0 && $invoice_for_month > $largest_invoice_month){
if ($invoice_for_month > 0 && $invoice_for_month > $largest_invoice_month) {
$largest_invoice_month = $invoice_for_month;
}
@ -616,7 +616,7 @@ var myLineChart = new Chart(ctx, {
$row = mysqli_fetch_array($sql_expenses);
$expenses_for_month = $row['expense_amount_for_month'];
if($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month){
if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) {
$largest_expense_month = $expenses_for_month;
}
@ -693,7 +693,7 @@ var myLineChart = new Chart(ctx, {
$trip_miles_for_month = $row['trip_miles_for_month'];
$largest_trip_miles_month = 0;
if($trip_miles_for_month > 0 && $trip_miles_for_month > $largest_trip_miles_month){
if ($trip_miles_for_month > 0 && $trip_miles_for_month > $largest_trip_miles_month) {
$largest_trip_miles_month = $trip_miles_for_month;
}
@ -752,7 +752,7 @@ var myPieChart = new Chart(ctx, {
labels: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_name = json_encode($row['category_name']);
echo "$category_name,";
}
@ -764,7 +764,7 @@ var myPieChart = new Chart(ctx, {
data: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id FROM categories, invoices WHERE invoice_category_id = category_id AND invoice_status = 'Paid' AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_id = $row['category_id'];
$sql_invoices = mysqli_query($mysqli,"SELECT SUM(invoice_amount) AS income_amount_for_year FROM invoices WHERE invoice_category_id = $category_id AND YEAR(invoice_date) = $year AND company_id = $session_company_id");
@ -779,7 +779,7 @@ var myPieChart = new Chart(ctx, {
backgroundColor: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_id, category_color FROM categories, invoices WHERE invoice_category_id = category_id AND YEAR(invoice_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_color = json_encode($row['category_color']);
echo "$category_color,";
}
@ -809,7 +809,7 @@ var myPieChart = new Chart(ctx, {
labels: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_name = json_encode($row['category_name']);
echo "$category_name,";
}
@ -821,7 +821,7 @@ var myPieChart = new Chart(ctx, {
data: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, categories.category_id FROM categories, expenses WHERE expense_category_id = category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_id = $row['category_id'];
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_category_id = $category_id AND YEAR(expense_date) = $year");
@ -836,7 +836,7 @@ var myPieChart = new Chart(ctx, {
backgroundColor: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = categories.category_id AND expense_vendor_id > 0 AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_color = json_encode($row['category_color']);
echo "$category_color,";
}
@ -862,7 +862,7 @@ var myPieChart = new Chart(ctx, {
labels: [
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_name = json_encode($row['vendor_name']);
echo "$vendor_name,";
}
@ -874,7 +874,7 @@ var myPieChart = new Chart(ctx, {
data: [
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT DISTINCT vendor_name, vendor_id FROM vendors, expenses WHERE expense_vendor_id = vendor_id AND YEAR(expense_date) = $year AND vendors.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id = $row['vendor_id'];
$sql_expenses = mysqli_query($mysqli,"SELECT SUM(expense_amount) AS expense_amount_for_year FROM expenses WHERE expense_vendor_id = $vendor_id AND YEAR(expense_date) = $year");
@ -889,7 +889,7 @@ var myPieChart = new Chart(ctx, {
backgroundColor: [
<?php
$sql_categories = mysqli_query($mysqli,"SELECT DISTINCT category_name, category_color FROM categories, expenses WHERE expense_category_id = category_id AND YEAR(expense_date) = $year AND categories.company_id = $session_company_id");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_color = json_encode($row['category_color']);
echo "$category_color,";
}

View File

@ -7,17 +7,17 @@
// Check if our database versions are defined
// If undefined, the file is probably being accessed directly rather than called via post.php?update_db
if(!defined("LATEST_DATABASE_VERSION") || !defined("CURRENT_DATABASE_VERSION") || !isset($mysqli)){
if (!defined("LATEST_DATABASE_VERSION") || !defined("CURRENT_DATABASE_VERSION") || !isset($mysqli)) {
echo "Cannot access this file directly.";
exit();
}
// Check if we need an update
if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
if (LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION) {
// We need updates!
if(CURRENT_DATABASE_VERSION == '0.0.1'){
if (CURRENT_DATABASE_VERSION == '0.0.1') {
// Insert queries here required to update to DB version 0.0.2
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_module_enable_itdoc` TINYINT(1) DEFAULT 1 AFTER `config_backup_path`");
@ -28,7 +28,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.2'");
}
if(CURRENT_DATABASE_VERSION == '0.0.2'){
if (CURRENT_DATABASE_VERSION == '0.0.2') {
// Insert queries here required to update to DB version 0.0.3
// Add document content raw column & index
@ -36,7 +36,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
// Populate content raw column with existing document data
$documents_sql = mysqli_query($mysqli, "SELECT * FROM `documents`");
while($row = mysqli_fetch_array($documents_sql)){
while ($row = mysqli_fetch_array($documents_sql)) {
$id = $row['document_id'];
$name = $row['document_name'];
$content = $row['document_content'];
@ -52,7 +52,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.3'");
}
if(CURRENT_DATABASE_VERSION == '0.0.3'){
if (CURRENT_DATABASE_VERSION == '0.0.3') {
// Insert queries here required to update to DB version 0.0.4
// mysqli_query($mysqli, "ALTER TABLE .....");
@ -151,7 +151,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
}
if(CURRENT_DATABASE_VERSION == '0.0.4'){
if (CURRENT_DATABASE_VERSION == '0.0.4') {
// Queries here required to update to DB version 0.0.5
mysqli_query($mysqli, "ALTER TABLE `assets` DROP `asset_meshcentral_id`;");
@ -162,7 +162,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.5'");
}
if(CURRENT_DATABASE_VERSION == '0.0.5'){
if (CURRENT_DATABASE_VERSION == '0.0.5') {
// Insert queries here required to update to DB version 0.0.6
mysqli_query($mysqli, "UPDATE documents SET document_folder_id = 0");
@ -175,7 +175,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE settings SET config_current_database_version = '0.0.6'");
}
if(CURRENT_DATABASE_VERSION == '0.0.6'){
if (CURRENT_DATABASE_VERSION == '0.0.6') {
// Insert queries here required to update to DB version 0.0.7
mysqli_query($mysqli, "ALTER TABLE contacts ADD contact_department VARCHAR(200) NULL AFTER contact_title");
mysqli_query($mysqli, "DROP TABLE departments");
@ -184,7 +184,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.7'");
}
if(CURRENT_DATABASE_VERSION == '0.0.7'){
if (CURRENT_DATABASE_VERSION == '0.0.7') {
// Insert queries here required to update to DB version 0.0.8
// Add contact_department column to tables without it (fresh installs) - this will cause an error if it already exists so catch and discard it
@ -198,7 +198,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.8'");
}
if(CURRENT_DATABASE_VERSION == '0.0.8'){
if (CURRENT_DATABASE_VERSION == '0.0.8') {
// Insert queries here required to update to DB version 0.0.9
mysqli_query($mysqli, "ALTER TABLE `revenues` CHANGE `revenue_created_at` `revenue_created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, CHANGE `revenue_updated_at` `revenue_updated_at` DATETIME on update CURRENT_TIMESTAMP NULL DEFAULT NULL; ");
@ -207,7 +207,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.0.9'");
}
if(CURRENT_DATABASE_VERSION == '0.0.9'){
if (CURRENT_DATABASE_VERSION == '0.0.9') {
// Insert queries here required to update to DB version 0.0.9
// Remove unused tables
mysqli_query($mysqli, "DROP TABLE contracts");
@ -221,7 +221,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.0'");
}
if(CURRENT_DATABASE_VERSION == '0.1.0'){
if (CURRENT_DATABASE_VERSION == '0.1.0') {
// Insert queries here required to update to DB version 0.1.1
// Logs don't get archived
mysqli_query($mysqli, "ALTER TABLE `logs` DROP `log_archived_at`");
@ -241,7 +241,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.1'");
}
if(CURRENT_DATABASE_VERSION == '0.1.1'){
if (CURRENT_DATABASE_VERSION == '0.1.1') {
// Insert queries here required to update to DB version 0.1.2
// Create Many to Many Relationship tables for Assets, Contacts, Software and Vendors
@ -265,7 +265,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.2'");
}
if(CURRENT_DATABASE_VERSION == '0.1.2'){
if (CURRENT_DATABASE_VERSION == '0.1.2') {
// Insert queries here required to update to DB version 0.1.3
mysqli_query($mysqli, "ALTER TABLE `logs` ADD `log_entity_id` INT NOT NULL DEFAULT '0' AFTER `log_user_id`");
@ -273,7 +273,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.3'");
}
if(CURRENT_DATABASE_VERSION == '0.1.3'){
if (CURRENT_DATABASE_VERSION == '0.1.3') {
// Insert queries here required to update to DB version 0.1.4
mysqli_query($mysqli, "ALTER TABLE assets ADD asset_status VARCHAR(200) NULL AFTER asset_mac");
@ -281,7 +281,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.4'");
}
if(CURRENT_DATABASE_VERSION == '0.1.4'){
if (CURRENT_DATABASE_VERSION == '0.1.4') {
// Insert queries here required to update to DB version 0.1.5
mysqli_query($mysqli, "ALTER TABLE `domains` ADD `domain_txt` TEXT NULL DEFAULT NULL AFTER `domain_mail_servers`");
@ -289,7 +289,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.5'");
}
if(CURRENT_DATABASE_VERSION == '0.1.5'){
if (CURRENT_DATABASE_VERSION == '0.1.5') {
// Insert queries here required to update to DB version 0.1.6
// Remove Mailing List Tables
mysqli_query($mysqli, "DROP TABLE campaigns");
@ -299,7 +299,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.6'");
}
if(CURRENT_DATABASE_VERSION == '0.1.6'){
if (CURRENT_DATABASE_VERSION == '0.1.6') {
// Insert queries here required to update to DB version 0.1.7
//Remove custom links
mysqli_query($mysqli, "DROP TABLE custom_links");
@ -307,7 +307,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.7'");
}
if(CURRENT_DATABASE_VERSION == '0.1.7'){
if (CURRENT_DATABASE_VERSION == '0.1.7') {
// Insert queries here required to update to DB version 0.1.8
mysqli_query($mysqli, "ALTER TABLE `settings` DROP `config_backup_enable`");
mysqli_query($mysqli, "ALTER TABLE `settings` DROP `config_backup_path`");
@ -316,14 +316,14 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.8'");
}
if(CURRENT_DATABASE_VERSION == '0.1.8'){
if (CURRENT_DATABASE_VERSION == '0.1.8') {
// Insert queries here required to update to DB version 0.1.9
mysqli_query($mysqli, "ALTER TABLE `settings` DROP `config_base_url`");
// Then, update the database to the next sequential version
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.1.9'");
}
if(CURRENT_DATABASE_VERSION == '0.1.9'){
if (CURRENT_DATABASE_VERSION == '0.1.9') {
// Insert queries here required to update to DB version 0.2.0
// Allow contacts to reset their portal password
mysqli_query($mysqli, "ALTER TABLE contacts ADD contact_password_reset_token VARCHAR(200) NULL DEFAULT NULL AFTER contact_password_hash");
@ -332,7 +332,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.0'");
}
if(CURRENT_DATABASE_VERSION == '0.2.0'){
if (CURRENT_DATABASE_VERSION == '0.2.0') {
//Insert queries here required to update to DB version 0.2.1
mysqli_query($mysqli, "ALTER TABLE `vendors`
@ -369,7 +369,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.1'");
}
if(CURRENT_DATABASE_VERSION == '0.2.1'){
if (CURRENT_DATABASE_VERSION == '0.2.1') {
// Insert queries here required to update to DB version 0.2.2
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_ticket_email_parse` INT(1) NOT NULL DEFAULT '0' AFTER `config_ticket_from_email`");
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_imap_host` VARCHAR(200) NULL DEFAULT NULL AFTER `config_mail_from_name`, ADD `config_imap_port` INT(5) NULL DEFAULT NULL AFTER `config_imap_host`, ADD `config_imap_encryption` VARCHAR(200) NULL DEFAULT NULL AFTER `config_imap_port`;");
@ -378,7 +378,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.2'");
}
if(CURRENT_DATABASE_VERSION == '0.2.2'){
if (CURRENT_DATABASE_VERSION == '0.2.2') {
// Insert queries here required to update to DB version 0.2.3
// Add contact_important field to those who don't have it (installed before March 2022)
@ -392,7 +392,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.3'");
}
if(CURRENT_DATABASE_VERSION == '0.2.3'){
if (CURRENT_DATABASE_VERSION == '0.2.3') {
//Create New interfaces Table
mysqli_query($mysqli, "CREATE TABLE `interfaces` (`interface_id` int(11) AUTO_INCREMENT PRIMARY KEY,
@ -413,18 +413,18 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
}
if(CURRENT_DATABASE_VERSION == '0.2.4'){
if (CURRENT_DATABASE_VERSION == '0.2.4') {
mysqli_query($mysqli, "CREATE TABLE `contact_assets` (`contact_id` int(11) NOT NULL,`asset_id` int(11) NOT NULL, PRIMARY KEY (`contact_id`,`asset_id`))");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.5'");
}
if(CURRENT_DATABASE_VERSION == '0.2.5'){
if (CURRENT_DATABASE_VERSION == '0.2.5') {
mysqli_query($mysqli, "ALTER TABLE `users` ADD `user_status` TINYINT(1) DEFAULT 1 AFTER `user_password`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.6'");
}
if(CURRENT_DATABASE_VERSION == '0.2.6'){
if (CURRENT_DATABASE_VERSION == '0.2.6') {
// Insert queries here required to update to DB version 0.2.7
mysqli_query($mysqli, "ALTER TABLE `contacts` ADD `contact_token_expire` DATETIME NULL DEFAULT NULL AFTER `contact_password_reset_token`");
@ -436,7 +436,7 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.7'");
}
if(CURRENT_DATABASE_VERSION == '0.2.7'){
if (CURRENT_DATABASE_VERSION == '0.2.7') {
mysqli_query($mysqli, "ALTER TABLE `vendors` ADD `vendor_template` TINYINT(1) DEFAULT 0 AFTER `vendor_notes`");
mysqli_query($mysqli, "ALTER TABLE `software` ADD `software_template` TINYINT(1) DEFAULT 0 AFTER `software_notes`");
@ -446,14 +446,14 @@ if(LATEST_DATABASE_VERSION > CURRENT_DATABASE_VERSION){
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.8'");
}
if(CURRENT_DATABASE_VERSION == '0.2.8'){
if (CURRENT_DATABASE_VERSION == '0.2.8') {
mysqli_query($mysqli, "ALTER TABLE `settings` ADD `config_theme` VARCHAR(200) DEFAULT 'blue' AFTER `config_module_enable_ticketing`");
mysqli_query($mysqli, "UPDATE `settings` SET `config_current_database_version` = '0.2.9'");
}
//if(CURRENT_DATABASE_VERSION == '0.2.9'){
//if (CURRENT_DATABASE_VERSION == '0.2.9') {
// Insert queries here required to update to DB version 0.3.0
// Then, update the database to the next sequential version

View File

@ -44,7 +44,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE account_archived_at IS NULL AND company_id = $session_company_id ORDER BY account_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']);
$opening_balance = floatval($row['opening_balance']);
@ -64,7 +64,7 @@
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
<option <?php if($config_default_expense_account == $account_id){ echo "selected"; } ?> value="<?php echo $account_id; ?>"><div class="float-left"><?php echo $account_name; ?></div><div class="float-right"> [$<?php echo number_format($balance,2); ?>]</div></option>
<option <?php if ($config_default_expense_account == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><div class="float-left"><?php echo $account_name; ?></div><div class="float-right"> [$<?php echo number_format($balance,2); ?>]</div></option>
<?php
}
@ -84,7 +84,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 AND vendor_archived_at IS NULL AND company_id = $session_company_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$vendor_id = $row['vendor_id'];
$vendor_name = htmlentities($row['vendor_name']);
?>
@ -119,7 +119,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$category_id = $row['category_id'];
$category_name = htmlentities($row['category_name']);
?>

View File

@ -45,7 +45,7 @@
<?php
$sql_accounts = mysqli_query($mysqli,"SELECT * FROM accounts WHERE company_id = $session_company_id ORDER BY account_name ASC");
while($row = mysqli_fetch_array($sql_accounts)){
while ($row = mysqli_fetch_array($sql_accounts)) {
$account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']);
$opening_balance = floatval($row['opening_balance']);
@ -64,7 +64,7 @@
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
<option <?php if($expense_account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
<option <?php if ($expense_account_id == $account_id_select) { ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
<?php
}
@ -83,11 +83,11 @@
<?php
$sql_vendors = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 AND company_id = $session_company_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_id_select = $row['vendor_id'];
$vendor_name_select = htmlentities($row['vendor_name']);
?>
<option <?php if($expense_vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<option <?php if ($expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<?php
}
@ -115,11 +115,11 @@
<?php
$sql_categories = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense' AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql_categories)){
while ($row = mysqli_fetch_array($sql_categories)) {
$category_id_select = $row['category_id'];
$category_name_select = htmlentities($row['category_name']);
?>
<option <?php if($expense_category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<option <?php if ($expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<?php
}

View File

@ -47,7 +47,7 @@
<?php
$sql_accounts = mysqli_query($mysqli,"SELECT * FROM accounts WHERE (account_archived_at > '$expense_created_at' OR account_archived_at IS NULL) AND company_id = $session_company_id ORDER BY account_name ASC");
while($row = mysqli_fetch_array($sql_accounts)){
while ($row = mysqli_fetch_array($sql_accounts)) {
$account_id_select = $row['account_id'];
$account_name_select = htmlentities($row['account_name']);
$opening_balance = floatval($row['opening_balance']);
@ -67,7 +67,7 @@
$balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
<option <?php if($expense_account_id == $account_id_select){ ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
<option <?php if ($expense_account_id == $account_id_select) { ?> selected <?php } ?> value="<?php echo $account_id_select; ?>"><?php echo $account_name_select; ?> [$<?php echo number_format($balance,2); ?>]</option>
<?php
}
@ -86,11 +86,11 @@
<?php
$sql_select = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_client_id = 0 AND vendor_template = 0 AND (vendor_archived_at > '$expense_created_at' OR vendor_archived_at IS NULL) AND company_id = $session_company_id ORDER BY vendor_name ASC");
while($row = mysqli_fetch_array($sql_select)){
while ($row = mysqli_fetch_array($sql_select)) {
$vendor_id_select = $row['vendor_id'];
$vendor_name_select = htmlentities($row['vendor_name']);
?>
<option <?php if($expense_vendor_id == $vendor_id_select){ ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<option <?php if ($expense_vendor_id == $vendor_id_select) { ?> selected <?php } ?> value="<?php echo $vendor_id_select; ?>"><?php echo $vendor_name_select; ?></option>
<?php
}
@ -121,11 +121,11 @@
<?php
$sql_select = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Expense' AND (category_archived_at > '$expense_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql_select)){
while ($row = mysqli_fetch_array($sql_select)) {
$category_id_select = $row['category_id'];
$category_name_select = htmlentities($row['category_name']);
?>
<option <?php if($expense_category_id == $category_id_select){ ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<option <?php if ($expense_category_id == $category_id_select) { ?> selected <?php } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<?php
}
@ -154,7 +154,7 @@
<input type="file" class="form-control-file" name="file">
</div>
<?php if(!empty($expense_receipt)){ ?>
<?php if (!empty($expense_receipt)) { ?>
<hr>
<a class="text-secondary" href="<?php echo "uploads/expenses/$session_company_id/$expense_receipt"; ?>"><i class="fa fa-fw fa-2x fa-file-pdf text-secondary"></i> <?php echo basename($expense_receipt); ?></a>
<?php } ?>

View File

@ -2,50 +2,50 @@
//$o = "DESC";
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "expense_date";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
if(empty($_GET['canned_date'])){
if (empty($_GET['canned_date'])) {
//Prevents lots of undefined variable errors.
// $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00
$_GET['canned_date'] = 'custom';
}
//Date Filter
if($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])){
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}elseif($_GET['canned_date'] == "today"){
}elseif ($_GET['canned_date'] == "today") {
$dtf = date('Y-m-d');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "yesterday"){
}elseif ($_GET['canned_date'] == "yesterday") {
$dtf = date('Y-m-d',strtotime("yesterday"));
$dtt = date('Y-m-d',strtotime("yesterday"));
}elseif($_GET['canned_date'] == "thisweek"){
}elseif ($_GET['canned_date'] == "thisweek") {
$dtf = date('Y-m-d',strtotime("monday this week"));
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastweek"){
}elseif ($_GET['canned_date'] == "lastweek") {
$dtf = date('Y-m-d',strtotime("monday last week"));
$dtt = date('Y-m-d',strtotime("sunday last week"));
}elseif($_GET['canned_date'] == "thismonth"){
}elseif ($_GET['canned_date'] == "thismonth") {
$dtf = date('Y-m-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastmonth"){
}elseif ($_GET['canned_date'] == "lastmonth") {
$dtf = date('Y-m-d',strtotime("first day of last month"));
$dtt = date('Y-m-d',strtotime("last day of last month"));
}elseif($_GET['canned_date'] == "thisyear"){
}elseif ($_GET['canned_date'] == "thisyear") {
$dtf = date('Y-01-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastyear"){
}elseif ($_GET['canned_date'] == "lastyear") {
$dtf = date('Y-m-d',strtotime("first day of january last year"));
$dtt = date('Y-m-d',strtotime("last day of december last year"));
}else{
@ -83,7 +83,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo strip_tags(htmlentities($q));} ?>" placeholder="Search Expenses">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo strip_tags(htmlentities($q));} ?>" placeholder="Search Expenses">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@ -96,21 +96,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['dtf'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="">Custom</option>
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
@ -132,7 +132,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=expense_date&o=<?php echo $disp; ?>">Date</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=vendor_name&o=<?php echo $disp; ?>">Vendor</a></th>
@ -146,7 +146,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$expense_id = $row['expense_id'];
$expense_date = $row['expense_date'];
$expense_amount = floatval($row['expense_amount']);
@ -162,7 +162,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$account_name = htmlentities($row['account_name']);
$expense_account_id = $row['expense_account_id'];
if(empty($expense_receipt)){
if (empty($expense_receipt)) {
$receipt_attached = "";
}else{
$receipt_attached = "<a class='text-secondary mr-2' target='_blank' href='uploads/expenses/$session_company_id/$expense_receipt'><i class='fa fa-file-pdf'></i></a>";
@ -184,7 +184,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</button>
<div class="dropdown-menu">
<?php
if(!empty($expense_receipt)){
if (!empty($expense_receipt)) {
?>
<a class="dropdown-item" href="<?php echo "uploads/expenses/$session_company_id/$expense_receipt"; ?>" download="<?php echo "$expense_date-$vendor_name-$category_name-$expense_id.pdf"; ?>">Download</a>
<div class="dropdown-divider"></div>

View File

@ -43,7 +43,7 @@ function key32gen()
}
function initials($str) {
if(!empty($str)){
if (!empty($str)) {
$ret = '';
foreach (explode(' ', $str) as $word)
$ret .= strtoupper($word[0]);
@ -69,8 +69,8 @@ function get_user_agent() {
function get_ip() {
if(defined("CONST_GET_IP_METHOD")){
if(CONST_GET_IP_METHOD == "HTTP_X_FORWARDED_FOR"){
if (defined("CONST_GET_IP_METHOD")) {
if (CONST_GET_IP_METHOD == "HTTP_X_FORWARDED_FOR") {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
@ -132,7 +132,7 @@ function get_os($user_os) {
return $os_platform;
}
function get_device(){
function get_device() {
$tablet_browser = 0;
$mobile_browser = 0;
if (preg_match('/(tablet|ipad|playbook)|(android(?!.*(mobi|opera mini)))/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
@ -194,7 +194,7 @@ function truncate($text, $chars) {
function formatPhoneNumber($phoneNumber) {
$phoneNumber = preg_replace('/[^0-9]/','',$phoneNumber);
if(strlen($phoneNumber) > 10) {
if (strlen($phoneNumber) > 10) {
$countryCode = substr($phoneNumber, 0, strlen($phoneNumber)-10);
$areaCode = substr($phoneNumber, -10, 3);
$nextThree = substr($phoneNumber, -7, 3);
@ -202,14 +202,14 @@ function formatPhoneNumber($phoneNumber) {
$phoneNumber = '+'.$countryCode.' ('.$areaCode.') '.$nextThree.'-'.$lastFour;
}
else if(strlen($phoneNumber) == 10) {
else if (strlen($phoneNumber) == 10) {
$areaCode = substr($phoneNumber, 0, 3);
$nextThree = substr($phoneNumber, 3, 3);
$lastFour = substr($phoneNumber, 6, 4);
$phoneNumber = '('.$areaCode.') '.$nextThree.'-'.$lastFour;
}
else if(strlen($phoneNumber) == 7) {
else if (strlen($phoneNumber) == 7) {
$nextThree = substr($phoneNumber, 0, 3);
$lastFour = substr($phoneNumber, 3, 4);
@ -227,7 +227,7 @@ function mkdir_missing($dir) {
// Called during initial setup
// Encrypts the master key with the user's password
function setupFirstUserSpecificKey($user_password, $site_encryption_master_key){
function setupFirstUserSpecificKey($user_password, $site_encryption_master_key) {
$iv = bin2hex(random_bytes(8));
$salt = bin2hex(random_bytes(8));
@ -247,7 +247,7 @@ function setupFirstUserSpecificKey($user_password, $site_encryption_master_key){
* New Users: Requires the admin setting up their account have a Specific/Session key configured
* Password Changes: Will use the current info in the session.
*/
function encryptUserSpecificKey($user_password){
function encryptUserSpecificKey($user_password) {
$iv = bin2hex(random_bytes(8));
$salt = bin2hex(random_bytes(8));
@ -273,7 +273,7 @@ function encryptUserSpecificKey($user_password){
// Given a ciphertext (incl. IV) and the user's password, returns the site master key
// Ran at login, to facilitate generateUserSessionKey
function decryptUserSpecificKey($user_encryption_ciphertext, $user_password){
function decryptUserSpecificKey($user_encryption_ciphertext, $user_password) {
//Get the IV, salt and ciphertext
$salt = substr($user_encryption_ciphertext, 0, 16);
$iv = substr($user_encryption_ciphertext, 16, 16);
@ -294,7 +294,7 @@ Generates what is probably best described as a session key (ephemeral-ish)
- Only the user can decrypt their session ciphertext to get the master key
- Encryption key never hits the disk in cleartext
*/
function generateUserSessionKey($site_encryption_master_key){
function generateUserSessionKey($site_encryption_master_key) {
// Generate both of these using bin2hex(random_bytes(8))
$user_encryption_session_key = bin2hex(random_bytes(8));
@ -307,7 +307,7 @@ function generateUserSessionKey($site_encryption_master_key){
// Give the user "their" key as a cookie
include('config.php');
if($config_https_only){
if ($config_https_only) {
setcookie("user_encryption_session_key", "$user_encryption_session_key", ['path' => '/','secure' => true,'httponly' => true,'samesite' => 'None']);
} else{
setcookie("user_encryption_session_key", $user_encryption_session_key, 0, "/");
@ -316,7 +316,7 @@ function generateUserSessionKey($site_encryption_master_key){
}
// Decrypts an encrypted password (website/asset login), returns it as a string
function decryptLoginEntry($login_password_ciphertext){
function decryptLoginEntry($login_password_ciphertext) {
// Split the login into IV and Ciphertext
$login_iv = substr($login_password_ciphertext, 0, 16);
@ -337,7 +337,7 @@ function decryptLoginEntry($login_password_ciphertext){
}
// Encrypts a website/asset login password
function encryptLoginEntry($login_password_cleartext){
function encryptLoginEntry($login_password_cleartext) {
$iv = bin2hex(random_bytes(8));
// Get the user session info.
@ -356,10 +356,10 @@ function encryptLoginEntry($login_password_cleartext){
}
// Get domain expiration date
function getDomainExpirationDate($name){
function getDomainExpirationDate($name) {
// Only run if we think the domain is valid
if(!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
if (!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
return '0000-00-00';
}
@ -368,8 +368,8 @@ function getDomainExpirationDate($name){
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
$response = json_decode(curl_exec($ch),1);
if($response){
if(is_array($response['expiration_date'])){
if ($response) {
if (is_array($response['expiration_date'])) {
$expiry = new DateTime($response['expiration_date'][1]);
}
else{
@ -384,12 +384,12 @@ function getDomainExpirationDate($name){
}
// Get domain general info (whois + NS/A/MX records)
function getDomainRecords($name){
function getDomainRecords($name) {
$records = array();
// Only run if we think the domain is valid
if(!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
if (!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
$records['a'] = '';
$records['ns'] = '';
$records['mx'] = '';
@ -409,13 +409,13 @@ function getDomainRecords($name){
// Used to automatically attempt to get SSL certificates as part of adding domains
// The logic for the fetch (sync) button on the client_certificates page is in ajax.php, and allows ports other than 443
function getSSL($name){
function getSSL($name) {
$certificate = array();
$certificate['success'] = FALSE;
// Only run if we think the domain is valid
if(!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
if (!filter_var($name, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME)) {
$certificate['expire'] = '';
$certificate['issued_by'] = '';
$certificate['public_key'] = '';
@ -428,12 +428,12 @@ function getSSL($name){
$read = stream_socket_client($socket, $errno, $errstr, 5, STREAM_CLIENT_CONNECT, $get);
// If the socket connected
if($read){
if ($read) {
$cert = stream_context_get_params($read);
$cert_public_key_obj = openssl_x509_parse($cert['options']['ssl']['peer_certificate']);
openssl_x509_export($cert['options']['ssl']['peer_certificate'], $export);
if($cert_public_key_obj){
if ($cert_public_key_obj) {
$certificate['success'] = TRUE;
$certificate['expire'] = date('Y-m-d', $cert_public_key_obj['validTo_time_t']);
$certificate['issued_by'] = strip_tags($cert_public_key_obj['issuer']['O']);
@ -444,7 +444,7 @@ function getSSL($name){
return $certificate;
}
function strto_AZaz09($string){
function strto_AZaz09($string) {
$string = ucwords(strtolower($string));
// Replace spaces with _
@ -458,8 +458,8 @@ function strto_AZaz09($string){
// Cross-Site Request Forgery check for sensitive functions
// Validates the CSRF token provided matches the one in the users session
function validateCSRFToken($token){
if(hash_equals($token, $_SESSION['csrf_token'])){
function validateCSRFToken($token) {
if (hash_equals($token, $_SESSION['csrf_token'])) {
return true;
}
else{
@ -477,8 +477,8 @@ function validateCSRFToken($token){
* Accountant - 1
*/
function validateAdminRole(){
if(!isset($_SESSION['user_role']) || $_SESSION['user_role'] != 3){
function validateAdminRole() {
if (!isset($_SESSION['user_role']) || $_SESSION['user_role'] != 3) {
$_SESSION['alert_type'] = "danger";
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -486,8 +486,8 @@ function validateAdminRole(){
}
}
function validateTechRole(){
if(!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 1){
function validateTechRole() {
if (!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 1) {
$_SESSION['alert_type'] = "danger";
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -495,8 +495,8 @@ function validateTechRole(){
}
}
function validateAccountantRole(){
if(!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 2){
function validateAccountantRole() {
if (!isset($_SESSION['user_role']) || $_SESSION['user_role'] == 2) {
$_SESSION['alert_type'] = "danger";
$_SESSION['alert_message'] = WORDING_ROLECHECK_FAILED;
header("Location: " . $_SERVER["HTTP_REFERER"]);
@ -505,7 +505,7 @@ function validateAccountantRole(){
}
// Send a single email to a single recipient
function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_password, $config_smtp_encryption, $config_smtp_port, $from_email, $from_name, $to_email, $to_name, $subject, $body){
function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_password, $config_smtp_encryption, $config_smtp_port, $from_email, $from_name, $to_email, $to_name, $subject, $body) {
$mail = new PHPMailer(true);
@ -540,7 +540,7 @@ function sendSingleEmail($config_smtp_host, $config_smtp_username, $config_smtp_
return true;
}
catch(Exception $e){
catch(Exception $e) {
// If we couldn't send the message return the error so we can log it
return "Message not sent. Mailer Error: {$mail->ErrorInfo}";
}

View File

@ -2,12 +2,12 @@
<?php
if(isset($_GET['query'])){
if (isset($_GET['query'])) {
$query = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['query'])));
$phone_query = preg_replace("/[^0-9]/", '',$query);
if(empty($phone_query)){
if (empty($phone_query)) {
$phone_query = $query;
}
@ -28,7 +28,7 @@ if(isset($_GET['query'])){
<hr>
<div class="row">
<?php if(mysqli_num_rows($sql_clients) > 0){ ?>
<?php if (mysqli_num_rows($sql_clients) > 0) { ?>
<!-- Clients-->
@ -48,7 +48,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_clients)){
while ($row = mysqli_fetch_array($sql_clients)) {
$client_id = $row['client_id'];
$client_name = htmlentities($row['client_name']);
$location_phone = formatPhoneNumber($row['location_phone']);
@ -72,7 +72,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_contacts) > 0){ ?>
<?php if (mysqli_num_rows($sql_contacts) > 0) { ?>
<!-- Contacts-->
@ -94,7 +94,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_contacts)){
while ($row = mysqli_fetch_array($sql_contacts)) {
$contact_id = $row['contact_id'];
$contact_name = htmlentities($row['contact_name']);
$contact_title = htmlentities($row['contact_title']);
@ -128,7 +128,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_vendors) > 0){ ?>
<?php if (mysqli_num_rows($sql_vendors) > 0) { ?>
<!-- Vendors -->
<div class="col-6">
@ -148,7 +148,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_vendors)){
while ($row = mysqli_fetch_array($sql_vendors)) {
$vendor_name = htmlentities($row['vendor_name']);
$vendor_description = htmlentities($row['vendor_description']);
$vendor_phone = formatPhoneNumber($row['vendor_phone']);
@ -171,7 +171,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_products) > 0){ ?>
<?php if (mysqli_num_rows($sql_products) > 0) { ?>
<!-- Products -->
<div class="col-6">
@ -190,7 +190,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_products)){
while ($row = mysqli_fetch_array($sql_products)) {
$product_name = htmlentities($row['product_name']);
$product_description = htmlentities($row['product_description']);
?>
@ -211,7 +211,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_documents) > 0){ ?>
<?php if (mysqli_num_rows($sql_documents) > 0) { ?>
<!-- Documents -->
<div class="col-6">
@ -231,7 +231,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_documents)){
while ($row = mysqli_fetch_array($sql_documents)) {
$document_name = htmlentities($row['document_name']);
$document_client_id = $row['document_client_id'];
$document_client = htmlentities($row['client_name']);
@ -256,7 +256,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_tickets) > 0){ ?>
<?php if (mysqli_num_rows($sql_tickets) > 0) { ?>
<!-- Tickets -->
<div class="col-6">
@ -277,7 +277,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_tickets)){
while ($row = mysqli_fetch_array($sql_tickets)) {
$ticket_id = $row['ticket_id'];
$ticket_prefix = $row['ticket_prefix'];
$ticket_number = $row['ticket_number'];
@ -306,7 +306,7 @@ if(isset($_GET['query'])){
<?php } ?>
<?php if(mysqli_num_rows($sql_logins) > 0){ ?>
<?php if (mysqli_num_rows($sql_logins) > 0) { ?>
<!-- Logins -->
<div class="col-6">
@ -326,7 +326,7 @@ if(isset($_GET['query'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_logins)){
while ($row = mysqli_fetch_array($sql_logins)) {
$login_name = htmlentities($row['login_name']);
$login_client_id = $row['login_client_id'];
$login_username = htmlentities($row['login_username']);

View File

@ -5,7 +5,7 @@ include("functions.php");
$ip = trim(strip_tags(mysqli_real_escape_string($mysqli,get_ip())));
$user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_AGENT']));
if(isset($_GET['id']) && isset($_GET['key'])){
if (isset($_GET['id']) && isset($_GET['key'])) {
$item_id = intval($_GET['id']);
$item_key = trim(strip_tags(mysqli_real_escape_string($mysqli,$_GET['key'])));
@ -13,24 +13,24 @@ if(isset($_GET['id']) && isset($_GET['key'])){
$row = mysqli_fetch_array($sql);
// Check result
if(mysqli_num_rows($sql) !== 1 || !$row){
if (mysqli_num_rows($sql) !== 1 || !$row) {
exit("No file.");
}
// Check it is a file
if($row['item_type'] !== "File"){
if ($row['item_type'] !== "File") {
exit("Bad item type.");
}
// Check item share is active & hasn't been viewed too many times
if($row['item_active'] !== "1" || $row['item_views'] >= $row['item_view_limit']){
if ($row['item_active'] !== "1" || $row['item_views'] >= $row['item_view_limit']) {
exit("Item cannot be viewed at this time.");
}
$item_related_id = $row['item_related_id'];
$client_id = $row['item_client_id'];
if(empty($row['item_views'])){
if (empty($row['item_views'])) {
$item_views = 0;
}
else {
@ -40,7 +40,7 @@ if(isset($_GET['id']) && isset($_GET['key'])){
$file_sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = '$item_related_id' AND file_client_id = '$client_id' LIMIT 1");
$file_row = mysqli_fetch_array($file_sql);
if(mysqli_num_rows($file_sql) !== 1 || !$file_row){
if (mysqli_num_rows($file_sql) !== 1 || !$file_row) {
exit("No file.");
}

View File

@ -46,8 +46,8 @@ $user_agent = strip_tags(mysqli_real_escape_string($mysqli,$_SERVER['HTTP_USER_A
<?php
//Alert Feedback
if(!empty($_SESSION['alert_message'])){
if (!isset($_SESSION['alert_type'])){
if (!empty($_SESSION['alert_message'])) {
if (!isset($_SESSION['alert_type'])) {
$_SESSION['alert_type'] = "info";
}
?>

View File

@ -7,14 +7,14 @@ include("config.php");
session_start();
if(isset($_POST['pay_invoice'])){
if (isset($_POST['pay_invoice'])) {
$email = mysqli_real_escape_string($mysqli,$_POST['email']);
$password = md5(mysqli_real_escape_string($mysqli,$_POST['password']));
$sql = mysqli_query($mysqli,"SELECT * FROM users WHERE email = '$email' AND password = '$password'");
if(mysqli_num_rows($sql) == 1){
if (mysqli_num_rows($sql) == 1) {
$row = mysqli_fetch_array($sql);
$_SESSION['logged'] = TRUE;
$_SESSION['user_id'] = $row['user_id'];
@ -68,7 +68,7 @@ if(isset($_POST['pay_invoice'])){
<i class="fab fa-fw fa-3x fa-cc-discover"></i>
<i class="fab fa-fw fa-3x fa-cc-amex"></i>
</center>
<?php if(isset($response)) { echo $response; } ?>
<?php if (isset($response)) { echo $response; } ?>
<form method="post">
<div class="form-group">
<label>Name on card</label>

View File

@ -5,7 +5,7 @@ include("functions.php");
session_start();
if(isset($_GET['accept_quote'], $_GET['company_id'], $_GET['url_key'])){
if (isset($_GET['accept_quote'], $_GET['company_id'], $_GET['url_key'])) {
$quote_id = intval($_GET['accept_quote']);
$company_id = intval($_GET['company_id']);
@ -13,7 +13,7 @@ if(isset($_GET['accept_quote'], $_GET['company_id'], $_GET['url_key'])){
$sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id AND quote_url_key = '$url_key' AND company_id = $company_id");
if(mysqli_num_rows($sql) == 1){
if (mysqli_num_rows($sql) == 1) {
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Accepted' WHERE quote_id = $quote_id");
@ -28,7 +28,7 @@ if(isset($_GET['accept_quote'], $_GET['company_id'], $_GET['url_key'])){
}
if(isset($_GET['decline_quote'], $_GET['company_id'], $_GET['url_key'])){
if (isset($_GET['decline_quote'], $_GET['company_id'], $_GET['url_key'])) {
$quote_id = intval($_GET['decline_quote']);
$company_id = intval($_GET['company_id']);
@ -36,7 +36,7 @@ if(isset($_GET['decline_quote'], $_GET['company_id'], $_GET['url_key'])){
$sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id AND quote_url_key = '$url_key' AND quote_url_key = '$url_key' AND company_id = $company_id");
if(mysqli_num_rows($sql) == 1){
if (mysqli_num_rows($sql) == 1) {
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Declined' WHERE quote_id = $quote_id");

View File

@ -2,7 +2,7 @@
<?php
if(isset($_GET['invoice_id'], $_GET['url_key'])){
if (isset($_GET['invoice_id'], $_GET['url_key'])) {
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
$invoice_id = intval($_GET['invoice_id']);
@ -17,7 +17,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
AND invoice_url_key = '$url_key'"
);
if(mysqli_num_rows($sql) == 1){
if (mysqli_num_rows($sql) == 1) {
$row = mysqli_fetch_array($sql);
$invoice_id = $row['invoice_id'];
@ -43,7 +43,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$client_website = htmlentities($row['client_website']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = htmlentities($row['client_net_terms']);
if($client_net_terms == 0){
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$company_id = $row['company_id'];
@ -55,7 +55,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$company_phone = formatPhoneNumber($row['company_phone']);
$company_email = htmlentities($row['company_email']);
$company_logo = htmlentities($row['company_logo']);
if(!empty($company_logo)){
if (!empty($company_logo)) {
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
}
$company_locale = htmlentities($row['company_locale']);
@ -72,22 +72,22 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$browser = strip_tags(mysqli_real_escape_string($mysqli,get_web_browser()));
//Set Badge color based off of invoice status
if($invoice_status == "Sent"){
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
}elseif($invoice_status == "Viewed"){
}elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
}elseif($invoice_status == "Partial"){
}elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
}elseif($invoice_status == "Paid"){
}elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
}elseif($invoice_status == "Cancelled"){
}elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
}else{
$invoice_badge_color = "secondary";
}
//Update status to Viewed only if invoice_status = "Sent"
if($invoice_status == 'Sent'){
if ($invoice_status == 'Sent') {
mysqli_query($mysqli,"UPDATE invoices SET invoice_status = 'Viewed' WHERE invoice_id = $invoice_id");
}
@ -108,9 +108,9 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$balance = $invoice_amount - $amount_paid;
//check to see if overdue
if($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled"){
if ($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled") {
$unixtime_invoice_due = strtotime($invoice_due) + 86400;
if($unixtime_invoice_due < time()){
if ($unixtime_invoice_due < time()) {
$invoice_color = "text-danger";
}
}
@ -124,10 +124,10 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
<a class="btn btn-primary" href="#" onclick="window.print();"><i class="fa fa-fw fa-print"></i> Print</a>
<a class="btn btn-primary" href="#" onclick="pdfMake.createPdf(docDefinition).download('<?php echo "$invoice_date-$company_name-Invoice-$invoice_prefix$invoice_number.pdf"; ?>');"><i class="fa fa-fw fa-download"></i> Download</a>
<?php
if($invoice_status != "Paid" && $invoice_status != "Cancelled" && $invoice_status != "Draft" && $config_stripe_enable == 1){
if ($invoice_status != "Paid" && $invoice_status != "Cancelled" && $invoice_status != "Draft" && $config_stripe_enable == 1) {
?>
<?php
if($config_stripe_enable == 1){
if ($config_stripe_enable == 1) {
?>
<a class="btn btn-success" href="guest_pay.php?invoice_id=<?php echo $invoice_id; ?>"><i class="fa fa-fw fa-credit-card"></i> Pay Online <small>(Coming Soon)</small></a>
<?php } ?>
@ -140,7 +140,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
<img class="img-fluid" src="<?php echo "uploads/settings/$company_id/$company_logo"; ?>">
</div>
<div class="col-sm-10">
<?php if($invoice_status == "Paid"){ ?>
<?php if ($invoice_status == "Paid") { ?>
<div class="ribbon-wrapper">
<div class="ribbon bg-success">
<?php echo $invoice_status; ?>
@ -214,7 +214,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
$total_tax = 0;
$sub_total = 0;
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_id = $row['item_id'];
$item_name = htmlentities($row['item_name']);
$item_description = htmlentities($row['item_description']);
@ -251,7 +251,7 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
<div class="row mb-4">
<div class="col-sm-7">
<?php if(!empty($invoice_note)){ ?>
<?php if (!empty($invoice_note)) { ?>
<div class="card">
<div class="card-body">
<div style="white-space:pre-line"><?php echo $invoice_note; ?></div>
@ -266,13 +266,13 @@ if(isset($_GET['invoice_id'], $_GET['url_key'])){
<td>Subtotal</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $sub_total, $invoice_currency_code); ?></td>
</tr>
<?php if($total_tax > 0){ ?>
<?php if ($total_tax > 0) { ?>
<tr class="border-bottom">
<td>Tax</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $total_tax, $invoice_currency_code); ?></td>
</tr>
<?php } ?>
<?php if($amount_paid > 0){ ?>
<?php if ($amount_paid > 0) { ?>
<tr class="border-bottom">
<td><div class="text-success">Paid</div></td>
<td class="text-right text-success"><?php echo numfmt_format_currency($currency_format, $amount_paid, $invoice_currency_code); ?></td>
@ -309,7 +309,7 @@ var docDefinition = {
// Header
{
columns: [
<?php if(!empty($company_logo_base64)){ ?>
<?php if (!empty($company_logo_base64)) { ?>
{
image: <?php echo json_encode("data:image;base64,$company_logo_base64") ?>,
width: 120
@ -441,7 +441,7 @@ var docDefinition = {
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$item_quantity = $row['item_quantity'];
@ -719,7 +719,7 @@ var docDefinition = {
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due < CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_date DESC");
if(mysqli_num_rows($sql) > 1){
if (mysqli_num_rows($sql) > 1) {
?>
@ -741,7 +741,7 @@ var docDefinition = {
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
@ -756,7 +756,7 @@ var docDefinition = {
?>
<tr <?php if($_GET['invoice_id'] == $invoice_id){ echo "class='table-active'"; } ?>>
<tr <?php if ($_GET['invoice_id'] == $invoice_id) { echo "class='table-active'"; } ?>>
<th class="text-center"><a href="guest_view_invoice.php?invoice_id=<?php echo $invoice_id; ?>&url_key=<?php echo $invoice_url_key; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></th>
<td><?php echo $invoice_date; ?></td>
<td class="text-danger text-bold"><?php echo $invoice_due; ?> (<?php echo $days; ?> Days Late)</td>
@ -779,7 +779,7 @@ var docDefinition = {
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_due > CURDATE() AND(invoice_status = 'Sent' OR invoice_status = 'Viewed' OR invoice_status = 'Partial') ORDER BY invoice_number DESC");
if(mysqli_num_rows($sql) > 1){
if (mysqli_num_rows($sql) > 1) {
?>
@ -801,7 +801,7 @@ var docDefinition = {
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
@ -816,7 +816,7 @@ var docDefinition = {
?>
<tr <?php if($_GET['invoice_id'] == $invoice_id){ echo "class='table-active'"; } ?>>
<tr <?php if ($_GET['invoice_id'] == $invoice_id) { echo "class='table-active'"; } ?>>
<th class="text-center"><a href="guest_view_invoice.php?invoice_id=<?php echo $invoice_id; ?>&url_key=<?php echo $invoice_url_key; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></th>
<td><?php echo $invoice_date; ?></td>
<td><?php echo $invoice_due; ?> (Due in <?php echo $days; ?> Days)</td>
@ -840,7 +840,7 @@ var docDefinition = {
$sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_client_id = $client_id AND invoice_status = 'Paid' ORDER BY invoice_date DESC");
if(mysqli_num_rows($sql) > 1){
if (mysqli_num_rows($sql) > 1) {
?>
@ -862,7 +862,7 @@ var docDefinition = {
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
@ -875,7 +875,7 @@ var docDefinition = {
?>
<tr <?php if($_GET['invoice_id'] == $invoice_id){ echo "class='table-active'"; } ?>>
<tr <?php if ($_GET['invoice_id'] == $invoice_id) { echo "class='table-active'"; } ?>>
<th class="text-center"><a href="guest_view_invoice.php?invoice_id=<?php echo $invoice_id; ?>&url_key=<?php echo $invoice_url_key; ?>"><?php echo "$invoice_prefix$invoice_number"; ?></a></th>
<td><?php echo $invoice_date; ?></td>
<td><?php echo $invoice_due; ?></td>
@ -890,14 +890,14 @@ var docDefinition = {
$sql_payments = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id ORDER BY payment_date DESC");
while($row = mysqli_fetch_array($sql_payments)){
while ($row = mysqli_fetch_array($sql_payments)) {
$payment_id = $row['payment_id'];
$payment_date = $row['payment_date'];
$payment_amount = floatval($row['payment_amount']);
$payment_currency_code = htmlentities($row['payment_currency_code']);
$payment_method = htmlentities($row['payment_method']);
$payment_reference = htmlentities($row['payment_reference']);
if(strtotime($payment_date) > strtotime($invoice_due)){
if (strtotime($payment_date) > strtotime($invoice_due)) {
$payment_note = "Late";
$difference = strtotime($payment_date) - strtotime($invoice_due);
$days = floor($difference / (60*60*24) ) . " Days";

View File

@ -11,7 +11,7 @@ include("guest_header.php"); ?>
<hr>
<?php
if(!isset($_GET['id']) || !isset($_GET['key'])){
if (!isset($_GET['id']) || !isset($_GET['key'])) {
echo "<div class=\"alert alert-danger\" role=\"alert\">Incorrect URL.</div>";
include("guest_footer.php");
exit();
@ -24,14 +24,14 @@ $sql = mysqli_query($mysqli, "SELECT * FROM shared_items WHERE item_id = '$item_
$row = mysqli_fetch_array($sql);
// Check we got a result
if(mysqli_num_rows($sql) !== 1 || !$row){
if (mysqli_num_rows($sql) !== 1 || !$row) {
echo "<div class=\"alert alert-danger\" role=\"alert\">No item to view. Check with the person that sent you this link to ensure it is correct and has not expired.</div>";
include("guest_footer.php");
exit();
}
// Check item share is active & hasn't been viewed too many times
if($row['item_active'] !== "1" || $row['item_views'] >= $row['item_view_limit']){
if ($row['item_active'] !== "1" || $row['item_views'] >= $row['item_view_limit']) {
echo "<div class=\"alert alert-danger\" role=\"alert\">Item cannot be viewed at this time. Check with the person that sent you this link to ensure it is correct and has not expired.</div>";
include("guest_footer.php");
exit();
@ -50,11 +50,11 @@ $item_created = $row['item_created_at'];
$item_expire = $row['item_expire_at'];
$client_id = $row['item_client_id'];
if($item_type == "Document"){
if ($item_type == "Document") {
$doc_sql = mysqli_query($mysqli, "SELECT * FROM documents WHERE document_id = '$item_related_id' AND document_client_id = '$client_id' LIMIT 1");
$doc_row = mysqli_fetch_array($doc_sql);
if(mysqli_num_rows($doc_sql) !== 1 || !$doc_row){
if (mysqli_num_rows($doc_sql) !== 1 || !$doc_row) {
echo "<div class=\"alert alert-danger\" role=\"alert\">Error retrieving document to view.</div>";
include("guest_footer.php");
exit();
@ -64,7 +64,7 @@ if($item_type == "Document"){
$doc_content = $doc_row['document_content'];
echo "<h3>A document has been shared with you</h3>";
if(!empty($item_note)){
if (!empty($item_note)) {
echo "<p class=\"lead\">Note: <i>$item_note</i></p>";
}
echo "<br>";
@ -79,11 +79,11 @@ if($item_type == "Document"){
$name = mysqli_real_escape_string($mysqli, $doc_title);
mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'View', log_description = 'Viewed shared $item_type $name via link', log_client_id = '$client_id', log_created_at = NOW(), log_ip = '$ip', log_user_agent = '$user_agent', company_id = '1'");
}elseif($item_type == "File"){
}elseif ($item_type == "File") {
$file_sql = mysqli_query($mysqli, "SELECT * FROM files WHERE file_id = '$item_related_id' AND file_client_id = '$client_id' LIMIT 1");
$file_row = mysqli_fetch_array($file_sql);
if(mysqli_num_rows($file_sql) !== 1 || !$file_row){
if (mysqli_num_rows($file_sql) !== 1 || !$file_row) {
echo "<div class=\"alert alert-danger\" role=\"alert\">Error retrieving file.</div>";
include("guest_footer.php");
exit();
@ -92,18 +92,18 @@ if($item_type == "Document"){
$file_name = htmlentities($file_row['file_name']);
echo "<h3>A file has been shared with you</h3>";
if(!empty($item_note)){
if (!empty($item_note)) {
echo "<p class=\"lead\">Note: <i>$item_note</i></p>";
}
echo "<a href=\"guest_download_file.php?id=$item_id&key=$item_key\" download=\"$file_name;\">Download $file_name</a>";
}elseif($item_type == "Login"){
}elseif ($item_type == "Login") {
$encryption_key = $_GET['ek'];
$login_sql = mysqli_query($mysqli, "SELECT * FROM logins WHERE login_id = '$item_related_id' AND login_client_id = '$client_id' LIMIT 1");
$login_row = mysqli_fetch_array($login_sql);
if(mysqli_num_rows($login_sql) !== 1 || !$login_row){
if (mysqli_num_rows($login_sql) !== 1 || !$login_row) {
echo "<div class=\"alert alert-danger\" role=\"alert\">Error retrieving login.</div>";
include("guest_footer.php");
exit();
@ -119,7 +119,7 @@ if($item_type == "Document"){
$login_notes = htmlentities($login_row['login_note']);
echo "<h3>A login entry has been shared with you</h3>";
if(!empty($item_note)){
if (!empty($item_note)) {
echo "<p class=\"lead\">Note: <i>$item_note</i></p>";
}
echo "<br>";

View File

@ -2,7 +2,7 @@
include("guest_header.php");
if(isset($_GET['quote_id'], $_GET['url_key'])){
if (isset($_GET['quote_id'], $_GET['url_key'])) {
$url_key = mysqli_real_escape_string($mysqli,$_GET['url_key']);
$quote_id = intval($_GET['quote_id']);
@ -17,7 +17,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
AND quote_url_key = '$url_key'"
);
if(mysqli_num_rows($sql) == 1){
if (mysqli_num_rows($sql) == 1) {
$row = mysqli_fetch_array($sql);
@ -43,7 +43,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
$client_website = htmlentities($row['client_website']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = htmlentities($row['client_net_terms']);
if($client_net_terms == 0){
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$company_id = $row['company_id'];
@ -55,7 +55,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
$company_phone = formatPhoneNumber($row['company_phone']);
$company_email = htmlentities($row['company_email']);
$company_logo = htmlentities($row['company_logo']);
if(!empty($company_logo)){
if (!empty($company_logo)) {
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
}
$company_locale = htmlentities($row['company_locale']);
@ -70,7 +70,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
$device = get_device();
//Update status to Viewed only if invoice_status = "Sent"
if($quote_status == 'Sent'){
if ($quote_status == 'Sent') {
mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Viewed' WHERE quote_id = $quote_id");
}
@ -88,7 +88,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
<div class="card-header d-print-none">
<div class="float-left">
<?php
if($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Viewed"){
if ($quote_status == "Draft" || $quote_status == "Sent" || $quote_status == "Viewed") {
?>
<a class="btn btn-success" href="guest_post.php?accept_quote=<?php echo $quote_id; ?>&company_id=<?php echo $company_id; ?>&url_key=<?php echo $url_key; ?>"><i class="fa fa-fw fa-check"></i> Accept</a>
<a class="btn btn-danger" href="guest_post.php?decline_quote=<?php echo $quote_id; ?>&company_id=<?php echo $company_id; ?>&url_key=<?php echo $url_key; ?>"><i class="fa fa-fw fa-times"></i> Decline</a>
@ -170,7 +170,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_items)){
while ($row = mysqli_fetch_array($sql_items)) {
$item_id = $row['item_id'];
$item_name = htmlentities($row['item_name']);
$item_description = htmlentities($row['item_description']);
@ -207,7 +207,7 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
<div class="row mb-4">
<div class="col-sm-7">
<?php if(!empty($quote_note)){ ?>
<?php if (!empty($quote_note)) { ?>
<div class="card">
<div class="card-body">
<div style="white-space:pre-line"><?php echo $quote_note; ?></div>
@ -223,13 +223,13 @@ if(isset($_GET['quote_id'], $_GET['url_key'])){
<td>Subtotal</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $sub_total, $quote_currency_code); ?></td>
</tr>
<?php if($discount > 0){ ?>
<?php if ($discount > 0) { ?>
<tr class="border-bottom">
<td>Discount</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $quote_discount, $quote_currency_code); ?></td>
</tr>
<?php } ?>
<?php if($total_tax > 0){ ?>
<?php if ($total_tax > 0) { ?>
<tr class="border-bottom">
<td>Tax</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $total_tax, $quote_currency_code); ?></td>
@ -266,7 +266,7 @@ var docDefinition = {
// Header
{
columns: [
<?php if(!empty($company_logo_base64)){ ?>
<?php if (!empty($company_logo_base64)) { ?>
{
image: <?php echo json_encode("data:image;base64,$company_logo_base64") ?>,
width: 120
@ -387,7 +387,7 @@ var docDefinition = {
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_id ASC");
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$item_quantity = $row['item_quantity'];

View File

@ -1,8 +1,8 @@
<?php
//Alert Feedback
if(!empty($_SESSION['alert_message'])){
if (!isset($_SESSION['alert_type'])){
if (!empty($_SESSION['alert_message'])) {
if (!isset($_SESSION['alert_type'])) {
$_SESSION['alert_type'] = "success";
}
?>
@ -17,7 +17,7 @@ if(!empty($_SESSION['alert_message'])){
}
//Set Records Per Page
if(empty($_SESSION['records_per_page'])){
if (empty($_SESSION['records_per_page'])) {
$_SESSION['records_per_page'] = 10;
}

View File

@ -10,7 +10,7 @@ include("top_nav.php");
<?php
if(isset($_GET['client_id'])){
if (isset($_GET['client_id'])) {
$client_id = intval($_GET['client_id']);
$sql = mysqli_query($mysqli,"UPDATE clients SET client_accessed_at = NOW() WHERE client_id = $client_id AND company_id = $session_company_id");
@ -21,7 +21,7 @@ if(isset($_GET['client_id'])){
WHERE client_id = $client_id
AND clients.company_id = $session_company_id");
if(mysqli_num_rows($sql) == 0){
if (mysqli_num_rows($sql) == 0) {
include("header.php");
echo "<center><h1 class='text-secondary mt-5'>Nothing to see here</h1></center>";
}else{
@ -33,7 +33,7 @@ if(isset($_GET['client_id'])){
$client_referral = htmlentities($row['client_referral']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = $row['client_net_terms'];
if($client_net_terms == 0){
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$client_notes = htmlentities($row['client_notes']);
@ -61,13 +61,13 @@ if(isset($_GET['client_id'])){
$client_tag_name_display_array = array();
$client_tag_id_array = array();
$sql_client_tags = mysqli_query($mysqli,"SELECT * FROM client_tags LEFT JOIN tags ON client_tags.tag_id = tags.tag_id WHERE client_tags.client_id = $client_id");
while($row = mysqli_fetch_array($sql_client_tags)){
while ($row = mysqli_fetch_array($sql_client_tags)) {
$client_tag_id = $row['tag_id'];
$client_tag_name = htmlentities($row['tag_name']);
$client_tag_color = htmlentities($row['tag_color']);
$client_tag_icon = htmlentities($row['tag_icon']);
if(empty($client_tag_icon)){
if (empty($client_tag_icon)) {
$client_tag_icon = "tag";
}

View File

@ -11,14 +11,14 @@ $location_phone = formatPhoneNumber($location_phone);
<div class="row">
<div class="col-md">
<h4 class="text-secondary"><strong><?php echo $client_name; ?></strong></h4>
<?php if(!empty($location_address)){ ?>
<?php if (!empty($location_address)) { ?>
<a href="//maps.<?php echo $session_map_source; ?>.com/?q=<?php echo "$location_address $location_zip"; ?>" target="_blank">
<div><i class="fa fa-fw fa-map-marker-alt text-secondary ml-1 mr-1"></i> <?php echo $location_address; ?></div>
<div class="ml-4 mb-2"><?php echo "$location_city $location_state $location_zip"; ?></div>
</a>
<?php } ?>
<?php
if(!empty($location_phone)){
if (!empty($location_phone)) {
?>
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <a href="tel:<?php echo $location_phone?>"><?php echo $location_phone; ?></a>
<br>
@ -26,7 +26,7 @@ $location_phone = formatPhoneNumber($location_phone);
}
?>
<?php
if(!empty($client_website)){
if (!empty($client_website)) {
?>
<i class="fa fa-fw fa-globe text-secondary ml-1 mr-2 mb-2"></i> <a target="_blank" href="//<?php echo $client_website; ?>"><?php echo $client_website; ?></a>
<br>
@ -34,7 +34,7 @@ $location_phone = formatPhoneNumber($location_phone);
}
?>
<?php
if(!empty($client_tag_name_display_array)){
if (!empty($client_tag_name_display_array)) {
?>
<?php echo $client_tags_display; ?>
<?php
@ -44,7 +44,7 @@ $location_phone = formatPhoneNumber($location_phone);
<div class="col-md border-left">
<h4 class="text-secondary">Contact</h4>
<?php
if(!empty($contact_name)){
if (!empty($contact_name)) {
?>
<i class="fa fa-fw fa-user text-secondary ml-1 mr-2 mb-2"></i> <?php echo $contact_name; ?>
<br>
@ -52,7 +52,7 @@ $location_phone = formatPhoneNumber($location_phone);
}
?>
<?php
if(!empty($contact_email)){
if (!empty($contact_email)) {
?>
<i class="fa fa-fw fa-envelope text-secondary ml-1 mr-2 mb-2"></i> <a href="mailto:<?php echo $contact_email; ?>"><?php echo $contact_email; ?></a><button class='btn btn-sm clipboardjs' data-clipboard-text='<?php echo $contact_email; ?>'><i class='far fa-copy text-secondary'></i></button>
<br>
@ -60,11 +60,11 @@ $location_phone = formatPhoneNumber($location_phone);
}
?>
<?php
if(!empty($contact_phone)){
if (!empty($contact_phone)) {
?>
<i class="fa fa-fw fa-phone text-secondary ml-1 mr-2 mb-2"></i> <a href="tel:<?php echo $contact_phone; ?>"><?php echo $contact_phone; ?> </a>
<?php
if(!empty($contact_extension)){
if (!empty($contact_extension)) {
?>
x<?php echo $contact_extension; ?>
<?php
@ -75,30 +75,30 @@ $location_phone = formatPhoneNumber($location_phone);
}
?>
<?php
if(!empty($contact_mobile)){
if (!empty($contact_mobile)) {
?>
<i class="fa fa-fw fa-mobile-alt text-secondary ml-1 mr-2 mb-2"></i> <a href="tel:<?php echo $contact_mobile; ?>"> <?php echo $contact_mobile; ?> </a>
<?php
}
?>
</div>
<?php if($session_user_role == 1 || $session_user_role == 3 AND $config_module_enable_accounting == 1){ ?>
<?php if ($session_user_role == 1 || $session_user_role == 3 AND $config_module_enable_accounting == 1) { ?>
<div class="col-md border-left">
<h4 class="text-secondary">Billing</h4>
<h6 class="ml-1 text-secondary">Paid <div class="text-dark float-right"> <?php echo numfmt_format_currency($currency_format, $amount_paid, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Balance <div class="<?php if($balance > 0){ echo "text-danger"; }else{ echo "text-dark"; } ?> float-right"> <?php echo numfmt_format_currency($currency_format, $balance, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Balance <div class="<?php if ($balance > 0) { echo "text-danger"; }else{ echo "text-dark"; } ?> float-right"> <?php echo numfmt_format_currency($currency_format, $balance, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Monthly Recurring <div class="text-dark float-right"> <?php echo numfmt_format_currency($currency_format, $recurring_monthly, $client_currency_code); ?></div></h6>
<h6 class="ml-1 text-secondary">Net Terms <div class="text-dark float-right"><?php echo $client_net_terms; ?> <small class="text-secondary">Days</small></div></h6>
</div>
<?php } ?>
<?php if($config_module_enable_ticketing == 1){ ?>
<?php if ($config_module_enable_ticketing == 1) { ?>
<div class="col-md border-left">
<h4 class="text-secondary">Support</h4>
<h6 class="ml-1 text-secondary">Open Tickets <div class="text-dark float-right"><?php echo $num_active_tickets; ?></div></h6>
</div>
<?php } ?>
<div class="col-md-1 border-left">
<?php if($session_user_role == 3) { ?>
<?php if ($session_user_role == 3) { ?>
<div class="dropdown dropleft text-center">
<button class="btn btn-dark btn-sm float-right" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-ellipsis-v"></i>

View File

@ -2,7 +2,7 @@
include("inc_all.php");
if(isset($_GET['invoice_id'])){
if (isset($_GET['invoice_id'])) {
$invoice_id = intval($_GET['invoice_id']);
@ -14,7 +14,7 @@ if(isset($_GET['invoice_id'])){
WHERE invoice_id = $invoice_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></center>";
}else{
@ -45,7 +45,7 @@ if(isset($_GET['invoice_id'])){
$client_website = htmlentities($row['client_website']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = htmlentities($row['client_net_terms']);
if($client_net_terms == 0){
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$company_id = $row['company_id'];
@ -59,7 +59,7 @@ if(isset($_GET['invoice_id'])){
$company_email = htmlentities($row['company_email']);
$company_website = htmlentities($row['company_website']);
$company_logo = htmlentities($row['company_logo']);
if(!empty($company_logo)){
if (!empty($company_logo)) {
$company_logo_base64 = base64_encode(file_get_contents("uploads/settings/$company_id/$company_logo"));
}
$sql_history = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id ORDER BY history_id DESC");
@ -74,23 +74,23 @@ if(isset($_GET['invoice_id'])){
$balance = $invoice_amount - $amount_paid;
//check to see if overdue
if($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled"){
if ($invoice_status !== "Paid" && $invoice_status !== "Draft" && $invoice_status !== "Cancelled") {
$unixtime_invoice_due = strtotime($invoice_due) + 86400;
if($unixtime_invoice_due < time()){
if ($unixtime_invoice_due < time()) {
$invoice_overdue = "Overdue";
}
}
//Set Badge color based off of invoice status
if($invoice_status == "Sent"){
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
}elseif($invoice_status == "Viewed"){
}elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
}elseif($invoice_status == "Partial"){
}elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
}elseif($invoice_status == "Paid"){
}elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
}elseif($invoice_status == "Cancelled"){
}elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
}else{
$invoice_badge_color = "secondary";
@ -99,8 +99,8 @@ if(isset($_GET['invoice_id'])){
//Product autocomplete
$products_sql = mysqli_query($mysqli,"SELECT product_name AS label, product_description AS description, product_price AS price FROM products WHERE company_id = $session_company_id");
if(mysqli_num_rows($products_sql) > 0){
while($row = mysqli_fetch_array($products_sql)){
if (mysqli_num_rows($products_sql) > 0) {
while ($row = mysqli_fetch_array($products_sql)) {
$products[] = $row;
}
$json_products = json_encode($products);
@ -116,7 +116,7 @@ if(isset($_GET['invoice_id'])){
<a href="client_invoices.php?client_id=<?php echo $client_id; ?>"><?php echo $client_name; ?></a>
</li>
<li class="breadcrumb-item active"><?php echo "$invoice_prefix$invoice_number"; ?></li>
<?php if(isset($invoice_overdue)){ ?>
<?php if (isset($invoice_overdue)) { ?>
<span class="p-2 ml-2 badge badge-danger"><?php echo $invoice_overdue; ?></span>
<?php } ?>
</ol>
@ -128,12 +128,12 @@ if(isset($_GET['invoice_id'])){
<div class="row">
<div class="col-md-4">
<?php if($invoice_status == 'Draft'){ ?>
<?php if ($invoice_status == 'Draft') { ?>
<button class="btn btn-success btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
<i class="fas fa-fw fa-paper-plane"></i> Send
</button>
<div class="dropdown-menu">
<?php if(!empty($config_smtp_host) && !empty($contact_email)){ ?>
<?php if (!empty($config_smtp_host) && !empty($contact_email)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send Email</a>
<div class="dropdown-divider"></div>
<?php } ?>
@ -141,7 +141,7 @@ if(isset($_GET['invoice_id'])){
</div>
<?php } ?>
<?php if($invoice_status !== 'Paid' && $invoice_status !== 'Cancelled' && $invoice_status !== 'Draft'){ ?>
<?php if ($invoice_status !== 'Paid' && $invoice_status !== 'Cancelled' && $invoice_status !== 'Draft') { ?>
<a class="btn btn-success btn-sm" href="#" data-toggle="modal" data-target="#addPaymentModal"><i class="fa fa-fw fa-credit-card"></i> Add Payment</a>
<?php } ?>
</div>
@ -159,11 +159,11 @@ if(isset($_GET['invoice_id'])){
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" onclick="window.print();">Print</a>
<a class="dropdown-item" href="#" onclick="pdfMake.createPdf(docDefinition).download('<?php echo "$invoice_date-$company_name-$client_name-Invoice-$invoice_prefix$invoice_number.pdf"; ?>');">Download PDF</a>
<?php if(!empty($config_smtp_host) && !empty($contact_email)){ ?>
<?php if (!empty($config_smtp_host) && !empty($contact_email)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send Email</a>
<?php } ?>
<a class="dropdown-item" target="_blank" href="guest_view_invoice.php?invoice_id=<?php echo "$invoice_id&url_key=$invoice_url_key"; ?>">Guest URL</a>
<?php if($invoice_status !== 'Cancelled' && $invoice_status !== 'Paid'){ ?>
<?php if ($invoice_status !== 'Cancelled' && $invoice_status !== 'Paid') { ?>
<div class="dropdown-divider"></div>
<a class="dropdown-item text-danger" href="post.php?cancel_invoice=<?php echo $invoice_id; ?>">Cancel</a>
<?php } ?>
@ -255,7 +255,7 @@ if(isset($_GET['invoice_id'])){
$total_tax = 0;
$sub_total = 0;
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_id = $row['item_id'];
$item_name = htmlentities($row['item_name']);
$item_description = htmlentities($row['item_description']);
@ -305,7 +305,7 @@ if(isset($_GET['invoice_id'])){
<?php
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE company_id = $session_company_id ORDER BY tax_name ASC");
while($row = mysqli_fetch_array($taxes_sql)){
while ($row = mysqli_fetch_array($taxes_sql)) {
$tax_id = $row['tax_id'];
$tax_name = htmlentities($row['tax_name']);
$tax_percent = htmlentities($row['tax_percent']);
@ -354,13 +354,13 @@ if(isset($_GET['invoice_id'])){
<td>Subtotal</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $sub_total, $invoice_currency_code); ?></td>
</tr>
<?php if($total_tax > 0){ ?>
<?php if ($total_tax > 0) { ?>
<tr class="border-bottom">
<td>Tax</td>
<td class="text-right"><?php echo numfmt_format_currency($currency_format, $total_tax, $invoice_currency_code); ?></td>
</tr>
<?php } ?>
<?php if($amount_paid > 0){ ?>
<?php if ($amount_paid > 0) { ?>
<tr class="border-bottom">
<td><div class="text-success">Paid</div></td>
<td class="text-right text-success"><?php echo numfmt_format_currency($currency_format, $amount_paid, $invoice_currency_code); ?></td>
@ -407,7 +407,7 @@ if(isset($_GET['invoice_id'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_history)){
while ($row = mysqli_fetch_array($sql_history)) {
$history_created_at = $row['history_created_at'];
$history_status = htmlentities($row['history_status']);
$history_description = htmlentities($row['history_description']);
@ -455,7 +455,7 @@ if(isset($_GET['invoice_id'])){
<tbody>
<?php
while($row = mysqli_fetch_array($sql_payments)){
while ($row = mysqli_fetch_array($sql_payments)) {
$payment_id = $row['payment_id'];
$payment_date = $row['payment_date'];
$payment_amount = floatval($row['payment_amount']);
@ -501,12 +501,12 @@ include("footer.php");
<link rel="stylesheet" href="plugins/jquery-ui/jquery-ui.min.css">
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
<script>
$(function(){
$(function() {
var availableProducts = <?php echo $json_products?>;
$("#name").autocomplete({
source: availableProducts,
select: function (event, ui){
select: function (event, ui) {
$("#name").val(ui.item.label); // Product name field - this seemingly has to referenced as label
$("#desc").val(ui.item.description); // Product description field
$("#qty").val(1); // Product quantity field automatically make it a 1
@ -533,7 +533,7 @@ var docDefinition = {
// Header
{
columns: [
<?php if(!empty($company_logo_base64)){ ?>
<?php if (!empty($company_logo_base64)) { ?>
{
image: <?php echo json_encode("data:image;base64,$company_logo_base64") ?>,
width: 120
@ -665,7 +665,7 @@ var docDefinition = {
$sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_id ASC");
while($row = mysqli_fetch_array($sql_invoice_items)){
while ($row = mysqli_fetch_array($sql_invoice_items)) {
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$item_quantity = $row['item_quantity'];

View File

@ -10,7 +10,7 @@
<form action="post.php" method="post" autocomplete="off">
<div class="modal-body bg-white">
<?php if(isset($_GET['client_id'])){ ?>
<?php if (isset($_GET['client_id'])) { ?>
<input type="hidden" name="client" value="<?php echo $client_id; ?>">
<?php }else{ ?>
@ -25,7 +25,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM clients WHERE company_id = $session_company_id ORDER BY client_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$client_id = $row['client_id'];
$client_name = htmlentities($row['client_name']);
?>
@ -61,7 +61,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$category_id = $row['category_id'];
$category_name = htmlentities($row['category_name']);
?>

View File

@ -43,11 +43,11 @@
<?php
$sql_income_category = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Income' AND (category_archived_at > '$invoice_created_at' OR category_archived_at IS NULL) AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql_income_category)){
while ($row = mysqli_fetch_array($sql_income_category)) {
$category_id_select= $row['category_id'];
$category_name_select = htmlentities($row['category_name']);
?>
<option <?php if($category_id == $category_id_select){ echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<option <?php if ($category_id == $category_id_select) { echo "selected"; } ?> value="<?php echo $category_id_select; ?>"><?php echo $category_name_select; ?></option>
<?php
}

View File

@ -55,7 +55,7 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM accounts WHERE account_archived_at IS NULL AND company_id = $session_company_id ORDER BY account_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$account_id = $row['account_id'];
$account_name = htmlentities($row['account_name']);
$opening_balance = $row['opening_balance'];
@ -75,7 +75,7 @@
$account_balance = $opening_balance + $total_payments + $total_revenues - $total_expenses;
?>
<option <?php if($config_default_payment_account == $account_id){ echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?> [$<?php echo number_format($account_balance,2); ?>]</option>
<option <?php if ($config_default_payment_account == $account_id) { echo "selected"; } ?> value="<?php echo $account_id; ?>"><?php echo $account_name; ?> [$<?php echo number_format($account_balance,2); ?>]</option>
<?php
}
@ -95,10 +95,10 @@
<?php
$sql = mysqli_query($mysqli,"SELECT * FROM categories WHERE category_type = 'Payment Method' AND category_archived_at IS NULL AND company_id = $session_company_id ORDER BY category_name ASC");
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$category_name = htmlentities($row['category_name']);
?>
<option <?php if($config_default_payment_method == $category_name){ echo "selected"; } ?>><?php echo $category_name; ?></option>
<option <?php if ($config_default_payment_method == $category_name) { echo "selected"; } ?>><?php echo $category_name; ?></option>
<?php
}
@ -117,7 +117,7 @@
</div>
</div>
<?php if(!empty($config_smtp_host) && !empty($contact_email)){ ?>
<?php if (!empty($config_smtp_host) && !empty($contact_email)) { ?>
<div class="form-group">
<label>Email Receipt</label>

View File

@ -52,63 +52,63 @@
$real_overdue_amount = $total_overdue - $total_overdue_partial;
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli, $_GET['sb']));
}else{
$sb = "invoice_number";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
if(empty($_GET['canned_date'])){
if (empty($_GET['canned_date'])) {
//Prevents lots of undefined variable errors.
// $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00
$_GET['canned_date'] = 'custom';
}
//Invoice status from GET
if(isset($_GET['status']) && ($_GET['status']) == 'Draft'){
if (isset($_GET['status']) && ($_GET['status']) == 'Draft') {
$status_query = 'Draft';
}elseif(isset($_GET['status']) && ($_GET['status']) == 'Sent'){
}elseif (isset($_GET['status']) && ($_GET['status']) == 'Sent') {
$status_query = 'Sent';
}elseif(isset($_GET['status']) && ($_GET['status']) == 'Viewed'){
}elseif (isset($_GET['status']) && ($_GET['status']) == 'Viewed') {
$status_query = 'Viewed';
}elseif(isset($_GET['status']) && ($_GET['status']) == 'Partial'){
}elseif (isset($_GET['status']) && ($_GET['status']) == 'Partial') {
$status_query = 'Partial';
}else{
$status_query = '%';
}
//Date Filter
if($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])){
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}elseif($_GET['canned_date'] == "today"){
}elseif ($_GET['canned_date'] == "today") {
$dtf = date('Y-m-d');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "yesterday"){
}elseif ($_GET['canned_date'] == "yesterday") {
$dtf = date('Y-m-d',strtotime("yesterday"));
$dtt = date('Y-m-d',strtotime("yesterday"));
}elseif($_GET['canned_date'] == "thisweek"){
}elseif ($_GET['canned_date'] == "thisweek") {
$dtf = date('Y-m-d',strtotime("monday this week"));
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastweek"){
}elseif ($_GET['canned_date'] == "lastweek") {
$dtf = date('Y-m-d',strtotime("monday last week"));
$dtt = date('Y-m-d',strtotime("sunday last week"));
}elseif($_GET['canned_date'] == "thismonth"){
}elseif ($_GET['canned_date'] == "thismonth") {
$dtf = date('Y-m-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastmonth"){
}elseif ($_GET['canned_date'] == "lastmonth") {
$dtf = date('Y-m-d',strtotime("first day of last month"));
$dtt = date('Y-m-d',strtotime("last day of last month"));
}elseif($_GET['canned_date'] == "thisyear"){
}elseif ($_GET['canned_date'] == "thisyear") {
$dtf = date('Y-01-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastyear"){
}elseif ($_GET['canned_date'] == "lastyear") {
$dtf = date('Y-m-d',strtotime("first day of january last year"));
$dtt = date('Y-m-d',strtotime("last day of december last year"));
}else{
@ -201,11 +201,11 @@
<div class="card-body">
<form class="mb-4" autocomplete="off">
<input type="hidden" name="status" value="<?php if(isset($_GET['status'])){ echo htmlentities($_GET['status']); } ?>">
<input type="hidden" name="status" value="<?php if (isset($_GET['status'])) { echo htmlentities($_GET['status']); } ?>">
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo strip_tags(htmlentities($q));} ?>" placeholder="Search Invoices">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo strip_tags(htmlentities($q));} ?>" placeholder="Search Invoices">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@ -213,21 +213,21 @@
</div>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['dtf'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="custom">Custom</option>
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="custom">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
@ -249,7 +249,7 @@
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_number&o=<?php echo $disp; ?>">Number</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_scope&o=<?php echo $disp; ?>">Scope</a></th>
@ -265,12 +265,12 @@
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
$invoice_scope = htmlentities($row['invoice_scope']);
if(empty($invoice_scope)){
if (empty($invoice_scope)) {
$invoice_scope_display = "-";
}else{
$invoice_scope_display = $invoice_scope;
@ -287,27 +287,27 @@
$category_name = htmlentities($row['category_name']);
$client_currency_code = htmlentities($row['client_currency_code']);
$client_net_terms = htmlentities($row['client_net_terms']);
if($client_net_terms == 0){
if ($client_net_terms == 0) {
$client_net_terms = $config_default_net_terms;
}
$now = time();
if(($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now ){
if (($invoice_status == "Sent" || $invoice_status == "Partial" || $invoice_status == "Viewed") && strtotime($invoice_due) + 86400 < $now ) {
$overdue_color = "text-danger font-weight-bold";
}else{
$overdue_color = "";
}
if($invoice_status == "Sent"){
if ($invoice_status == "Sent") {
$invoice_badge_color = "warning text-white";
}elseif($invoice_status == "Viewed"){
}elseif ($invoice_status == "Viewed") {
$invoice_badge_color = "info";
}elseif($invoice_status == "Partial"){
}elseif ($invoice_status == "Partial") {
$invoice_badge_color = "primary";
}elseif($invoice_status == "Paid"){
}elseif ($invoice_status == "Paid") {
$invoice_badge_color = "success";
}elseif($invoice_status == "Cancelled"){
}elseif ($invoice_status == "Cancelled") {
$invoice_badge_color = "danger";
}else{
$invoice_badge_color = "secondary";
@ -337,7 +337,7 @@
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#editInvoiceModal<?php echo $invoice_id; ?>">Edit</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#addInvoiceCopyModal<?php echo $invoice_id; ?>">Copy</a>
<div class="dropdown-divider"></div>
<?php if(!empty($config_smtp_host)){ ?>
<?php if (!empty($config_smtp_host)) { ?>
<a class="dropdown-item" href="post.php?email_invoice=<?php echo $invoice_id; ?>">Send</a>
<div class="dropdown-divider"></div>
<?php } ?>

View File

@ -8,9 +8,9 @@
</button>
</div>
<form action="post.php" method="post" autocomplete="off">
<?php if(isset($invoice_id)){ ?>
<?php if (isset($invoice_id)) { ?>
<input type="hidden" name="invoice_id" value="<?php echo $invoice_id; ?>">
<?php }elseif(isset($quote_id)){ ?>
<?php }elseif (isset($quote_id)) { ?>
<input type="hidden" name="quote_id" value="<?php echo $quote_id; ?>">
<?php }else{ ?>
<input type="hidden" name="recurring_id" value="<?php echo $recurring_id; ?>">
@ -78,12 +78,12 @@
<?php
$taxes_sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE (tax_archived_at > '$item_created_at' OR tax_archived_at IS NULL) AND company_id = $session_company_id ORDER BY tax_name ASC");
while($row = mysqli_fetch_array($taxes_sql)){
while ($row = mysqli_fetch_array($taxes_sql)) {
$tax_id_select = $row['tax_id'];
$tax_name = htmlentities($row['tax_name']);
$tax_percent = $row['tax_percent'];
?>
<option <?php if($tax_id_select == $tax_id){ echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
<option <?php if ($tax_id_select == $tax_id) { echo "selected"; } ?> value="<?php echo $tax_id_select; ?>"><?php echo "$tax_name $tax_percent%"; ?></option>
<?php
}

View File

@ -1,6 +1,6 @@
<?php
if(!file_exists('config.php')){
if (!file_exists('config.php')) {
header("Location: setup.php");
exit;
}
@ -37,7 +37,7 @@ if (isset($_POST['login'])) {
mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Login', log_action = 'Failed', log_description = 'Failed login attempt due to IP lockout', log_ip = '$ip', log_user_agent = '$user_agent'");
// Send an alert only count hits 10 to reduce flooding alerts (using 1 as "default" company)
if($failed_login_count == 10){
if ($failed_login_count == 10) {
mysqli_query($mysqli,"INSERT INTO notifications SET notification_type = 'Lockout', notification = '$ip was locked out for repeated failed login attempts.', notification_timestamp = NOW() company_id = '1'");
}
@ -176,10 +176,10 @@ if (isset($_POST['login'])) {
<!-- /.login-logo -->
<div class="card">
<div class="card-body login-card-body">
<p class="login-box-msg"><?php if(isset($response)) { echo $response; } ?></p>
<p class="login-box-msg"><?php if (isset($response)) { echo $response; } ?></p>
<form method="post">
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="Agent Email" name="email" value="<?php if(!empty($token_field)){ echo $email; }?>" required <?php if(empty($token_field)){ echo "autofocus"; } ?> >
<input type="text" class="form-control" placeholder="Agent Email" name="email" value="<?php if (!empty($token_field)) { echo $email; }?>" required <?php if (empty($token_field)) { echo "autofocus"; } ?> >
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-envelope"></span>
@ -187,14 +187,14 @@ if (isset($_POST['login'])) {
</div>
</div>
<div class="input-group mb-3">
<input type="password" class="form-control" placeholder="Agent Password" name="password" value="<?php if(!empty($token_field)){ echo $password; } ?>" required>
<input type="password" class="form-control" placeholder="Agent Password" name="password" value="<?php if (!empty($token_field)) { echo $password; } ?>" required>
<div class="input-group-append">
<div class="input-group-text">
<span class="fas fa-lock"></span>
</div>
</div>
</div>
<?php if(!empty($token_field)){ echo $token_field; } ?>
<?php if (!empty($token_field)) { echo $token_field; } ?>
<button type="submit" class="btn btn-primary btn-block mb-3" name="login">Sign In</button>
@ -222,7 +222,7 @@ if (isset($_POST['login'])) {
<!-- Prevents resubmit on refresh or back -->
<script>
if(window.history.replaceState){
if (window.history.replaceState) {
window.history.replaceState(null,null,window.location.href);
}

View File

@ -1,49 +1,49 @@
<?php include("inc_all_settings.php");
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "log_id";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
if(empty($_GET['canned_date'])){
if (empty($_GET['canned_date'])) {
//Prevents lots of undefined variable errors.
// $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00
$_GET['canned_date'] = 'custom';
}
//Date Filter
if($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])){
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}elseif($_GET['canned_date'] == "today"){
}elseif ($_GET['canned_date'] == "today") {
$dtf = date('Y-m-d');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "yesterday"){
}elseif ($_GET['canned_date'] == "yesterday") {
$dtf = date('Y-m-d',strtotime("yesterday"));
$dtt = date('Y-m-d',strtotime("yesterday"));
}elseif($_GET['canned_date'] == "thisweek"){
}elseif ($_GET['canned_date'] == "thisweek") {
$dtf = date('Y-m-d',strtotime("monday this week"));
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastweek"){
}elseif ($_GET['canned_date'] == "lastweek") {
$dtf = date('Y-m-d',strtotime("monday last week"));
$dtt = date('Y-m-d',strtotime("sunday last week"));
}elseif($_GET['canned_date'] == "thismonth"){
}elseif ($_GET['canned_date'] == "thismonth") {
$dtf = date('Y-m-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastmonth"){
}elseif ($_GET['canned_date'] == "lastmonth") {
$dtf = date('Y-m-d',strtotime("first day of last month"));
$dtt = date('Y-m-d',strtotime("last day of last month"));
}elseif($_GET['canned_date'] == "thisyear"){
}elseif ($_GET['canned_date'] == "thisyear") {
$dtf = date('Y-01-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastyear"){
}elseif ($_GET['canned_date'] == "lastyear") {
$dtf = date('Y-m-d',strtotime("first day of january last year"));
$dtt = date('Y-m-d',strtotime("last day of december last year"));
}else{
@ -75,7 +75,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search audit logs">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search audit logs">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@ -83,21 +83,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['dtf'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="">Custom</option>
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
@ -119,7 +119,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-sm table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=log_created_at&o=<?php echo $disp; ?>">Timestamp</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">User</a></th>
@ -134,7 +134,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$log_id = $row['log_id'];
$log_type = htmlentities($row['log_type']);
$log_action = htmlentities($row['log_action']);
@ -146,14 +146,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$log_created_at = $row['log_created_at'];
$user_id = $row['user_id'];
$user_name = htmlentities($row['user_name']);
if(empty($user_name)){
if (empty($user_name)) {
$user_name_display = "-";
}else{
$user_name_display = $user_name;
}
$client_name = htmlentities($row['client_name']);
$client_id = $row['client_id'];
if(empty($client_name)){
if (empty($client_name)) {
$client_name_display = "-";
}else{
$client_name_display = "<a href='client_logs.php?client_id=$client_id&tab=logs'>$client_name</a>";

View File

@ -11,12 +11,12 @@ $sql = mysqli_query($mysqli,"SELECT * FROM notifications LEFT JOIN clients ON no
<h3 class="card-title mt-2"><i class="fa fa-fw fa-bell"></i> Notifications</h3>
<div class="card-tools">
<?php if(mysqli_num_rows($sql) > 0){ ?><a href="post.php?dismiss_all_notifications" class="btn btn-primary"><i class="fa fa-check"></i> Dismiss All</a><?php } ?>
<?php if (mysqli_num_rows($sql) > 0) { ?><a href="post.php?dismiss_all_notifications" class="btn btn-primary"><i class="fa fa-check"></i> Dismiss All</a><?php } ?>
<a href="notifications_dismissed.php" class="btn btn-secondary"><i class="fa fa-history"></i> Dismissed</a>
</div>
</div>
<div class="card-body">
<?php if(mysqli_num_rows($sql) > 0){ ?>
<?php if (mysqli_num_rows($sql) > 0) { ?>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
@ -32,14 +32,14 @@ $sql = mysqli_query($mysqli,"SELECT * FROM notifications LEFT JOIN clients ON no
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$notification_id = $row['notification_id'];
$notification_type = htmlentities($row['notification_type']);
$notification = htmlentities($row['notification']);
$notification_timestamp = $row['notification_timestamp'];
$client_name = htmlentities($row['client_name']);
$client_id = $row['client_id'];
if(empty($client_name)){
if (empty($client_name)) {
$client_name_display = "-";
}else{
$client_name_display = "<a href='client_overview.php?client_id=$client_id'>$client_name</a>";

View File

@ -1,20 +1,20 @@
<?php include("inc_all.php");
//Column Filter
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "notification_timestamp";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
//Date From and Date To Filter
if(!empty($_GET['dtf'])){
if (!empty($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}else{
@ -44,7 +44,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){ echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Dismissed Notifications">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) { echo strip_tags(htmlentities($q)); } ?>" placeholder="Search Dismissed Notifications">
<div class="input-group-append">
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
</div>
@ -54,7 +54,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<button class="btn btn-primary float-right" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['dtf'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
@ -73,21 +73,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</form>
<div class="table-responsive">
<table class="table table-hover">
<thead class="<?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="<?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_timestamp&o=<?php echo $disp; ?>">Timestamp <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_type&o=<?php echo $disp; ?>">Type <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification&o=<?php echo $disp; ?>">Notification <i class="fa fa-sort-alpha<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=client_name&o=<?php echo $disp; ?>">Client <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_dismissed_at&o=<?php echo $disp; ?>">Dismissed At <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Dismissed By <i class="fa fa-sort-numeric<?php if($disp=='ASC'){ echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_timestamp&o=<?php echo $disp; ?>">Timestamp <i class="fa fa-sort-numeric<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_type&o=<?php echo $disp; ?>">Type <i class="fa fa-sort-alpha<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification&o=<?php echo $disp; ?>">Notification <i class="fa fa-sort-alpha<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=client_name&o=<?php echo $disp; ?>">Client <i class="fa fa-sort-numeric<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=notification_dismissed_at&o=<?php echo $disp; ?>">Dismissed At <i class="fa fa-sort-numeric<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=user_name&o=<?php echo $disp; ?>">Dismissed By <i class="fa fa-sort-numeric<?php if ($disp=='ASC') { echo "-up"; }else{ echo "-down"; }?>"></i></a></th>
</tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$notification_id = $row['notification_id'];
$notification_timestamp = $row['notification_timestamp'];
$notification_type = htmlentities($row['notification_type']);
@ -96,7 +96,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$user_name = htmlentities($row['user_name']);
$client_name = htmlentities($row['client_name']);
$client_id = $row['client_id'];
if(empty($client_name)){
if (empty($client_name)) {
$client_name_display = "-";
}else{
$client_name_display = "<a href='client_overview.php?client_id=$client_id'>$client_name</a>";

View File

@ -21,12 +21,12 @@ if ($total_found_rows > 10) {
<div class="col mb-3">
<form action="post.php" method="post">
<select onchange="this.form.submit()" class="input-form select2" name="change_records_per_page">
<option <?php if($_SESSION['records_per_page'] == 5){ echo "selected"; } ?> >5</option>
<option <?php if($_SESSION['records_per_page'] == 10){ echo "selected"; } ?> >10</option>
<option <?php if($_SESSION['records_per_page'] == 20){ echo "selected"; } ?> >20</option>
<option <?php if($_SESSION['records_per_page'] == 50){ echo "selected"; } ?> >50</option>
<option <?php if($_SESSION['records_per_page'] == 100){ echo "selected"; } ?> >100</option>
<option <?php if($_SESSION['records_per_page'] == 500){ echo "selected"; } ?> >500</option>
<option <?php if ($_SESSION['records_per_page'] == 5) { echo "selected"; } ?> >5</option>
<option <?php if ($_SESSION['records_per_page'] == 10) { echo "selected"; } ?> >10</option>
<option <?php if ($_SESSION['records_per_page'] == 20) { echo "selected"; } ?> >20</option>
<option <?php if ($_SESSION['records_per_page'] == 50) { echo "selected"; } ?> >50</option>
<option <?php if ($_SESSION['records_per_page'] == 100) { echo "selected"; } ?> >100</option>
<option <?php if ($_SESSION['records_per_page'] == 500) { echo "selected"; } ?> >500</option>
</select>
</form>
</div>
@ -39,21 +39,21 @@ if ($total_found_rows > 10) {
<?php
if($total_pages <= 100){
if ($total_pages <= 100) {
$pages_split = 10;
}
if(($total_pages <= 1000) && ($total_pages > 100)){
if (($total_pages <= 1000) && ($total_pages > 100)) {
$pages_split = 100;
}
if(($total_pages <= 10000) && ($total_pages > 1000)){
if (($total_pages <= 10000) && ($total_pages > 1000)) {
$pages_split = 1000;
}
if($p > 1){
if ($p > 1) {
$prev_class = "";
}else{
$prev_class = "disabled";
}
if($p <> $total_pages) {
if ($p <> $total_pages) {
$next_class = "";
}else{
$next_class = "disabled";
@ -62,14 +62,14 @@ if ($total_found_rows > 10) {
$prev_page = $p - 1;
$next_page = $p + 1;
if($p > 1){
if ($p > 1) {
echo "<li class='page-item $prev_class'><a class='page-link' href='?$url_query_strings&p=$prev_page'>Prev</a></li>";
}
while($i < $total_pages){
while ($i < $total_pages) {
$i++;
if(($i == 1) || (($p <= 3) && ($i <= 6)) || (($i > $total_pages - 6) && ($p > $total_pages - 3 )) || (is_int($i / $pages_split)) || (($p > 3) && ($i >= $p - 2) && ($i <= $p + 3)) || ($i == $total_pages)){
if($p == $i ) {
if (($i == 1) || (($p <= 3) && ($i <= 6)) || (($i > $total_pages - 6) && ($p > $total_pages - 3 )) || (is_int($i / $pages_split)) || (($p > 3) && ($i >= $p - 2) && ($i <= $p + 3)) || ($i == $total_pages)) {
if ($p == $i ) {
$page_class = "active";
}else{
$page_class = "";
@ -78,7 +78,7 @@ if ($total_found_rows > 10) {
}
}
if($p <> $total_pages){
if ($p <> $total_pages) {
echo "<li class='page-item $next_class'><a class='page-link' href='?$url_query_strings&p=$next_page'>Next</a></li>";
}
@ -92,7 +92,7 @@ if ($total_found_rows > 10) {
}
if($total_found_rows == 0){
if ($total_found_rows == 0) {
echo "<center class='my-3'><i class='far fa-fw fa-6x fa-meh-rolling-eyes text-secondary'></i><h3 class='text-secondary mt-3'>No Results</h3></center>";
}

View File

@ -8,7 +8,7 @@
*/
// Paging
if(isset($_GET['p'])){
if (isset($_GET['p'])) {
$p = intval($_GET['p']);
$record_from = (($p)-1)*$_SESSION['records_per_page'];
$record_to = $_SESSION['records_per_page'];
@ -19,8 +19,8 @@ if(isset($_GET['p'])){
}
// Order
if(isset($_GET['o'])){
if($_GET['o'] == 'ASC'){
if (isset($_GET['o'])) {
if ($_GET['o'] == 'ASC') {
$o = "ASC";
$disp = "DESC";
}else{
@ -33,7 +33,7 @@ if(isset($_GET['o'])){
}
// Search
if(isset($_GET['q'])){
if (isset($_GET['q'])) {
$q = strip_tags(mysqli_real_escape_string($mysqli,trim($_GET['q'])));
}else{
$q = "";

View File

@ -1,49 +1,49 @@
<?php include("inc_all.php");
if(!empty($_GET['sb'])){
if (!empty($_GET['sb'])) {
$sb = strip_tags(mysqli_real_escape_string($mysqli,$_GET['sb']));
}else{
$sb = "payment_date";
}
// Reverse default sort
if(!isset($_GET['o'])){
if (!isset($_GET['o'])) {
$o = "DESC";
$disp = "ASC";
}
if(empty($_GET['canned_date'])){
if (empty($_GET['canned_date'])) {
//Prevents lots of undefined variable errors.
// $dtf and $dtt will be set by the below else to 0000-00-00 / 9999-00-00
$_GET['canned_date'] = 'custom';
}
//Date Filter
if($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])){
if ($_GET['canned_date'] == "custom" && !empty($_GET['dtf'])) {
$dtf = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtf']));
$dtt = strip_tags(mysqli_real_escape_string($mysqli,$_GET['dtt']));
}elseif($_GET['canned_date'] == "today"){
}elseif ($_GET['canned_date'] == "today") {
$dtf = date('Y-m-d');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "yesterday"){
}elseif ($_GET['canned_date'] == "yesterday") {
$dtf = date('Y-m-d',strtotime("yesterday"));
$dtt = date('Y-m-d',strtotime("yesterday"));
}elseif($_GET['canned_date'] == "thisweek"){
}elseif ($_GET['canned_date'] == "thisweek") {
$dtf = date('Y-m-d',strtotime("monday this week"));
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastweek"){
}elseif ($_GET['canned_date'] == "lastweek") {
$dtf = date('Y-m-d',strtotime("monday last week"));
$dtt = date('Y-m-d',strtotime("sunday last week"));
}elseif($_GET['canned_date'] == "thismonth"){
}elseif ($_GET['canned_date'] == "thismonth") {
$dtf = date('Y-m-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastmonth"){
}elseif ($_GET['canned_date'] == "lastmonth") {
$dtf = date('Y-m-d',strtotime("first day of last month"));
$dtt = date('Y-m-d',strtotime("last day of last month"));
}elseif($_GET['canned_date'] == "thisyear"){
}elseif ($_GET['canned_date'] == "thisyear") {
$dtf = date('Y-01-01');
$dtt = date('Y-m-d');
}elseif($_GET['canned_date'] == "lastyear"){
}elseif ($_GET['canned_date'] == "lastyear") {
$dtf = date('Y-m-d',strtotime("first day of january last year"));
$dtt = date('Y-m-d',strtotime("last day of december last year"));
}else{
@ -78,7 +78,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<div class="row">
<div class="col-sm-4">
<div class="input-group">
<input type="search" class="form-control" name="q" value="<?php if(isset($q)){echo strip_tags(htmlentities($q));} ?>" placeholder="Search Payments">
<input type="search" class="form-control" name="q" value="<?php if (isset($q)) {echo strip_tags(htmlentities($q));} ?>" placeholder="Search Payments">
<div class="input-group-append">
<button class="btn btn-secondary" type="button" data-toggle="collapse" data-target="#advancedFilter"><i class="fas fa-filter"></i></button>
<button class="btn btn-primary"><i class="fa fa-search"></i></button>
@ -86,21 +86,21 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div>
</div>
</div>
<div class="collapse mt-3 <?php if(!empty($_GET['dtf'])){ echo "show"; } ?>" id="advancedFilter">
<div class="collapse mt-3 <?php if (!empty($_GET['dtf'])) { echo "show"; } ?>" id="advancedFilter">
<div class="row">
<div class="col-md-2">
<div class="form-group">
<label>Canned Date</label>
<select class="form-control select2" name="canned_date">
<option <?php if($_GET['canned_date'] == "custom"){ echo "selected"; } ?> value="custom">Custom</option>
<option <?php if($_GET['canned_date'] == "today"){ echo "selected"; } ?> value="today">Today</option>
<option <?php if($_GET['canned_date'] == "yesterday"){ echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if($_GET['canned_date'] == "thisweek"){ echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if($_GET['canned_date'] == "lastweek"){ echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if($_GET['canned_date'] == "thismonth"){ echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if($_GET['canned_date'] == "lastmonth"){ echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if($_GET['canned_date'] == "thisyear"){ echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if($_GET['canned_date'] == "lastyear"){ echo "selected"; } ?> value="lastyear">Last Year</option>
<option <?php if ($_GET['canned_date'] == "custom") { echo "selected"; } ?> value="custom">Custom</option>
<option <?php if ($_GET['canned_date'] == "today") { echo "selected"; } ?> value="today">Today</option>
<option <?php if ($_GET['canned_date'] == "yesterday") { echo "selected"; } ?> value="yesterday">Yesterday</option>
<option <?php if ($_GET['canned_date'] == "thisweek") { echo "selected"; } ?> value="thisweek">This Week</option>
<option <?php if ($_GET['canned_date'] == "lastweek") { echo "selected"; } ?> value="lastweek">Last Week</option>
<option <?php if ($_GET['canned_date'] == "thismonth") { echo "selected"; } ?> value="thismonth">This Month</option>
<option <?php if ($_GET['canned_date'] == "lastmonth") { echo "selected"; } ?> value="lastmonth">Last Month</option>
<option <?php if ($_GET['canned_date'] == "thisyear") { echo "selected"; } ?> value="thisyear">This Year</option>
<option <?php if ($_GET['canned_date'] == "lastyear") { echo "selected"; } ?> value="lastyear">Last Year</option>
</select>
</div>
</div>
@ -122,7 +122,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<hr>
<div class="table-responsive">
<table class="table table-striped table-borderless table-hover">
<thead class="text-dark <?php if($num_rows[0] == 0){ echo "d-none"; } ?>">
<thead class="text-dark <?php if ($num_rows[0] == 0) { echo "d-none"; } ?>">
<tr>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=payment_date&o=<?php echo $disp; ?>">Payment Date</a></th>
<th><a class="text-dark" href="?<?php echo $url_query_strings_sb; ?>&sb=invoice_date&o=<?php echo $disp; ?>">Invoice Date</a></th>
@ -137,7 +137,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<tbody>
<?php
while($row = mysqli_fetch_array($sql)){
while ($row = mysqli_fetch_array($sql)) {
$invoice_id = $row['invoice_id'];
$invoice_prefix = htmlentities($row['invoice_prefix']);
$invoice_number = htmlentities($row['invoice_number']);
@ -148,7 +148,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
$payment_amount = floatval($row['payment_amount']);
$payment_currency_code = htmlentities($row['payment_currency_code']);
$payment_reference = htmlentities($row['payment_reference']);
if(empty($payment_reference)){
if (empty($payment_reference)) {
$payment_reference_display = "-";
}else{
$payment_reference_display = $payment_reference;

View File

@ -117,7 +117,7 @@ $total_tickets = $row['total_tickets'];
<a href="?status=%" class="btn btn-secondary btn-block p-3 mb-3 text-left">All my tickets | <strong><?php echo $total_tickets ?></strong></a>
<?php
if($session_contact_id == $session_client_primary_contact_id){
if ($session_contact_id == $session_client_primary_contact_id) {
?>
<hr>

Some files were not shown because too many files have changed in this diff Show More