Merge branch 'develop' into '1758-Error-tamaño-al-crear-elemento-de-imagen-en-consola-visual-dev'
# Conflicts: # pandora_console/godmode/reporting/visual_console_builder.editor.js
|
@ -1,84 +1,170 @@
|
|||
* {
|
||||
font-family: "Open Sans", "Noto Sans", sans-serif
|
||||
}
|
||||
|
||||
body {
|
||||
min-width:425px;
|
||||
min-height:540px;
|
||||
margin:5px;
|
||||
font-family:Tahoma, Geneva, Arial;
|
||||
font-size:10pt;
|
||||
min-width: 425px;
|
||||
min-height: 540px;
|
||||
margin: 5px;
|
||||
font-family: Tahoma, Geneva, Arial;
|
||||
font-size: 10pt;
|
||||
}
|
||||
h1 { font-weight: bold; font-size:16px; margin:2px 0px 2px 0px; color:#237948; font-family:arial }
|
||||
h2{
|
||||
color : black;
|
||||
h1 {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
margin: 2px 0px 2px 0px;
|
||||
}
|
||||
p
|
||||
{
|
||||
font-family:"Times New Roman";
|
||||
font-size:20px;
|
||||
h2 {
|
||||
color : #333;
|
||||
}
|
||||
p {
|
||||
font-size: 20px;
|
||||
}
|
||||
a {
|
||||
color: #254533;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a:visited {
|
||||
color: #254533; text-decoration:none;
|
||||
}
|
||||
a:visited:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
a { color: #254533; text-decoration:none; }
|
||||
a:hover { text-decoration:underline; }
|
||||
a:visited { color: #254533; text-decoration:none; }
|
||||
a:visited:hover { text-decoration:underline; }
|
||||
span.res {
|
||||
font-size: 80%;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
span.res { font-size:80%; color:#555; }
|
||||
|
||||
img.pm { margin-right:3px;cursor:pointer; margin-top:0px; }
|
||||
div.main{
|
||||
background-color : white;
|
||||
img.pm {
|
||||
margin-right: 3px;
|
||||
cursor: pointer;
|
||||
margin-top: 2px;
|
||||
float: right;
|
||||
}
|
||||
div.main {
|
||||
background-color: white;
|
||||
height: 500px;
|
||||
width: 400px;
|
||||
}
|
||||
div.textarea{
|
||||
background-color : #D5DED5;
|
||||
width :100%
|
||||
div.textarea {
|
||||
background-color: #D5DED5;
|
||||
width: 100%
|
||||
}
|
||||
div.e {
|
||||
text-align: right;
|
||||
font-size:8pt;
|
||||
}
|
||||
div.b {
|
||||
background-color:white;
|
||||
display: none;
|
||||
}
|
||||
div.b p a {
|
||||
font-size: 10pt;
|
||||
}
|
||||
div.e{ text-align:right; font-size:8pt; }
|
||||
div.b { background-color:white; border:1px solid #BABABA; margin:5px; padding:4px; display:none; }
|
||||
div.b p a { font-size: 10pt; }
|
||||
div.b p { margin:2px 0px 4px 0px; display:none; color:#333; font-size:9pt; }
|
||||
div.b div.items p {
|
||||
margin:2px 0px 8px 0px; color:#333; width:355px;float:left;display:block;
|
||||
margin: 2px 0px 8px 0px;
|
||||
width: 355px;
|
||||
float: left;
|
||||
display: block;
|
||||
}
|
||||
div.b div.items p img {
|
||||
float:left;margin:0px 3px 0px 0px;
|
||||
float: left;
|
||||
margin: 0px 3px 0px 0px;
|
||||
}
|
||||
|
||||
div.options_header{
|
||||
margin : 10px 10px;
|
||||
div.options_header {
|
||||
margin: 10px 10px;
|
||||
}
|
||||
|
||||
div.options_divider{
|
||||
width : 100%;
|
||||
background-color : #C8C8C8;
|
||||
div.options_divider {
|
||||
width: 627px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
div.optionsG_textarea{
|
||||
background-color : green;
|
||||
width : 450px;
|
||||
margin : 5px, 10px;
|
||||
div.options_divider h2{
|
||||
margin: 20px 20px 0;
|
||||
padding: 5px;
|
||||
font-weight: 500;
|
||||
border: 2px solid #82b92e;
|
||||
border-top-left-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
color: white;
|
||||
text-align: center;
|
||||
background: #82b92e;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
div.options_textarea{
|
||||
background-color : #ebebeb;
|
||||
width : 550px;
|
||||
margin : 10px 10px;
|
||||
|
||||
div.options_textarea {
|
||||
background-color: #f6f6f6;
|
||||
width: 550px;
|
||||
margin: 0 20px;
|
||||
padding: 10px 10px 25px 25px;
|
||||
border-bottom-left-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
border: 1px solid #e4e4e4;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
div.options_footer {
|
||||
width: 550px;
|
||||
margin: 10px 10px;
|
||||
padding: 10px;
|
||||
-webkit-border-radius:10px;
|
||||
border: 2px solid #c8c8c8;
|
||||
}
|
||||
|
||||
div.options_footer{
|
||||
width : 550px;
|
||||
margin : 10px 10px;
|
||||
padding: 10px;
|
||||
select {
|
||||
background: white;
|
||||
border: 1px solid #888;
|
||||
font-size: smaller;
|
||||
padding: 2px 1px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.sound_selector td:first-child {
|
||||
padding-left: 25px;
|
||||
width: 39%;
|
||||
}
|
||||
|
||||
.options_textarea button {
|
||||
background-color: #82b92e;
|
||||
border: 1px solid #82b92e;
|
||||
color: white;
|
||||
padding: 6px 32px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 12px;
|
||||
border-radius: 2px;
|
||||
margin: 25px 0px 0px 422px;
|
||||
}
|
||||
|
||||
.options_textarea button:hover {
|
||||
background-color: transparent;
|
||||
color: #82b92e;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.options_textarea h3 {
|
||||
text-align: left;
|
||||
font-size: 11.4pt;
|
||||
}
|
||||
|
||||
button h3 {
|
||||
margin: 0;
|
||||
font-size: 10pt !important;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
display:none;
|
||||
font-size:12px;
|
||||
height:70px;
|
||||
width:160px;
|
||||
padding:25px;
|
||||
color:#eee;
|
||||
display: none;
|
||||
font-size: 12px;
|
||||
height: 70px;
|
||||
width: 160px;
|
||||
padding: 25px;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
|
@ -87,11 +173,78 @@ div.options_footer{
|
|||
left: 50%;
|
||||
margin-left: -50px;
|
||||
margin-top: -50px;
|
||||
text-align:center;
|
||||
z-index:1234;
|
||||
text-align: center;
|
||||
z-index: 1234;
|
||||
overflow: auto;
|
||||
width: 100px;
|
||||
height: 102px;
|
||||
}
|
||||
|
||||
.error {
|
||||
display: flex;
|
||||
border: solid #e4e4e4 1px;
|
||||
border-radius: 2px;
|
||||
background: #f6f6f6;
|
||||
padding: 10px;
|
||||
margin: 10px;
|
||||
margin-top: 35px;
|
||||
}
|
||||
|
||||
.error_text {
|
||||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.result {
|
||||
margin: 10px;
|
||||
height: 500;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
#events_title {
|
||||
padding: 5px 0;
|
||||
margin: 0;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
.event {
|
||||
border: solid 1px #e5e5e5;
|
||||
border-top: 0;
|
||||
padding: 5px 6px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.event a {
|
||||
margin-left: 5px;
|
||||
color: white;
|
||||
font-size: 9pt;
|
||||
}
|
||||
|
||||
.sev-Warning a {
|
||||
margin-left: 5px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.event p {
|
||||
margin: 0 0 0 6px;
|
||||
padding-top: 2px;
|
||||
display: none;
|
||||
font-size: 8pt;
|
||||
}
|
||||
|
||||
.sev-Warning {
|
||||
background: #FDDD30;
|
||||
color: #333;
|
||||
}
|
||||
.sev-Critical {
|
||||
background: #F84348;
|
||||
}
|
||||
.sev-Informational {
|
||||
background: #4CA8E0;
|
||||
}
|
||||
.sev-Normal {
|
||||
background: #84B839;
|
||||
}
|
||||
.sev-Maintenance {
|
||||
background: #A8A8A8;
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 507 B After Width: | Height: | Size: 468 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 636 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 703 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 91 B |
After Width: | Height: | Size: 350 B |
Before Width: | Height: | Size: 95 B |
After Width: | Height: | Size: 353 B |
Before Width: | Height: | Size: 501 B After Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -1,29 +1,35 @@
|
|||
var timer = null;
|
||||
var allEvents=new Array();
|
||||
var newEvents=new Array();
|
||||
var oldEvents=new Array();
|
||||
var api_div_numbers=21;
|
||||
|
||||
var refreshTimer = null;
|
||||
var isFetching = null;
|
||||
var storedEvents = new Array();
|
||||
var notVisited = {};
|
||||
|
||||
$(window).load(function() {
|
||||
initilise();
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(main , 100 );
|
||||
// Wait some ms to throw main function
|
||||
var delay = setTimeout(main, 100);
|
||||
resetInterval();
|
||||
});
|
||||
|
||||
|
||||
|
||||
function fetchEvents(){
|
||||
return oldEvents;
|
||||
function fetchEvents() {
|
||||
return storedEvents;
|
||||
}
|
||||
|
||||
function fetchNotVisited() {
|
||||
return notVisited;
|
||||
}
|
||||
|
||||
function removeNotVisited(eventId) {
|
||||
if (notVisited[eventId] === true) delete notVisited[eventId];
|
||||
}
|
||||
|
||||
function main() {
|
||||
var url=localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
|
||||
var feedUrl = url;
|
||||
localStorage["data_check"]="true";
|
||||
|
||||
chrome.runtime.sendMessage({text: "FETCH_EVENTS"});
|
||||
// Do not fetch if is fetching now
|
||||
if (isFetching) return;
|
||||
isFetching = true;
|
||||
|
||||
var feedUrl = localStorage["ip_address"]+'/include/api.php?op=get&op2=events&return_type=csv&apipass='+localStorage["api_pass"]+'&user='+localStorage["user_name"]+'&pass='+localStorage["pass"];
|
||||
req = new XMLHttpRequest();
|
||||
req.onload = handleResponse;
|
||||
req.onerror = handleError;
|
||||
|
@ -32,96 +38,85 @@ function main() {
|
|||
}
|
||||
|
||||
function handleError() {
|
||||
localStorage["data_check"]="false";
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(main , 1000);
|
||||
chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"});
|
||||
isFetching = false;
|
||||
}
|
||||
|
||||
function handleResponse() {
|
||||
var doc = req.responseText;
|
||||
if (doc=="auth error") {
|
||||
localStorage["data_check"]="false";
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(main , 1000);
|
||||
}
|
||||
else{
|
||||
var n=doc.search("404 Not Found");
|
||||
if(n>0){
|
||||
localStorage["data_check"]="false";
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(main , 1000);
|
||||
}
|
||||
|
||||
else{
|
||||
localStorage["data_check"]="true"
|
||||
chrome.runtime.sendMessage({text: "FETCH_EVENTS_URL_ERROR"});
|
||||
} else {
|
||||
var n = doc.search("404 Not Found");
|
||||
if (n>0) {
|
||||
chrome.runtime.sendMessage({text: "FETCH_EVENTS_DATA_ERROR"});
|
||||
} else {
|
||||
getEvents(doc);
|
||||
chrome.runtime.sendMessage({text: "FETCH_EVENTS_SUCCESS"});
|
||||
}
|
||||
}
|
||||
isFetching = false;
|
||||
}
|
||||
|
||||
function getEvents(reply){
|
||||
if(check()){
|
||||
all_event_array=reply.split("\n");
|
||||
allEvents=divideArray(all_event_array);
|
||||
if(oldEvents.length==0){
|
||||
oldEvents=allEvents;
|
||||
var fetchedEvents = parseReplyEvents(reply);
|
||||
|
||||
// If there is no events requested, mark all as visited
|
||||
if (storedEvents.length == 0) {
|
||||
notVisited = {};
|
||||
storedEvents = fetchedEvents;
|
||||
return;
|
||||
}
|
||||
|
||||
// Discriminate the new events
|
||||
newEvents=fetchNewEvents(fetchedEvents,storedEvents);
|
||||
var newNotVisited = {};
|
||||
var notVisitedCount = 0;
|
||||
|
||||
// Check if popup is displayed to make some actions
|
||||
var views = chrome.extension.getViews({ type: "popup" });
|
||||
for(var k=0;k<newEvents.length;k++){
|
||||
newNotVisited[newEvents[k]['id']] = true;
|
||||
if (views.length == 0) {
|
||||
notVisitedCount++;
|
||||
displayNotification (newEvents[k])
|
||||
alertsSound(newEvents[k]);
|
||||
}
|
||||
newEvents=fetchNewEvents(allEvents,oldEvents);
|
||||
if(newEvents.length!=0){
|
||||
for(var k=0;k<newEvents.length;k++){
|
||||
localStorage["new_events"]++;
|
||||
showNotification(k);
|
||||
}
|
||||
}
|
||||
|
||||
// Make that the old events marked as not visited remains with the
|
||||
// same status
|
||||
for(var k=0;k<fetchedEvents.length;k++){
|
||||
if (notVisited[fetchedEvents[k]['id']] === true) {
|
||||
newNotVisited[fetchedEvents[k]['id']] = true;
|
||||
notVisitedCount++;
|
||||
}
|
||||
oldEvents=allEvents;
|
||||
if(localStorage["new_events"]!=0){
|
||||
showBadge(localStorage["new_events"]);
|
||||
}
|
||||
else{
|
||||
hideBadge();
|
||||
}
|
||||
|
||||
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(main , localStorage["refresh"]*1000 );
|
||||
}
|
||||
notVisited = newNotVisited;
|
||||
|
||||
// Update the number
|
||||
localStorage["new_events"] = (views.length == 0) ? notVisitedCount : 0;
|
||||
updateBadge();
|
||||
|
||||
// Store the requested events
|
||||
storedEvents = fetchedEvents;
|
||||
}
|
||||
|
||||
function updateBadge() {
|
||||
if (localStorage["new_events"] != 0) {
|
||||
chrome.browserAction.setBadgeBackgroundColor({color:[0,200,0,255]});
|
||||
chrome.browserAction.setBadgeText({ text: localStorage["new_events"] });
|
||||
} else {
|
||||
chrome.browserAction.setBadgeText({ text: "" });
|
||||
}
|
||||
}
|
||||
|
||||
function showBadge(txt) {
|
||||
chrome.browserAction.setBadgeBackgroundColor({color:[0,200,0,255]});
|
||||
chrome.browserAction.setBadgeText({ text: txt });
|
||||
}
|
||||
function hideBadge() {
|
||||
chrome.browserAction.setBadgeText({ text: "" });
|
||||
}
|
||||
function divideArray(e_array){
|
||||
var Events=new Array();
|
||||
for(var i=0;i<e_array.length;i++){
|
||||
var event=e_array[i].split(";");
|
||||
Events.push(event);
|
||||
}
|
||||
return Events;
|
||||
}
|
||||
|
||||
function hideNotification(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
function fetchNewEvents(A,B){
|
||||
var arrDiff = new Array();
|
||||
for(var i = 0; i < A.length; i++) {
|
||||
var id = false;
|
||||
for(var j = 0; j < B.length; j++) {
|
||||
if(A[i][0] == B[j][0]) {
|
||||
if(A[i]['id'] == B[j]['id']) {
|
||||
id = true;
|
||||
break;
|
||||
}
|
||||
|
@ -134,115 +129,183 @@ function fetchNewEvents(A,B){
|
|||
}
|
||||
|
||||
|
||||
function showNotification(eventId){
|
||||
var Severity;
|
||||
if(localStorage["sound_alert"]=="on"){
|
||||
if(newEvents[eventId][19]=="Critical"){
|
||||
function parseReplyEvents (reply) {
|
||||
|
||||
// Split the API response
|
||||
var e_array = reply.split("\n");
|
||||
|
||||
// Form a properly object
|
||||
var fetchedEvents=new Array();
|
||||
for(var i=0;i<e_array.length;i++){
|
||||
// Avoid to parse empty lines
|
||||
if (e_array[i].length == 0) continue;
|
||||
|
||||
var event=e_array[i].split(";");
|
||||
fetchedEvents.push({
|
||||
'id' : event[0],
|
||||
'agent_name' : event[1],
|
||||
'agent' : event[2],
|
||||
'date' : event[5],
|
||||
'title' : event[6],
|
||||
'module' : event[9],
|
||||
'type' : event[14],
|
||||
'source' : event[17],
|
||||
'severity' : event[28],
|
||||
'visited' : false
|
||||
});
|
||||
}
|
||||
// Return the events
|
||||
return fetchedEvents;
|
||||
}
|
||||
|
||||
function alertsSound(pEvent){
|
||||
if(localStorage["sound_alert"]!="on"){
|
||||
return;
|
||||
}
|
||||
|
||||
switch (pEvent['severity']) {
|
||||
case "Critical":
|
||||
playSound(localStorage["critical"]);
|
||||
}
|
||||
if(newEvents[eventId][19]=="Informational"){
|
||||
break;
|
||||
case "Informational":
|
||||
playSound(localStorage["informational"]);
|
||||
}
|
||||
if(newEvents[eventId][19]=="Maintenance"){
|
||||
break;
|
||||
case "Maintenance":
|
||||
playSound(localStorage["maintenance"]);
|
||||
}
|
||||
if(newEvents[eventId][19]=="Normal"){
|
||||
break;
|
||||
case "Normal":
|
||||
playSound(localStorage["normal"]);
|
||||
}
|
||||
if(newEvents[eventId][19]=="Warning"){
|
||||
break;
|
||||
case "Warning":
|
||||
playSound(localStorage["warning"]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
var notification = webkitNotifications.createHTMLNotification(
|
||||
"notification.html?event="+eventId
|
||||
);
|
||||
notification.show();
|
||||
}
|
||||
|
||||
function getNotification(eventId){
|
||||
var title=newEvents[eventId][6];
|
||||
var id;
|
||||
if(newEvents[eventId][9]==0){
|
||||
id=".";
|
||||
function displayNotification (pEvent) {
|
||||
|
||||
// Check if the user is okay to get some notification
|
||||
if (Notification.permission === "granted") {
|
||||
// If it's okay create a notification
|
||||
getNotification(pEvent);
|
||||
}
|
||||
else {
|
||||
id= " in the module with Id "+ newEvents[eventId][9] + ".";
|
||||
}
|
||||
|
||||
var event = newEvents[eventId][14]+" : "+newEvents[eventId][17]+". Event occured at "+ newEvents[eventId][5]+id;
|
||||
return '<a>' + title + '</a> <br/> <span style="font-size:80%">' + event + '</span>';
|
||||
|
||||
// Otherwise, we need to ask the user for permission
|
||||
// Note, Chrome does not implement the permission static property
|
||||
// So we have to check for NOT 'denied' instead of 'default'
|
||||
else if (Notification.permission !== 'denied') {
|
||||
Notification.requestPermission(function (permission) {
|
||||
// Whatever the user answers, we make sure we store the information
|
||||
if(!('permission' in Notification)) {
|
||||
Notification.permission = permission;
|
||||
}
|
||||
|
||||
// If the user is okay, let's create a notification
|
||||
if (permission === "granted") getNotification(pEvent);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function check(){
|
||||
if (localStorage["data_check"]=="true" && localStorage["ip_address"] != null && localStorage["api_pass"] != null &&localStorage["user_name"]!=null &&localStorage["pass"]!=null && localStorage["ip_address"] != "" && localStorage["api_pass"] != "" &&localStorage["user_name"]!="" &&localStorage["pass"]!=""){
|
||||
return true;
|
||||
function getNotification(pEvent){
|
||||
|
||||
// Build the event text
|
||||
var even = pEvent['type'];
|
||||
if (pEvent['source'] != '') even += " : " + pEvent['source'];
|
||||
even += ". Event occured at " + pEvent['date'];
|
||||
if(pEvent['module'] != 0) even += " in the module with Id "+ pEvent['module'];
|
||||
even += ".";
|
||||
|
||||
var url = (pEvent['agent']=="")
|
||||
? localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events"
|
||||
: localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=" + pEvent['agent'];
|
||||
|
||||
var notification = new Notification(
|
||||
pEvent['title'],
|
||||
{
|
||||
body: even,
|
||||
icon: "images/icon.png"
|
||||
}
|
||||
);
|
||||
|
||||
// Add the link
|
||||
notification.onclick = function (event) {
|
||||
event.preventDefault();
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
// Close notification after 10 secs
|
||||
setTimeout(function() {notification.close()}, 10000);
|
||||
}
|
||||
|
||||
function resetInterval () {
|
||||
if (refreshTimer) clearInterval(refreshTimer);
|
||||
refreshTimer = setInterval(main, localStorage["refresh"]*1000);
|
||||
}
|
||||
|
||||
function initilise(){
|
||||
|
||||
if(localStorage["ip_address"]==undefined){
|
||||
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
|
||||
|
||||
}
|
||||
|
||||
if(localStorage["api_pass"]==undefined){
|
||||
localStorage["api_pass"]="doreik0";
|
||||
}
|
||||
|
||||
if(localStorage["user_name"]==undefined){
|
||||
localStorage["user_name"]="demo";
|
||||
}
|
||||
|
||||
if(localStorage["pass"]==undefined){
|
||||
localStorage["pass"]="demo";
|
||||
}
|
||||
if(localStorage["critical"]==null){
|
||||
localStorage["critical"]="11";
|
||||
}
|
||||
if(localStorage["informational"]==null){
|
||||
localStorage["informational"]="1";
|
||||
}
|
||||
if(localStorage["maintenance"]==null){
|
||||
localStorage["maintenance"]="10";
|
||||
}
|
||||
if(localStorage["normal"]==null){
|
||||
localStorage["normal"]="6";
|
||||
}
|
||||
if(localStorage["warning"]==null){
|
||||
localStorage["warning"]="2";
|
||||
}
|
||||
if(localStorage["events"]==null){
|
||||
localStorage["events"]=20;
|
||||
}
|
||||
if(localStorage["refresh"]==null){
|
||||
localStorage["refresh"]="10";
|
||||
}
|
||||
if(localStorage["ip_address"]==null){
|
||||
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
|
||||
}
|
||||
|
||||
if(localStorage["api_pass"]==null){
|
||||
localStorage["api_pass"]="doreik0";
|
||||
}
|
||||
|
||||
if(localStorage["user_name"]==null){
|
||||
localStorage["user_name"]="demo";
|
||||
}
|
||||
|
||||
if(localStorage["pass"]==null){
|
||||
localStorage["pass"]="demo";
|
||||
}
|
||||
if(localStorage["sound_alert"]==null){
|
||||
localStorage["sound_alert"]="on";
|
||||
}
|
||||
if(localStorage["changed"]==null){
|
||||
localStorage["changed"]="false";
|
||||
}
|
||||
if(localStorage["new_events"]==null){
|
||||
localStorage["new_events"]=parseInt(localStorage["events"]);
|
||||
}
|
||||
if (isFetching == null) isFetching = false;
|
||||
if(localStorage["ip_address"]==undefined){
|
||||
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
|
||||
}
|
||||
|
||||
if(localStorage["api_pass"]==undefined){
|
||||
localStorage["api_pass"]="doreik0";
|
||||
}
|
||||
|
||||
if(localStorage["user_name"]==undefined){
|
||||
localStorage["user_name"]="demo";
|
||||
}
|
||||
|
||||
if(localStorage["pass"]==undefined){
|
||||
localStorage["pass"]="demo";
|
||||
}
|
||||
if(localStorage["critical"]==null){
|
||||
localStorage["critical"]="11";
|
||||
}
|
||||
if(localStorage["informational"]==null){
|
||||
localStorage["informational"]="1";
|
||||
}
|
||||
if(localStorage["maintenance"]==null){
|
||||
localStorage["maintenance"]="10";
|
||||
}
|
||||
if(localStorage["normal"]==null){
|
||||
localStorage["normal"]="6";
|
||||
}
|
||||
if(localStorage["warning"]==null){
|
||||
localStorage["warning"]="2";
|
||||
}
|
||||
if(localStorage["events"]==null){
|
||||
localStorage["events"]=20;
|
||||
}
|
||||
if(localStorage["refresh"]==null){
|
||||
localStorage["refresh"]="10";
|
||||
}
|
||||
if(localStorage["ip_address"]==null){
|
||||
localStorage["ip_address"]="http://firefly.artica.es/pandora_demo";
|
||||
}
|
||||
|
||||
if(localStorage["api_pass"]==null){
|
||||
localStorage["api_pass"]="doreik0";
|
||||
}
|
||||
|
||||
if(localStorage["user_name"]==null){
|
||||
localStorage["user_name"]="demo";
|
||||
}
|
||||
|
||||
if(localStorage["pass"]==null){
|
||||
localStorage["pass"]="demo";
|
||||
}
|
||||
if(localStorage["sound_alert"]==null){
|
||||
localStorage["sound_alert"]="on";
|
||||
}
|
||||
if(localStorage["changed"]==null){
|
||||
localStorage["changed"]="false";
|
||||
}
|
||||
if(localStorage["new_events"]==null){
|
||||
localStorage["new_events"]=parseInt(localStorage["events"]);
|
||||
}
|
||||
if(localStorage["error"]==null) {
|
||||
localStorage["error"] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ function initialise(){
|
|||
document.getElementById('normal').value = localStorage["normal"];
|
||||
document.getElementById('warning').value = localStorage["warning"];
|
||||
document.getElementById('refresh').value = localStorage["refresh"];
|
||||
document.getElementById('events').value = localStorage["events"];
|
||||
document.getElementById('number_events').value = localStorage["events"];
|
||||
if(localStorage["sound_alert"]=="on"){
|
||||
disable(false);
|
||||
document.getElementById('sound_alert_o').checked=true;
|
||||
|
@ -20,7 +20,6 @@ function initialise(){
|
|||
disable(true);
|
||||
document.getElementById('sound_alert_f').checked=true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function change(value, id){
|
||||
|
@ -46,16 +45,13 @@ function change_o(value, id){
|
|||
if(id=="refresh"){
|
||||
localStorage["refresh"]=value;
|
||||
}
|
||||
if(id=="events"){
|
||||
if(id=="number_events"){
|
||||
localStorage["events"]=value;
|
||||
}
|
||||
}
|
||||
|
||||
function change_global(value,id){
|
||||
console.log("value => "+value);
|
||||
console.log("id => "+id);
|
||||
bg=chrome.extension.getBackgroundPage();
|
||||
bg.location.reload();
|
||||
if(id=="ip_address"){
|
||||
localStorage["ip_address"]=value;
|
||||
}
|
||||
|
@ -96,12 +92,6 @@ function disable(state){
|
|||
}
|
||||
}
|
||||
|
||||
function windowClose() {
|
||||
//window.close();
|
||||
console.log("close");
|
||||
}
|
||||
|
||||
|
||||
//Add callbacks to elements
|
||||
$(document).ready (function () {
|
||||
|
||||
|
@ -163,13 +153,12 @@ $(document).ready (function () {
|
|||
change_o($(this).val(), "refresh");
|
||||
});
|
||||
|
||||
$("#events").change(function () {
|
||||
change_o($(this).val(), "events");
|
||||
$("#number_events").change(function () {
|
||||
change_o($(this).val(), "number_events");
|
||||
});
|
||||
|
||||
//Close button
|
||||
$("#close").click (function () {
|
||||
window.close();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
var timer = null;
|
||||
var event_array;
|
||||
var max_events;
|
||||
var bg;
|
||||
$(document).ready(function(){
|
||||
|
@ -8,198 +6,165 @@ $(document).ready(function(){
|
|||
localStorage["events"]="20";
|
||||
}
|
||||
bg=chrome.extension.getBackgroundPage();
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(mainPoP , 2000 );
|
||||
});
|
||||
|
||||
function mainPoP(){
|
||||
if(bg.check()){
|
||||
// Display the information
|
||||
if (bg.fetchEvents().length == 0) {
|
||||
showError("Error in fetching data!! Check your internet connection");
|
||||
} else {
|
||||
showEvents();
|
||||
}
|
||||
else
|
||||
{
|
||||
showUrlError();
|
||||
}
|
||||
}
|
||||
function showUrlError(){
|
||||
var res=document.createDocumentFragment();
|
||||
var r = document.getElementById('e');
|
||||
var eve=document.createElement('div');
|
||||
eve.id="event_temp";
|
||||
eve.setAttribute("class","b");
|
||||
|
||||
var p = document.createElement('a');
|
||||
p.href="options.html";
|
||||
p.target="_blank";
|
||||
p.innerText="Configure ip address,API password, user name and password with correct values";
|
||||
eve.appendChild(p);
|
||||
res.appendChild(eve);
|
||||
r.parentNode.insertBefore(res,r);
|
||||
$('.loader').hide();
|
||||
$('div.b').show();
|
||||
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(refresh , 1000 );
|
||||
|
||||
// Adding buttons listeners
|
||||
document.getElementById("m_refresh").addEventListener("click", mrefresh);
|
||||
|
||||
// Added listener to background messages
|
||||
chrome.runtime.onMessage.addListener(function(message,sender,sendResponse){
|
||||
switch (message.text) {
|
||||
case "FETCH_EVENTS":
|
||||
setSpinner();
|
||||
//$('div.b').hide();
|
||||
break;
|
||||
case "FETCH_EVENTS_SUCCESS":
|
||||
unsetSpinner();
|
||||
showEvents();
|
||||
break;
|
||||
case "FETCH_EVENTS_DATA_ERROR":
|
||||
unsetSpinner();
|
||||
showError("Error in fetching data!! Check your internet connection");
|
||||
break;
|
||||
case "FETCH_EVENTS_URL_ERROR":
|
||||
unsetSpinner();
|
||||
showError("Configure ip address,API password, user name and password with correct values");
|
||||
break;
|
||||
default:
|
||||
console.log("Unrecognized message: ", message.text);
|
||||
break;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function setSpinner () {
|
||||
$('#refr_img_id').attr("src", "images/spinny.gif");
|
||||
}
|
||||
|
||||
function showDataError(){
|
||||
var res=document.createDocumentFragment();
|
||||
var r = document.getElementById('e');
|
||||
var eve=document.createElement('div');
|
||||
eve.id="event_temp";
|
||||
eve.setAttribute("class","b");
|
||||
|
||||
var p = document.createElement('a');
|
||||
p.innerText="Error in fetching data!! Check your internet connection";
|
||||
eve.appendChild(p);
|
||||
res.appendChild(eve);
|
||||
r.parentNode.insertBefore(res,r);
|
||||
$('.loader').hide();
|
||||
$('div.b').show();
|
||||
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(refresh , 1000 );
|
||||
function unsetSpinner() {
|
||||
$('#refr_img_id').attr("src", "images/refresh.png");
|
||||
}
|
||||
|
||||
function clearError() {
|
||||
$('.error').hide();
|
||||
$('.error a').text("");
|
||||
$('.result').css('height', null);
|
||||
}
|
||||
|
||||
function showError(text){
|
||||
$('.error a').text(text);
|
||||
$('.error').show();
|
||||
$('.result').height(420);
|
||||
}
|
||||
|
||||
function showEvents(){
|
||||
var allEvents=bg.fetchEvents();
|
||||
var r = document.getElementById('e');
|
||||
var res=document.createDocumentFragment();
|
||||
|
||||
clearError();
|
||||
$('#events').empty();
|
||||
var e_refr = document.getElementById('event_temp');
|
||||
if(e_refr){
|
||||
wrapper.removeChild(e_refr);
|
||||
}
|
||||
var allEvents = bg.fetchEvents();
|
||||
var notVisitedEvents = bg.fetchNotVisited();
|
||||
var eve=document.createElement('div');
|
||||
eve.id="event_temp";
|
||||
eve.setAttribute("class","b");
|
||||
|
||||
var i=0;
|
||||
if(allEvents.length>0){
|
||||
while(i<max_events){
|
||||
while(i<max_events && i<allEvents.length){
|
||||
var eve_title=document.createElement('div');
|
||||
eve_title.id = 'e_' + i + '_' + allEvents[i]['id'];
|
||||
var img = document.createElement('img');
|
||||
img.src = 'images/plus.gif';
|
||||
img.width = '9';
|
||||
img.height='9';
|
||||
img.src = 'images/plus.png';
|
||||
img.className ='pm';
|
||||
img.id='i_' + i;
|
||||
img.id='i_' + i + '_' + allEvents[i]['id'];
|
||||
eve_title.appendChild(img);
|
||||
var div_empty = document.createElement('img');
|
||||
var a = document.createElement('a');
|
||||
var temp_style;
|
||||
|
||||
var agent_url;
|
||||
if(allEvents[i][1]==""){;
|
||||
agent_url=localStorage["ip_address"]+"/index.php?sec=eventos&sec2=operation/events/events" ;
|
||||
}else{
|
||||
agent_url=localStorage["ip_address"]+"/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="+allEvents[i][1];
|
||||
}
|
||||
var agent_url = (allEvents[i]["agent_name"] == 0)
|
||||
? localStorage["ip_address"]
|
||||
+ "/index.php?sec=eventos&sec2=operation/events/events"
|
||||
: localStorage["ip_address"]
|
||||
+ "/index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente="
|
||||
+ allEvents[i]['agent_name'];
|
||||
a.setAttribute("href",agent_url);
|
||||
a.target="_blank";
|
||||
a.target = "_blank";
|
||||
a.className = 'a_2_mo';
|
||||
|
||||
|
||||
a.innerText = allEvents[i][6];
|
||||
|
||||
if(i<localStorage["new_events"]){
|
||||
var temp_style="font-weight:bold;";
|
||||
}
|
||||
else{
|
||||
var temp_style="font-weight:normal;";
|
||||
a.innerText = allEvents[i]['title'];
|
||||
eve_title.setAttribute("class","event sev-" + allEvents[i]['severity']);
|
||||
|
||||
if (notVisitedEvents[allEvents[i]['id']] === true) {
|
||||
eve_title.style.fontWeight = 600;
|
||||
}
|
||||
|
||||
|
||||
if(allEvents[i][19]=="Warning"){
|
||||
eve_title.setAttribute("style","background:#FCED7E; margin-bottom:-12px;"+temp_style);
|
||||
}
|
||||
if(allEvents[i][19]=="Critical"){
|
||||
eve_title.setAttribute("style","background:#FA7A7A; margin-bottom:-12px;"+temp_style);
|
||||
}
|
||||
if(allEvents[i][19]=="Informational"){
|
||||
eve_title.setAttribute("style","background:#7FB9FA; margin-bottom:-12px;"+temp_style);
|
||||
}
|
||||
if(allEvents[i][19]=="Normal"){
|
||||
eve_title.setAttribute("style","background:#A8D96C; margin-bottom:-12px;"+temp_style);
|
||||
}
|
||||
if(allEvents[i][19]=="Maintenance"){
|
||||
eve_title.setAttribute("style","background:#BABDB6; margin-bottom:-12px;"+temp_style);
|
||||
}
|
||||
eve_title.appendChild(a);
|
||||
eve.appendChild(eve_title);
|
||||
var b = document.createElement('br');
|
||||
eve.appendChild(b);
|
||||
|
||||
var time=allEvents[i][5].split(" ");
|
||||
var time=allEvents[i]['date'].split(" ");
|
||||
var time_text = time[0]+" "+time[1];
|
||||
|
||||
|
||||
var p = document.createElement('p');
|
||||
var id;
|
||||
if(allEvents[i][9]==0){
|
||||
id=".";
|
||||
}
|
||||
else {
|
||||
id= " in the module with Id "+ allEvents[i][9] + ".";
|
||||
}
|
||||
var id = (allEvents[i]['module']==0)
|
||||
? "."
|
||||
: " in the module with Id "+ allEvents[i]['module'] + ".";
|
||||
|
||||
p.innerText = allEvents[i][14]+" : "+allEvents[i][17]+". Event occured at "+ time_text+id;
|
||||
p.innerText = allEvents[i]['type']+" : "+allEvents[i]['source']+". Event occured at "+ time_text+id;
|
||||
p.id = 'p_' + i;
|
||||
eve.appendChild(p);
|
||||
eve_title.appendChild(p);
|
||||
i++;
|
||||
}
|
||||
|
||||
res.appendChild(eve);
|
||||
r.parentNode.insertBefore(res,r);
|
||||
$('#events').append(eve);
|
||||
|
||||
$('img.pm').click(showHide);
|
||||
$('.loader').hide();
|
||||
$('div.b').show();
|
||||
}
|
||||
else{
|
||||
showDataError();
|
||||
} else {
|
||||
showError("Error in fetching data!! Check your internet connection");
|
||||
}
|
||||
|
||||
localStorage["new_events"]=0;
|
||||
bg.hideBadge();
|
||||
if(timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
timer =setTimeout(refresh , 30*1000 );
|
||||
bg.updateBadge();
|
||||
}
|
||||
|
||||
function showHide() {
|
||||
var id = $(this).attr('id');
|
||||
var num = id.split("_")[1];
|
||||
var pid = "p_" + num;
|
||||
// Image id has the form i_<position>_<eventId>
|
||||
var nums = id.split('_');
|
||||
var pid = "p_" + nums[1];
|
||||
|
||||
// Mark as visited if visited
|
||||
if($(this).parent().css('font-weight') == '600') {
|
||||
bg.removeNotVisited(nums[2]);
|
||||
$(this).parent().css('font-weight', '');
|
||||
}
|
||||
|
||||
// Toggle information
|
||||
if($('#' + pid).css('display') == 'none') {
|
||||
$('#' + pid).slideDown("fast");
|
||||
$(this).attr({src: 'images/minus.gif'});
|
||||
$('#' + pid).slideDown();
|
||||
$(this).attr({src: 'images/minus.png'});
|
||||
}
|
||||
else {
|
||||
$('#' + pid).slideUp("fast");
|
||||
$(this).attr({src: 'images/plus.gif'});
|
||||
$('#' + pid).slideUp();
|
||||
$(this).attr({src: 'images/plus.png'});
|
||||
}
|
||||
}
|
||||
|
||||
function refresh(){
|
||||
localStorage["new_events"]=0;
|
||||
bg.hideBadge();
|
||||
var e = document.getElementById('event_temp');
|
||||
if(e){
|
||||
e.parentNode.removeChild(e);
|
||||
}
|
||||
mainPoP();
|
||||
}
|
||||
|
||||
|
||||
function mrefresh(){
|
||||
localStorage["new_events"]=0;
|
||||
bg.hideBadge();
|
||||
var bg=chrome.extension.getBackgroundPage();
|
||||
bg.location.reload();
|
||||
var e = document.getElementById('event_temp');
|
||||
if(e){
|
||||
e.parentNode.removeChild(e);
|
||||
}
|
||||
mainPoP();
|
||||
bg.updateBadge();
|
||||
clearError();
|
||||
bg.resetInterval();
|
||||
bg.main();
|
||||
}
|
||||
|
|
|
@ -20,10 +20,10 @@
|
|||
},
|
||||
"options_page": "options.html",
|
||||
"permissions": [
|
||||
"tabs",
|
||||
"notifications",
|
||||
"http://*/*",
|
||||
"background"
|
||||
"tabs",
|
||||
"notifications",
|
||||
"http://*/*",
|
||||
"background"
|
||||
],
|
||||
"default_locale": "en"
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<head>
|
||||
<title>Pandora FMS extension</title>
|
||||
<link rel="stylesheet" href="css/popup.css" type="text/css" />
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,500,600' rel='stylesheet' type='text/css'>
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<script src="js/sound.js"></script>
|
||||
<script src="js/options.js"></script>
|
||||
|
@ -35,23 +36,18 @@
|
|||
<td> <input type="password" size=50px name="pass" id="pass"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="options_textarea">
|
||||
<br/>
|
||||
<table width=450px>
|
||||
<caption><h3>Event Alert Sounds Configuration</h3></caption>
|
||||
<tr>
|
||||
<td title="All sound alerts of notifications on/off" style="cursor:help">Sound Alerts </td>
|
||||
<td>
|
||||
<td style='padding-bottom: 15px;' title="All sound alerts of notifications on/off" style="cursor:help">Sound Alerts </td>
|
||||
<td style='padding-bottom: 15px;'>
|
||||
<input type="radio" id="sound_alert_o" name="sound_alert" value="on" /> On
|
||||
<input type="radio" id="sound_alert_f" name="sound_alert" value="off" /> Off
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>Severity</b></td>
|
||||
<td ><b>Sound Type</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="sound_selector">
|
||||
<td>Critical</td>
|
||||
<td>
|
||||
<select id="critical">
|
||||
|
@ -69,7 +65,7 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="sound_selector">
|
||||
<td>Informational</td>
|
||||
<td>
|
||||
<select id="informational">
|
||||
|
@ -87,7 +83,7 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="sound_selector">
|
||||
<td>Maintenance</td>
|
||||
<td>
|
||||
<select id="maintenance">
|
||||
|
@ -105,7 +101,7 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="sound_selector">
|
||||
<td>Normal</td>
|
||||
<td>
|
||||
<select id="normal">
|
||||
|
@ -123,7 +119,7 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr class="sound_selector">
|
||||
<td>Warning</td>
|
||||
<td>
|
||||
<select id="warning">
|
||||
|
@ -142,8 +138,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td title="Automatic Refresh time to fetch new events" style="cursor:help">Auto Refresh Time</td>
|
||||
<td>
|
||||
<td style='padding-top: 15px;' title="Automatic Refresh time to fetch new events" style="cursor:help">Auto Refresh Time</td>
|
||||
<td style='padding-top: 15px;'>
|
||||
<select id="refresh">
|
||||
<option value="5">5 seconds</option>
|
||||
<option value="10">10 seconds</option>
|
||||
|
@ -161,7 +157,7 @@
|
|||
<tr>
|
||||
<td title="Number of events to be displayed in pop up window" style="cursor:help">Number of events</td>
|
||||
<td>
|
||||
<select id="events">
|
||||
<select id="number_events">
|
||||
<option value="5">5</option>
|
||||
<option value="10">10</option>
|
||||
<option value="12">12</option>
|
||||
|
@ -173,10 +169,11 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<button id="close" type="button"><h3>Close</h3></button>
|
||||
</div>
|
||||
<div class="options_footer">
|
||||
<button id="close" type="button"><h3>Close</h3></button>
|
||||
<p style="font-family:arial;font-style:italic;color:black;font-size:11px;">Author Information : R.Hareesan (rharishan@gmail.com)</p>
|
||||
<p style="display: none;font-family:arial;font-style:italic;color:black;font-size:11px;">Author Information : R.Hareesan (rharishan@gmail.com)</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<html>
|
||||
<head>
|
||||
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600' rel='stylesheet' type='text/css'>
|
||||
<link rel="stylesheet" href="css/popup.css" type="text/css" />
|
||||
<script src="js/jquery-1.7.2.min.js"></script>
|
||||
<script src="js/popup.js"></script>
|
||||
|
@ -7,16 +8,28 @@
|
|||
<body>
|
||||
<div>
|
||||
<div id="head">
|
||||
<a href=""><img src="images/logo.png" border="0"/></a><a href="options.html" target="_blank"><img src="images/gear.png" style='float:right;padding:5px 5px 0 0;border:0px' title="Options"></a>
|
||||
<a onclick="mrefresh();" style="cursor:pointer" id="m_refresh"><img src="images/refresh.png" style='float:right;padding:5px 5px 0 0;border:0px' title="Refresh"></a>
|
||||
</div>
|
||||
|
||||
<div class="loader"> <img src='images/spinny.gif'/> Loading... </div>
|
||||
<div class="result" id="result" >
|
||||
<div class="b" id="event">
|
||||
<h1>Events</h1>
|
||||
<div class="e" id="e">
|
||||
<a href=""><img src="images/logo.png" border="0"/></a>
|
||||
<a href="options.html" target="_blank">
|
||||
<img src="images/gear.png" style='float:right;padding:5px 5px 0 0;border:0px' title="Options">
|
||||
</a>
|
||||
<a style="cursor:pointer" id="m_refresh">
|
||||
<img src="images/refresh.png" id="refr_img_id" style='float:right;padding:5px 5px 0 0;border:0px' title="Refresh">
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 35px">
|
||||
<div class="error">
|
||||
<div>
|
||||
<img src="images/error.png" title="error">
|
||||
</div>
|
||||
<div class="error_text">
|
||||
<h1>ERROR</h1>
|
||||
<a href="options.html" target="_blank" ></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="result" id="result">
|
||||
<div class="b" id="events">
|
||||
<div class="e" id="e" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -64,7 +64,8 @@ $PANDHOME_ENT/pandora_plugins/Nutanix/pandora_nutanix.pl \
|
|||
$PANDHOME_ENT/pandora_plugins/MTL/pandora_mtl.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Informix/informix.pl \
|
||||
$PANDHOME_ENT/pandora_plugins/Ruckus/ruckus.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl"
|
||||
$PANDHOME_ENT/pandora_plugins/UX/pandora_ux.pl \
|
||||
$PANDHOME_ENT/pandora_server/util/plugins/vmware-plugin.pl "
|
||||
PLUGIN_LIB_FILE="$CODEHOME/pandora_server/lib/PandoraFMS/PluginTools.pm"
|
||||
|
||||
# Update version in spec files
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, FreeBSD Version
|
||||
# Version 7.0NG.718, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, HP-UX Version
|
||||
# Version 7.0NG.718, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, Solaris Version
|
||||
# Version 7.0NG.718, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2010 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.717, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
# FreeBSD/IPSO version
|
||||
# Licenced under GPL licence, 2003-2007 Sancho Lerena
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.717, HPUX Version
|
||||
# Version 7.0NG.718, HPUX Version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
# Licensed under GPL license v2,
|
||||
# please visit http://pandora.sourceforge.net
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Fichero de configuracion base de agentes de Pandora
|
||||
# Base config file for Pandora agents
|
||||
# Version 7.0NG.717, Solaris version
|
||||
# Version 7.0NG.718, Solaris version
|
||||
|
||||
# General Parameters
|
||||
# ==================
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, AIX version
|
||||
# Version 7.0NG.718, AIX version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-agent-unix
|
||||
Version: 7.0NG.717-180111
|
||||
Version: 7.0NG.718-180205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.717-180111"
|
||||
pandora_version="7.0NG.718-180205"
|
||||
|
||||
echo "Test if you has the tools for to make the packages."
|
||||
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2012 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, FreeBSD Version
|
||||
# Version 7.0NG.718, FreeBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2016 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, HP-UX Version
|
||||
# Version 7.0NG.718, HP-UX Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2014 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, GNU/Linux
|
||||
# Version 7.0NG.718, GNU/Linux
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, NetBSD Version
|
||||
# Version 7.0NG.718, NetBSD Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2010 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Base config file for Pandora FMS agents
|
||||
# Version 7.0NG.717, Solaris Version
|
||||
# Version 7.0NG.718, Solaris Version
|
||||
# Licensed under GPL license v2,
|
||||
# Copyright (c) 2003-2009 Artica Soluciones Tecnologicas
|
||||
# http://www.pandorafms.com
|
||||
|
|
|
@ -40,8 +40,8 @@ my $Sem = undef;
|
|||
# Semaphore used to control the number of threads
|
||||
my $ThreadSem = undef;
|
||||
|
||||
use constant AGENT_VERSION => '7.0NG.717';
|
||||
use constant AGENT_BUILD => '180111';
|
||||
use constant AGENT_VERSION => '7.0NG.718';
|
||||
use constant AGENT_BUILD => '180205';
|
||||
|
||||
# Agent log default file size maximum and instances
|
||||
use constant DEFAULT_MAX_LOG_SIZE => 600000;
|
||||
|
@ -1298,13 +1298,14 @@ sub check_collections () {
|
|||
|
||||
# Read local md5
|
||||
my $local_collection_md5 = '';
|
||||
if (defined (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file"))) {
|
||||
$local_collection_md5 = <MD5_FILE>;
|
||||
close MD5_FILE;
|
||||
}
|
||||
else{
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
|
||||
next;
|
||||
if (-f "$ConfDir/collections/$collection_md5_file") {
|
||||
if (open (MD5_FILE, "< $ConfDir/collections/$collection_md5_file")) {
|
||||
$local_collection_md5 = <MD5_FILE>;
|
||||
close MD5_FILE;
|
||||
} else {
|
||||
log_message ('Collection', "Could not open dir $ConfDir/collections/$collection_md5_file");
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
# Check for changes
|
||||
|
@ -1312,7 +1313,7 @@ sub check_collections () {
|
|||
next if ($local_collection_md5 eq $remote_collection_md5);
|
||||
|
||||
# Download and unzip
|
||||
if(recv_file ($collection_md5_file, $Conf{'server_path_md5'}) != 0){
|
||||
if (recv_file ($collection_file, $Conf{'server_path_zip'}) != 0) {
|
||||
log_message ('Collection', "Could not write $collection_file on " . $Conf{'server_path_zip'});
|
||||
next;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.717
|
||||
%define release 180111
|
||||
%define version 7.0NG.718
|
||||
%define release 180205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#Pandora FMS Linux Agent
|
||||
#
|
||||
%define name pandorafms_agent_unix
|
||||
%define version 7.0NG.717
|
||||
%define release 180111
|
||||
%define version 7.0NG.718
|
||||
%define release 180205
|
||||
|
||||
Summary: Pandora FMS Linux agent, PERL version
|
||||
Name: %{name}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
# Please see http://www.pandorafms.org. This code is licensed under GPL 2.0 license.
|
||||
# **********************************************************************
|
||||
|
||||
PI_VERSION="7.0NG.717"
|
||||
PI_BUILD="180111"
|
||||
PI_VERSION="7.0NG.718"
|
||||
PI_BUILD="180205"
|
||||
OS_NAME=`uname -s`
|
||||
|
||||
FORCE=0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Base config file for Pandora FMS Windows Agent
|
||||
# (c) 2006-2017 Artica Soluciones Tecnologicas
|
||||
# Version 7.0NG.717
|
||||
# Version 7.0NG.718
|
||||
|
||||
# This program is Free Software, you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public Licence as published by the Free Software
|
||||
|
|
|
@ -3,7 +3,7 @@ AllowLanguageSelection
|
|||
{Yes}
|
||||
|
||||
AppName
|
||||
{Pandora FMS Windows Agent v7.0NG.717}
|
||||
{Pandora FMS Windows Agent v7.0NG.718}
|
||||
|
||||
ApplicationID
|
||||
{17E3D2CF-CA02-406B-8A80-9D31C17BD08F}
|
||||
|
@ -186,7 +186,7 @@ UpgradeApplicationID
|
|||
{}
|
||||
|
||||
Version
|
||||
{180111}
|
||||
{180205}
|
||||
|
||||
ViewReadme
|
||||
{Yes}
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||
using namespace Pandora_Strutils;
|
||||
|
||||
#define PATH_SIZE _MAX_PATH+1
|
||||
#define PANDORA_VERSION ("7.0NG.717(Build 180111)")
|
||||
#define PANDORA_VERSION ("7.0NG.718(Build 180205)")
|
||||
|
||||
string pandora_path;
|
||||
string pandora_dir;
|
||||
|
|
|
@ -11,7 +11,7 @@ BEGIN
|
|||
VALUE "LegalCopyright", "Artica ST"
|
||||
VALUE "OriginalFilename", "PandoraAgent.exe"
|
||||
VALUE "ProductName", "Pandora FMS Windows Agent"
|
||||
VALUE "ProductVersion", "(7.0NG.717(Build 180111))"
|
||||
VALUE "ProductVersion", "(7.0NG.718(Build 180205))"
|
||||
VALUE "FileVersion", "1.0.0.0"
|
||||
END
|
||||
END
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
package: pandorafms-console
|
||||
Version: 7.0NG.717-180111
|
||||
Version: 7.0NG.718-180205
|
||||
Architecture: all
|
||||
Priority: optional
|
||||
Section: admin
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
pandora_version="7.0NG.717-180111"
|
||||
pandora_version="7.0NG.718-180205"
|
||||
|
||||
package_pear=0
|
||||
package_pandora=1
|
||||
|
|
|
@ -147,7 +147,7 @@ function mainInsertData() {
|
|||
$config['remote_config']);
|
||||
echo '</div>';
|
||||
|
||||
$table = null;
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox filters';
|
||||
$table->style = array();
|
||||
|
|
|
@ -13,4 +13,6 @@ ALTER TABLE tcontainer_item ADD COLUMN `fullscale` tinyint(1) UNSIGNED NOT NULL
|
|||
|
||||
ALTER TABLE treport_content ADD COLUMN hide_no_data tinyint(1) DEFAULT 0;
|
||||
|
||||
COMMIT;
|
||||
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
|
||||
|
||||
COMMIT;
|
||||
|
|
|
@ -1110,6 +1110,7 @@ ALTER TABLE tserver ADD COLUMN `server_keepalive` int(11) DEFAULT 0;
|
|||
ALTER TABLE tagente_estado MODIFY `status_changes` tinyint(4) unsigned default 0;
|
||||
ALTER TABLE tagente_estado CHANGE `last_known_status` `known_status` tinyint(4) default 0;
|
||||
ALTER TABLE tagente_estado ADD COLUMN `last_known_status` tinyint(4) default 0;
|
||||
ALTER TABLE tagente_estado ADD COLUMN last_unknown_update bigint(20) NOT NULL default 0;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `talert_actions`
|
||||
|
@ -1158,10 +1159,10 @@ ALTER TABLE titem MODIFY `source_data` int(10) unsigned;
|
|||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('big_operation_step_datos_purge', '100');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('small_operation_step_datos_purge', '1000');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('days_autodisable_deletion', '30');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 9);
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('MR', 11);
|
||||
UPDATE tconfig SET value = 'https://licensing.artica.es/pandoraupdate7/server.php' WHERE token='url_update_manager';
|
||||
DELETE FROM `tconfig` WHERE `token` = 'current_package_enterprise';
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '716');
|
||||
INSERT INTO `tconfig` (`token`, `value`) VALUES ('current_package_enterprise', '718');
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tplanned_downtime_agents`
|
||||
|
|
|
@ -94,7 +94,7 @@ switch ($tipo) {
|
|||
case "helpmodal":
|
||||
|
||||
echo __("This is the online help for Pandora FMS console. This help is -in best cases- just a brief contextual help, not intented to teach you how to use Pandora FMS. Official documentation of Pandora FMS is about 900 pages, and you probably don't need to read it entirely, but sure, you should download it and take a look.<br><br>
|
||||
<a href='https://pandorafms.org/en/docs/monitoring-documentation/' target='_blanck'>Download the official documentation</a>");
|
||||
<a href='https://pandorafms.org/en/docs/monitoring-documentation/' target='_blanck' style='color: #82b92e; font-size: 10pt; text-decoration: underline;'>Download the official documentation</a>");
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ else {
|
|||
|
||||
include_once($homedir . 'include/functions_ui.php');
|
||||
include_once($homedir . 'include/functions.php');
|
||||
include_once($homedir . 'include/functions_html.php');
|
||||
include_once(__DIR__ . '/../include/functions_html.php');
|
||||
|
||||
|
||||
if($config['visual_animation']){
|
||||
|
@ -254,7 +254,7 @@ echo '<div class="login_page">';
|
|||
echo '<div><span class="span1">';
|
||||
if(file_exists (ENTERPRISE_DIR . "/load_enterprise.php")){
|
||||
if($config['custom_title1_login']){
|
||||
echo strtoupper(io_safe_output($config['custom_title1_login']));
|
||||
echo io_safe_output($config['custom_title1_login']);
|
||||
}
|
||||
else{
|
||||
echo __('WELCOME TO PANDORA FMS');
|
||||
|
@ -267,7 +267,7 @@ echo '<div class="login_page">';
|
|||
echo '<div><span class="span2">';
|
||||
if(file_exists (ENTERPRISE_DIR . "/load_enterprise.php")){
|
||||
if($config['custom_title2_login']){
|
||||
echo strtoupper(io_safe_output($config['custom_title2_login']));
|
||||
echo io_safe_output($config['custom_title2_login']);
|
||||
}
|
||||
else{
|
||||
echo __('NEXT GENERATION');
|
||||
|
|
|
@ -245,8 +245,10 @@ $modules = db_get_all_rows_sql("SELECT id_agente_modulo as id_module, nombre as
|
|||
WHERE id_agente = " . $id_parent);
|
||||
$modules_values = array();
|
||||
$modules_values[0] = __('Any');
|
||||
foreach ($modules as $m) {
|
||||
$modules_values[$m['id_module']] = $m['name'];
|
||||
if(is_array($modules)){
|
||||
foreach ($modules as $m) {
|
||||
$modules_values[$m['id_module']] = $m['name'];
|
||||
}
|
||||
}
|
||||
|
||||
$table->data[4][0] = __('Group');
|
||||
|
|
|
@ -96,7 +96,7 @@ if ($snmpwalk) {
|
|||
// We get here only the interface part of the MIB, not full mib
|
||||
foreach($snmpis as $key => $snmp) {
|
||||
|
||||
$data = explode(': ',$snmp);
|
||||
$data = explode (': ',$snmp, 2);
|
||||
$keydata = explode('::',$key);
|
||||
$keydata2 = explode('.',$keydata[1]);
|
||||
|
||||
|
@ -106,16 +106,8 @@ if ($snmpwalk) {
|
|||
}
|
||||
|
||||
if (array_key_exists(1,$data)) {
|
||||
// Fixed for switch dell powerconnect
|
||||
if(count($data) > 2) {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
unset($data[0]);
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = implode(": ",$data);
|
||||
} else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
}
|
||||
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = $data[0];
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[1];
|
||||
} else {
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['type'] = '';
|
||||
$interfaces[$keydata2[1]][$keydata2[0]]['value'] = $data[0];
|
||||
|
|
|
@ -334,12 +334,14 @@ $(document).ready (function () {
|
|||
}
|
||||
}
|
||||
else {
|
||||
$("[name=field" + i + "_value]")
|
||||
.val($("[name=field" + i + "_value]")
|
||||
.val());
|
||||
$("[name=field" + i + "_recovery_value]")
|
||||
.val($("[name=field" + i + "_recovery_value]")
|
||||
.val());
|
||||
if ($("[name=field" + i + "_value]").val() != 'text/plain') {
|
||||
$("[name=field" + i + "_value]")
|
||||
.val($("[name=field" + i + "_value]")
|
||||
.val());
|
||||
$("[name=field" + i + "_recovery_value]")
|
||||
.val($("[name=field" + i + "_recovery_value]")
|
||||
.val());
|
||||
}
|
||||
}
|
||||
// Add help hint only in first field
|
||||
if (i == 1) {
|
||||
|
|
|
@ -342,6 +342,7 @@ if ($create_group || $delete_group || $update_group) {
|
|||
$groups = users_get_groups_tree ($config['id_user'], "AR", true);
|
||||
}
|
||||
|
||||
$table = new StdClass();
|
||||
$table->width = '100%';
|
||||
|
||||
$all_parents = array();
|
||||
|
|
|
@ -135,8 +135,7 @@ if ($update_agents) {
|
|||
$result = false;
|
||||
foreach ($id_agents as $id_agent) {
|
||||
if (!empty($values)) {
|
||||
if ($config['metaconsole_agent_cache'] == 1 &&
|
||||
isset($values['id_grupo'])) {
|
||||
if ($config['metaconsole_agent_cache'] == 1) {
|
||||
$values['update_module_count'] = 1; // Force an update of the agent cache.
|
||||
}
|
||||
$group_old = false;
|
||||
|
@ -259,7 +258,7 @@ $table->data[0][0] = __('Group');
|
|||
$table->data[0][1] = html_print_select_groups(false, "AW", true,
|
||||
'id_group', $id_group, false, '', '', true);
|
||||
$table->data[0][2] = __('Group recursion');
|
||||
$table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion,
|
||||
$table->data[0][3] = html_print_checkbox ("recursion2", 1, $recursion,
|
||||
true, false);
|
||||
|
||||
|
||||
|
@ -626,7 +625,7 @@ $(document).ready (function () {
|
|||
$("select#id_os").pandoraSelectOS ();
|
||||
|
||||
var recursion;
|
||||
$("#checkbox-recursion").click(function () {
|
||||
$("#checkbox-recursion2").click(function () {
|
||||
recursion = this.checked ? 1 : 0;
|
||||
$("#id_group").trigger("change");
|
||||
});
|
||||
|
|
|
@ -354,7 +354,7 @@ if (is_array ($config['extensions'])) {
|
|||
$sub2[$extmenu["sec2"]]["refr"] = 0;
|
||||
}
|
||||
else {
|
||||
if (array_key_exists('fatherId',$extmenu)) {
|
||||
if (is_array($extmenu) && array_key_exists('fatherId',$extmenu)) {
|
||||
if (strlen($extmenu['fatherId']) > 0) {
|
||||
if (array_key_exists('subfatherId',$extmenu)) {
|
||||
if (strlen($extmenu['subfatherId']) > 0) {
|
||||
|
|
|
@ -111,6 +111,7 @@ $filters = db_get_all_rows_sql($sql);
|
|||
if ($filters === false)
|
||||
$filters = array ();
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->class = 'databox data';
|
||||
|
||||
|
|
|
@ -258,15 +258,11 @@ $table->head = array ();
|
|||
$table->head[0] = __('Map name');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Items');
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
$table->size[3] = "6%";
|
||||
$table->size[4] = "6%";
|
||||
|
||||
// Fix: IW was the old ACL for report editing, now is RW
|
||||
//Only for RW flag
|
||||
if ($vconsoles_write || $vconsoles_manage) {
|
||||
$table->head[3] = __('Copy');
|
||||
$table->head[4] = __('Delete');
|
||||
$table->size[3] = "6%";
|
||||
$table->size[4] = "6%";
|
||||
}
|
||||
|
||||
$table->align = array ();
|
||||
$table->align[0] = 'left';
|
||||
|
@ -299,25 +295,22 @@ if ($own_info['is_admin'] || $vconsoles_read) {
|
|||
$maps = visual_map_get_user_layouts (0,false,$filters,false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count(visual_map_get_user_layouts(0,false,$filters,false));
|
||||
$total_maps = count($maps);
|
||||
}else{
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters);
|
||||
$maps = visual_map_get_user_layouts (0,false,$filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count(visual_map_get_user_layouts(0,false,$filters));
|
||||
$total_maps = count($maps);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'], false,
|
||||
$filters, false);
|
||||
$maps = visual_map_get_user_layouts ($config['id_user'], false, $filters, false);
|
||||
unset($filters['offset']);
|
||||
unset($filters['limit']);
|
||||
$total_maps = count(visual_map_get_user_layouts ($config['id_user'], false,
|
||||
$filters, false));
|
||||
$total_maps = count($maps);
|
||||
}
|
||||
if (!$maps && !is_metaconsole()) {
|
||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
|
||||
false, false));
|
||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false, false, false));
|
||||
if(!$total){
|
||||
require_once ($config['homedir'] . "/general/firts_task/map_builder.php");
|
||||
} else {
|
||||
|
@ -328,8 +321,7 @@ if (!$maps && !is_metaconsole()) {
|
|||
}
|
||||
}
|
||||
elseif (!$maps && is_metaconsole()) {
|
||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false,
|
||||
false, false));
|
||||
$total = count(visual_map_get_user_layouts ($config['id_user'], false, false, false));
|
||||
if(!$total){
|
||||
ui_print_info_message(
|
||||
array(
|
||||
|
@ -345,14 +337,18 @@ elseif (!$maps && is_metaconsole()) {
|
|||
}
|
||||
else {
|
||||
ui_pagination ($total_maps, $url, $offset, $pagination);
|
||||
|
||||
foreach ($maps as $map) {
|
||||
// ACL for the visual console permission
|
||||
$vconsole_write = check_acl ($config['id_user'],
|
||||
$map['id_group'], "VW");
|
||||
$vconsole_manage = check_acl ($config['id_user'],
|
||||
$map['id_group'], "VM");
|
||||
$vconsole_write = false;
|
||||
$vconsole_manage = false;
|
||||
if(isset($map['vw'])){
|
||||
$vconsole_write = true;
|
||||
}
|
||||
|
||||
if(isset($map['vm'])){
|
||||
$vconsole_manage = true;
|
||||
}
|
||||
|
||||
$data = array ();
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
|
@ -369,7 +365,6 @@ else {
|
|||
|
||||
// Fix: IW was the old ACL for report editing, now is RW
|
||||
if ($vconsole_write || $vconsole_manage) {
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
$data[3] = '<a class="copy_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&copy_layout=1">'.html_print_image ("images/copy.png", true).'</a>';
|
||||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=network&sec2=godmode/reporting/map_builder&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
||||
|
@ -379,6 +374,11 @@ else {
|
|||
$data[4] = '<a class="delete_visualmap" href="index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=' . $pure . '&id_layout='.$map['id'].'&delete_layout=1">'.html_print_image ("images/cross.png", true).'</a>';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$data[3] = '';
|
||||
$data[4] = '';
|
||||
}
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
html_print_table ($table);
|
||||
|
|
|
@ -362,7 +362,7 @@ switch ($action) {
|
|||
break;
|
||||
case 'sql':
|
||||
$description = $item['description'];
|
||||
$sql = $item['external_source'];
|
||||
$sql_query_report = $item['external_source'];
|
||||
$idCustom = $item['treport_custom_sql_id'];
|
||||
$header = $item['header_definition'];
|
||||
$historical_db = $item['historical_db'];
|
||||
|
@ -940,7 +940,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$agents = agents_get_group_agents($group);
|
||||
if ((empty($agents)) || $agents == -1) $agents = array();
|
||||
|
||||
$sql = 'SELECT source
|
||||
$sql_log = 'SELECT source
|
||||
FROM tagente,tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent ';
|
||||
|
||||
|
@ -948,16 +948,16 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
$index = 0;
|
||||
foreach ($agents as $key => $a) {
|
||||
if ($index == 0) {
|
||||
$sql .= ' AND (id_agente = ' . $key;
|
||||
$sql_log .= ' AND (id_agente = ' . $key;
|
||||
}
|
||||
else {
|
||||
$sql .= ' OR id_agente = ' . $key;
|
||||
$sql_log .= ' OR id_agente = ' . $key;
|
||||
}
|
||||
$index++;
|
||||
}
|
||||
$sql .= ")";
|
||||
$sql_log .= ")";
|
||||
}
|
||||
html_print_select_from_sql ($sql, 'source', $source, '', __('All'), '', false, false, false);
|
||||
html_print_select_from_sql ($sql_log, 'source', $source, '', __('All'), '', false, false, false);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -1076,10 +1076,10 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('Agents'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
$sql = 'SELECT id_agente, alias
|
||||
$sql_log_report = 'SELECT id_agente, alias
|
||||
FROM tagente, tagent_module_log
|
||||
WHERE tagente.id_agente = tagent_module_log.id_agent';
|
||||
$all_agent_log = db_get_all_rows_sql($sql);
|
||||
$all_agent_log = db_get_all_rows_sql($sql_log_report);
|
||||
|
||||
foreach ($all_agent_log as $key => $value) {
|
||||
$agents2[$value['id_agente']] = $value['alias'];
|
||||
|
@ -1278,7 +1278,7 @@ You can of course remove the warnings, that's why we include the source and do n
|
|||
<td style="font-weight:bold;"><?php echo __('SQL query'); ?></td>
|
||||
<td style="" id="sql_entry">
|
||||
<?php
|
||||
html_print_textarea('sql', 5, 25, $sql);
|
||||
html_print_textarea('sql', 5, 25, $sql_query_report);
|
||||
?>
|
||||
</td>
|
||||
<td style="" id="sql_example"></td>
|
||||
|
|
|
@ -352,6 +352,12 @@ foreach ($items as $item) {
|
|||
|
||||
$row[1] = get_report_name($item['type']);
|
||||
|
||||
$custom_graph_name = db_get_row_sql('select name from tgraph where id_graph = '.$item['id_gs']);
|
||||
|
||||
if($item['type'] == 'custom_graph'){
|
||||
$row[1] = get_report_name($item['type']).' ('.$custom_graph_name['name'].')';
|
||||
}
|
||||
|
||||
$server_name = $item ['server_name'];
|
||||
|
||||
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
|
||||
|
|
|
@ -113,8 +113,14 @@ if ($action == 'new') {
|
|||
src="">';
|
||||
}
|
||||
else {
|
||||
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
|
||||
src="images/console/background/'.$background.'">';
|
||||
if(defined('METACONSOLE')){
|
||||
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
|
||||
src="../../images/console/background/'.$background.'">';
|
||||
} else {
|
||||
$table->data[0][2] = '<img id="imagen2" style="width:230px;"
|
||||
src="images/console/background/'.$background.'">';
|
||||
}
|
||||
|
||||
$table->data[0][2] .= '<img id="imagen" style="display:none;"
|
||||
src="">';
|
||||
}
|
||||
|
@ -204,24 +210,6 @@ echo "</form>";
|
|||
<script type="text/javascript">
|
||||
|
||||
$(document).ready (function () {
|
||||
|
||||
var metaconsole = null;
|
||||
function is_metaconsole() {
|
||||
|
||||
if (metaconsole === null)
|
||||
metaconsole = $("input[name='metaconsole']").val();
|
||||
|
||||
if (metaconsole != 0 && metaconsole != undefined)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
var url_hack_metaconsole = '';
|
||||
if (is_metaconsole()) {
|
||||
url_hack_metaconsole = '../../';
|
||||
}
|
||||
|
||||
$("#modsize").click(function(event){
|
||||
event.preventDefault();
|
||||
|
||||
|
@ -280,6 +268,7 @@ $(document).ready (function () {
|
|||
}
|
||||
else{
|
||||
original_image=new Image();
|
||||
url_hack_metaconsole = metaconsole_url();
|
||||
original_image.src= url_hack_metaconsole + 'images/console/background/'+$('#background').val();
|
||||
if (parseInt(original_image.width) < 1024){
|
||||
alert('Default width is '+original_image.width+'px, smaller than minimum -> 1024px');
|
||||
|
@ -330,7 +319,7 @@ $(document).ready (function () {
|
|||
var size_changer_state = false;
|
||||
|
||||
$("#background").change(function() {
|
||||
|
||||
url_hack_metaconsole = metaconsole_url();
|
||||
$('#imagen2').attr('src', url_hack_metaconsole + 'images/console/background/'+$('#background').val());
|
||||
|
||||
$('#imagen2').width(230);
|
||||
|
@ -345,6 +334,7 @@ $(document).ready (function () {
|
|||
|
||||
$("#background").mouseout(function() {
|
||||
if(size_changer_state){
|
||||
url_hack_metaconsole = metaconsole_url();
|
||||
$('#imagen').attr('src',url_hack_metaconsole + 'images/console/background/'+$('#background').val());
|
||||
$('input[name=width]').val($('#imagen').width());
|
||||
$('input[name=height]').val($('#imagen').height());
|
||||
|
@ -397,7 +387,15 @@ $(document).ready (function () {
|
|||
$("#hidden-is_favourite_sent").val(0);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function metaconsole_url() {
|
||||
metaconsole = $("input[name='metaconsole_activated']").val();
|
||||
if( metaconsole == 0 || metaconsole === undefined){
|
||||
return '';
|
||||
} else {
|
||||
return '../../';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
|
@ -2722,16 +2722,16 @@ function createItem(type, values, id_data) {
|
|||
class_type = "group_item";
|
||||
|
||||
|
||||
img_src = "images/spinner.gif";
|
||||
img_src = "images/spinner.gif";
|
||||
|
||||
item = $('<div></div>')
|
||||
.attr('id', id_data)
|
||||
.attr('class', 'item ' + class_type)
|
||||
.css('text-align', 'left')
|
||||
.css('position', 'absolute')
|
||||
.css('display', 'inline-block')
|
||||
.css('top', values['top'] + 'px')
|
||||
.css('left', values['left'] + 'px');
|
||||
item = $('<div></div>')
|
||||
.attr('id', id_data)
|
||||
.attr('class', 'item ' + class_type)
|
||||
.css('text-align', 'left')
|
||||
.css('position', 'absolute')
|
||||
.css('display', 'inline-block')
|
||||
.css('top', values['top'] + 'px')
|
||||
.css('left', values['left'] + 'px');
|
||||
|
||||
|
||||
|
||||
|
@ -2827,7 +2827,7 @@ function createItem(type, values, id_data) {
|
|||
|
||||
if(values['label_position'] == 'up'){
|
||||
|
||||
if(values['image'] == '' || values['image'] == 'none'){
|
||||
if((values['image'] == '' || values['image'] == 'none') && values['show_statistics'] != 1){
|
||||
item
|
||||
.append('<table style="width:70px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
.append($input);
|
||||
|
@ -2836,14 +2836,12 @@ function createItem(type, values, id_data) {
|
|||
item
|
||||
.append('<table style="width:70px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
.append($image)
|
||||
.append($image)
|
||||
.append($input);
|
||||
}
|
||||
|
||||
}
|
||||
else if(values['label_position'] == 'down'){
|
||||
|
||||
if(values['image'] == '' || values['image'] == 'none'){
|
||||
if((values['image'] == '' || values['image'] == 'none') && values['show_statistics'] != 1){
|
||||
item
|
||||
.append('<table style="width:70px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
.append($input);
|
||||
|
@ -2851,7 +2849,6 @@ function createItem(type, values, id_data) {
|
|||
}
|
||||
else{
|
||||
item
|
||||
.append($image)
|
||||
.append($image)
|
||||
.append('<table style="width:70px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
.append($input);
|
||||
|
@ -2869,14 +2866,13 @@ function createItem(type, values, id_data) {
|
|||
.append('<table style="float:left;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
}
|
||||
|
||||
if(values['image'] == '' || values['image'] == 'none'){
|
||||
if((values['image'] == '' || values['image'] == 'none') && values['show_statistics'] != 1){
|
||||
item
|
||||
.append($input);
|
||||
}
|
||||
else{
|
||||
item
|
||||
.append($image)
|
||||
.append($image)
|
||||
.append($input);
|
||||
}
|
||||
|
||||
|
@ -2892,19 +2888,16 @@ function createItem(type, values, id_data) {
|
|||
.append('<table style="float:right;height:'+values['height']+'px"><tr><td></td></tr><tr><td><span id="text_'+id_data+'" class="text">'+values['label']+'</span></td></tr><tr><td></td></tr></table>')
|
||||
}
|
||||
|
||||
if(values['image'] == '' || values['image'] == 'none'){
|
||||
if((values['image'] == '' || values['image'] == 'none') && values['show_statistics'] != 1){
|
||||
item
|
||||
.append($input);
|
||||
}
|
||||
else{
|
||||
item
|
||||
.append($image)
|
||||
.append($image)
|
||||
.append($input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(values['show_statistics'] != 1){
|
||||
|
|
|
@ -159,7 +159,8 @@ $table->data[26][1] .= ' <a href="javascript: toggleButton(\'warning\');">' . ht
|
|||
$table->data[26][1] .= '<div id="layer_sound_warning"></div>';
|
||||
|
||||
$table->data[28][0] = __('Public URL');
|
||||
$table->data[28][0] .= ui_print_help_tip(__('Set this value when your PandoraFMS across inverse proxy or for example with mod_proxy of Apache.'), true);
|
||||
$table->data[28][0] .= ui_print_help_tip(__('Set this value when your PandoraFMS across inverse proxy or for example with mod_proxy of Apache.') .
|
||||
' '.__('Without the index.php such as http://domain/pandora_url/'), true);
|
||||
$table->data[28][1] = html_print_input_text ('public_url', $config['public_url'], '', 40, 255, true);
|
||||
|
||||
$table->data[29][0] = __('Referer security');
|
||||
|
|
|
@ -951,7 +951,7 @@ tinyMCE.init({
|
|||
theme : "advanced",
|
||||
theme_advanced_toolbar_location : "top",
|
||||
theme_advanced_toolbar_align : "left",
|
||||
theme_advanced_buttons1 : "bold,italic, |, cut, copy, paste, |, undo, redo",
|
||||
theme_advanced_buttons1 : "bold,italic, |, image, |, cut, copy, paste, |, undo, redo, |, forecolor, |, fontsizeselect, |, justifyleft, justifycenter, justifyright",
|
||||
theme_advanced_buttons2 : "",
|
||||
theme_advanced_buttons3 : "",
|
||||
theme_advanced_statusbar_location : "none"
|
||||
|
|
|
@ -248,8 +248,7 @@ else {
|
|||
|
||||
}
|
||||
|
||||
$table = null;
|
||||
|
||||
$table = new stdClass();
|
||||
$table->cellpadding = 0;
|
||||
$table->cellspacing = 0;
|
||||
$table->width = '100%';
|
||||
|
|
|
@ -283,7 +283,7 @@ if ($get_module_detail) {
|
|||
if ($attr[1] != "modules_format_data") {
|
||||
$data[] = date('d F Y h:i:s A', $row['utimestamp']);
|
||||
}
|
||||
elseif (($config['command_snapshot']) && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
|
||||
elseif (($config['command_snapshot'] == '0') && (preg_match ("/[\n]+/i", $row[$attr[0]]))) {
|
||||
// Its a single-data, multiline data (data snapshot) ?
|
||||
|
||||
// Detect string data with \n and convert to <br>'s
|
||||
|
|
|
@ -445,9 +445,8 @@ function process_user_login_remote ($login, $pass, $api = false) {
|
|||
* @return bool True is the user is admin
|
||||
*/
|
||||
function is_user_admin ($id_user) {
|
||||
$is_admin = (bool) db_get_value ('is_admin', 'tusuario', 'id_user', $id_user);
|
||||
|
||||
return $is_admin;
|
||||
require_once(__DIR__ . "/../functions_users.php");
|
||||
return users_is_admin($id_user);
|
||||
}
|
||||
|
||||
|
||||
|
@ -531,7 +530,15 @@ function get_user_email ($user) {
|
|||
* @return mixed An array of users
|
||||
*/
|
||||
function get_user_info ($user) {
|
||||
return db_get_row ("tusuario", "id_user", get_user_id ($user));
|
||||
static $cache_user_info = array();
|
||||
if (array_key_exists($user, $cache_user_info)){
|
||||
return $cache_user_info[$user];
|
||||
}
|
||||
else{
|
||||
$return = db_get_row ("tusuario", "id_user", get_user_id ($user));
|
||||
$cache_user_info[$user] = $return;
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -53,7 +53,7 @@ class Tree {
|
|||
|
||||
$this->strictACL = (bool) db_get_value("strict_acl", "tusuario", "id_user", $config['id_user']);
|
||||
|
||||
$this->acltags = tags_get_user_module_and_tags($config['id_user'], $this->access);
|
||||
$this->acltags = tags_get_user_groups_and_tags($config['id_user'], $this->access);
|
||||
}
|
||||
|
||||
public function setFilter($filter) {
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
/**
|
||||
* Pandora build version and version
|
||||
*/
|
||||
$build_version = 'PC180111';
|
||||
$pandora_version = 'v7.0NG.717';
|
||||
$build_version = 'PC180205';
|
||||
$pandora_version = 'v7.0NG.718';
|
||||
|
||||
// Do not overwrite default timezone set if defined.
|
||||
$script_tz = @date_default_timezone_get();
|
||||
|
|
|
@ -1714,7 +1714,7 @@ function check_sql ($sql) {
|
|||
|
||||
//Check that it not delete_ as "delete_pending" (this is a common field in pandora tables).
|
||||
|
||||
if (preg_match("/\*|delete[^_]|drop|alter|modify|union|password|pass|insert|update/i", $sql)) {
|
||||
if (preg_match("/\*|delete[^_]|drop|alter|modify|password|pass|insert|update/i", $sql)) {
|
||||
return "";
|
||||
}
|
||||
return $sql;
|
||||
|
@ -1809,85 +1809,26 @@ function check_acl($id_user, $id_group, $access, $onlyOneGroup = false) {
|
|||
$id_group = (int) $id_group;
|
||||
}
|
||||
|
||||
$three_eyes_crow_groups = db_get_all_rows_sql("SELECT tperfil.*, tusuario_perfil.id_perfil FROM tperfil, tusuario_perfil WHERE tusuario_perfil.id_usuario = '" .
|
||||
$id_user . "' AND tusuario_perfil.id_grupo = 0 AND tusuario_perfil.id_perfil = tperfil.id_perfil");
|
||||
if ($id_group != 0 || $onlyOneGroup === true) {
|
||||
$groups_list_acl = users_get_groups ($id_user, 'AR', false, true, null);
|
||||
}
|
||||
else{
|
||||
$groups_list_acl = get_users_acl($id_user);
|
||||
}
|
||||
|
||||
if ($three_eyes_crow_groups && !empty($three_eyes_crow_groups)) {
|
||||
$acl_column = get_acl_column($access);
|
||||
|
||||
foreach ($three_eyes_crow_groups as $three_eyes_crow_group) {
|
||||
if (isset($three_eyes_crow_group[$acl_column]) && $three_eyes_crow_group[$acl_column] == 1) {
|
||||
if(is_array($groups_list_acl)){
|
||||
if(isset($groups_list_acl[$id_group])){
|
||||
$access = get_acl_column($access);
|
||||
if(isset($groups_list_acl[$id_group][$access])
|
||||
&& $groups_list_acl[$id_group][$access] > 0){
|
||||
return 1;
|
||||
}
|
||||
else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$parents_id = array($id_group);
|
||||
if ($id_group != 0 && $onlyOneGroup !== true) {
|
||||
$group = db_get_row_filter('tgrupo', array('id_grupo' => $id_group));
|
||||
$parents = groups_get_parents($group['parent'], true);
|
||||
|
||||
foreach ($parents as $parent) {
|
||||
$parents_id[] = $parent['id_grupo'];
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: To reduce this querys in one adding the group condition if necessary (only one line is different)
|
||||
//Joined multiple queries into one. That saves on the query overhead and query cache.
|
||||
if ($id_group == 0 && $onlyOneGroup !== true) {
|
||||
$query = sprintf("SELECT tperfil.incident_view, tperfil.incident_edit,
|
||||
tperfil.incident_management, tperfil.agent_view,
|
||||
tperfil.agent_edit, tperfil.alert_edit,
|
||||
tperfil.alert_management, tperfil.pandora_management,
|
||||
tperfil.db_management, tperfil.user_management,
|
||||
tperfil.report_view, tperfil.report_edit,
|
||||
tperfil.report_management, tperfil.event_view,
|
||||
tperfil.event_edit, tperfil.event_management,
|
||||
tperfil.agent_disable,
|
||||
tperfil.map_view, tperfil.map_edit, tperfil.map_management,
|
||||
tperfil.vconsole_view, tperfil.vconsole_edit, tperfil.vconsole_management
|
||||
FROM tusuario_perfil, tperfil
|
||||
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
|
||||
AND tusuario_perfil.id_usuario = '%s'", $id_user);
|
||||
//GroupID = 0 and onlyOneGroup = false, group id doesnt matter (use with caution!)
|
||||
}
|
||||
else {
|
||||
$query = sprintf("SELECT tperfil.incident_view, tperfil.incident_edit,
|
||||
tperfil.incident_management, tperfil.agent_view,
|
||||
tperfil.agent_edit, tperfil.alert_edit,
|
||||
tperfil.alert_management, tperfil.pandora_management,
|
||||
tperfil.db_management, tperfil.user_management,
|
||||
tperfil.report_view, tperfil.report_edit,
|
||||
tperfil.report_management, tperfil.event_view,
|
||||
tperfil.event_edit, tperfil.event_management,
|
||||
tperfil.agent_disable,
|
||||
tperfil.map_view, tperfil.map_edit, tperfil.map_management,
|
||||
tperfil.vconsole_view, tperfil.vconsole_edit, tperfil.vconsole_management
|
||||
FROM tusuario_perfil, tperfil
|
||||
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
|
||||
AND tusuario_perfil.id_usuario = '%s'
|
||||
AND (tusuario_perfil.id_grupo IN (%s)
|
||||
OR tusuario_perfil.id_grupo = 0)", $id_user, implode(', ', $parents_id));
|
||||
}
|
||||
|
||||
$rowdup = db_get_all_rows_sql ($query);
|
||||
|
||||
if (empty ($rowdup))
|
||||
return 0;
|
||||
|
||||
$result = 0;
|
||||
$acl_column = get_acl_column($access);
|
||||
foreach ($rowdup as $row) {
|
||||
// For each profile for this pair of group and user do...
|
||||
if (isset($row[$acl_column])) {
|
||||
$result += $row[$acl_column];
|
||||
}
|
||||
}
|
||||
|
||||
if ($result >= 1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1975,6 +1916,51 @@ function get_acl_column($access) {
|
|||
}
|
||||
}
|
||||
|
||||
function get_users_acl($id_user){
|
||||
static $users_acl_cache = array();
|
||||
|
||||
|
||||
if (is_array($users_acl_cache[$id_user])) {
|
||||
$rowdup = $users_acl_cache[$id_user];
|
||||
}
|
||||
else {
|
||||
$query = sprintf("SELECT sum(tperfil.incident_view) as incident_view,
|
||||
sum(tperfil.incident_edit) as incident_edit,
|
||||
sum(tperfil.incident_management) as incident_management,
|
||||
sum(tperfil.agent_view) as agent_view,
|
||||
sum(tperfil.agent_edit) as agent_edit,
|
||||
sum(tperfil.alert_edit) as alert_edit,
|
||||
sum(tperfil.alert_management) as alert_management,
|
||||
sum(tperfil.pandora_management) as pandora_management,
|
||||
sum(tperfil.db_management) as db_management,
|
||||
sum(tperfil.user_management) as user_management,
|
||||
sum(tperfil.report_view) as report_view,
|
||||
sum(tperfil.report_edit) as report_edit,
|
||||
sum(tperfil.report_management) as report_management,
|
||||
sum(tperfil.event_view) as event_view,
|
||||
sum(tperfil.event_edit) as event_edit,
|
||||
sum(tperfil.event_management) as event_management,
|
||||
sum(tperfil.agent_disable) as agent_disable,
|
||||
sum(tperfil.map_view) as map_view,
|
||||
sum(tperfil.map_edit) as map_edit,
|
||||
sum(tperfil.map_management) as map_management,
|
||||
sum(tperfil.vconsole_view) as vconsole_view,
|
||||
sum(tperfil.vconsole_edit) as vconsole_edit,
|
||||
sum(tperfil.vconsole_management) as vconsole_management
|
||||
FROM tusuario_perfil, tperfil
|
||||
WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
|
||||
AND tusuario_perfil.id_usuario = '%s'", $id_user);
|
||||
|
||||
$rowdup = db_get_all_rows_sql ($query);
|
||||
$users_acl_cache[$id_user] = $rowdup;
|
||||
}
|
||||
|
||||
if (empty ($rowdup) || !$rowdup)
|
||||
return 0;
|
||||
|
||||
return $rowdup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of a plugin
|
||||
*
|
||||
|
|
|
@ -2601,7 +2601,9 @@ function select_modules_for_agent_group($id_group, $id_agents,
|
|||
}
|
||||
|
||||
if ($selection == 1 || (count($id_agents) == 1)) {
|
||||
$modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
$modules = db_get_all_rows_sql("SELECT DISTINCT nombre, id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
|
||||
if (empty($modules)) $modules = array();
|
||||
|
||||
|
@ -2614,13 +2616,15 @@ function select_modules_for_agent_group($id_group, $id_agents,
|
|||
}
|
||||
}
|
||||
else {
|
||||
$modules = db_get_all_rows_sql("SELECT nombre, id_agente_modulo FROM tagente_modulo WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
$modules = db_get_all_rows_sql("SELECT nombre, id_agente_modulo
|
||||
FROM tagente_modulo
|
||||
WHERE 1 = 1" . $filter_agent . $filter_group);
|
||||
|
||||
if (empty($modules)) $modules = array();
|
||||
|
||||
foreach ($modules as $m) {
|
||||
$is_in_all_agents = true;
|
||||
$module_name = modules_get_agentmodule_name($m['id_agente_modulo']);
|
||||
$module_name = $m['nombre'];
|
||||
foreach ($id_agents as $a) {
|
||||
$module_in_agent = db_get_value_filter('id_agente_modulo',
|
||||
'tagente_modulo', array('id_agente' => $a, 'nombre' => $module_name));
|
||||
|
|
|
@ -8613,12 +8613,54 @@ function api_set_enable_alert ($agent_name, $module_name, $template_name, $thras
|
|||
$id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent, 'nombre' => $module_name));
|
||||
$id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"]));
|
||||
|
||||
db_process_sql("UPDATE talert_template_modules
|
||||
$result = db_process_sql("UPDATE talert_template_modules
|
||||
SET disabled = 0
|
||||
WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template");
|
||||
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert enable"));
|
||||
}
|
||||
if ($result) {
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert enable"));
|
||||
} else {
|
||||
returnData('string', array('type' => 'string', 'data' => __('Error alert enable')));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable an alert with alias
|
||||
*
|
||||
* @param string $agent_alias Alias of agent (for example "myagent")
|
||||
* @param string $module_name Name of the module (for example "Host alive")
|
||||
* @param string $template_name Name of the alert template (for example, "Warning event")
|
||||
* @param $thrash4 Don't use.
|
||||
|
||||
// http://localhost/pandora_console/include/api.php?op=set&op2=enable_alert_alias&id=garfio&id2=Status&other=Warning%20condition
|
||||
*/
|
||||
|
||||
function api_set_enable_alert_alias ($agent_alias, $module_name, $template_name, $thrash4) {
|
||||
if (defined ('METACONSOLE')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$agent_id = agents_get_agent_id_by_alias($agent_alias);
|
||||
$result = false;
|
||||
foreach ($agent_id as $key => $id_agent) {
|
||||
$id_agent_module = db_get_value_filter('id_agente_modulo', 'tagente_modulo', array('id_agente' => $id_agent['id_agente'], 'nombre' => $module_name));
|
||||
$id_template = db_get_value_filter('id', 'talert_templates', array('name' => $template_name["data"]));
|
||||
|
||||
$result = db_process_sql("UPDATE talert_template_modules
|
||||
SET disabled = 0
|
||||
WHERE id_agent_module = $id_agent_module AND id_alert_template = $id_template");
|
||||
|
||||
if ($result) {
|
||||
returnData('string', array('type' => 'string', 'data' => "Correct alert enable"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$result){
|
||||
returnData('string', array('type' => 'string', 'data' => __('Error alert enable')));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disable all the alerts of one module
|
||||
|
@ -9996,69 +10038,80 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) {
|
|||
return;
|
||||
}
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
|
||||
$string_type = strpos($module_type,'string');
|
||||
// Get the html item
|
||||
$graph_html = grafico_modulo_sparse(
|
||||
$id_module, $graph_seconds, false, 600, 300, '',
|
||||
'', false, false, true, time(), '', 0, 0, true, true,
|
||||
ui_get_full_url(false) . '/', 1, false, '', false, true,
|
||||
true, 'white', null, false, false, $config['type_module_charts'],
|
||||
false, false);
|
||||
|
||||
$graph_image_file_encoded = false;
|
||||
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
|
||||
$file_url = $matches[1];
|
||||
if ($string_type === false) {
|
||||
$graph_html = grafico_modulo_sparse(
|
||||
$id_module, $graph_seconds, false, 600, 300, '',
|
||||
'', false, false, true, time(), '', 0, 0, true, true,
|
||||
ui_get_full_url(false) . '/', 1, false, '', false, true,
|
||||
true, 'white', null, false, false, $config['type_module_charts'],
|
||||
false, false);
|
||||
} else {
|
||||
$graph_html = grafico_modulo_string(
|
||||
$id_module, $graph_seconds, false, 600, 300, '',
|
||||
'', false, false, true, time(), true, ui_get_full_url(false) . '/',
|
||||
'', 1, true);
|
||||
}
|
||||
|
||||
if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) {
|
||||
array_shift ($parameters);
|
||||
foreach ($parameters as $parameter){
|
||||
$value = explode ("=",$parameter);
|
||||
$graph_image_file_encoded = false;
|
||||
if (preg_match("/<img src='(.+)'./", $graph_html, $matches)) {
|
||||
$file_url = $matches[1];
|
||||
|
||||
if (strcmp($value[0], "static_graph") == 0){
|
||||
$static_graph = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "graph_type") == 0){
|
||||
$graph_type = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "ttl") == 0){
|
||||
$ttl = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "id_graph") == 0){
|
||||
$id_graph = $value[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preg_match("/\?(.+)&(.+)&(.+)&(.+)/", $file_url,$parameters)) {
|
||||
array_shift ($parameters);
|
||||
foreach ($parameters as $parameter){
|
||||
$value = explode ("=",$parameter);
|
||||
|
||||
if (strcmp($value[0], "static_graph") == 0){
|
||||
$static_graph = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "graph_type") == 0){
|
||||
$graph_type = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "ttl") == 0){
|
||||
$ttl = $value[1];
|
||||
}
|
||||
elseif (strcmp($value[0], "id_graph") == 0){
|
||||
$id_graph = $value[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check values are OK
|
||||
if ( (isset ($graph_type))
|
||||
&& (isset ($ttl))
|
||||
&& (isset ($id_graph))) {
|
||||
$_GET["ttl"] = $ttl;
|
||||
$_GET["id_graph"] = $id_graph;
|
||||
$_GET["graph_type"] = $graph_type;
|
||||
$_GET["static_graph"] = $static_graph;
|
||||
$_GET["graph_threshold"] = $graph_threshold;
|
||||
$_GET["id_module"] = $id_module;
|
||||
}
|
||||
// Check values are OK
|
||||
if ( (isset ($graph_type))
|
||||
&& (isset ($ttl))
|
||||
&& (isset ($id_graph))) {
|
||||
$_GET["ttl"] = $ttl;
|
||||
$_GET["id_graph"] = $id_graph;
|
||||
$_GET["graph_type"] = $graph_type;
|
||||
$_GET["static_graph"] = $static_graph;
|
||||
$_GET["graph_threshold"] = $graph_threshold;
|
||||
$_GET["id_module"] = $id_module;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
include (__DIR__ . "/graphs/functions_pchart.php");
|
||||
$output = ob_get_clean();
|
||||
ob_start();
|
||||
include (__DIR__ . "/graphs/functions_pchart.php");
|
||||
$output = ob_get_clean();
|
||||
|
||||
$graph_image_file_encoded = base64_encode($output);
|
||||
if (empty($graph_image_file_encoded)) {
|
||||
// returnError('error_module_graph', __(''));
|
||||
}
|
||||
else {
|
||||
if($other['data'][1]){
|
||||
header('Content-type: text/html');
|
||||
returnData('string', array('type' => 'string', 'data' => '<img src="data:image/jpeg;base64,' . $graph_image_file_encoded . '">'));
|
||||
} else {
|
||||
returnData('string', array('type' => 'string', 'data' => $graph_image_file_encoded));
|
||||
}
|
||||
$graph_image_file_encoded = base64_encode($output);
|
||||
if (empty($graph_image_file_encoded)) {
|
||||
// returnError('error_module_graph', __(''));
|
||||
}
|
||||
else {
|
||||
if($other['data'][1]){
|
||||
header('Content-type: text/html');
|
||||
returnData('string', array('type' => 'string', 'data' => '<img src="data:image/jpeg;base64,' . $graph_image_file_encoded . '">'));
|
||||
} else {
|
||||
returnData('string', array('type' => 'string', 'data' => $graph_image_file_encoded));
|
||||
}
|
||||
// To show only the base64 code, call returnData as:
|
||||
// returnData('string', array('type' => 'string', 'data' => $graph_image_file_encoded));
|
||||
}
|
||||
// returnData('string', array('type' => 'string', 'data' => $graph_image_file_encoded));
|
||||
}
|
||||
}
|
||||
|
||||
function api_set_metaconsole_synch($keys) {
|
||||
|
|
|
@ -1630,7 +1630,7 @@ function config_process_config () {
|
|||
if ($is_user_updating == 'operation/users/user_edit') {
|
||||
$id = get_parameter_get ("id", $config["id_user"]); // ID given as parameter
|
||||
$user_info = get_user_info ($id);
|
||||
|
||||
|
||||
//If current user is editing himself or if the user has UM (User Management) rights on any groups the user is part of AND the authorization scheme allows for users/admins to update info
|
||||
if (($config["id_user"] == $id || check_acl ($config["id_user"], users_get_groups ($id), "UM")) && $config["user_can_update_info"]) {
|
||||
$view_mode = false;
|
||||
|
@ -1645,10 +1645,19 @@ function config_process_config () {
|
|||
}
|
||||
}
|
||||
|
||||
if (isset($config['id_user']))
|
||||
$relative_path = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));
|
||||
else
|
||||
$relative_path = enterprise_hook('skins_set_image_skin_path',array(get_parameter('nick')));
|
||||
if(!is_metaconsole()) {
|
||||
// Skins are available only in console mode
|
||||
|
||||
if (isset($config['id_user'])){
|
||||
$relative_path = enterprise_hook('skins_set_image_skin_path',array($config['id_user']));
|
||||
}
|
||||
else{
|
||||
$relative_path = enterprise_hook('skins_set_image_skin_path',array(get_parameter('nick')));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$relative_path = '';
|
||||
}
|
||||
$config['relative_path'] = $relative_path;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,15 +90,8 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
|
||||
// Get cron configuration
|
||||
$cron_array = explode (" ", $cron);
|
||||
// Months start from 0
|
||||
if ($cron_array[3] != '*') {
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
if ($mon_s['up'] !== false) {
|
||||
$cron_array[3] = $mon_s['down'] - 1 . "-" . $mon_s['up'] - 1;
|
||||
} else {
|
||||
$cron_array[3] = $mon_s['down'] - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// REMARKS: Months start from 1 in php (different to server)
|
||||
|
||||
// Get current time
|
||||
if ($cur_time === false) $cur_time = time();
|
||||
|
@ -106,10 +99,6 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
$nex_time = $cur_time + $module_interval;
|
||||
$nex_time_array = explode (" ", date ("i H d m Y", $nex_time));
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array)) return $nex_time;
|
||||
|
||||
// Get first next date candidate from next cron configuration
|
||||
// Initialize some vars
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Update minutes
|
||||
$min_s = cron_get_interval ($cron_array[0]);
|
||||
|
@ -128,7 +117,6 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
|
||||
if ($nex_time === false) {
|
||||
// Update the month day if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[1] = 0;
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
|
@ -139,7 +127,7 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[3] = 1;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
|
@ -155,26 +143,24 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
$nex_time_array[1] = ($hour_s['down'] == '*') ? 0 : $hour_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update again
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time >= $cur_time) {
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next day is in cron
|
||||
$nex_time_array[2]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the month if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[2] = 1;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
// Update the year if overflow
|
||||
$nex_time_array[3] = 0;
|
||||
$nex_time_array[3] = 1;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
|
@ -189,21 +175,20 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
$nex_time_array[2] = ($mday_s['down'] == '*') ? 1 : $mday_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time >= $cur_time) {
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
}
|
||||
$prev_ovfl = false;
|
||||
|
||||
// Check if next month is in cron
|
||||
$nex_time_array[3]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time === false) {
|
||||
#Update the year if overflow
|
||||
$prev_ovfl = true;
|
||||
$nex_time_array[3]++;
|
||||
$nex_time_array[3] = 1;
|
||||
$nex_time_array[4]++;
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
}
|
||||
|
||||
|
@ -214,11 +199,11 @@ function cron_next_execution_date ($cron, $cur_time = false, $module_interval =
|
|||
|
||||
// Update the month if fails
|
||||
$mon_s = cron_get_interval ($cron_array[3]);
|
||||
$nex_time_array[3] = ($mon_s['down'] == '*') ? 0 : $mon_s['down'];
|
||||
$nex_time_array[3] = ($mon_s['down'] == '*') ? 1 : $mon_s['down'];
|
||||
|
||||
// When an overflow is passed check the hour update in the next execution
|
||||
if ($prev_ovfl) {
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
$nex_time = cron_valid_date($nex_time_array);
|
||||
if ($nex_time >= $cur_time) {
|
||||
if (cron_is_in_cron($cron_array, $nex_time_array) && $nex_time) {
|
||||
return $nex_time;
|
||||
}
|
||||
|
|
|
@ -664,14 +664,14 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
|
||||
$module_interval = modules_get_interval ($id_agente_modulo);
|
||||
|
||||
if (($raw_data === false) && ( ($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval)) ) ) {
|
||||
if (($raw_data === false) && ( $first_utimestamp === false )) {
|
||||
// No data
|
||||
return false;
|
||||
}
|
||||
|
||||
// Retrieve going unknown events in range
|
||||
$unknown_events = db_get_module_ranges_unknown($id_agente_modulo, $tstart, $tend, $search_historydb);
|
||||
|
||||
|
||||
// Get the last event after inverval to know if graph start on unknown
|
||||
$previous_unknown_events = db_get_row_filter (
|
||||
'tevento',
|
||||
|
@ -686,25 +686,24 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
|
||||
//show graph if graph is inside unknown
|
||||
if( $previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' &&
|
||||
$unknown_events === false && $raw_data === false){
|
||||
$unknown_events === false){
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
$unknown_events[0]['time_from'] = $tstart+0.1;
|
||||
$unknown_events[0]['time_from'] = $tstart;
|
||||
}
|
||||
|
||||
//if time to is missing in last event force time to outside range time
|
||||
if( $unknown_events && !isset($unknown_events[count($unknown_events) -1]['time_to']) ){
|
||||
$unknown_events[count($unknown_events) -1]['time_to'] = $tend + $module_interval;
|
||||
$unknown_events[count($unknown_events) -1]['time_to'] = $tend;
|
||||
}
|
||||
|
||||
//if time to is missing in first event force time to outside range time
|
||||
if ($first_data["datos"] === false && !$flag_async) {
|
||||
$last_inserted_value = false;
|
||||
}elseif( ($unknown_events && !isset($unknown_events[0]['time_from']) &&
|
||||
$previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) ||
|
||||
($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){
|
||||
//$last_inserted_value = null;
|
||||
}elseif(($unknown_events && !isset($unknown_events[0]['time_from']) &&
|
||||
$previous_unknown_events && $previous_unknown_events['event_type'] == 'going_unknown' && !$flag_async) ||
|
||||
($first_utimestamp < $tstart - (SECONDS_1DAY + 2*$module_interval) && !$flag_async) ){
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
$unknown_events[0]['time_from'] = $tstart+0.1;
|
||||
$unknown_events[0]['time_from'] = $tstart;
|
||||
}
|
||||
else{
|
||||
$last_inserted_value = $first_data["datos"];
|
||||
|
@ -721,7 +720,9 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
$last_value = $first_data["datos"];
|
||||
|
||||
//reverse array data optimization
|
||||
$raw_data = array_reverse($raw_data);
|
||||
if (is_array($raw_data)) {
|
||||
$raw_data = array_reverse($raw_data);
|
||||
}
|
||||
|
||||
// Build template
|
||||
$pool_id = 0;
|
||||
|
@ -734,7 +735,7 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
$current_unknown = null;
|
||||
}
|
||||
|
||||
if($raw_data){
|
||||
if(is_array($raw_data)) {
|
||||
$current_raw_data = array_pop($raw_data);
|
||||
}
|
||||
else{
|
||||
|
@ -746,11 +747,10 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
$tmp_data = array();
|
||||
$current_timestamp_end = $current_timestamp + $slice_size;
|
||||
|
||||
if (( $current_timestamp > $now) ||
|
||||
( ($current_timestamp_end - $last_timestamp) >
|
||||
(SECONDS_1DAY + 2 * $module_interval) ) ) {
|
||||
|
||||
$tmp_data["utimestamp"] = $last_timestamp + SECONDS_1DAY + 2 * $module_interval;
|
||||
if (($current_timestamp > $now)
|
||||
|| (($current_timestamp - $last_timestamp) > (SECONDS_1DAY + 2 * $module_interval)) ) {
|
||||
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
|
||||
//check not init
|
||||
$tmp_data["datos"] = $last_value === false ? false : null;
|
||||
|
@ -765,25 +765,30 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data";
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
|
||||
//insert raw data
|
||||
while ( ($current_raw_data != null) &&
|
||||
( ($current_timestamp_end >= $current_raw_data['utimestamp']) &&
|
||||
($current_timestamp < $current_raw_data['utimestamp']) ) ) {
|
||||
( ($current_timestamp_end > $current_raw_data['utimestamp']) &&
|
||||
($current_timestamp <= $current_raw_data['utimestamp']) ) ) {
|
||||
|
||||
// Add unknown state detected
|
||||
// Add real data detected
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data (raw)";
|
||||
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 1;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
$tmp_data["utimestamp"] = $current_raw_data["utimestamp"];
|
||||
$tmp_data["datos"] = $current_raw_data["datos"];
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "real data";
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 2;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
|
||||
$last_value = $current_raw_data["datos"];
|
||||
|
@ -803,21 +808,49 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
( ( ($current_unknown['time_from'] != null) &&
|
||||
($current_timestamp_end >= $current_unknown['time_from']) ) ||
|
||||
($current_timestamp_end >= $current_unknown['time_to']) ) ) {
|
||||
|
||||
|
||||
if( ( $current_timestamp <= $current_unknown['time_from']) &&
|
||||
( $current_timestamp_end >= $current_unknown['time_from'] ) ){
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data (e)";
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 1;
|
||||
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
// Add unknown state detected
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_from"];
|
||||
$tmp_data["datos"] = null;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "event data unknown from";
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 2;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
$current_unknown["time_from"] = null;
|
||||
}
|
||||
elseif( ($current_timestamp <= $current_unknown['time_to']) &&
|
||||
($current_timestamp_end > $current_unknown['time_to'] ) ){
|
||||
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
//add first slice data always
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data (event_to)";
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 1;
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
if( ($current_timestamp <= $current_unknown['time_to']) &&
|
||||
($current_timestamp_end >= $current_unknown['time_to'] ) ){
|
||||
$tmp_data["utimestamp"] = $current_unknown["time_to"];
|
||||
//Add order to avoid usort missorder in same utimestamp data cells
|
||||
$tmp_data["order"] = 2;
|
||||
$i = count($data_slices) - 1;
|
||||
while ($i >= 0) {
|
||||
if($data_slices[$i]['utimestamp'] <= $current_unknown["time_to"]){
|
||||
|
@ -840,16 +873,32 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
$current_unknown = null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//sort current slice
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
function ($a, $b) {
|
||||
if ($a['utimestamp'] == $b['utimestamp']) return 0;
|
||||
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
|
||||
$return[$pool_id]["utimestamp"] = $current_timestamp;
|
||||
if (count($return[$pool_id]['data']) == 0) {
|
||||
//insert first slice data
|
||||
$tmp_data["utimestamp"] = $current_timestamp;
|
||||
$tmp_data["datos"] = $last_inserted_value;
|
||||
// debug purpose
|
||||
//$tmp_data["obs"] = "virtual data (empty)";
|
||||
array_push($return[$pool_id]["data"], $tmp_data);
|
||||
}
|
||||
|
||||
//sort current slice
|
||||
if(count($return[$pool_id]['data'] > 1)) {
|
||||
usort(
|
||||
$return[$pool_id]['data'],
|
||||
function ($a, $b) {
|
||||
if ($a['utimestamp'] == $b['utimestamp']) return (($a['order'] < $b['order'])?-1:1);
|
||||
return ($a['utimestamp'] < $b['utimestamp']) ? -1 : 1;
|
||||
}
|
||||
);
|
||||
}
|
||||
//put the last slice data like first element of next slice
|
||||
$last_inserted_value = end($return[$pool_id]['data']);
|
||||
$last_inserted_value = $last_inserted_value['datos'];
|
||||
|
@ -867,6 +916,9 @@ function db_uncompress_module_data($id_agente_modulo, $tstart = false, $tend = f
|
|||
//$end_array['data'][0]['obs'] = 'virtual data END';
|
||||
array_push($return, $end_array);
|
||||
}
|
||||
|
||||
// html_debug_print($return);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -1788,4 +1840,4 @@ function db_check_minor_relase_available_to_um ($package, $ent, $offline) {
|
|||
}
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -1176,6 +1176,9 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$datelimit = $date - $period;
|
||||
|
||||
$resolution = $config['graph_res'] * 50; //Number of points of the graph
|
||||
if($resolution > $period){
|
||||
$resolution = $period;
|
||||
}
|
||||
$interval = (int) ($period / $resolution);
|
||||
|
||||
// If projection graph, fill with zero previous data to projection interval
|
||||
|
@ -1321,7 +1324,6 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$data = array ();
|
||||
}
|
||||
|
||||
|
||||
// Uncompressed module data
|
||||
if ($uncompressed_module) {
|
||||
$min_necessary = 1;
|
||||
|
@ -2387,8 +2389,9 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
|
|||
$array_percentil = array();
|
||||
}
|
||||
|
||||
$previous_data = modules_get_previous_data ($value_module, $datelimit);
|
||||
$data_uncompress = db_uncompress_module_data($value_module, $datelimit, $date);
|
||||
|
||||
|
||||
foreach ($data_uncompress as $key_data => $value_data) {
|
||||
foreach ($value_data['data'] as $k => $v) {
|
||||
if($flash_charts) {
|
||||
|
@ -2398,6 +2401,13 @@ function fullscale_data_combined($module_list, $period, $date, $flash_charts, $p
|
|||
$real_date = $v['utimestamp'];
|
||||
}
|
||||
|
||||
if(!isset($v['datos'])){
|
||||
$v['datos'] = $previous_data;
|
||||
}
|
||||
else{
|
||||
$previous_data = $v['datos'];
|
||||
}
|
||||
|
||||
if (!is_null($percentil) && $percentil) {
|
||||
$array_percentil[] = $v['datos'];
|
||||
}
|
||||
|
|
|
@ -573,7 +573,7 @@ function groups_get_status ($id_group = 0, $strict_user = false) {
|
|||
require_once ($config['homedir'].'/include/functions_reporting.php');
|
||||
|
||||
if ($strict_user) {
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'], 'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'], 'AR', $strict_user);
|
||||
$group_status = group_get_data ($config['id_user'], $strict_user, $acltags, false, 'group');
|
||||
$data['monitor_alerts_fired'] = $groups_status['_monitors_alerts_fired_'];
|
||||
$data['agent_critical'] = $groups_status['_agents_critical_'];
|
||||
|
@ -3010,7 +3010,7 @@ function group_get_groups_list($id_user = false, $user_strict = false, $access =
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
$acltags = tags_get_user_module_and_tags ($id_user, $access, $user_strict);
|
||||
$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
|
|
|
@ -24,14 +24,13 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
}
|
||||
|
||||
$user_groups = array();
|
||||
$groups_without_tags = array();
|
||||
foreach ($acltags as $group => $tags) {
|
||||
if ($user_strict) { //Remove groups with tags
|
||||
$groups_without_tags[$group] = $group;
|
||||
}
|
||||
$user_groups[$group] = groups_get_name($group);
|
||||
if ($tags != '') {
|
||||
$tags_group = explode(',', $tags);
|
||||
$user_tags = array();
|
||||
|
||||
foreach ($acltags as $item) {
|
||||
$user_groups[$item["id_grupo"]] = $item["nombre"];
|
||||
|
||||
if ($item["tags"] != '') {
|
||||
$tags_group = explode(',', $item["tags"]);
|
||||
|
||||
foreach ($tags_group as $tag) {
|
||||
$user_tags[$tag] = tags_get_name($tag);
|
||||
|
@ -39,12 +38,7 @@ function groupview_get_all_data ($id_user = false, $user_strict = false, $acltag
|
|||
}
|
||||
}
|
||||
|
||||
if ($user_strict) {
|
||||
$user_groups_ids = implode(',', array_keys($groups_without_tags));
|
||||
}
|
||||
else {
|
||||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
}
|
||||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
|
||||
if (!empty($user_groups_ids)) {
|
||||
if (is_metaconsole() && (!$user_strict)) {
|
||||
|
@ -380,7 +374,8 @@ function groupview_status_modules_agents($id_user = false, $user_strict = false,
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
$acltags = tags_get_user_module_and_tags ($id_user, $access, $user_strict);
|
||||
//$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
$acltags = users_get_groups ($id_user, $access, true, true);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
|
@ -526,7 +521,11 @@ function groupview_get_groups_list($id_user = false, $user_strict = false, $acce
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
$acltags = tags_get_user_module_and_tags ($id_user, $access, $user_strict);
|
||||
//$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
//
|
||||
|
||||
|
||||
$acltags = users_get_groups($id_user, $access, true, true);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
|
@ -575,19 +574,15 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
if ($id_user == false) {
|
||||
$id_user = $config['id_user'];
|
||||
}
|
||||
$groups_with_privileges = users_get_groups($id_user, $access);
|
||||
$groups_with_privileges = implode('","', $groups_with_privileges);
|
||||
|
||||
|
||||
$user_groups = array();
|
||||
$user_tags = array();
|
||||
$groups_without_tags = array();
|
||||
foreach ($acltags as $group => $tags) {
|
||||
if ($user_strict) { //Remove groups with tags
|
||||
$groups_without_tags[$group] = $group;
|
||||
}
|
||||
$user_groups[$group] = groups_get_name($group);
|
||||
if ($tags != '') {
|
||||
$tags_group = explode(',', $tags);
|
||||
$user_tags = array();
|
||||
|
||||
foreach ($acltags as $item) {
|
||||
$user_groups[$item["id_grupo"]] = $item["nombre"];
|
||||
|
||||
if ($item["tags"] != '') {
|
||||
$tags_group = explode(',', $item["tags"]);
|
||||
|
||||
foreach ($tags_group as $tag) {
|
||||
$user_tags[$tag] = tags_get_name($tag);
|
||||
|
@ -595,15 +590,12 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
}
|
||||
}
|
||||
|
||||
$groups_with_privileges = implode(',', array_keys($acltags));
|
||||
|
||||
if (!$user_strict)
|
||||
$acltags[0] = 0;
|
||||
|
||||
if ($user_strict) {
|
||||
$user_groups_ids = implode(',', array_keys($groups_without_tags));
|
||||
}
|
||||
else {
|
||||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
}
|
||||
$user_groups_ids = implode(',', array_keys($acltags));
|
||||
|
||||
if (!empty($user_groups_ids)) {
|
||||
if (is_metaconsole() && (!$user_strict)) {
|
||||
|
@ -700,7 +692,7 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
SELECT *
|
||||
FROM tgrupo
|
||||
WHERE id_grupo IN (" . $fathers_id . ")
|
||||
AND nombre IN (\"". $groups_with_privileges ."\")
|
||||
AND id_grupo IN (" . $groups_with_privileges . ")
|
||||
ORDER BY nombre COLLATE utf8_general_ci ASC");
|
||||
if (!empty($list_father_groups)) {
|
||||
//Merges the arrays and eliminates the duplicates groups
|
||||
|
@ -763,17 +755,20 @@ function groupview_get_data ($id_user = false, $user_strict = false, $acltags, $
|
|||
COUNT(*) AS _total_agents_, id_grupo, intervalo,
|
||||
ultimo_contacto, disabled
|
||||
FROM tmetaconsole_agent WHERE id_grupo = " . $group['id_grupo'] . " AND disabled = 0 GROUP BY id_grupo");
|
||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
||||
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$group_agents['_monitors_unknown_'];
|
||||
$list[$group['id_grupo']]['_monitors_not_init_'] = (int)$group_agents['_monitors_not_init_'];
|
||||
$list[$group['id_grupo']]['_monitors_ok_'] = (int)$group_agents['_monitors_ok_'];
|
||||
|
||||
|
||||
$list[$group['id_grupo']]['_monitors_critical_'] = (int)$group_agents['_monitors_critical_'];
|
||||
$list[$group['id_grupo']]['_monitors_warning_'] = (int)$group_agents['_monitors_warning_'];
|
||||
$list[$group['id_grupo']]['_monitors_unknown_'] = (int)$group_agents['_monitors_unknown_'];
|
||||
$list[$group['id_grupo']]['_monitors_not_init_'] = (int)$group_agents['_monitors_not_init_'];
|
||||
$list[$group['id_grupo']]['_monitors_ok_'] = (int)$group_agents['_monitors_ok_'];
|
||||
$list[$group['id_grupo']]['_monitors_alerts_fired_'] = (int)$group_agents['_monitors_alerts_fired_'];
|
||||
|
||||
$list[$group['id_grupo']]['_total_agents_'] = (int)$group_agents['_total_agents_'];
|
||||
|
||||
$list[$group['id_grupo']]["_monitor_checks_"] = $list[$group['id_grupo']]["_monitors_not_init_"] + $list[$group['id_grupo']]["_monitors_unknown_"] + $list[$group['id_grupo']]["_monitors_warning_"] + $list[$group['id_grupo']]["_monitors_critical_"] + $list[$group['id_grupo']]["_monitors_ok_"];
|
||||
$list[$group['id_grupo']]['_total_agents_'] = (int)$group_agents['_total_agents_'];
|
||||
$list[$group['id_grupo']]["_monitor_checks_"] = $list[$group['id_grupo']]["_monitors_not_init_"]
|
||||
+ $list[$group['id_grupo']]["_monitors_unknown_"]
|
||||
+ $list[$group['id_grupo']]["_monitors_warning_"]
|
||||
+ $list[$group['id_grupo']]["_monitors_critical_"]
|
||||
+ $list[$group['id_grupo']]["_monitors_ok_"];
|
||||
|
||||
if ($group['icon'])
|
||||
$list[$group['id_grupo']]["_iconImg_"] = html_print_image ("images/".$group['icon'].".png", true, array ("style" => 'vertical-align: middle;'));
|
||||
|
|
|
@ -929,7 +929,7 @@ function html_print_extended_select_for_cron ($hour = '*', $minute = '*', $mday
|
|||
}
|
||||
|
||||
# Months
|
||||
for ($i = 0; $i < 12; $i++) {
|
||||
for ($i = 1; $i <= 12; $i++) {
|
||||
$months[$i] = date('F', mktime (0, 0, 0, $i, 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -372,8 +372,16 @@ function io_unsafe_string ($string) {
|
|||
*/
|
||||
function __ ($string /*, variable arguments */) {
|
||||
global $l10n;
|
||||
global $config;
|
||||
static $extensions_cache = array();
|
||||
|
||||
$extensions = extensions_get_extensions();
|
||||
if (array_key_exists($config["id_user"], $extensions_cache)) {
|
||||
$extensions = $extensions_cache[$config["id_user"]];
|
||||
}
|
||||
else {
|
||||
$extensions = extensions_get_extensions();
|
||||
$extensions_cache[$config["id_user"]] = $extensions;
|
||||
}
|
||||
if (empty($extensions))
|
||||
$extensions = array();
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ function maps_duplicate_items_map($id, $map_items) {
|
|||
'options' => $item['options'], 'style' => $item['style']);
|
||||
$result_copy_item = db_process_sql_insert('titem', $copy_items);
|
||||
if ($result_copy_item) {
|
||||
$item_relations = db_get_all_rows_sql("SELECT * FROM trel_item WHERE id = " . $item['id']);
|
||||
$item_relations = db_get_all_rows_sql("SELECT * FROM trel_item WHERE id = " . $item['id'] . " AND deleted = 0");
|
||||
if ($item['id'] == $item_relations['parent_id']) {
|
||||
$copy_item_relations = array(
|
||||
'id_parent' => $result_copy_item,
|
||||
|
|
|
@ -2552,7 +2552,9 @@ function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = fal
|
|||
foreach ($rows_temp as $module_group_key => $modules_group_val)
|
||||
$rows_temp_processed[$modules_group_val['name']] = $modules_group_val['name'];
|
||||
|
||||
$rows_select = array_unique(array_merge($rows_select, $rows_temp_processed));
|
||||
if(is_array($rows_select) && is_array($rows_temp_processed)){
|
||||
$rows_select = array_unique(array_merge($rows_select, $rows_temp_processed));
|
||||
}
|
||||
}
|
||||
|
||||
$groups_temp = users_get_groups_for_select(false, "AR", true, true, false);
|
||||
|
@ -2565,7 +2567,9 @@ function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = fal
|
|||
}
|
||||
|
||||
if (!empty($groups_temp_processed)) {
|
||||
$groups_select = array_unique(array_merge($groups_select, $groups_temp_processed));
|
||||
if(is_array($rows_select) && is_array($rows_temp_processed)){
|
||||
$groups_select = array_unique(array_merge($groups_select, $groups_temp_processed));
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($modules_temp))
|
||||
|
@ -2574,7 +2578,13 @@ function modules_get_modules_name ($sql_from , $sql_conditions = '', $meta = fal
|
|||
metaconsole_restore_db();
|
||||
}
|
||||
unset($groups_select[__('All')]);
|
||||
$key_group_all = array_search(__('All'), $groups_select);
|
||||
if(is_array($groups_select)){
|
||||
$key_group_all = array_search(__('All'), $groups_select);
|
||||
}
|
||||
else{
|
||||
$key_group_all = false;
|
||||
}
|
||||
|
||||
if ($key_group_all !== false)
|
||||
unset($groups_select[$key_group_all]);
|
||||
return $modules;
|
||||
|
|
|
@ -317,7 +317,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente,
|
||||
tagente.normal_count, tagente.warning_count, tagente.critical_count,
|
||||
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
|
||||
}
|
||||
else {
|
||||
|
@ -343,7 +343,7 @@ function networkmap_generate_dot ($pandora_name, $group = 0,
|
|||
$fields = array ('tagente.id_grupo, tagente.nombre, tagente.id_os, tagente.id_parent, tagente.id_agente,
|
||||
tagente.normal_count, tagente.warning_count, tagente.critical_count,
|
||||
tagente.unknown_count, tagente.total_count, tagente.notinit_count');
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
|
||||
}
|
||||
else {
|
||||
|
@ -625,7 +625,7 @@ function networkmap_generate_dot_groups ($pandora_name, $group = 0,
|
|||
global $config;
|
||||
|
||||
if ($strict_user) {
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
}
|
||||
$parents = array();
|
||||
$orphans = array();
|
||||
|
@ -1003,7 +1003,7 @@ function networkmap_create_agent_node ($agent, $simple = 0, $font_size = 10, $cu
|
|||
|
||||
if ($strict_user) {
|
||||
require_once($config['homedir']."/include/functions_tags.php");
|
||||
$acltags = tags_get_user_module_and_tags ($config["id_user"], 'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config["id_user"], 'AR', $strict_user);
|
||||
|
||||
$agent_filter = array("id" => $agent["id_agente"]);
|
||||
$strict_data['normal_count'] = (int) groups_get_normal_monitors ($agent['id_grupo'], $agent_filter, array(), $strict_user, $acltags);
|
||||
|
@ -1798,7 +1798,7 @@ function networkmap_get_new_nodes_from_ip_mask($ip_mask,
|
|||
if ($strict_user) {
|
||||
$filter['group_by'] = 'tagente.id_agente';
|
||||
$fields = array ('tagente.id_agente');
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$user_agents = tags_get_all_user_agents (false, $config['id_user'], $acltags, $filter, $fields, false, $strict_user, true);
|
||||
|
||||
foreach ($all_user_agents as $agent) {
|
||||
|
|
|
@ -2511,7 +2511,7 @@ function reporting_database_serialized($report, $content) {
|
|||
$return['label'] = (isset($content['style']['label'])) ? $content['style']['label'] : '';
|
||||
|
||||
$keys = array();
|
||||
if ($content['header_definition'] != '') {
|
||||
if (isset($content['header_definition']) && ($content['header_definition'] != '')) {
|
||||
$keys = explode('|', $content['header_definition']);
|
||||
}
|
||||
|
||||
|
@ -4492,7 +4492,7 @@ function reporting_sql($report, $content) {
|
|||
}
|
||||
else {
|
||||
$return['correct'] = 0;
|
||||
$return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, union, password, pass, insert or update.');
|
||||
$return['error'] = __('Illegal query: Due security restrictions, there are some tokens or words you cannot use: *, delete, drop, alter, modify, password, pass, insert or update.');
|
||||
}
|
||||
|
||||
if ($config['metaconsole']) {
|
||||
|
@ -8713,7 +8713,7 @@ function reporting_tiny_stats ($counts_info, $return = false, $type = 'agent', $
|
|||
|
||||
if ($strict_user && $type == 'agent') {
|
||||
|
||||
$acltags = tags_get_user_module_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$acltags = tags_get_user_groups_and_tags ($config['id_user'],'AR', $strict_user);
|
||||
$filter['disabled'] = 0;
|
||||
$id_agent = $counts_info['id_agente'];
|
||||
|
||||
|
@ -11002,4 +11002,4 @@ function reporting_label_macro ($item, $label) {
|
|||
return $label;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -3625,7 +3625,7 @@ function reporting_get_total_servers ($num_servers) {
|
|||
|
||||
function reporting_get_events ($data, $links = false) {
|
||||
global $config;
|
||||
|
||||
$table_events = new stdClass();
|
||||
$table_events->width = "100%";
|
||||
if (defined('METACONSOLE'))
|
||||
$style = " vertical-align:middle;";
|
||||
|
@ -3697,7 +3697,7 @@ function reporting_get_last_activity() {
|
|||
global $config;
|
||||
|
||||
// Show last activity from this user
|
||||
|
||||
$table = new stdClass();
|
||||
$table->width = '100%';
|
||||
$table->data = array ();
|
||||
$table->size = array ();
|
||||
|
@ -4010,8 +4010,10 @@ function reporting_get_event_histogram_meta ($width) {
|
|||
$events = db_get_all_rows_sql($sql);
|
||||
|
||||
$events_criticity = array();
|
||||
foreach ($events as $key => $value) {
|
||||
array_push($events_criticity,$value['criticity']);
|
||||
if(is_array($events)){
|
||||
foreach ($events as $key => $value) {
|
||||
array_push($events_criticity,$value['criticity']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($events)) {
|
||||
|
|
|
@ -427,7 +427,7 @@ function tactical_status_modules_agents($id_user = false, $user_strict = false,
|
|||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
$acltags = tags_get_user_module_and_tags ($id_user, $access, $user_strict);
|
||||
$acltags = tags_get_user_groups_and_tags ($id_user, $access, $user_strict);
|
||||
|
||||
// If using metaconsole, the strict users will use the agent table of every node
|
||||
if (is_metaconsole() && $user_strict) {
|
||||
|
|
|
@ -670,30 +670,19 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR',
|
|||
return ERR_WRONG_PARAMETERS;
|
||||
}
|
||||
|
||||
$acltags = tags_get_user_module_and_tags($id_user, $access);
|
||||
|
||||
// Delete the groups without tag restrictions from the acl tags array if $force_group_and_tag == false
|
||||
// Delete the groups that aren't in the received groups id
|
||||
$acltags_aux = array();
|
||||
|
||||
if (!empty($groups) && in_array(0, $groups)) {
|
||||
$acltags_aux[0] = "";
|
||||
}
|
||||
foreach ($acltags as $group_id => $tags) {
|
||||
if (!empty($groups) && array_search($group_id, $groups) === false) {
|
||||
unset($acltags[$group_id]);
|
||||
$raw_acltags = tags_get_user_groups_and_tags($id_user, $access);
|
||||
|
||||
$acltags = array();
|
||||
foreach ($raw_acltags as $group => $taglist) {
|
||||
if (!empty($taglist)) {
|
||||
$acltags[$group] = explode(',', $taglist);
|
||||
}
|
||||
else {
|
||||
if (!empty($tags))
|
||||
$tags = explode(",", $tags);
|
||||
$acltags_aux[$group_id] = $tags;
|
||||
$acltags[$group] = '';
|
||||
}
|
||||
}
|
||||
// Clean the possible empty elements
|
||||
if (!$force_group_and_tag)
|
||||
$acltags_aux = array_filter($acltags_aux);
|
||||
$acltags = $acltags_aux;
|
||||
|
||||
|
||||
switch ($return_mode) {
|
||||
case 'data':
|
||||
// Stop here and return the array
|
||||
|
@ -711,6 +700,7 @@ function tags_get_acl_tags($id_user, $id_group, $access = 'AR',
|
|||
case 'event_condition':
|
||||
// Return the condition of the tags for tevento table
|
||||
$condition = tags_get_acl_tags_event_condition($acltags, $meta, $force_group_and_tag);
|
||||
|
||||
if (!empty($condition)) {
|
||||
return " $query_prefix " . "(" . $condition . ")";
|
||||
}
|
||||
|
@ -735,7 +725,7 @@ function tags_get_acl_tags_module_condition($acltags, $modules_table = '') {
|
|||
$group_conditions = array();
|
||||
|
||||
// The acltags array contains the groups with the acl propagation applied
|
||||
// after the changes done into the 'tags_get_user_module_and_tags' function.
|
||||
// after the changes done into the 'tags_get_user_groups_and_tags' function.
|
||||
foreach ($acltags as $group_id => $group_tags) {
|
||||
$tag_join = '';
|
||||
if (!empty($group_tags)) {
|
||||
|
@ -859,83 +849,84 @@ function tags_get_acl_tags_event_condition($acltags, $meta = false, $force_group
|
|||
|
||||
// Juanma (08/05/2014) Fix : Will have all groups retrieved (also propagated ones)
|
||||
$_groups_not_in = '';
|
||||
|
||||
foreach ($acltags as $group_id => $group_tags) {
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
// Juanma (08/05/2014) Fix : Get all groups (children also, Propagate ACL func!)
|
||||
$group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));
|
||||
$_groups_not_in .= implode(',', array_values(groups_get_id_recursive($group_id))) . ',';
|
||||
|
||||
// Tags condition (The module has at least one of the restricted tags)
|
||||
$tags_condition = '';
|
||||
if (empty($group_tags)) {
|
||||
$tags_condition = "id_grupo = ".$group_id;
|
||||
}
|
||||
else {
|
||||
if (!is_array($group_tags)) {
|
||||
$group_tags = explode(',', $group_tags);
|
||||
|
||||
if($acltags[0]){
|
||||
foreach ($acltags as $group_id => $group_tags) {
|
||||
// Group condition (The module belongs to an agent of the group X)
|
||||
$group_condition = sprintf('id_grupo IN (%s)', implode(',', array_values(groups_get_id_recursive($group_id, true))));
|
||||
//$_groups_not_in .= implode(',', array_values(groups_get_id_recursive($group_id))) . ',';
|
||||
|
||||
// Tags condition (The module has at least one of the restricted tags)
|
||||
$tags_condition = '';
|
||||
if (empty($group_tags)) {
|
||||
$tags_condition = "id_grupo = ".$group_id;
|
||||
}
|
||||
else {
|
||||
if (!is_array($group_tags)) {
|
||||
$group_tags = explode(',', $group_tags);
|
||||
}
|
||||
|
||||
foreach ($group_tags as $tag) {
|
||||
// If the tag ID doesnt exist, ignore
|
||||
if (!isset($all_tags[$tag])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($tags_condition != '') {
|
||||
$tags_condition .= " OR \n";
|
||||
}
|
||||
|
||||
//~ // Add as condition all the posibilities of the serialized tags
|
||||
//~ $tags_condition .= sprintf('tags LIKE "%s,%%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s,%%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%s %%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s %%"',io_safe_input($all_tags[$tag]));
|
||||
|
||||
if ($force_group_and_tag) {
|
||||
if (!empty($all_tags[$tag])) {
|
||||
if ($force_equal) {
|
||||
$tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
|
||||
} else {
|
||||
$tags_condition .= "(tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
|
||||
}
|
||||
$childrens = groups_get_childrens($group_id, null, true);
|
||||
|
||||
if (empty($childrens)) {
|
||||
$tags_condition .= sprintf(' AND id_grupo = %d )', $group_id);
|
||||
} else {
|
||||
$childrens_ids[] = $group_id;
|
||||
foreach ($childrens as $child) {
|
||||
$childrens_ids[] = (int)$child['id_grupo'];
|
||||
}
|
||||
$ids_str = implode(',', $childrens_ids);
|
||||
|
||||
$tags_condition .= sprintf(' AND id_grupo IN (%s) )', $ids_str);
|
||||
}
|
||||
} else {
|
||||
$tags_condition .= "id_grupo = ".$group_id;
|
||||
}
|
||||
} else {
|
||||
if ($force_equal) {
|
||||
$tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
|
||||
} else {
|
||||
$tags_condition .= "tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($group_tags as $tag) {
|
||||
// If the tag ID doesnt exist, ignore
|
||||
if (!isset($all_tags[$tag])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($tags_condition != '') {
|
||||
$tags_condition .= " OR \n";
|
||||
}
|
||||
|
||||
//~ // Add as condition all the posibilities of the serialized tags
|
||||
//~ $tags_condition .= sprintf('tags LIKE "%s,%%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s,%%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%s %%"',io_safe_input($all_tags[$tag]));
|
||||
//~ $tags_condition .= sprintf(' OR tags LIKE "%%,%s %%"',io_safe_input($all_tags[$tag]));
|
||||
|
||||
if ($force_group_and_tag) {
|
||||
if (!empty($all_tags[$tag])) {
|
||||
if ($force_equal) {
|
||||
$tags_condition .= sprintf('(tags = "%s"',io_safe_input($all_tags[$tag]));
|
||||
} else {
|
||||
$tags_condition .= "(tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
|
||||
}
|
||||
$childrens = groups_get_childrens($group_id, null, true);
|
||||
|
||||
if (empty($childrens)) {
|
||||
$tags_condition .= sprintf(' AND id_grupo = %d )', $group_id);
|
||||
} else {
|
||||
$childrens_ids[] = $group_id;
|
||||
foreach ($childrens as $child) {
|
||||
$childrens_ids[] = (int)$child['id_grupo'];
|
||||
}
|
||||
$ids_str = implode(',', $childrens_ids);
|
||||
|
||||
$tags_condition .= sprintf(' AND id_grupo IN (%s) )', $ids_str);
|
||||
}
|
||||
} else {
|
||||
$tags_condition .= "id_grupo = ".$group_id;
|
||||
}
|
||||
} else {
|
||||
if ($force_equal) {
|
||||
$tags_condition .= sprintf('tags = "%s"',io_safe_input($all_tags[$tag]));
|
||||
} else {
|
||||
$tags_condition .= "tags LIKE '%".io_safe_input($all_tags[$tag])."%'";
|
||||
}
|
||||
}
|
||||
// If there is not tag condition ignore
|
||||
if (empty($tags_condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($condition != '') {
|
||||
$condition .= ' OR ';
|
||||
}
|
||||
|
||||
$condition .= "($tags_condition)\n";
|
||||
}
|
||||
|
||||
// If there is not tag condition ignore
|
||||
if (empty($tags_condition)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($condition != '') {
|
||||
$condition .= ' OR ';
|
||||
}
|
||||
|
||||
$condition .= "($tags_condition)\n";
|
||||
}
|
||||
|
||||
//Commented because ACLs propagation don't work
|
||||
|
@ -2402,76 +2393,21 @@ function __add_acltags (&$acltags, $group_id, $tags_str) {
|
|||
}
|
||||
|
||||
/* Return array with groups and their tags */
|
||||
function tags_get_user_module_and_tags ($id_user = false, $access = 'AR', $strict_user = false) {
|
||||
function tags_get_user_groups_and_tags ($id_user = false, $access = 'AR', $strict_user = false) {
|
||||
global $config;
|
||||
|
||||
|
||||
if ($id_user == false) {
|
||||
$id_user = $config['id_user'];
|
||||
}
|
||||
|
||||
$acl_column = get_acl_column($access);
|
||||
|
||||
$sql = sprintf("SELECT tags, id_grupo
|
||||
FROM tusuario_perfil, tperfil
|
||||
WHERE tperfil.id_perfil = tusuario_perfil.id_perfil AND
|
||||
tusuario_perfil.id_usuario = '%s' AND
|
||||
tperfil.%s = 1
|
||||
ORDER BY id_grupo", $id_user, $acl_column);
|
||||
$tags_and_groups = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($tags_and_groups === false)
|
||||
$tags_and_groups = array();
|
||||
|
||||
$acltags = array();
|
||||
|
||||
// Change the 'All' group with all groups
|
||||
$user_groups = users_get_groups($id_user, $access, false);
|
||||
$user_groups_ids = array();
|
||||
if (!empty($user_groups) && is_array($user_groups)) {
|
||||
$user_groups_ids = array_keys($user_groups);
|
||||
|
||||
$acls = users_get_groups ($id_user, $access, false, true);
|
||||
|
||||
$return = array();
|
||||
foreach ($acls as $acl) {
|
||||
$return[$acl["id_grupo"]] = $acl["tags"];
|
||||
}
|
||||
|
||||
// If the user is admin, he should have access to the all group with the required permission
|
||||
if (is_user_admin($id_user))
|
||||
array_unshift($tags_and_groups, array('id_grupo' => 0, 'tags' => ''));
|
||||
|
||||
$tags_and_groups_aux = array();
|
||||
foreach ($tags_and_groups as $data) {
|
||||
// All group
|
||||
if ((int)$data['id_grupo'] === 0) {
|
||||
// All group with empty tags. All groups without tags permission!
|
||||
if (empty($data['tags'])) {
|
||||
foreach ($user_groups_ids as $group_id) {
|
||||
$acltags[$group_id] = '';
|
||||
}
|
||||
|
||||
return $acltags; // End of the function
|
||||
}
|
||||
// Create a new element for every group with the tags
|
||||
else {
|
||||
foreach ($user_groups_ids as $group_id) {
|
||||
$tags_and_groups_aux[] = array(
|
||||
'id_grupo' => $group_id,
|
||||
'tags' => $data['tags']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Specific group
|
||||
else {
|
||||
$tags_and_groups_aux[] = $data;
|
||||
}
|
||||
}
|
||||
$tags_and_groups = $tags_and_groups_aux;
|
||||
unset($tags_and_groups_aux);
|
||||
|
||||
|
||||
foreach ($tags_and_groups as $group_tag) {
|
||||
__add_acltags($acltags, $group_tag['id_grupo'], $group_tag['tags']);
|
||||
}
|
||||
|
||||
|
||||
return $acltags;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|