diff --git a/access.php b/access.php index 24e0107ed..ccb0e8053 100644 --- a/access.php +++ b/access.php @@ -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(); @@ -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 @@ -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' ); @@ -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' )] ) ) @@ -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__'; } @@ -181,20 +183,20 @@ // Add a DEFAULT CONFIGURATION to be used as a mask. . ' '; for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) { echo ' '; } for( $i = 0, $cnt = count( $nonuserlist ); $i < $cnt; $i++ ) { echo ' '; + . ( $nonuserlist[$i]['cal_is_public'] === 'Y' ? '*' : '' ) . ''; } echo $goStr; @@ -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 '
'; print_form_key(); @@ -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: @@ -249,7 +251,7 @@ access_get_function_description( $order[$i] ), substr( $access, $order[$i], 1 )], 'dito' ) . '
'; - if( ( $i + 1 ) % $div == 0 ) + if ( ( $i + 1 ) % $div === 0 ) echo ' '; @@ -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; @@ -291,14 +293,14 @@ // Add a DEFAULT CONFIGURATION to be used as a mask. . ' '; for( $i = 0, $cnt = count( $userlist ); $i < $cnt; $i++ ) { - if( $userlist[$i]['cal_login'] != $guser ) + if ( $userlist[$i]['cal_login'] !== $guser ) echo ' '; } @@ -343,7 +345,7 @@ for( $j = 1; $j < 5; $j++ ) { $bottomedge = ''; - if( $j == 3 ) + if ( $j === 3 ) continue; $j8 = $j * 8; @@ -353,17 +355,17 @@ ' . 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'; @@ -383,7 +385,7 @@ . $j64 . '" name="v_' . $j64 . '"' . ( ! empty( $op['view'] ) && ( $op['view'] & $j64 ) ? $checked : '' ) . '>' - . ( $guser != '__public__' ? ' + . ( $guser !== '__public__' ? '