Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/agents/code-quality.agent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "This Custom agent acts as a quality assurance specialist, focusing on code quality, best practices, and maintainability."
name: "Code Quality Specialist"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
tools: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', 'web']
model: "Claude Sonnet 4.5"
---

Expand Down
2 changes: 1 addition & 1 deletion .github/agents/mysql-mariadb.agent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases."
name: "MySQL/ MariaDB Database Administrator"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
tools: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', 'web']
model: "Claude Sonnet 4.5"
---

Expand Down
2 changes: 1 addition & 1 deletion .github/agents/php-devloper.agent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "This custom agent acts as a PHP developer, assisting with PHP code development, debugging, and optimization."
name: "PHP Developer"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
tools: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', 'web']
model: "Claude Sonnet 4.5"
---

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* issue: If the audit log does not exist or is not set, set it and create it
* issue: Audit assumes that all selected_items are numeric resulting in fatal error
* feature: Support for Cacti 1.3
* Refactor: Migrats JS functions to functions.js

--- 1.2 ---

Expand Down
104 changes: 1 addition & 103 deletions audit.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,54 +338,6 @@ function audit_log() {
</table>
<input type='hidden' id='page' value='<?php print get_request_var('page');?>'>
</form>
<script type='text/javascript'>
function applyFilter() {
strURL = 'audit.php' +
'?filter='+$('#filter').val()+
'&rows='+$('#rows').val()+
'&page='+$('#page').val()+
'&event_page='+$('#event_page').val()+
'&user_id='+$('#user_id').val()+
'&header=false';
loadPageNoHeader(strURL);
}

function clearFilter() {
strURL = 'audit.php?clear=1&header=false';
loadPageNoHeader(strURL);
}

$(function() {
$('#event_page, #user_id, #rows').change(function() {
applyFilter();
});

$('#refresh').click(function() {
applyFilter();
});

$('#clear').click(function() {
clearFilter();
});

$('#purge').click(function() {
strURL = 'audit.php?action=purge&header=false';
loadPageNoHeader(strURL);
});

$('#export').click(function() {
document.location = 'audit.php?action=export' +
'&filter='+$('#filter').val()+
'&event_page='+$('#event_page').val()+
'&user_id='+$('#user_id').val();
});

$('#form_audit').submit(function(event) {
event.preventDefault();
applyFilter();
});
});
</script>
</td>
</tr>
<?php
Expand Down Expand Up @@ -508,61 +460,7 @@ function clearFilter() {
}

?>
<script type='text/javascript'>
var auditTimer = null;

function open_dialog(id) {
$.get('audit.php?action=getdata&id='+id, function(data) {
if (data.indexOf('narrow') > 0) {
width = 400;
} else {
width = 700;
}
$('body').append('<div id="audit" style="display:block;display:none;" title="<?php print __esc('Audit Event Details', 'audit');?>">'+data+'</div>');
$('#audit').dialog({
minWidth: width,
position: {
my: 'left',
at: 'right',
of: $('span[id="event'+id+'"]')
}
});
});
}

$('span[id^="event"]').hover(function() {
close_dialog();

id = $(this).attr('id').replace('event', '');

if (auditTimer != null) {
clearTimeout(auditTimer);
}

auditTimer = setTimeout(function() { open_dialog(id); }, 400);
},
function() {
if (auditTimer != null) {
clearTimeout(auditTimer);
}

$('#dialog').hover(function() {
clearTimeout(auditTimer);
}, function() {
auditTimer = setTimeout(function() { close_dialog(); }, 400);
});

});

function close_dialog() {
if ($('#audit').length) {
if (typeof $('#audit').dialog() === 'function') {
$('#audit').dialog('close');
}
$('#audit').remove();
}
}
</script>
<script type='text/javascript' src='plugins/audit/js/functions.js'></script>
<?php
}

3 changes: 1 addition & 2 deletions audit_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,5 +266,4 @@ function audit_config_insert() {
array($page, $user_id, $action, $ip_address, $user_agent, $event_time, $post));
}
}
}

}
150 changes: 150 additions & 0 deletions js/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2025 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/

/**
* Audit Plugin JavaScript Functions
*
* This file contains all JavaScript functions for the Audit plugin
*/

/**
* Apply filter to audit log
*/
function audit_applyFilter() {
strURL = 'audit.php' +
'?filter='+$('#filter').val()+
'&rows='+$('#rows').val()+
'&page='+$('#page').val()+
'&event_page='+$('#event_page').val()+
'&user_id='+$('#user_id').val()+
'&header=false';
loadPageNoHeader(strURL);
}

/**
* Clear all filters
*/
function audit_clearFilter() {
strURL = 'audit.php?clear=1&header=false';
loadPageNoHeader(strURL);
}

/**
* Global variable to store audit timer
*/
var auditTimer = null;

/**
* Open dialog to display audit event details
* @param {number} id - The audit event ID
*/
function audit_open_dialog(id) {
$.get('audit.php?action=getdata&id='+id, function(data) {
var width;
if (data.indexOf('narrow') > 0) {
width = 400;
} else {
width = 700;
}
$('body').append('<div id="audit" style="display:block;display:none;" title="Audit Event Details">'+data+'</div>');
$('#audit').dialog({
minWidth: width,
position: {
my: 'left',
at: 'right',
of: $('span[id="event'+id+'"]')
}
});
});
}

/**
* Close audit dialog
*/
function audit_close_dialog() {
if ($('#audit').length) {
if (typeof $('#audit').dialog() === 'function') {
$('#audit').dialog('close');
}
$('#audit').remove();
}
}

/**
* Initialize audit event handlers on document ready
*/
$(function() {
// Filter change event handlers
$('#event_page, #user_id, #rows').change(function() {
audit_applyFilter();
});

$('#refresh').click(function() {
audit_applyFilter();
});

$('#clear').click(function() {
audit_clearFilter();
});

$('#purge').click(function() {
strURL = 'audit.php?action=purge&header=false';
loadPageNoHeader(strURL);
});

$('#export').click(function() {
document.location = 'audit.php?action=export' +
'&filter='+$('#filter').val()+
'&event_page='+$('#event_page').val()+
'&user_id='+$('#user_id').val();
});

$('#form_audit').submit(function(event) {
event.preventDefault();
audit_applyFilter();
});

// Hover event handlers for audit event details
$('span[id^="event"]').hover(function() {
audit_close_dialog();

id = $(this).attr('id').replace('event', '');

if (auditTimer != null) {
clearTimeout(auditTimer);
}

auditTimer = setTimeout(function() { audit_open_dialog(id); }, 400);
},
function() {
if (auditTimer != null) {
clearTimeout(auditTimer);
}

$('#dialog').hover(function() {
clearTimeout(auditTimer);
}, function() {
auditTimer = setTimeout(function() { audit_close_dialog(); }, 400);
});
});
});