-
+
+
-
-
diff --git a/client_contact_details.php b/client_contact_details.php
index 45b79986..17687d6a 100644
--- a/client_contact_details.php
+++ b/client_contact_details.php
@@ -574,6 +574,30 @@ if (isset($_GET['contact_id'])) {
diff --git a/client_logins.php b/client_logins.php
index dc1ddf21..a7030acc 100644
--- a/client_logins.php
+++ b/client_logins.php
@@ -50,7 +50,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@@ -176,8 +181,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
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},
+ "ajax.php", {
+ get_totp_token: 'true',
+ totp_secret: secret
+ },
function(data) {
//If we get a response from post.php, parse it as JSON
const token = JSON.parse(data);
@@ -191,8 +198,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
function showOTPViaLoginID(login_id) {
// Send a GET request to ajax.php as ajax.php?get_totp_token_via_id=true&login_id=ID
jQuery.get(
- "ajax.php",
- {get_totp_token_via_id: 'true', login_id: login_id},
+ "ajax.php", {
+ get_totp_token_via_id: 'true',
+ login_id: login_id
+ },
function(data) {
//If we get a response from post.php, parse it as JSON
const token = JSON.parse(data);
@@ -204,7 +213,24 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
}
function generatePassword() {
- document.getElementById("password").value = ""
+ document.getElementById("password").value = ""
+ }
+
+ function generatePassword() {
+ var url = '/ajax.php?get_readable_pass=true';
+
+ // Make an AJAX request to the server
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', url, true);
+
+ xhr.onreadystatechange = function() {
+ if (xhr.readyState == 4 && xhr.status == 200) {
+ var password = xhr.responseText;
+
+ document.getElementById("password").value = password;
+ }
+ };
+ xhr.send();
}
@@ -219,4 +245,3 @@ require_once "client_login_import_modal.php";
require_once "client_login_export_modal.php";
require_once "footer.php";
-
diff --git a/functions.php b/functions.php
index cc5c5b45..47aa7edf 100644
--- a/functions.php
+++ b/functions.php
@@ -15,8 +15,7 @@ use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// Function to generate both crypto & URL safe random strings
-function randomString($length = 16)
-{
+function randomString($length = 16) {
// Generate some cryptographically safe random bytes
// Generate a little more than requested as we'll lose some later converting
$random_bytes = random_bytes($length + 5);
@@ -33,8 +32,7 @@ function randomString($length = 16)
}
// Older keygen function - only used for TOTP currently
-function key32gen()
-{
+function key32gen() {
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$chars .= "234567";
while (1) {
@@ -256,8 +254,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 = randomString();
$salt = randomString();
@@ -874,6 +871,57 @@ function calculateAccountBalance($mysqli, $account_id) {
}
+function generateReadablePassword($security_level) {
+ // Arrays of words
+ $adjectives = ['Smart', 'Swift', 'Secure', 'Stable', 'Digital', 'Virtual', 'Active', 'Dynamic', 'Innovative', 'Efficient', 'Portable', 'Wireless', 'Rapid', 'Intuitive', 'Automated', 'Robust', 'Reliable', 'Sleek', 'Modern', 'Happy', 'Funny', 'Quick', 'Bright', 'Clever', 'Gentle', 'Brave', 'Calm', 'Eager', 'Fierce', 'Kind', 'Lucky', 'Proud', 'Silly', 'Witty', 'Bold', 'Curious', 'Elated', 'Gracious', 'Honest', 'Jolly', 'Merry', 'Noble', 'Optimistic', 'Playful', 'Quirky', 'Rustic', 'Steady', 'Tranquil', 'Upbeat'];
+ $nouns = ['Computer', 'Laptop', 'Tablet', 'Server', 'Router', 'Software', 'Hardware', 'Pixel', 'Byte', 'App', 'Network', 'Cloud', 'Firewall', 'Email', 'Database', 'Folder', 'Document', 'Interface', 'Program', 'Gadget', 'Dinosaur', 'Tiger', 'Elephant', 'Kangaroo', 'Monkey', 'Unicorn', 'Dragon', 'Puppy', 'Kitten', 'Parrot', 'Lion', 'Bear', 'Fox', 'Wolf', 'Rabbit', 'Deer', 'Owl', 'Hedgehog', 'Turtle', 'Frog', 'Butterfly', 'Panda', 'Giraffe', 'Zebra', 'Peacock', 'Koala', 'Raccoon', 'Squirrel', 'Hippo', 'Rhino', 'Book', "Monitor"];
+ $verbs = ['Connects', 'Runs', 'Processes', 'Secures', 'Encrypts', 'Saves', 'Updates', 'Boots', 'Scans', 'Compiles', 'Executes', 'Restores', 'Installs', 'Configures', 'Downloads', 'Streams', 'BacksUp', 'Syncs', 'Browses', 'Navigates', 'Runs', 'Jumps', 'Flies', 'Swims', 'Dances', 'Sings', 'Hops', 'Skips', 'Races', 'Climbs', 'Crawls', 'Glides', 'Twirls', 'Swings', 'Sprints', 'Gallops', 'Trots', 'Wanders', 'Strolls', 'Marches'];
+ $adverbs = ['Quickly', 'Slowly', 'Gracefully', 'Wildly', 'Loudly', 'Silently', 'Cheerfully', 'Eagerly', 'Gently', 'Happily', 'Jovially', 'Kindly', 'Lazily', 'Merrily', 'Neatly', 'Politely', 'Quietly', 'Rapidly', 'Smoothly', 'Tightly', 'Swiftly', 'Securely', 'Efficiently', 'Rapidly', 'Smoothly', 'Reliably', 'Safely', 'Wirelessly', 'Instantly', 'Silently', 'Automatically', 'Seamlessly', 'Digitally', 'Virtually', 'Continuously', 'Regularly', 'Intelligently', 'Logically'];
+
+ // Randomly select words from arrays
+ $adj = $adjectives[array_rand($adjectives)];
+ $noun = $nouns[array_rand($nouns)];
+ $verb = $verbs[array_rand($verbs)];
+ $adv = $adverbs[array_rand($adverbs)];
+
+
+
+ // Combine to create a base password
+ if ($security_level > 2 ) {
+ $password = "The" . $adj . $noun . $adv . $verb;
+ } else {
+ $password = $adj . $noun . $verb;
+ }
+
+ // Mapping of letters to special characters and numbers
+ $mappings = [
+ 'A' => '@', 'a' => '@',
+ 'E' => '3', 'e' => '3',
+ 'I' => '!', 'i' => '!',
+ 'O' => '0', 'o' => '0',
+ 'S' => '$', 's' => '$'
+ ];
+
+ // Replace characters based on mappings
+ if ($security_level > 4) {
+ $password = strtr($password, $mappings);
+ } else {
+ // Randomly replace characters based on mappings
+ for ($i = 0; $i < strlen($password); $i++) {
+ if (array_key_exists($password[$i], $mappings) && rand(0, 1)) {
+ $password[$i] = $mappings[$password[$i]];
+ }
+ }
+ }
+
+ if ($security_level > 3) {
+ // Add a random number at the end
+ $password .= rand(0, 99);
+ }
+
+ return $password;
+}
+
function addToMailQueue($mysqli, $data) {
foreach ($data as $email) {
@@ -914,4 +962,5 @@ function calculateInvoiceBalance($mysqli, $invoice_id) {
return $balance;
+
}
\ No newline at end of file
diff --git a/tickets.php b/tickets.php
index 8c70b8dd..24ee725a 100644
--- a/tickets.php
+++ b/tickets.php
@@ -37,9 +37,9 @@ if (isset($_GET['status']) && is_array($_GET['status']) && !empty($_GET['status'
// Ticket assignment status filter
if (isset($_GET['assigned']) & !empty($_GET['assigned'])) {
if ($_GET['assigned'] == 'unassigned') {
- $ticket_assigned_filter = '0';
+ $ticket_assigned_filter = 'AND ticket_assigned_to = 0';
} else {
- $ticket_assigned_filter = intval($_GET['assigned']);
+ $ticket_assigned_filter = 'AND ticket_assigned_to = '.intval($_GET['assigned']);
}
} else {
// Default - any
@@ -59,8 +59,7 @@ $sql = mysqli_query(
LEFT JOIN assets ON ticket_asset_id = asset_id
LEFT JOIN locations ON ticket_location_id = location_id
LEFT JOIN vendors ON ticket_vendor_id = vendor_id
- WHERE ticket_assigned_to LIKE '%$ticket_assigned_filter%'
- AND $ticket_status_snippet
+ WHERE $ticket_status_snippet " . $ticket_assigned_filter . "
AND DATE(ticket_created_at) BETWEEN '$dtf' AND '$dtt'
AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_status LIKE '%$q%' OR ticket_priority LIKE '%$q%' OR user_name LIKE '%$q%' OR contact_name LIKE '%$q%' OR asset_name LIKE '%$q%' OR vendor_name LIKE '%$q%' OR ticket_vendor_ticket_number LIKE '%q%')
ORDER BY $sort $order LIMIT $record_from, $record_to"
@@ -320,6 +319,10 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
$ticket_status_color = "success";
} elseif ($ticket_status == "Closed") {
$ticket_status_color = "dark";
+ } elseif ($ticket_status == "Auto Close") {
+ $ticket_status_color = "dark";
+ } elseif ($ticket_status == "Client-Replied") {
+ $ticket_status_color = "warning";
} else{
$ticket_status_color = "secondary";
}
@@ -367,7 +370,7 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']);
-
|