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
|
|
|
//
|
|
|
|
|
|
|
|
$selfEdit = ZM_USER_SELF_EDIT && $_REQUEST['uid'] == $user['Id'];
|
|
|
|
|
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
|
|
|
|
|
|
|
if ( $_REQUEST['uid'] ) {
|
2019-01-24 00:20:31 +08:00
|
|
|
if ( !($newUser = dbFetchOne('SELECT * FROM Users WHERE Id = ?', NULL, ARRAY($_REQUEST['uid']))) ) {
|
|
|
|
$view = 'error';
|
2014-07-08 22:52:55 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$newUser = array();
|
2015-05-10 21:10:30 +08:00
|
|
|
$newUser['Username'] = translate('NewUser');
|
2014-07-08 22:52:55 +08:00
|
|
|
$newUser['Enabled'] = 1;
|
|
|
|
$newUser['MonitorIds'] = '';
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
2019-01-24 00:20:31 +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
|
|
|
|
2019-01-24 00:20:31 +08:00
|
|
|
$sql = 'SELECT Id,Name FROM Monitors ORDER BY Sequence ASC';
|
2008-07-14 21:54:50 +08:00
|
|
|
$monitors = array();
|
2019-01-24 00:20:31 +08:00
|
|
|
foreach( dbFetchAll($sql) as $monitor ) {
|
|
|
|
$monitors[] = $monitor;
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2019-01-24 00:20:31 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('User').' - '.$newUser['Username']);
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
2019-02-10 09:45:52 +08:00
|
|
|
<h2><?php echo translate('User').' - '.validHtmlStr($newUser['Username']); ?></h2>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
2019-02-10 13:39:19 +08:00
|
|
|
<form name="contentForm" method="post" action="?" onsubmit="return validateForm( this, <?php echo empty($newUser['Password'])?'true':'false' ?> )">
|
2014-12-05 07:44:23 +08:00
|
|
|
<input type="hidden" name="view" value="<?php echo $view ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<input type="hidden" name="action" value="user"/>
|
2014-12-05 07:44:23 +08:00
|
|
|
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
|
2019-02-10 09:45:52 +08:00
|
|
|
<input type="hidden" name="newUser[MonitorIds]" value="<?php echo validHtmlStr($newUser['MonitorIds']); ?>"/>
|
2019-01-24 00:20:31 +08:00
|
|
|
<table id="contentTable" class="major">
|
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>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Username') ?></th>
|
2019-02-10 09:45:52 +08:00
|
|
|
<td><input type="text" name="newUser[Username]" value="<?php echo validHtmlStr($newUser['Username']); ?>"/></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th 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>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th 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>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Language') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Language]", $langs ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<?php
|
2019-01-24 00:20:31 +08:00
|
|
|
if ( canEdit('System') ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Enabled') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Enabled]", $yesno ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Stream') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Stream]", $nv ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Events') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Events]", $nve ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Control') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Control]", $nve ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Monitors') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[Monitors]", $nve ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
2015-08-16 01:01:57 +08:00
|
|
|
<tr>
|
|
|
|
<th scope="row"><?php echo translate('Groups') ?></th>
|
|
|
|
<td><?php echo buildSelect( "newUser[Groups]", $nve ) ?></td>
|
|
|
|
</tr>
|
2008-07-14 21:54:50 +08:00
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('System') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[System]", $nve ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('MaxBandwidth') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><?php echo buildSelect( "newUser[MaxBandwidth]", $bandwidths ) ?></td>
|
2008-07-14 21:54:50 +08:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('RestrictedMonitors') ?></th>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td>
|
2008-09-01 22:05:06 +08:00
|
|
|
<select name="monitorIds" size="4" multiple="multiple">
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2019-01-24 00:20:31 +08:00
|
|
|
foreach ( $monitors as $monitor ) {
|
|
|
|
if ( visibleMonitor($monitor['Id']) ) {
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
2019-01-24 00:20:31 +08:00
|
|
|
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists($monitor['Id'], $monitorIds) ) { ?> selected="selected"<?php } ?>><?php echo htmlentities($monitor['Name']) ?></option>
|
2008-07-14 21:54:50 +08:00
|
|
|
<?php
|
2019-01-24 00:20:31 +08:00
|
|
|
}
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
2019-05-29 22:28:25 +08:00
|
|
|
<?php if ( ZM_OPT_USE_API ) { ?>
|
|
|
|
<tr>
|
|
|
|
<th scope="row"><?php echo translate('APIEnabled')?></th>
|
|
|
|
<td><?php echo buildSelect( "newUser[APIEnabled]", $yesno ) ?></td>
|
|
|
|
</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">
|
2019-01-24 00:20:31 +08:00
|
|
|
<button type="submit" value="Save"><?php echo translate('Save') ?></button>
|
|
|
|
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|