fix code style

This commit is contained in:
Isaac Connor 2019-01-23 11:20:31 -05:00
parent b9584bb5d2
commit b1cc7bf837
1 changed files with 24 additions and 29 deletions

View File

@ -20,15 +20,14 @@
$selfEdit = ZM_USER_SELF_EDIT && $_REQUEST['uid'] == $user['Id']; $selfEdit = ZM_USER_SELF_EDIT && $_REQUEST['uid'] == $user['Id'];
if ( !canEdit( 'System' ) && !$selfEdit ) if ( !canEdit('System') && !$selfEdit ) {
{ $view = 'error';
$view = "error";
return; return;
} }
if ( $_REQUEST['uid'] ) { if ( $_REQUEST['uid'] ) {
if ( !($newUser = dbFetchOne( 'SELECT * FROM Users WHERE Id = ?', NULL, ARRAY($_REQUEST['uid'])) ) ) { if ( !($newUser = dbFetchOne('SELECT * FROM Users WHERE Id = ?', NULL, ARRAY($_REQUEST['uid']))) ) {
$view = "error"; $view = 'error';
return; return;
} }
} else { } else {
@ -38,29 +37,28 @@ if ( $_REQUEST['uid'] ) {
$newUser['MonitorIds'] = ''; $newUser['MonitorIds'] = '';
} }
$monitorIds = array_flip(explode( ',', $newUser['MonitorIds'] )); $monitorIds = array_flip(explode(',', $newUser['MonitorIds']));
$yesno = array( 0=>translate('No'), 1=>translate('Yes') ); $yesno = array( 0=>translate('No'), 1=>translate('Yes') );
$nv = array( 'None'=>translate('None'), 'View'=>translate('View') ); $nv = array( 'None'=>translate('None'), 'View'=>translate('View') );
$nve = array( 'None'=>translate('None'), 'View'=>translate('View'), 'Edit'=>translate('Edit') ); $nve = array( 'None'=>translate('None'), 'View'=>translate('View'), 'Edit'=>translate('Edit') );
$bandwidths = array_merge( array( ""=>"" ), $bandwidth_options ); $bandwidths = array_merge( array( ''=>'' ), $bandwidth_options );
$langs = array_merge( array( ""=>"" ), getLanguages() ); $langs = array_merge( array( ''=>'' ), getLanguages() );
$sql = "select Id,Name from Monitors order by Sequence asc"; $sql = 'SELECT Id,Name FROM Monitors ORDER BY Sequence ASC';
$monitors = array(); $monitors = array();
foreach( dbFetchAll( $sql ) as $monitor ) foreach( dbFetchAll($sql) as $monitor ) {
{
$monitors[] = $monitor; $monitors[] = $monitor;
} }
$focusWindow = true; $focusWindow = true;
xhtmlHeaders(__FILE__, translate('User')." - ".$newUser['Username'] ); xhtmlHeaders(__FILE__, translate('User').' - '.$newUser['Username']);
?> ?>
<body> <body>
<div id="page"> <div id="page">
<div id="header"> <div id="header">
<h2><?php echo translate('User')." - ".$newUser['Username'] ?></h2> <h2><?php echo translate('User').' - '.$newUser['Username'] ?></h2>
</div> </div>
<div id="content"> <div id="content">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm( this, <?php echo empty($newUser['Password'])?'true':'false' ?> )"> <form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm( this, <?php echo empty($newUser['Password'])?'true':'false' ?> )">
@ -68,11 +66,10 @@ xhtmlHeaders(__FILE__, translate('User')." - ".$newUser['Username'] );
<input type="hidden" name="action" value="user"/> <input type="hidden" name="action" value="user"/>
<input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/> <input type="hidden" name="uid" value="<?php echo validHtmlStr($_REQUEST['uid']) ?>"/>
<input type="hidden" name="newUser[MonitorIds]" value="<?php echo $newUser['MonitorIds'] ?>"/> <input type="hidden" name="newUser[MonitorIds]" value="<?php echo $newUser['MonitorIds'] ?>"/>
<table id="contentTable" class="major" cellspacing="0"> <table id="contentTable" class="major">
<tbody> <tbody>
<?php <?php
if ( canEdit( 'System' ) ) if ( canEdit('System') ) {
{
?> ?>
<tr> <tr>
<th scope="row"><?php echo translate('Username') ?></th> <th scope="row"><?php echo translate('Username') ?></th>
@ -83,19 +80,18 @@ if ( canEdit( 'System' ) )
?> ?>
<tr> <tr>
<th scope="row"><?php echo translate('NewPassword') ?></th> <th scope="row"><?php echo translate('NewPassword') ?></th>
<td><input type="password" name="newUser[Password]" value=""/></td> <td><input type="password" name="newUser[Password]"/></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php echo translate('ConfirmPassword') ?></th> <th scope="row"><?php echo translate('ConfirmPassword') ?></th>
<td><input type="password" name="conf_password" value=""/></td> <td><input type="password" name="conf_password"/></td>
</tr> </tr>
<tr> <tr>
<th scope="row"><?php echo translate('Language') ?></th> <th scope="row"><?php echo translate('Language') ?></th>
<td><?php echo buildSelect( "newUser[Language]", $langs ) ?></td> <td><?php echo buildSelect( "newUser[Language]", $langs ) ?></td>
</tr> </tr>
<?php <?php
if ( canEdit( 'System' ) ) if ( canEdit('System') ) {
{
?> ?>
<tr> <tr>
<th scope="row"><?php echo translate('Enabled') ?></th> <th scope="row"><?php echo translate('Enabled') ?></th>
@ -134,12 +130,10 @@ if ( canEdit( 'System' ) )
<td> <td>
<select name="monitorIds" size="4" multiple="multiple"> <select name="monitorIds" size="4" multiple="multiple">
<?php <?php
foreach ( $monitors as $monitor ) foreach ( $monitors as $monitor ) {
{ if ( visibleMonitor($monitor['Id']) ) {
if ( visibleMonitor( $monitor['Id'] ) )
{
?> ?>
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?>><?php echo htmlentities($monitor['Name']) ?></option> <option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists($monitor['Id'], $monitorIds) ) { ?> selected="selected"<?php } ?>><?php echo htmlentities($monitor['Name']) ?></option>
<?php <?php
} }
} }
@ -153,7 +147,8 @@ if ( canEdit( 'System' ) )
</tbody> </tbody>
</table> </table>
<div id="contentButtons"> <div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"/><input type="button" value="<?php echo translate('Cancel') ?>" data-on-click="closeWindow"/> <button type="submit" value="Save"><?php echo translate('Save') ?></button>
<button type="button" data-on-click="closeWindow"><?php echo translate('Cancel') ?></button>
</div> </div>
</form> </form>
</div> </div>