Skip to content

Commit 7a0dd18

Browse files
authored
Merge pull request #526 from bbannon/foreach
2 parents dfa6d67 + 62efa28 commit 7a0dd18

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

access.php

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,20 @@
183183
<option value="__default__"'
184184
. ( $guser == '__default__' ? $selected : '' )
185185
. '>' . $defConfigStr . '</option>';
186-
for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {
186+
187+
foreach ( $userlist as $i ) {
187188
echo '
188-
<option value="' . $userlist[$i]['cal_login'] . '"'
189-
. ( $guser == $userlist[$i]['cal_login'] ? $selected : '' )
190-
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
189+
<option value="' . $i['cal_login'] .
190+
( $guser === $i['cal_login'] ? '" selected>' : '">' ) .
191+
$i['cal_fullname'] . '</option>';
191192
}
192-
for( $i = 0, $cnt = count( $nonuserlist ); $i < $cnt; $i++ ) {
193+
194+
foreach ( $nonuserlist as $i ) {
193195
echo '
194-
<option value="' . $nonuserlist[$i]['cal_login'] . '"'
195-
. ( $guser == $nonuserlist[$i]['cal_login'] ? $selected : '' )
196-
. '>' . $nonuserlist[$i]['cal_fullname'] . ' '
197-
. ( $nonuserlist[$i]['cal_is_public'] == 'Y' ? '*' : '' ) . '</option>';
196+
<option value="' . $i['cal_login'] .
197+
( $guser === $i['cal_login'] ? '" selected>' : '">' ) .
198+
$i['cal_fullname'] . ' ' .
199+
( $i['cal_is_public'] === 'Y' ? '*' : '' ) . '</option>';
198200
}
199201

200202
echo $goStr;
@@ -294,14 +296,15 @@
294296
. ( $otheruser == '__default__' ? $selected : '' )
295297
. '>' . $defConfigStr . '</option>';
296298

297-
for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {
298-
if( $userlist[$i]['cal_login'] != $guser )
299+
foreach ( $userlist as $i ) {
300+
if ( $i['cal_login'] !== $guser )
299301
echo '
300-
<option value="' . $userlist[$i]['cal_login'] . '"'
301-
. ( ! empty( $otheruser ) && $otheruser == $userlist[$i]['cal_login']
302-
? $selected : '' )
303-
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
302+
<option value="' . $i['cal_login'] .
303+
( ! empty ( $otheruser ) && $otheruser === $i['cal_login']
304+
? '" selected>' : '">' ) .
305+
$i['cal_fullname'] . '</option>';
304306
}
307+
305308
echo $goStr;
306309
}
307310
}
@@ -475,4 +478,4 @@ function get_list_of_users( $user ) {
475478
return $u;
476479
}
477480

478-
?>
481+
?>

0 commit comments

Comments
 (0)