Merge branch 'master' of github.com:ZoneMinder/zoneminder
This commit is contained in:
commit
cd2e96eaec
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
$error='';
|
||||
|
||||
if ( !canEdit('System') ) {
|
||||
$error = 'Insufficient permissions';
|
||||
} else if ( !defined('ZM_PATH_SHUTDOWN') or ZM_PATH_SHUTDOWN == '' ) {
|
||||
$error = 'ZM_PATH_SHUTDOWN is not defined. This is normally configured in /etc/zm/conf.d/01-system-paths.conf';
|
||||
} else if ( !file_exists(ZM_PATH_SHUTDOWN) ) {
|
||||
$error = 'Path does not exist for ZM_PATH_SHUTDOWN. Current value is '.ZM_PATH_SHUTDOWN;
|
||||
}
|
||||
|
||||
if ( $error ) {
|
||||
ZM\Error($error);
|
||||
return;
|
||||
}
|
||||
|
||||
$output_str = '';
|
||||
if ( isset($output) ) {
|
||||
$output_str = '<p>'.implode('<br/>', $output).'</p>'.PHP_EOL;
|
||||
}
|
||||
|
||||
$cancel_str = '';
|
||||
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
|
||||
$cancel_str = '<p>You may cancel this shutdown by clicking '.translate('Cancel').'</p>'.PHP_EOL;
|
||||
}
|
||||
|
||||
$cancel_btn = '';
|
||||
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
|
||||
$cancel_btn = '<button type="submit" class="btn btn-primary" name="action" value="cancel">' .translate('Cancel'). '</button>'.PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="modal" id="shutdownModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title"><?php echo translate('Shutdown').' '.translate('Restart') ?></h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form name="contentForm" id="shutdownForm" method="post" action="?">
|
||||
<?php
|
||||
// We have to manually insert the csrf key into the form when using a modal generated via ajax call
|
||||
echo getCSRFinputHTML();
|
||||
?>
|
||||
<input type="hidden" name="view" value="shutdown"/>
|
||||
<?php echo $output_str ?>
|
||||
<?php echo $cancel_str ?>
|
||||
<p class="warning"><h2>Warning</h2>
|
||||
This command will either shutdown or restart all ZoneMinder Servers<br/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="radio" name="when" value="now" id="whennow"/><label for="whennow">Now</label>
|
||||
<input type="radio" name="when" value="1min" id="when1min" checked="checked"/><label for="when1min">1 Minute</label>
|
||||
</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<?php echo $cancel_btn ?>
|
||||
<button type="submit" id="restartBtn" class="btn btn-primary" name="action" value="restart"><?php echo translate('Restart') ?></button>
|
||||
<button type="submit" id="shutdownBtn" class="btn btn-primary" name="action" value="shutdown"><?php echo translate('Shutdown') ?></button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo translate('Close') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -23,7 +23,7 @@ if ( $action == 'logout' ) {
|
|||
userLogout();
|
||||
$view = 'login';
|
||||
} elseif ( $action == 'config' ) {
|
||||
$redirect = '?view=user&uid='.$user['Id'];
|
||||
$redirect = '?view=user&prev=console&uid='.$user['Id'];
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -66,9 +66,7 @@ if ( $action == 'Save' ) {
|
|||
} else {
|
||||
dbQuery('INSERT INTO Users SET '.implode(', ', $changes));
|
||||
}
|
||||
$refreshParent = true;
|
||||
} # end if changes
|
||||
$redirect = '?view=options&tab=users';
|
||||
} else if ( ZM_USER_SELF_EDIT and ( $_REQUEST['uid'] == $user['Id'] ) ) {
|
||||
$uid = $user['Id'];
|
||||
|
||||
|
@ -99,9 +97,7 @@ if ( $action == 'Save' ) {
|
|||
zm_session_start();
|
||||
generateAuthHash(ZM_AUTH_HASH_IPS, true);
|
||||
session_write_close();
|
||||
$refreshParent = true;
|
||||
}
|
||||
$redirect = '?view=options&tab=users';
|
||||
}
|
||||
} // end if $action == user
|
||||
?>
|
||||
|
|
|
@ -424,6 +424,9 @@ function deleteEvent($event) {
|
|||
} # CAN EDIT
|
||||
}
|
||||
|
||||
/**
|
||||
* $label must be already escaped. It can't be done here since it sometimes contains HTML tags.
|
||||
*/
|
||||
function makeLink($url, $label, $condition=1, $options='') {
|
||||
$string = '';
|
||||
if ( $condition ) {
|
||||
|
@ -443,32 +446,6 @@ function makeHelpLink($ohndx) {
|
|||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* $label must be already escaped. It can't be done here since it sometimes contains HTML tags.
|
||||
*/
|
||||
function makePopupLink($url, $winName, $winSize, $label, $condition=1, $options='') {
|
||||
// Avoid double-encoding since some consumers incorrectly pass a pre-escaped URL.
|
||||
$string = '<a';
|
||||
if ( $condition ) {
|
||||
$string .= ' class="popup-link" href="' . htmlspecialchars($url, ENT_COMPAT | ENT_HTML401, ini_get('default_charset'), false) . '"';
|
||||
$string .= ' data-window-name="' . htmlspecialchars($winName) . '"';
|
||||
if ( is_array( $winSize ) ) {
|
||||
$string .= ' data-window-tag="' . htmlspecialchars($winSize[0]) . '"';
|
||||
$string .= ' data-window-width="' . htmlspecialchars($winSize[1]) . '"';
|
||||
$string .= ' data-window-height="' . htmlspecialchars($winSize[2]) . '"';
|
||||
} else {
|
||||
$string .= ' data-window-tag="' . htmlspecialchars($winSize) . '"';
|
||||
}
|
||||
|
||||
$string .= ($options ? (' ' . $options ) : '') . '>';
|
||||
} else {
|
||||
$string .= '>';
|
||||
}
|
||||
$string .= $label;
|
||||
$string .= '</a>';
|
||||
return $string;
|
||||
}
|
||||
|
||||
function makeButton($url, $buttonValue, $condition=1, $options='') {
|
||||
$string = '<button type="button" data-on-click-this="'.$buttonValue.'"';
|
||||
$string .= ' data-url="' .$url. '"';
|
||||
|
|
|
@ -183,6 +183,9 @@ $user = null;
|
|||
if ( isset($_REQUEST['view']) )
|
||||
$view = detaintPath($_REQUEST['view']);
|
||||
|
||||
if ( isset($_REQUEST['redirect']) )
|
||||
$redirect = '?view='.detaintPath($_REQUEST['redirect']);
|
||||
|
||||
# Add CSP Headers
|
||||
$cspNonce = bin2hex(zm_random_bytes(16));
|
||||
|
||||
|
|
|
@ -72,14 +72,10 @@ function MonitorStream(monitorData) {
|
|||
|
||||
this.onclick = function(evt) {
|
||||
var el = evt.currentTarget;
|
||||
var tag = 'watch';
|
||||
var id = el.getAttribute("data-monitor-id");
|
||||
var width = el.getAttribute("data-width");
|
||||
var height = el.getAttribute("data-height");
|
||||
var url = '?view=watch&mid='+id;
|
||||
var name = 'zmWatch'+id;
|
||||
evt.preventDefault();
|
||||
createPopup(url, name, tag, width, height);
|
||||
window.location.assign(url);
|
||||
};
|
||||
|
||||
this.setup_onclick = function() {
|
||||
|
|
|
@ -756,9 +756,9 @@ function getStatusBtnHTML($status) {
|
|||
//$result .= '</li>'.PHP_EOL;
|
||||
|
||||
if ( ZM_SYSTEM_SHUTDOWN ) {
|
||||
$result .= '<p class="navbar-text">'.PHP_EOL;
|
||||
$result .= makePopupLink('?view=shutdown', 'zmShutdown', 'shutdown', '<i class="material-icons md-18">power_settings_new</i>' ).PHP_EOL;
|
||||
$result .= '</p>'.PHP_EOL;
|
||||
$result .= '<div class="navbar-text pr-2 align-self-center">'.PHP_EOL;
|
||||
$result .= '<button class="btn btn-outline" data-on-click="getShutdownModal" data-toggle="tooltip" data-placement="top" title="' .translate("Shutdown"). '" ><i class="material-icons md-18">power_settings_new</i></button>'.PHP_EOL;
|
||||
$result .= '</div>'.PHP_EOL;
|
||||
}
|
||||
|
||||
} else if ( canView('System') ) {
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
// This file should only contain static JavaScript and no php.
|
||||
// Use skin.js.php for JavaScript that need pre-processing
|
||||
//
|
||||
var popupOptions = "resizable,scrollbars,status=no,toolbar=yes";
|
||||
|
||||
// Globally define the icons used in the bootstrap-table top-right toolbar
|
||||
var icons = {
|
||||
|
@ -59,88 +58,6 @@ function checkSize() {
|
|||
}
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
function newWindow( url, name, width, height ) {
|
||||
window.open( url, name, popupOptions+",width="+width+",height="+height );
|
||||
}
|
||||
|
||||
function getPopupSize( tag, width, height ) {
|
||||
if ( typeof popupSizes == 'undefined' ) {
|
||||
Error("Can't find any window sizes");
|
||||
return {'width': 0, 'height': 0};
|
||||
}
|
||||
var popupSize = Object.clone(popupSizes[tag]);
|
||||
if ( !popupSize ) {
|
||||
Error("Can't find window size for tag '"+tag+"'");
|
||||
return {'width': 0, 'height': 0};
|
||||
}
|
||||
if ( popupSize.width && popupSize.height ) {
|
||||
if ( width || height ) {
|
||||
Warning("Ignoring passed dimensions "+width+"x"+height+" when getting popup size for tag '"+tag+"'");
|
||||
}
|
||||
return popupSize;
|
||||
}
|
||||
if ( popupSize.addWidth ) {
|
||||
popupSize.width = popupSize.addWidth;
|
||||
if ( !width ) {
|
||||
Error("Got addWidth but no passed width when getting popup size for tag '"+tag+"'");
|
||||
} else {
|
||||
popupSize.width += parseInt(width);
|
||||
}
|
||||
} else if ( width ) {
|
||||
popupSize.width = width;
|
||||
Error("Got passed width but no addWidth when getting popup size for tag '"+tag+"'");
|
||||
}
|
||||
if ( popupSize.minWidth && popupSize.width < popupSize.minWidth ) {
|
||||
Warning("Adjusting to minimum width when getting popup size for tag '"+tag+"'");
|
||||
popupSize.width = popupSize.minWidth;
|
||||
}
|
||||
if ( popupSize.addHeight ) {
|
||||
popupSize.height = popupSize.addHeight;
|
||||
if ( !height ) {
|
||||
Error("Got addHeight but no passed height when getting popup size for tag '"+tag+"'");
|
||||
} else {
|
||||
popupSize.height += parseInt(height);
|
||||
}
|
||||
} else if ( height ) {
|
||||
popupSize.height = height;
|
||||
Error("Got passed height but no addHeight when getting popup size for tag '"+tag+"'");
|
||||
}
|
||||
if ( popupSize.minHeight && ( popupSize.height < popupSize.minHeight ) ) {
|
||||
Warning("Adjusting to minimum height ("+popupSize.minHeight+") when getting popup size for tag '"+tag+"' because calculated height is " + popupSize.height);
|
||||
popupSize.height = popupSize.minHeight;
|
||||
}
|
||||
return popupSize;
|
||||
}
|
||||
|
||||
function zmWindow(sub_url) {
|
||||
var zmWin = window.open( 'https://www.zoneminder.com'+(sub_url?sub_url:''), 'ZoneMinder' );
|
||||
if ( ! zmWin ) {
|
||||
// if popup blocking is enabled, the popup won't be defined.
|
||||
console.log("Please disable popup blocking.");
|
||||
} else {
|
||||
zmWin.focus();
|
||||
}
|
||||
}
|
||||
|
||||
function createPopup( url, name, tag, width, height ) {
|
||||
var popupSize = getPopupSize( tag, width, height );
|
||||
var popupDimensions = "";
|
||||
if ( popupSize.width > 0 ) {
|
||||
popupDimensions += ",width="+popupSize.width;
|
||||
}
|
||||
if ( popupSize.height > 0 ) {
|
||||
popupDimensions += ",height="+popupSize.height;
|
||||
}
|
||||
var popup = window.open( url+"&popup=1", name, popupOptions+popupDimensions );
|
||||
if ( ! popup ) {
|
||||
// if popup blocking is enabled, the popup won't be defined.
|
||||
console.log("Please disable popup blocking.");
|
||||
} else {
|
||||
popup.focus();
|
||||
}
|
||||
}
|
||||
|
||||
// Polyfill for NodeList.prototype.forEach on IE.
|
||||
if (window.NodeList && !NodeList.prototype.forEach) {
|
||||
NodeList.prototype.forEach = Array.prototype.forEach;
|
||||
|
@ -155,26 +72,6 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
|
|||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll(".popup-link").forEach(function(el) {
|
||||
el.addEventListener("click", function onClick(evt) {
|
||||
var el = this;
|
||||
var url;
|
||||
if ( el.hasAttribute("href") ) {
|
||||
// <a>
|
||||
url = el.getAttribute("href");
|
||||
} else {
|
||||
// buttons
|
||||
url = el.getAttribute("data-url");
|
||||
}
|
||||
var name = el.getAttribute("data-window-name");
|
||||
var tag = el.getAttribute("data-window-tag");
|
||||
var width = el.getAttribute("data-window-width");
|
||||
var height = el.getAttribute("data-window-height");
|
||||
evt.preventDefault();
|
||||
createPopup(url, name, tag, width, height);
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll(".zmlink").forEach(function(el) {
|
||||
el.addEventListener("click", function onClick(evt) {
|
||||
var el = this;
|
||||
|
@ -271,46 +168,22 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
|
|||
});
|
||||
});
|
||||
|
||||
function createEventPopup( eventId, eventFilter, width, height ) {
|
||||
function openEvent( eventId, eventFilter ) {
|
||||
var url = '?view=event&eid='+eventId;
|
||||
if ( eventFilter ) {
|
||||
url += eventFilter;
|
||||
}
|
||||
var name = 'zmEvent';
|
||||
var popupSize = getPopupSize( 'event', width, height );
|
||||
var popup = window.open( url, name, popupOptions+",width="+popupSize.width+",height="+popupSize.height );
|
||||
if ( ! popup ) {
|
||||
// if popup blocking is enabled, the popup won't be defined.
|
||||
console.log("Please disable popup blocking.");
|
||||
} else {
|
||||
popup.focus();
|
||||
}
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
function createFramesPopup( eventId, width, height ) {
|
||||
function openFrames( eventId ) {
|
||||
var url = '?view=frames&eid='+eventId;
|
||||
var name = 'zmFrames';
|
||||
var popupSize = getPopupSize( 'frames', width, height );
|
||||
var popup = window.open( url, name, popupOptions+",width="+popupSize.width+",height="+popupSize.height );
|
||||
if ( ! popup ) {
|
||||
// if popup blocking is enabled, the popup won't be defined.
|
||||
console.log("Please disable popup blocking.");
|
||||
} else {
|
||||
popup.focus();
|
||||
}
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
function createFramePopup( eventId, frameId, width, height ) {
|
||||
function openFrame( eventId, frameId, width, height ) {
|
||||
var url = '?view=frame&eid='+eventId+'&fid='+frameId;
|
||||
var name = 'zmFrame';
|
||||
var popupSize = getPopupSize( 'frame', width, height );
|
||||
var popup = window.open( url, name, popupOptions+",width="+popupSize.width+",height="+popupSize.height );
|
||||
if ( ! popup ) {
|
||||
// if popup blocking is enabled, the popup won't be defined.
|
||||
console.log("Please disable popup blocking.");
|
||||
} else {
|
||||
popup.focus();
|
||||
}
|
||||
window.location.assign(url);
|
||||
}
|
||||
|
||||
function windowToFront() {
|
||||
|
@ -577,17 +450,6 @@ function confirmDelete( message ) {
|
|||
return ( confirm( message?message:'Are you sure you wish to delete?' ) );
|
||||
}
|
||||
|
||||
if ( refreshParent ) {
|
||||
refreshParentWindow();
|
||||
}
|
||||
|
||||
if ( focusWindow ) {
|
||||
windowToFront();
|
||||
}
|
||||
if ( closePopup ) {
|
||||
closeWindow();
|
||||
}
|
||||
|
||||
window.addEventListener( 'DOMContentLoaded', checkSize );
|
||||
|
||||
function convertLabelFormat(LabelFormat, monitorName) {
|
||||
|
@ -956,3 +818,28 @@ function exportEvent() {
|
|||
.fail(logAjaxFail);
|
||||
$j('#exportProgress').removeClass( 'invisible' );
|
||||
}
|
||||
|
||||
// Load the Function modal on page load
|
||||
function getShutdownModal() {
|
||||
$j.getJSON(thisUrl + '?request=modal&modal=shutdown')
|
||||
.done(function(data) {
|
||||
if ( $j('#shutdownModal').length ) {
|
||||
$j('#shutdownModal').replaceWith(data.html);
|
||||
} else {
|
||||
$j("body").append(data.html);
|
||||
}
|
||||
// Manage the Shutdown modal
|
||||
$j('#shutdownModal').modal('show');
|
||||
// Redirect to the current view after the form is submitted - avoids a blank screen
|
||||
$j('#shutdownForm').append('<input type="hidden" name="redirect" value="'+ currentView +'" />');
|
||||
$j('#restartBtn').click(function(evt) {
|
||||
evt.preventDefault();
|
||||
$j('#shutdownForm').submit();
|
||||
});
|
||||
$j('#shutdownBtn').click(function(evt) {
|
||||
evt.preventDefault();
|
||||
$j('#shutdownForm').submit();
|
||||
});
|
||||
})
|
||||
.fail(logAjaxFail);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ monitorData[monitorData.length] = {
|
|||
'width': <?php echo $monitor->ViewWidth() ?>,
|
||||
'height':<?php echo $monitor->ViewHeight() ?>,
|
||||
'url': '<?php echo $monitor->UrlToIndex() ?>',
|
||||
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->ViewWidth(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->ViewHeight(), $monitor->PopupScale() ); ?> );},
|
||||
'onclick': function(){window.location.assign( '?view=watch&mid=<?php echo $monitor->Id() ?>' );},
|
||||
'type': '<?php echo $monitor->Type() ?>',
|
||||
'refresh': '<?php echo $monitor->Refresh() ?>'
|
||||
};
|
||||
|
|
|
@ -174,7 +174,6 @@ function submitToMontageReview(element) {
|
|||
function submitToExport(element) {
|
||||
var form = element.form;
|
||||
window.location.assign('?view=export&'+$j(form).serialize());
|
||||
//createPopup('?view=export&filter_id='+form.elements['Id'].value, 'zmExport', 'export' );
|
||||
}
|
||||
|
||||
function executeFilter( element ) {
|
||||
|
|
|
@ -37,7 +37,7 @@ monitorData[monitorData.length] = {
|
|||
'width': <?php echo $monitor->ViewWidth() ?>,
|
||||
'height':<?php echo $monitor->ViewHeight() ?>,
|
||||
'url': '<?php echo $monitor->UrlToIndex( ZM_MIN_STREAMING_PORT ? ($monitor->Id() + ZM_MIN_STREAMING_PORT) : '') ?>',
|
||||
'onclick': function(){createPopup( '?view=watch&mid=<?php echo $monitor->Id() ?>', 'zmWatch<?php echo $monitor->Id() ?>', 'watch', <?php echo reScale( $monitor->ViewWidth(), $monitor->PopupScale() ); ?>, <?php echo reScale( $monitor->ViewHeight(), $monitor->PopupScale() ); ?> );},
|
||||
'onclick': function(){window.location.assign( '?view=watch&mid=<?php echo $monitor->Id() ?>' );},
|
||||
'type': '<?php echo $monitor->Type() ?>',
|
||||
'refresh': '<?php echo $monitor->Refresh() ?>'
|
||||
};
|
||||
|
|
|
@ -562,11 +562,9 @@ function getEventCmdResponse( respObj, respText ) {
|
|||
var link = new Element('a', {
|
||||
'href': '#',
|
||||
'events': {
|
||||
'click': createEventPopup.pass( [
|
||||
'click': openEvent.pass( [
|
||||
zm_event.Id,
|
||||
'&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1',
|
||||
zm_event.Width,
|
||||
zm_event.Height
|
||||
'&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1'
|
||||
] )
|
||||
}
|
||||
});
|
||||
|
@ -576,11 +574,9 @@ function getEventCmdResponse( respObj, respText ) {
|
|||
link = new Element('a', {
|
||||
'href': '#',
|
||||
'events': {
|
||||
'click': createEventPopup.pass( [
|
||||
'click': openEvent.pass( [
|
||||
zm_event.Id,
|
||||
'&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1&popup=1',
|
||||
zm_event.Width,
|
||||
zm_event.Height
|
||||
'&filter[Query][terms][0][attr]=MonitorId&filter[Query][terms][0][op]=%3d&filter[Query][terms][0][val]='+monitorId+'&page=1'
|
||||
] )
|
||||
}
|
||||
});
|
||||
|
@ -590,11 +586,11 @@ function getEventCmdResponse( respObj, respText ) {
|
|||
row.getElement('td.colTime').set('text', zm_event.StartTime);
|
||||
row.getElement('td.colSecs').set('text', zm_event.Length);
|
||||
|
||||
link = new Element('a', {'href': '#', 'events': {'click': createFramesPopup.pass( [zm_event.Id, zm_event.Width, zm_event.Height] )}});
|
||||
link = new Element('a', {'href': '#', 'events': {'click': openFrames.pass( [zm_event.Id] )}});
|
||||
link.set('text', zm_event.Frames+'/'+zm_event.AlarmFrames);
|
||||
link.inject(row.getElement('td.colFrames'));
|
||||
|
||||
link = new Element('a', {'href': '#', 'events': {'click': createFramePopup.pass( [zm_event.Id, '0', zm_event.Width, zm_event.Height] )}});
|
||||
link = new Element('a', {'href': '#', 'events': {'click': openFrame.pass( [zm_event.Id, '0'] )}});
|
||||
link.set('text', zm_event.AvgScore+'/'+zm_event.MaxScore);
|
||||
link.inject(row.getElement('td.colScore'));
|
||||
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
<?php
|
||||
//
|
||||
// ZoneMinder web shutdown view file
|
||||
// Copyright (C) 2019 ZoneMinder LLC
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation; either version 2
|
||||
// of the License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canEdit('System') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
$focusWindow = true;
|
||||
|
||||
xhtmlHeaders(__FILE__, translate('Shutdown').' '.translate('Restart'));
|
||||
?>
|
||||
<body>
|
||||
<div id="page">
|
||||
<div id="header">
|
||||
<h2><?php echo translate('Shutdown').' '.translate('Restart') ?></h2>
|
||||
</div>
|
||||
<div id="content">
|
||||
<?php
|
||||
if ( !defined('ZM_PATH_SHUTDOWN') or ZM_PATH_SHUTDOWN == '' ) {
|
||||
echo '<div class="error">ZM_PATH_SHUTDOWN is not defined. This is normally configured in /etc/zm/conf.d/01-system-paths.conf</div>';
|
||||
} else if ( !file_exists(ZM_PATH_SHUTDOWN) ) {
|
||||
echo '<div class="error">Path does not exist for ZM_PATH_SHUTDOWN. Current value is '.ZM_PATH_SHUTDOWN.'</div>';
|
||||
} else {
|
||||
?>
|
||||
|
||||
<form name="contentForm" id="contentForm" method="post" action="?">
|
||||
<input type="hidden" name="view" value="shutdown"/>
|
||||
<?php
|
||||
if ( isset($output) ) {
|
||||
echo '<p>'.implode('<br/>', $output).'</p>';
|
||||
}
|
||||
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
|
||||
echo '<p>You may cancel this shutdown by clicking '.translate('Cancel').'</p>';
|
||||
}
|
||||
?>
|
||||
<p class="warning"><h2>Warning</h2>
|
||||
This command will either shutdown or restart all ZoneMinder Servers<br/>
|
||||
</p>
|
||||
<p>
|
||||
<input type="radio" name="when" value="now" id="whennow"/><label for="whennow">Now</label>
|
||||
<input type="radio" name="when" value="1min" id="when1min" checked="checked"/><label for="when1min">1 Minute</label>
|
||||
</p>
|
||||
<div id="contentButtons">
|
||||
<?php
|
||||
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
|
||||
?>
|
||||
<button type="submit" name="action" value="cancel"><?php echo translate('Cancel') ?></button>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
<button type="submit" name="action" value="restart"><?php echo translate('Restart') ?></button>
|
||||
<button type="submit" name="action" value="shutdown"><?php echo translate('Shutdown') ?></button>
|
||||
<button type="button" data-on-click="closeWindow"><?php echo translate('Close') ?></button>
|
||||
</div>
|
||||
</form>
|
||||
<?php
|
||||
} # end if PATH_SHUTDOWN looks value
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php xhtmlFooter() ?>
|
|
@ -69,6 +69,7 @@ xhtmlHeaders(__FILE__, translate('User').' - '.$newUser->Username());
|
|||
</div>
|
||||
<div id="content" class="row justify-content-center">
|
||||
<form id="contentForm" name="contentForm" method="post" action="?view=user">
|
||||
<input type="hidden" name="redirect" value="<?php echo isset($_REQUEST['prev']) ? $_REQUEST['prev'] : 'options&tab=users' ?>"/>
|
||||
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
|
||||
<table id="contentTable" class="table">
|
||||
<tbody>
|
||||
|
|
Loading…
Reference in New Issue