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
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
|
|
|
|
|
|
|
$selfEdit = ZM_USER_SELF_EDIT && $_REQUEST['uid'] == $user['Id'];
|
|
|
|
|
|
|
|
if ( !canEdit( 'System' ) && !$selfEdit )
|
|
|
|
{
|
2008-09-26 17:47:20 +08:00
|
|
|
$view = "error";
|
2008-07-14 21:54:50 +08:00
|
|
|
return;
|
|
|
|
}
|
2014-07-08 22:52:55 +08:00
|
|
|
|
|
|
|
if ( $_REQUEST['uid'] ) {
|
|
|
|
if ( !($newUser = dbFetchOne( 'SELECT * FROM Users WHERE Id = ?', NULL, ARRAY($_REQUEST['uid'])) ) ) {
|
|
|
|
$view = "error";
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-02-23 17:10:36 +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') );
|
2008-07-14 21:54:50 +08:00
|
|
|
$bandwidths = array_merge( array( ""=>"" ), $bwArray );
|
|
|
|
$langs = array_merge( array( ""=>"" ), getLanguages() );
|
|
|
|
|
|
|
|
$sql = "select Id,Name from Monitors order by Sequence asc";
|
|
|
|
$monitors = array();
|
|
|
|
foreach( dbFetchAll( $sql ) as $monitor )
|
|
|
|
{
|
|
|
|
$monitors[] = $monitor;
|
|
|
|
}
|
|
|
|
|
|
|
|
$focusWindow = true;
|
|
|
|
|
2015-05-10 21:10:30 +08:00
|
|
|
xhtmlHeaders(__FILE__, translate('User')." - ".$newUser['Username'] );
|
2008-07-14 21:54:50 +08:00
|
|
|
?>
|
|
|
|
<body>
|
|
|
|
<div id="page">
|
|
|
|
<div id="header">
|
2015-05-10 21:10:30 +08:00
|
|
|
<h2><?php echo translate('User')." - ".$newUser['Username'] ?></h2>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
<div id="content">
|
2014-12-05 07:44:23 +08:00
|
|
|
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm( this, <?php echo empty($newUser['Password'])?'true':'false' ?> )">
|
|
|
|
<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']) ?>"/>
|
|
|
|
<input type="hidden" name="newUser[MonitorIds]" value="<?php echo $newUser['MonitorIds'] ?>"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
<table id="contentTable" class="major" cellspacing="0">
|
|
|
|
<tbody>
|
|
|
|
<?php
|
|
|
|
if ( canEdit( 'System' ) )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('Username') ?></th>
|
2014-12-05 07:44:23 +08:00
|
|
|
<td><input type="text" name="newUser[Username]" value="<?php echo $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>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td><input type="password" name="newUser[Password]" value=""/></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2015-05-10 21:10:30 +08:00
|
|
|
<th scope="row"><?php echo translate('ConfirmPassword') ?></th>
|
2008-07-14 21:54:50 +08:00
|
|
|
<td><input type="password" name="conf_password" value=""/></td>
|
|
|
|
</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
|
|
|
|
if ( canEdit( 'System' ) )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<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
|
|
|
|
foreach ( $monitors as $monitor )
|
|
|
|
{
|
|
|
|
if ( visibleMonitor( $monitor['Id'] ) )
|
|
|
|
{
|
|
|
|
?>
|
2014-12-05 07:44:23 +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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
<div id="contentButtons">
|
2015-05-10 21:10:30 +08:00
|
|
|
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
|
2008-07-14 21:54:50 +08:00
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|