xml_tag_val("ZMA", $monitor['zma']); xml_tag_val("STATE", $monitor['zmc'] != 1 ? "ERROR" : ($monitor['zma'] == 1 ? "OK" : "WARN")); xml_tag_val("WIDTH", $monitor['Width']); xml_tag_val("HEIGHT", $monitor['Height']); /* Form the data-base query for this monitor */ $pageOffset = 0; $offset = 0; if (isset($_GET['numEvents'])) { $numEvents = validInteger($_GET['numEvents']); $eventsSql = "select E.Id,E.MonitorId,M.Name As MonitorName,E.Cause,E.Name,E.StartTime,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived from Monitors as M inner join Events as E on (M.Id = E.MonitorId) and ( E.MonitorId = " . $monitor['Id'] . " ) order by E.StartTime desc"; $eventsSql .= " limit " . $numEvents; /* If there is an pageOff<x> tag for this monitor, then retrieve the offset. Otherwise, don't specify offset */ if (isset($_GET['pageOff' . $monitor['Id']])) { /* If pageOffset is greater than we actually have, * we need to adjust it */ $pageOffset = validInteger($_GET['pageOff' . $monitor['Id']]); if ($pageOffset >= ceil($monitor['EventCount0'] / $numEvents)) { $pageOffset = 0; } $offset = $pageOffset * $numEvents; } $eventsSql .= " offset " . $offset; } else { unset($eventsSql); } xml_tag_val("PAGEOFF", $pageOffset); xml_tag_sec("EVENTS", 1); if (canView('Events') && isset($eventsSql)) { foreach (dbFetchAll(escapeSql($eventsSql)) as $event) { xml_tag_sec("EVENT", 1); xml_tag_val("ID", $event['Id']);
/* ACTION: View log file. Must have debug and log to file enabled, and sufficient perms * Parms: [lines] */ if (!canEdit('System')) { logXmlErr("Insufficient permissions to view log file"); echo "Insufficient permissions to view log file"; exit; } if (!ZM_EYEZM_DEBUG || !ZM_EYEZM_LOG_TO_FILE) { echo "eyeZm Debug (EYEZM_DEBUG) or log-to-file (EYEZM_LOG_TO_FILE) not enabled. Please enable first"; exit; } if (!file_exists(ZM_EYEZM_LOG_FILE)) { echo "Log file " . ZM_EYEZM_LOG_FILE . " doesn't exist"; exit; } $lines = validInteger(getset('lines', ZM_EYEZM_LOG_LINES)); logXml("Returning last " . $lines . " lines of eyeZm Log from " . ZM_EYEZM_LOG_FILE); echo shell_exec("tail -n " . $lines . " " . ZM_EYEZM_LOG_FILE); echo "\n\n--- Showing last " . $lines . " lines ---\n"; echo "--- End of Log ---\n\n"; } } } } } } } } } } }