Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert for() to foreach() #526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions access.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,20 @@
<option value="__default__"'
. ( $guser == '__default__' ? $selected : '' )
. '>' . $defConfigStr . '</option>';
for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {

foreach ( $userlist as $i ) {
echo '
<option value="' . $userlist[$i]['cal_login'] . '"'
. ( $guser == $userlist[$i]['cal_login'] ? $selected : '' )
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
<option value="' . $i['cal_login'] .
( $guser === $i['cal_login'] ? '" selected>' : '">' ) .
$i['cal_fullname'] . '</option>';
}
for( $i = 0, $cnt = count( $nonuserlist ); $i < $cnt; $i++ ) {

foreach ( $nonuserlist as $i ) {
echo '
<option value="' . $nonuserlist[$i]['cal_login'] . '"'
. ( $guser == $nonuserlist[$i]['cal_login'] ? $selected : '' )
. '>' . $nonuserlist[$i]['cal_fullname'] . ' '
. ( $nonuserlist[$i]['cal_is_public'] == 'Y' ? '*' : '' ) . '</option>';
<option value="' . $i['cal_login'] .
( $guser === $i['cal_login'] ? '" selected>' : '">' ) .
$i['cal_fullname'] . ' ' .
( $i['cal_is_public'] === 'Y' ? '*' : '' ) . '</option>';
}

echo $goStr;
Expand Down Expand Up @@ -294,14 +296,15 @@
. ( $otheruser == '__default__' ? $selected : '' )
. '>' . $defConfigStr . '</option>';

for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {
if( $userlist[$i]['cal_login'] != $guser )
foreach ( $userlist as $i ) {
if ( $i['cal_login'] !== $guser )
echo '
<option value="' . $userlist[$i]['cal_login'] . '"'
. ( ! empty( $otheruser ) && $otheruser == $userlist[$i]['cal_login']
? $selected : '' )
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
<option value="' . $i['cal_login'] .
( ! empty ( $otheruser ) && $otheruser === $i['cal_login']
? '" selected>' : '">' ) .
$i['cal_fullname'] . '</option>';
}

echo $goStr;
}
}
Expand Down Expand Up @@ -475,4 +478,4 @@ function get_list_of_users( $user ) {
return $u;
}

?>
?>