Windows/Tab Titles now reflect the current page your on along with the company name or selected client. Pages contact details, asset details, tickets, projects, documents, invoices, quotes, recurring invoices overide to include more detail in tab title

This commit is contained in:
johnnyq 2025-01-13 14:40:05 -05:00
parent 0cb3cdc26d
commit 97723da633
16 changed files with 75 additions and 58 deletions

View File

@ -66,6 +66,9 @@ if (isset($_GET['asset_id'])) {
$location_name_display = $location_name;
}
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$page_title = $row['asset_name'];
// Related Tickets Query
$sql_related_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
LEFT JOIN users on ticket_assigned_to = user_id

View File

@ -34,6 +34,9 @@ if (isset($_GET['contact_id'])) {
$auth_method = nullable_htmlentities($row['user_auth_method']);
$contact_client_id = intval($row['contact_client_id']);
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$page_title = $row['contact_name'];
// Check to see if Contact belongs to client
if($contact_client_id !== $client_id) {
exit();

View File

@ -37,6 +37,9 @@ $document_folder_id = intval($row['document_folder_id']);
$document_parent = intval($row['document_parent']);
$document_client_visible = intval($row['document_client_visible']);
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$page_title = $row['document_name'];
?>
<ol class="breadcrumb d-print-none">

View File

@ -50,7 +50,8 @@ function key32gen()
function nullable_htmlentities($unsanitizedInput)
{
return htmlentities($unsanitizedInput ?? '');
//return htmlentities($unsanitizedInput ?? '');
return htmlspecialchars($unsanitizedInput, ENT_QUOTES, 'UTF-8');
}
function initials($str)

View File

@ -13,6 +13,9 @@ if (str_contains(basename($_SERVER["PHP_SELF"]), "admin_")) { ?>
</div> <!-- /.content-wrapper -->
</div> <!-- ./wrapper -->
<!-- Set the browser window title to the clients name -->
<script>document.title = "<?php echo "$tab_title - $page_title"; ?>"</script>
<!-- REQUIRED SCRIPTS -->
<!-- Bootstrap 4 -->

View File

@ -1,13 +1,10 @@
<?php
require_once "config.php";
include_once "functions.php";
require_once "functions.php";
require_once "check_login.php";
require_once "page_title.php";
require_once "header.php";
require_once "top_nav.php";
// Get Main Side Bar Badge Counts

View File

@ -1,25 +1,16 @@
<?php
require_once "config.php";
require_once "functions.php";
require_once "check_login.php";
require_once "page_title.php";
if (!isset($session_is_admin) || !$session_is_admin) {
exit(WORDING_ROLECHECK_FAILED . "<br>Tell your admin: Your role does not have admin access.");
}
require_once "header.php";
require_once "top_nav.php";
require_once "admin_side_nav.php";
require_once "inc_wrapper.php";
require_once "inc_alert_feedback.php";
require_once "filter_header.php";
require_once "app_version.php";

View File

@ -1,10 +1,9 @@
<?php
require_once "config.php";
require_once "functions.php";
require_once "check_login.php";
require_once "page_title.php";
// Perms
enforceUserPermission('module_client');
@ -43,7 +42,6 @@ if (isset($_GET['client_id'])) {
$row = mysqli_fetch_array($sql);
$client_name = nullable_htmlentities($row['client_name']);
$client_name_title = $row['client_name'];
$client_is_lead = intval($row['client_lead']);
$client_type = nullable_htmlentities($row['client_type']);
$client_website = nullable_htmlentities($row['client_website']);
@ -77,6 +75,9 @@ if (isset($_GET['client_id'])) {
$location_phone = formatPhoneNumber($row['location_phone']);
$location_primary = intval($row['location_primary']);
// Tab Title // No Sanitizing needed
$tab_title = $row['client_name'];
// Client Tags
$client_tag_name_display_array = array();
@ -294,20 +295,9 @@ if (isset($_GET['client_id'])) {
}
require_once "header.php";
require_once "top_nav.php";
require_once "client_side_nav.php";
require_once "inc_wrapper.php";
require_once "inc_alert_feedback.php";
require_once "inc_client_top_head.php";
require_once "filter_header.php";
?>
<!-- Set the browser window title to the clients name -->
<script>document.title = "<?php echo $client_name_title; ?>"</script>

View File

@ -1,24 +1,16 @@
<?php
require_once "config.php";
require_once "functions.php";
require_once "check_login.php";
require_once "page_title.php";
// Reporting Perms
enforceUserPermission('module_reporting');
require_once "header.php";
require_once "top_nav.php";
require_once "reports_side_nav.php";
require_once "inc_wrapper.php";
require_once "inc_alert_feedback.php";
require_once "filter_header.php";
// Set variable default values

View File

@ -1,19 +1,12 @@
<?php
require_once "config.php";
require_once "functions.php";
require_once "check_login.php";
require_once "page_title.php";
require_once "header.php";
require_once "top_nav.php";
require_once "user_side_nav.php";
require_once "inc_wrapper.php";
require_once "inc_alert_feedback.php";
require_once "filter_header.php";

32
includes/page_title.php Normal file
View File

@ -0,0 +1,32 @@
<?php
// Set Page Title
// Get the current page name without the .php extension
$page_title = basename($_SERVER['PHP_SELF'], '.php');
// Remove 'client_' from the page name
$page_title = str_replace('client_', '', $page_title);
// Remove 'report_' from the page name
$page_title = str_replace('report_', '', $page_title);
// Remove 'admin_' from the page name
$page_title = str_replace('admin_', '', $page_title);
// Remove 'admin_' from the page name
$page_title = str_replace('settings_', '', $page_title);
// Replace any underscores with spaces
$page_title = str_replace('_', ' ', $page_title);
// Capitize
$page_title = ucwords($page_title);
// Sanitize title for SQL input such as logging
$page_title_sanitized = sanitizeInput($page_title);
// Sanitize the page title to prevent XSS for output
$page_title = nullable_htmlentities($page_title);
$tab_title = $session_company_name;

View File

@ -59,6 +59,10 @@ if (isset($_GET['invoice_id'])) {
$client_net_terms = $config_default_net_terms;
}
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$tab_title = $row['client_name'];
$page_title = "{$row['invoice_prefix']}{$row['invoice_number']}";
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
$row = mysqli_fetch_array($sql);
$company_id = intval($row['company_id']);

View File

@ -2,7 +2,6 @@
require_once "includes/inc_all.php";
if (isset($_GET['project_id'])) {
$project_id = intval($_GET['project_id']);
@ -33,7 +32,6 @@ if (isset($_GET['project_id'])) {
$project_updated_at = nullable_htmlentities($row['project_updated_at']);
$project_completed_at = nullable_htmlentities($row['project_completed_at']);
$project_archived_at = nullable_htmlentities($row['project_archived_at']);
$client_id = intval($row['client_id']);
$client_name = nullable_htmlentities($row['client_name']);
if ($client_name) {
@ -58,6 +56,10 @@ if (isset($_GET['project_id'])) {
$project_completed_date_display = "";
}
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$tab_title = "{$row['project_prefix']}{$row['project_number']}";
$page_title = $row['project_name'];
// Get Tickets
$sql_tickets = mysqli_query($mysqli, "SELECT * FROM tickets
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id

View File

@ -59,6 +59,10 @@ if (isset($_GET['quote_id'])) {
$client_net_terms = $config_default_net_terms;
}
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$tab_title = $row['client_name'];
$page_title = "{$row['quote_prefix']}{$row['quote_number']}";
$sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1");
$row = mysqli_fetch_array($sql);

View File

@ -63,6 +63,10 @@ if (isset($_GET['recurring_id'])) {
$recurring_payment_id = intval($row['recurring_payment_id']);
$recurring_payment_recurring_invoice_id = intval($row['recurring_payment_recurring_invoice_id']);
// Override Tab Title // No Sanitizing needed as this var will opnly be used in the tab title
$tab_title = $row['client_name'];
$page_title = "{$row['recurring_prefix']}{$row['recurring_number']}";
$sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1");
$row = mysqli_fetch_array($sql);

View File

@ -116,6 +116,10 @@ if (isset($_GET['ticket_id'])) {
$ticket_assigned_to_display = nullable_htmlentities($row['user_name']);
}
// Tab Title // No Sanitizing needed
$page_title = $row['ticket_subject'];
$tab_title = "{$row['ticket_prefix']}{$row['ticket_number']}";
$contact_id = intval($row['contact_id']);
$contact_name = nullable_htmlentities($row['contact_name']);
$contact_title = nullable_htmlentities($row['contact_title']);
@ -1155,23 +1159,14 @@ if (isset($_GET['ticket_id'])) {
<?php
if (lookupUserPermission("module_support") >= 2 && empty($ticket_closed_at)) {
require_once "modals/ticket_edit_modal.php";
require_once "modals/ticket_assign_modal.php";
require_once "modals/ticket_edit_contact_modal.php";
require_once "modals/ticket_edit_asset_modal.php";
require_once "modals/ticket_edit_vendor_modal.php";
require_once "modals/ticket_add_watcher_modal.php";
require_once "modals/ticket_edit_priority_modal.php";
require_once "modals/ticket_change_client_modal.php";
require_once "modals/ticket_edit_schedule_modal.php";
require_once "modals/ticket_merge_modal.php";
}