2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
|
|
|
//
|
|
|
|
// ZoneMinder web user view file, $Date$, $Revision$
|
2008-07-25 17:48:16 +08:00
|
|
|
// Copyright (C) 2001-2008 Philip Coombes
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
// 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
|
2016-12-26 23:23:16 +08:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-07-14 21:54:50 +08:00
|
|
|
//
|
|
|
|
|
2020-06-24 10:18:45 +08:00
|
|
|
$selfEdit = ZM_USER_SELF_EDIT && ($_REQUEST['uid'] == $user['Id']);
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2019-01-24 00:20:31 +08:00
|
|
|
if ( !canEdit('System') && !$selfEdit ) {
|
|
|
|
$view = 'error';
|
|
|
|
return;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
2014-07-08 22:52:55 +08:00
|
|
|
|
2020-08-01 22:27:54 +08:00
|
|
|
require('includes/User.php');
|
|
|
|
|
2014-07-08 22:52:55 +08:00
|
|
|
if ( $_REQUEST['uid'] ) {
|
2020-08-01 22:27:54 +08:00
|
|
|
if ( !($newUser = new ZM\User($_REQUEST['uid'])) ) {
|
2019-01-24 00:20:31 +08:00
|
|
|
$view = 'error';
|
2014-07-08 22:52:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
2020-08-01 22:27:54 +08:00
|
|
|
$newUser = new ZM\User();
|
|
|
|
$newUser->Username(translate('NewUser'));
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2020-08-01 22:27:54 +08:00
|
|
|
$monitorIds = array_flip(explode(',', $newUser->MonitorIds()));
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2015-05-10 21:10:30 +08:00
|
|
|
$yesno = array( 0=>translate('No'), 1=>translate('Yes') );
|
|
|
|
$nv = array( 'None'=>translate('None'), 'View'=>translate('View') );
|
|
|
|
$nve = array( 'None'=>translate('None'), 'View'=>translate('View'), 'Edit'=>translate('Edit') );
|
2019-01-24 00:20:31 +08:00
|
|
|
$bandwidths = array_merge( array( ''=>'' ), $bandwidth_options );
|
|
|
|
$langs = array_merge( array( ''=>'' ), getLanguages() );
|
2008-07-14 21:54:50 +08:00
|
|
|
|
2020-06-24 10:18:45 +08:00
|
|
|
$sql = 'SELECT Id, Name FROM Monitors ORDER BY Sequence ASC';
|
2008-07-14 21:54:50 +08:00
|
|
|
$monitors = array();
|
2020-06-24 10:18:45 +08:00
|
|
|
foreach ( dbFetchAll($sql) as $monitor ) {
|
|
|
|
if ( visibleMonitor($monitor['Id']) ) {
|
|
|
|
$monitors[$monitor['Id']] = $monitor;
|
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2020-08-01 22:27:54 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('User').' - '.$newUser->Username());
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
2020-08-27 02:52:10 +08:00
|
|
|
<?php echo getNavBarHTML() ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
<div id="page">
|
2020-09-26 04:49:18 +08:00
|
|
|
<div class="w-100">
|
|
|
|
<div class="float-left pl-3 pt-1">
|
|
|
|
<button type="button" id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
|
|
|
|
<button type="button" id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
|
|
|
|
</div>
|
|
|
|
<div class="w-100 pt-2">
|
|
|
|
<h2><?php echo translate('User').' - '.validHtmlStr($newUser->Username()); ?></h2>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-08-27 02:52:10 +08:00
|
|
|
<div id="content" class="row justify-content-center">
|
2020-06-24 10:18:45 +08:00
|
|
|
<form id="contentForm" name="contentForm" method="post" action="?view=user">
|
2014-12-05 07:44:23 +08:00
|
|
|
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
|
2020-08-27 02:52:10 +08:00
|
|
|
<table id="contentTable" class="table">
|
2008-07-14 21:54:50 +08:00
|
|
|
<tbody>
|
|
|
|
<?php
|
2019-01-24 00:20:31 +08:00
|
|
|
if ( canEdit('System') ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Username') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><input type="text" name="newUser[Username]" value="<?php echo validHtmlStr($newUser->Username()); ?>"<?php echo $newUser->Username() == 'admin' ? ' readonly="readonly"':''?>/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('NewPassword') ?></th>
|
2019-02-10 09:45:52 +08:00
|
|
|
<td><input type="password" name="newUser[Password]" autocomplete="new-password"/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('ConfirmPassword') ?></th>
|
2019-02-10 09:45:52 +08:00
|
|
|
<td><input type="password" name="conf_password" autocomplete="new-password"/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Language') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Language]', $langs, $newUser->Language()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2020-08-01 22:27:54 +08:00
|
|
|
if ( canEdit('System') and ( $newUser->Username() != 'admin' ) ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Enabled') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Enabled]', $yesno, $newUser->Enabled()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Stream') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Stream]', $nv, $newUser->Stream()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Events') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Events]', $nve, $newUser->Events()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Control') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Control]', $nve, $newUser->Control()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Monitors') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Monitors]', $nve, $newUser->Monitors()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
2015-08-16 01:01:57 +08:00
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('Groups') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[Groups]', $nve, $newUser->Groups()) ?></td>
|
2015-08-16 01:01:57 +08:00
|
|
|
</tr>
|
2008-07-14 21:54:50 +08:00
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('System') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[System]', $nve, $newUser->System()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
2020-10-01 23:51:59 +08:00
|
|
|
<tr>
|
|
|
|
<th class="text-right" scope="row"><?php echo translate('Devices') ?></th>
|
|
|
|
<td><?php echo htmlSelect('newUser[Devices]', $nve, $newUser->Devices()) ?></td>
|
|
|
|
</tr>
|
2008-07-14 21:54:50 +08:00
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('MaxBandwidth') ?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[MaxBandwidth]', $bandwidths, $newUser->MaxBandwidth()) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('RestrictedMonitors') ?></th>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td>
|
2020-08-01 22:27:54 +08:00
|
|
|
<?php echo htmlSelect('newUser[MonitorIds][]', $monitors, explode(',', $newUser->MonitorIds()), array('multiple'=>'multiple')); ?>
|
2008-07-14 21:54:50 +08:00
|
|
|
</td>
|
|
|
|
</tr>
|
2019-05-29 22:28:25 +08:00
|
|
|
<?php if ( ZM_OPT_USE_API ) { ?>
|
|
|
|
<tr>
|
2020-08-27 02:52:10 +08:00
|
|
|
<th class="text-right" scope="row"><?php echo translate('APIEnabled')?></th>
|
2020-08-01 22:27:54 +08:00
|
|
|
<td><?php echo htmlSelect('newUser[APIEnabled]', $yesno, $newUser->APIEnabled()) ?></td>
|
2019-05-29 22:28:25 +08:00
|
|
|
</tr>
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2019-05-29 22:28:25 +08:00
|
|
|
} // end if ZM_OPT_USE_API
|
|
|
|
} // end if canEdit(System)
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2020-06-24 10:18:45 +08:00
|
|
|
<button type="submit" name="action" value="Save"><?php echo translate('Save') ?></button>
|
2019-01-24 00:20:31 +08:00
|
|
|
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-09-03 06:17:12 +08:00
|
|
|
<?php xhtmlFooter() ?>
|