';
}
} // end function getBodyTopHTML
function getNavBarHTML($reload = null) {
# Provide a facility to turn off the headers if you put navbar=0 into the url
if ( isset($_REQUEST['navbar']) and $_REQUEST['navbar'] == '0' )
return '';
global $running;
global $user;
global $bandwidth_options;
global $view;
global $filterQuery;
global $sortQuery;
global $limitQuery;
if (!$sortQuery) {
parseSort();
}
if ( (!$filterQuery) and isset($_REQUEST['filter']) ) {
parseFilter($_REQUEST['filter']);
$filterQuery = $_REQUEST['filter']['query'];
}
if ( ZM_WEB_NAVBAR_TYPE == "normal" ) {
echo getNormalNavBarHTML($reload,$running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery);
} else {
echo getCollapsedNavBarHTML($reload,$running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery);
}
if ( $reload === null ) return ob_get_clean();
}
//
// The legacy navigation bar that collapses into a pulldown menu on small screens.
//
function getNormalNavBarHTML($reload=null,$running, $user, $bandwidth_options, $view, $filterQuery, $sortQuery, $limitQuery) {
if ( $reload === null ) {
ob_start();
$status = runtimeStatus($running);
?>
'.PHP_EOL;
echo 'trending_up'.PHP_EOL;
echo ' '.translate('Load').': '.getLoad().PHP_EOL;
echo ''.PHP_EOL;
}
// Returns the html representing the current number of connections made to the database
function getDbConHTML() {
$connections = dbFetchOne('SHOW status WHERE variable_name=\'threads_connected\'', 'Value');
$max_connections = dbFetchOne('SHOW variables WHERE variable_name=\'max_connections\'', 'Value');
$percent_used = $max_connections ? 100 * $connections / $max_connections : 100;
$class = ( $percent_used > 90 ) ? 'text-warning' : '';
echo '
'.PHP_EOL;
}
// Returns the html representing the current capacity of mapped memory filesystem (usually /dev/shm)
function getShmHTML() {
$shm_percent = getDiskPercent(ZM_PATH_MAP);
$shm_total_space = disk_total_space(ZM_PATH_MAP);
$shm_used = $shm_total_space - disk_free_space(ZM_PATH_MAP);
$class = '';
if ( $shm_percent > 98 ) {
$class = 'text-danger';
} else if ( $shm_percent > 90 ) {
$class = 'text-warning';
}
echo '
' .ZM_PATH_MAP. ': '.$shm_percent.'%
'.PHP_EOL;
}
// Returns the html representing the optional web console banner text
function getConsoleBannerHTML() {
if ( defined('ZM_WEB_CONSOLE_BANNER') and ZM_WEB_CONSOLE_BANNER != '' ) {
echo '
'.validHtmlStr(ZM_WEB_CONSOLE_BANNER).'
';
}
}
// Returns the html representing the current high,medium,low bandwidth setting
function getBandwidthHTML($bandwidth_options,$user) {
echo '
'.PHP_EOL;
}
// Returns the html representing the version of ZoneMinder
function getZMVersionHTML() {
$class = (ZM_DYN_DB_VERSION&&(ZM_DYN_DB_VERSION!=ZM_VERSION))?'text-danger':'';
echo '
'.PHP_EOL;
}
// Returns the html representing the ZoneMinder logo
function getNavBrandHTML() {
echo '' .ZM_HOME_CONTENT. ''.PHP_EOL;
}
// Returns the html representing the Console menu item
function getConsoleHTML() {
if ( canView('Monitors') ) {
echo '
'.PHP_EOL;
}
}
// Returns the html representing the Log menu item
function getLogHTML() {
if ( canView('System') ) {
if ( ZM\logToDatabase() > ZM\Logger::NOLOG ) {
if ( ! ZM_RUN_AUDIT ) {
# zmaudit can clean the logs, but if we aren't running it, then we should clean them regularly
if ( preg_match('/^\d+$/', ZM_LOG_DATABASE_LIMIT) ) {
# Number of lines, instead of an interval
$rows = dbFetchOne('SELECT Count(*) AS `Rows` FROM `Logs`', 'Rows');
if ( $rows > ZM_LOG_DATABASE_LIMIT ) {
dbQuery('DELETE low_priority FROM `Logs` ORDER BY `TimeKey` ASC LIMIT ?', array($rows - ZM_LOG_DATABASE_LIMIT));
}
} else if ( preg_match('/^\d\s*(hour|minute|day|week|month|year)$/', ZM_LOG_DATABASE_LIMIT, $matches) ) {
dbQuery('DELETE FROM `Logs` WHERE `TimeKey` < unix_timestamp( NOW() - interval '.ZM_LOG_DATABASE_LIMIT.') LIMIT 100');
} else {
ZM\Error('Potentially invalid value for ZM_LOG_DATABASE_LIMIT: ' . ZM_LOG_DATABASE_LIMIT);
}
}
$logstate = logState();
$class = ($logstate == 'ok') ? 'text-success' : ($logstate == 'alert' ? 'text-warning' : (($logstate == 'alarm' ? 'text-danger' : '')));
echo '
').PHP_EOL;
}
}
}
// Returns the html representing the X10 Devices menu item
function getDevicesHTML() {
if ( ZM_OPT_X10 && canView('Devices') ) {
echo '
'.PHP_EOL;
}
}
// Returns the html representing the Groups menu item
function getGroupsHTML($view) {
$class = $view == 'groups' ? 'selected' : '';
echo '
'.PHP_EOL;
}
// Returns the html representing the Filter menu item
function getFilterHTML($view,$filterQuery,$sortQuery,$limitQuery) {
$class = $view == 'filter' ? 'selected' : '';
echo '
'.PHP_EOL;
}
// Returns the html representing the Cycle menu item
function getCycleHTML($view) {
if ( canView('Stream') ) {
$class = $view == 'cycle' ? 'selected' : '';
echo '
'.PHP_EOL;
}
// Returns the html representing the logged in user name and avatar
function getAcctCircleHTML($user=null) {
if ( ZM_OPT_USE_AUTH and $user ) {
echo '