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 elvis - modified #463

Open
wants to merge 3 commits 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
57 changes: 28 additions & 29 deletions access.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
*/
require_once 'includes/init.php';

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

if( ! access_is_enabled() ) {
echo print_not_auth();
Expand Down Expand Up @@ -108,8 +108,9 @@
$saved = true;
}
}
$checked = ' checked';
$guser = getPostValue( 'guser' );

$checked = ' checked';
$selected = ' selected';

if( $guser == '__default__' ) {
Expand All @@ -133,27 +134,23 @@
// Now load all the data from webcal_access_user.
$allPermissions = access_load_user_permissions( false );

// Load default-default values if exist.
if( ! empty( $allPermissions['__default__.__default__'] ) )
$op = $allPermissions['__default__.__default__'];

if( $is_admin ) {
// Load user-default values if exist.
if( ! empty( $allPermissions[ $guser . '.__default__' ] ) )
$op = $allPermissions[ $guser . '.__default__' ];

// Load user-otheruser values if exist.
if( ! empty( $allPermissions[ $guser . '.' . $otheruser ] ) )
$op = $allPermissions[ $guser . '.' . $otheruser ];
} else {
$op = (
// Load otheruser-user values if exist.
$allPermissions["$otheruser.$guser"] ?:
// Load default-user values if exist.
if( ! empty( $allPermissions['__default__.' . $guser] ) )
$op = $allPermissions['__default__.' . $guser ];
$allPermissions["__default__.$guser"] );

// Load otheruser-user values if exist.
if( ! empty( $allPermissions[$otheruser . '.' . $guser] ) )
$op = $allPermissions[$otheruser . '.' . $guser];
if ( $is_admin ) {
// Load user-otheruser values if exist.
$op = ( $allPermissions["$guser.$otheruser"] ?:
// Load user-default values if exist.
$allPermissions["$guser.__default__"] );
}

$op = ( $op ?:
// Load default-default values if exist.
$allPermissions['__default__.__default__'] ?:
'' );
}
}
print_header( '',
Expand Down Expand Up @@ -356,17 +353,22 @@
<tr>
<td class="boxleft leftpadded' . ( $j > 3 ? ' boxbottom' : '' )
. '"><input class="form-control-sm" type="checkbox" value="Y" name=';

$op['email'] = ( $op['email'] ?: 'Y' );
$op['invite'] = ( $op['invite'] ?: 'Y' );
$op['time'] = ( $op['time'] ?: 'N' );

if( $j == 1 )
echo '"invite"'
. ( ! empty( $op['invite'] ) && $op['invite'] == 'N' ? '' : $checked )
. ( $op['invite'] === 'N' ? '' : $checked )
. '>' . translate( 'Can Invite' );
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 Down Expand Up @@ -458,12 +460,9 @@
/**
* get_list_of_users
*
* @param string $user
*
* @global string $is_admin
* @global string $is_nonuser_admin
* @param string $user
*
* @return array of users that the specified user can see.
* @return array of users that the specified user can see
*/
function get_list_of_users( $user ) {
global $is_admin, $is_nonuser_admin;
Expand Down