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

example of converting ==|!= to ===|!== #413

Open
wants to merge 34 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f4e6379
example of converting ==|!= to ===|!==
bbannon Sep 16, 2023
05d3e81
Merge branch 'craigk5n:master' into xact
bbannon Sep 18, 2023
7a05859
Merge branch 'craigk5n:master' into xact
bbannon Sep 20, 2023
65b9f4a
Merge branch 'craigk5n:master' into xact
bbannon Sep 22, 2023
c0c4e3b
Merge branch 'craigk5n:master' into xact
bbannon Sep 25, 2023
d08c0a5
Merge branch 'craigk5n:master' into xact
bbannon Sep 26, 2023
1836979
Merge branch 'craigk5n:master' into xact
bbannon Sep 27, 2023
9000f57
Merge branch 'craigk5n:master' into xact
bbannon Sep 27, 2023
3b7c041
Merge branch 'craigk5n:master' into xact
bbannon Sep 29, 2023
909dba7
Merge branch 'craigk5n:master' into xact
bbannon Oct 2, 2023
534a813
Merge branch 'craigk5n:master' into xact
bbannon Oct 2, 2023
e014bec
Merge branch 'craigk5n:master' into xact
bbannon Oct 6, 2023
a5bd287
Example of null coalescing assignment operator.
bbannon Oct 6, 2023
3c3349e
Merge branch 'craigk5n:master' into xact
bbannon Nov 15, 2023
767b309
Merge branch 'craigk5n:master' into xact
bbannon Nov 21, 2023
b13b347
Merge branch 'master' into xact
bbannon Nov 21, 2023
f9f55b1
Merge branch 'craigk5n:master' into xact
bbannon Nov 21, 2023
dc6c29f
Merge branch 'craigk5n:master' into xact
bbannon Nov 22, 2023
d09aa36
Merge branch 'craigk5n:master' into xact
bbannon Nov 25, 2023
d650ab6
Merge branch 'craigk5n:master' into xact
bbannon Nov 27, 2023
04cdbff
Merge branch 'craigk5n:master' into xact
bbannon Nov 28, 2023
d9a7057
Merge branch 'craigk5n:master' into xact
bbannon Nov 29, 2023
b7f7817
Merge branch 'craigk5n:master' into xact
bbannon Jan 3, 2024
d5e2caf
Merge branch 'craigk5n:master' into xact
bbannon Jan 24, 2024
8d7d5f7
Merge branch 'craigk5n:master' into xact
bbannon Feb 2, 2024
a4b7f91
Merge branch 'craigk5n:master' into xact
bbannon Apr 14, 2024
452b8e5
Merge branch 'craigk5n:master' into xact
bbannon May 17, 2024
053904a
Merge branch 'craigk5n:master' into xact
bbannon Jun 25, 2024
f413c8f
Merge branch 'craigk5n:master' into xact
bbannon Jul 29, 2024
ceaffae
Merge branch 'craigk5n:master' into xact
bbannon Jul 31, 2024
560f212
Merge branch 'craigk5n:master' into xact
bbannon Aug 31, 2024
88f1e69
Merge branch 'master' into xact
bbannon Aug 31, 2024
ee72d99
Merge branch 'craigk5n:master' into xact
bbannon Aug 31, 2024
d5f3b63
Merge branch 'craigk5n:master' into xact
bbannon Sep 3, 2024
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
62 changes: 32 additions & 30 deletions access.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
*/
require_once 'includes/init.php';

$allow_view_other =
( ! empty( $ALLOW_VIEW_OTHER ) && $ALLOW_VIEW_OTHER == 'Y' );
$allow_view_other = ( ( $ALLOW_VIEW_OTHER ??= 'Y' ) === 'Y' );

if( ! access_is_enabled() ) {
echo print_not_auth();
Expand All @@ -46,11 +45,12 @@
// Are we handling the access form?
// If so, do that, then redirect.
// Handle function access first.
if( getPostValue( 'auser' ) != '' && getPostValue( 'submit' ) == $saveStr ) {
if ( getPostValue ( 'auser' ) !== '' &&
getPostValue ( 'submit' ) === $saveStr ) {
$auser = getPostValue( 'auser' );
$perm = '';
for( $i = 0; $i < ACCESS_NUMBER_FUNCTIONS; $i++ ) {
$perm .= ( getPostValue( 'access_' . $i ) == 'Y' ? 'Y' : 'N' );
$perm .= ( getPostValue ( 'access_' . $i ) === 'Y' ? 'Y' : 'N' );
}

dbi_execute( 'DELETE FROM webcal_access_function
Expand All @@ -64,7 +64,8 @@
}

// Are we handling the other user form? If so, do that, then redirect.
if( getPostValue( 'otheruser' ) != '' && getPostValue( 'submit' ) == $saveStr ) {
if ( getPostValue ( 'otheruser' ) !== '' &&
getPostValue ( 'submit' ) === $saveStr ) {
$puser = getPostValue( 'guser' );
$pouser = getPostValue( 'otheruser' );

Expand Down Expand Up @@ -98,8 +99,9 @@
$puser,
$pouser,
( $view_total > 0 ? $view_total : 0 ),
( $edit_total > 0 && $puser != '__public__' ? $edit_total : 0 ),
( $approve_total > 0 && $puser != '__public__' ? $approve_total : 0 ),
( $puser !== '__public__' && $edit_total > 0 ? $edit_total : 0 ),
( $puser !== '__public__' && $approve_total > 0
? $approve_total : 0 ),
( strlen( $invite ) ? $invite : 'N' ),
( strlen( $email ) ? $email : 'N' ),
( strlen( $time ) ? $time : 'N' )] ) )
Expand All @@ -112,16 +114,16 @@
$guser = getPostValue( 'guser' );
$selected = ' selected';

if( $guser == '__default__' ) {
if ( $guser === '__default__' ) {
$otheruser = $guser;
$user_fullname = $defConfigStr;
} else
$otheruser = getPostValue( 'otheruser' );

if( $otheruser == '__default__' ) {
if ( $otheruser === '__default__' ) {
$otheruser_fullname = $defConfigStr;
$otheruser_login = '__default__';
} elseif( $otheruser == '__public__' ) {
} elseif ( $otheruser === '__public__' ) {
$otheruser_fullname = translate( 'Public Access' );
$otheruser_login = '__public__';
}
Expand Down Expand Up @@ -181,20 +183,20 @@
// Add a DEFAULT CONFIGURATION to be used as a mask.
. '
<option value="__default__"'
. ( $guser == '__default__' ? $selected : '' )
. ( $guser === '__default__' ? $selected : '' )
. '>' . $defConfigStr . '</option>';
for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {
echo '
<option value="' . $userlist[$i]['cal_login'] . '"'
. ( $guser == $userlist[$i]['cal_login'] ? $selected : '' )
. ( $guser === $userlist[$i]['cal_login'] ? $selected : '' )
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
}
for( $i = 0, $cnt = count( $nonuserlist ); $i < $cnt; $i++ ) {
echo '
<option value="' . $nonuserlist[$i]['cal_login'] . '"'
. ( $guser == $nonuserlist[$i]['cal_login'] ? $selected : '' )
. ( $guser === $nonuserlist[$i]['cal_login'] ? $selected : '' )
. '>' . $nonuserlist[$i]['cal_fullname'] . ' '
. ( $nonuserlist[$i]['cal_is_public'] == 'Y' ? '*' : '' ) . '</option>';
. ( $nonuserlist[$i]['cal_is_public'] === 'Y' ? '*' : '' ) . '</option>';
}

echo $goStr;
Expand All @@ -210,7 +212,7 @@
$order = array_merge ( [1, 0], range ( 2, 14 ), [27], range ( 15, 26 ) );
// Make sure that we have defined all the types of access
// defined in access.php.
assert( count( $order ) == ACCESS_NUMBER_FUNCTIONS );
assert ( count ( $order ) === ACCESS_NUMBER_FUNCTIONS );

echo '<form action="access.php" method="post" id="accessform" name="accessform">';
print_form_key();
Expand All @@ -226,8 +228,8 @@
// Public access and NUCs can never use some of these functions.
$show = true;

if( $guser == '__public__'
|| substr( $guser, 0, 5 ) == $NONUSER_PREFIX ) {
if ( $guser === '__public__' ||
substr ( $guser, 0, 5 ) === $NONUSER_PREFIX ) {
switch( $order[$i] ) {
case ACCESS_ACCESS_MANAGEMENT:
case ACCESS_ACCOUNT_INFO:
Expand All @@ -249,7 +251,7 @@
access_get_function_description( $order[$i] ),
substr( $access, $order[$i], 1 )], 'dito' ) . '<br>';

if( ( $i + 1 ) % $div == 0 )
if ( ( $i + 1 ) % $div === 0 )
echo '
</td>
<td>';
Expand All @@ -269,12 +271,12 @@
} else {
// Get list of users that this user can see (may depend on group settings)
// along with all nonuser calendars.
// if( $guser != '__default__' ) {
// if ( $guser !== '__default__' ) {
$guser = $login;
$pagetitle = translate( 'Grant This User Access to My Calendar' );
}

if( $guser == '__default__' ) {
if ( $guser === '__default__' ) {
$userlist = ['__default__'];
$otheruser = $otheruser_login = '__default__';
$otheruser_fullname = $defConfigStr;
Expand All @@ -291,14 +293,14 @@
// Add a DEFAULT CONFIGURATION to be used as a mask.
. '
<option value="__default__"'
. ( $otheruser == '__default__' ? $selected : '' )
. ( $otheruser === '__default__' ? $selected : '' )
. '>' . $defConfigStr . '</option>';

for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) {
if( $userlist[$i]['cal_login'] != $guser )
if ( $userlist[$i]['cal_login'] !== $guser )
echo '
<option value="' . $userlist[$i]['cal_login'] . '"'
. ( ! empty( $otheruser ) && $otheruser == $userlist[$i]['cal_login']
. ( ! empty ( $otheruser ) && $otheruser === $userlist[$i]['cal_login']
? $selected : '' )
. '>' . $userlist[$i]['cal_fullname'] . '</option>';
}
Expand Down Expand Up @@ -343,7 +345,7 @@

for( $j = 1; $j < 5; $j++ ) {
$bottomedge = '';
if( $j == 3 )
if ( $j === 3 )
continue;

$j8 = $j * 8;
Expand All @@ -353,17 +355,17 @@
<tr>
<td class="boxleft leftpadded' . ( $j > 3 ? ' boxbottom' : '' )
. '"><input class="form-control-sm" type="checkbox" value="Y" name=';
if( $j == 1 )
if ( $j === 1 )
echo '"invite"'
. ( ! empty( $op['invite'] ) && $op['invite'] == 'N' ? '' : $checked )
. ( $op['invite'] === 'N' ? '' : $checked )
. '>' . translate( 'Can Invite' );
elseif( $j == 2 )
elseif ( $j === 2 )
echo '"email"'
. ( ! empty( $op['email'] ) && $op['email'] == 'N' ? '' : $checked )
. ( $op['email'] === 'N' ? '' : $checked )
. '>' . translate( 'Can Email' );
else {
echo '"time"'
. ( ! empty( $op['time'] ) && $op['time'] == 'Y' ? $checked : '' )
. ( $op['time'] === 'Y' ? $checked : '' )
. ' onclick="enableAll( this.checked );">'
. translate( 'Can See Time Only' );
$bottomedge = 'boxbottom';
Expand All @@ -383,7 +385,7 @@
. $j64 . '" name="v_' . $j64 . '"'
. ( ! empty( $op['view'] ) && ( $op['view'] & $j64 )
? $checked : '' ) . '></td>'
. ( $guser != '__public__' ? '
. ( $guser !== '__public__' ? '
<td class="aligncenter boxleft pub ' . $bottomedge . '"><input '
. 'class="form-control-sm" type="checkbox" value="' . $j . '" name="e_' . $j . '"'
. ( ! empty( $op['edit'] ) && ( $op['edit'] & $j ) ? $checked : '' )
Expand Down