Skip to content

Commit

Permalink
WIP: add518a Merge branch 'craigk5n:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannon committed Jul 29, 2023
1 parent 15f34de commit 787ac2d
Show file tree
Hide file tree
Showing 55 changed files with 709 additions and 709 deletions.
6 changes: 3 additions & 3 deletions about.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
$credits = getPostValue( 'Credits' );
static $data;

if ( empty( $data ) ) {
if ( empty ( $data ) ) {
// Read in and format AUTHORS file.
$data = file_get_contents ( 'AUTHORS' );
$patterns = array ();
Expand All @@ -18,7 +18,7 @@
}
print_header ( [], '<link href="includes/css/about.css" rel="stylesheet" />',
'', true, false, true );
echo ' <div id="creds">' . ( empty( $credits ) ? '
echo ' <div id="creds">' . ( empty ( $credits ) ? '
<a title="' . $PROGRAM_NAME . '" href="' . $PROGRAM_URL
. '" target="_blank">
<h2>' . translate( 'Title' ) . '</h2>
Expand All @@ -29,7 +29,7 @@
</div>
<form action="about.php" name="aboutform" id="aboutform" method="post">';
print_form_key();
echo '<input type="submit" name="' . ( empty( $credits )
echo '<input type="submit" name="' . ( empty ( $credits )
? 'Credits" value="' . translate( 'Credits' )
: 'About" value="' . translate( 'About' ) ) . '" />
<input type="button" id="ok" name="ok" value="' . translate( 'OK' )
Expand Down
50 changes: 25 additions & 25 deletions access.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
include_once 'includes/init.php';

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

if( ! access_is_enabled() ) {
echo print_not_auth();
Expand Down Expand Up @@ -119,7 +119,7 @@
$otheruser_fullname = translate( 'Public Access' );
$otheruser_login = '__public__';
}
if( ! empty( $otheruser ) ) {
if( ! empty ( $otheruser ) ) {
if( $allow_view_other ) {
user_load_variables( $otheruser, 'otheruser_' );
// Turn off admin override so we see the users own settings.
Expand All @@ -128,24 +128,24 @@
$allPermissions = access_load_user_permissions( false );

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

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

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

// Load otheruser-user values if exist.
if( ! empty( $allPermissions[$otheruser . '.' . $guser] ) )
if( ! empty ( $allPermissions[$otheruser . '.' . $guser] ) )
$op = $allPermissions[$otheruser . '.' . $guser];
}
}
Expand All @@ -155,12 +155,12 @@
. filemtime( 'includes/js/access.js' ) . '"></script>
<link type="text/css" href="includes/css/access.css?'
. filemtime( 'includes/css/access.css' ) . '" rel="stylesheet" />',
( ! empty( $op['time'] ) && $op['time'] == 'Y'
( ! empty ( $op['time'] ) && $op['time'] == 'Y'
? 'onload="enableAll( true );"' : '' ) );

echo print_success( $saved );

if( ! empty( $guser ) && $is_admin )
if( ! empty ( $guser ) && $is_admin )
user_load_variables( $guser, 'user_' );

if( $is_admin ) {
Expand All @@ -170,7 +170,7 @@
// If we are here... we must need to print out a list of users.
echo '
<h2>' . translate( 'User Access Control' )
. ( empty( $user_fullname ) ? '' : ': ' . $user_fullname ) . '</h2>
. ( empty ( $user_fullname ) ? '' : ': ' . $user_fullname ) . '</h2>
' . display_admin_link( false ) . '
<form action="access.php" method="post" name="SelectUser">';
print_form_key();
Expand All @@ -197,7 +197,7 @@
echo $goStr;
} //end admin $guser !- default test

if( ! empty( $guser ) || ! $is_admin ) {
if( ! empty ( $guser ) || ! $is_admin ) {
if( $is_admin ) {
// Present a page to allow editing a user's rights.
$access = access_load_user_functions( $guser );
Expand Down Expand Up @@ -296,15 +296,15 @@
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>';
}
echo $goStr;
}
}

if( ! empty( $otheruser ) ) {
if( ! empty ( $otheruser ) ) {
if( $allow_view_other ) {
$typeStr = translate( 'Type' );
echo '<form action="access.php" method="post" name="EditOther">';
Expand Down Expand Up @@ -349,15 +349,15 @@
. '"><input class="form-control-sm" type="checkbox" value="Y" name=';
if( $j == 1 )
echo '"invite"'
. ( ! empty( $op['invite'] ) && $op['invite'] == 'N' ? '' : $checked )
. ( ! empty ( $op['invite'] ) && $op['invite'] == 'N' ? '' : $checked )
. ' />' . translate( 'Can Invite' );
elseif( $j == 2 )
echo '"email"'
. ( ! empty( $op['email'] ) && $op['email'] == 'N' ? '' : $checked )
. ( ! empty ( $op['email'] ) && $op['email'] == 'N' ? '' : $checked )
. ' />' . translate( 'Can Email' );
else {
echo '"time"'
. ( ! empty( $op['time'] ) && $op['time'] == 'Y' ? $checked : '' )
. ( ! empty ( $op['time'] ) && $op['time'] == 'Y' ? $checked : '' )
. ' onclick="enableAll( this.checked );" />'
. translate( 'Can See Time Only' );
$bottomedge = 'boxbottom';
Expand All @@ -367,40 +367,40 @@
. $access_type[$j] . '</td>
<td class="aligncenter boxleft pub ' . $bottomedge . '">'
. '<input class="form-control-sm" type="checkbox" value="' . $j . '" name="v_' . $j . '"'
. ( ! empty( $op['view'] ) && ( $op['view'] & $j ) ? $checked : '' )
. ( ! empty ( $op['view'] ) && ( $op['view'] & $j ) ? $checked : '' )
. ' /></td>
<td class="conf ' . $bottomedge . '"><input class="form-control-sm" type="checkbox" value="'
. $j * 8 . '" name="v_' . $j * 8 . '"'
. ( ! empty( $op['view'] ) && ( $op['view'] & ( $j * 8 ) )
. ( ! empty ( $op['view'] ) && ( $op['view'] & ( $j * 8 ) )
? $checked : '' ) . ' /></td>
<td class="priv ' . $bottomedge . '"><input class="form-control-sm" type="checkbox" value="'
. $j * 64 . '" name="v_' . $j * 64 . '"'
. ( ! empty( $op['view'] ) && ( $op['view'] & ( $j * 64 ) )
. ( ! empty ( $op['view'] ) && ( $op['view'] & ( $j * 64 ) )
? $checked : '' ) . ' /></td>'
. ( $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 : '' )
. ( ! empty ( $op['edit'] ) && ( $op['edit'] & $j ) ? $checked : '' )
. ' /></td>
<td class="conf ' . $bottomedge . '"><input class="form-control-sm" type="checkbox" value="'
. $j * 8 . '" name="e_' . $j * 8 . '"'
. ( ! empty( $op['edit'] ) && ( $op['edit'] & ( $j * 8 ) )
. ( ! empty ( $op['edit'] ) && ( $op['edit'] & ( $j * 8 ) )
? $checked : '' ) . ' /></td>
<td class="priv ' . $bottomedge . '"><input class="form-control-sm" type="checkbox" value="'
. $j * 64 . '" name="e_' . $j * 64 . '"'
. ( ! empty( $op['edit'] ) && ( $op['edit'] & ( $j * 64 ) )
. ( ! empty ( $op['edit'] ) && ( $op['edit'] & ( $j * 64 ) )
? $checked : '' ) . ' /></td>
<td class="aligncenter boxleft pub ' . $bottomedge . '"><input '
. 'class="form-control-sm" type="checkbox" value="' . $j . '" name="a_' . $j . '"'
. ( ! empty( $op['approve'] ) && ( $op['approve'] & $j )
. ( ! empty ( $op['approve'] ) && ( $op['approve'] & $j )
? $checked : '' ) . ' /></td>
<td class="conf ' . $bottomedge . '"><input class="form-control-sm" type="checkbox" value="'
. $j * 8 . '" name="a_' . $j * 8 . '"'
. ( ! empty( $op['approve'] ) && ( $op['approve'] & ( $j * 8 ) )
. ( ! empty ( $op['approve'] ) && ( $op['approve'] & ( $j * 8 ) )
? $checked : '' ) . ' /></td>
<td class="boxright priv ' . $bottomedge
. '"><input class="form-control-sm" type="checkbox" value="' . $j * 64 . '" name="a_' . $j * 64
. '"' . ( ! empty( $op['approve'] ) && ( $op['approve'] & ( $j * 64 ) )
. '"' . ( ! empty ( $op['approve'] ) && ( $op['approve'] & ( $j * 64 ) )
? $checked : '' ) . ' /></td>'
: '' ) . '
</tr>';
Expand Down
4 changes: 2 additions & 2 deletions adminhome.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
$links[] = 'pref.php?public=1';
}

if ( $is_admin && ! empty( $PUBLIC_ACCESS ) && $PUBLIC_ACCESS == 'Y'
if ( $is_admin && ! empty ( $PUBLIC_ACCESS ) && $PUBLIC_ACCESS == 'Y'
&& $PUBLIC_ACCESS_CAN_ADD == 'Y'
&& $PUBLIC_ACCESS_ADD_NEEDS_APPROVAL == 'Y' ) {
$names[] = translate ( 'Unapproved Public Events' );
Expand Down Expand Up @@ -168,7 +168,7 @@
<table>';

for ( $i = 0, $cnt = count( $names ); $i < $cnt; $i++ ) {
$empLink = empty( $links[$i] );
$empLink = empty ( $links[$i] );
echo ( $i % COLUMNS == 0 ? '
<tr>' : '' ) . '
<td>' . ( $empLink ? '' : '<a href="' . $links[$i] . '">' )
Expand Down
16 changes: 8 additions & 8 deletions autocomplete_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@
load_user_layers();

$action = getValue('action');
if (empty($action))
if (empty ( $action))
$action = 'search';
$query = getValue('q');
if (empty($query))
if (empty ( $query))
$query = getValue('query');

$sendPlainText = false;
$format = getValue('format');
if (
!empty($format) &&
!empty ( $format) &&
($format == 'text' || $format == 'plain')
);
$sendPlainText = true;
Expand All @@ -69,17 +69,17 @@
// remove double quotes
$query = str_replace('"', '', $query);
$words = explode(' ', $query);

$eventTitles = $ret = [];
$word_cnt = count ( $words );
for ($i = 0; $i < $word_cnt; $i++) {
$sql_params = [];
// Note: we only search approved/waiting events (not deleted).
$sql = 'SELECT we.cal_id, we.cal_name, we.cal_date, weu.cal_login '
. (empty($extra_filter) ? '' : ', wse.cal_data ')
. (empty ( $extra_filter) ? '' : ', wse.cal_data ')
. 'FROM webcal_entry_user weu LEFT JOIN webcal_entry we '
. (empty($cat_filter) ? '' : ', webcal_entry_categories wec ')
. (empty($extra_filter) ? '' : ', webcal_site_extras wse ')
. (empty ( $cat_filter) ? '' : ', webcal_entry_categories wec ')
. (empty ( $extra_filter) ? '' : ', webcal_site_extras wse ')
. 'ON weu.cal_id = we.cal_id WHERE weu.cal_status in ( \'A\',\'W\' )
AND weu.cal_login IN ( ?';
$sql_params[] = $login;
Expand All @@ -101,7 +101,7 @@
if ($res) {
while ($row = dbi_fetch_row($res)) {
$utitle = str_replace(' ', '', strtoupper($row[1]));
if (empty($eventTitles[$utitle])) {
if (empty ( $eventTitles[$utitle])) {
$ret[$matches]['id'] = $row[0];
$ret[$matches]['name'] = $row[1];
$ret[$matches]['text'] = $row[1] . ' (' . date_to_str($row[2]) . ')';
Expand Down
24 changes: 12 additions & 12 deletions category_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function renameIcon($id)
$catcolor = getValue('catcolor');
$isglobal = getValue('isglobal');
$delIcon = getPostValue('delIcon');
if (empty($id))
if (empty ( $id))
$is_my_event = true; // New event.
else {
$res = dbi_execute('SELECT cat_id, cat_owner FROM webcal_categories
Expand All @@ -37,14 +37,14 @@ function renameIcon($id)
$row = dbi_fetch_row($res);

$is_my_event = ($row[0] == $id && $row[1] == $login ||
(empty($row[1]) && $is_admin));
(empty ( $row[1]) && $is_admin));

dbi_free_result($res);
} else
$error = db_error();
}

if (!empty($_FILES['FileName']))
if (!empty ( $_FILES['FileName']))
$file = $_FILES['FileName'];

// Make sure we clear $file if no file was uploaded.
Expand All @@ -55,7 +55,7 @@ function renameIcon($id)
$error = print_not_auth();

$delete = getPostValue('delete');
if (empty($error) && !empty($delete)) {
if (empty ( $error) && !empty ( $delete)) {
// Delete this category.
if (!dbi_execute(
'DELETE FROM webcal_categories
Expand All @@ -76,10 +76,10 @@ function renameIcon($id)
}
// Rename any icons associated with this cat_id.
renameIcon($id);
} else if (empty($error) && empty($catname)) {
} else if (empty ( $error) && empty ( $catname)) {
$error = translate('Category name is required');
} else if (empty($error)) {
if (!empty($id)) {
} else if (empty ( $error)) {
if (!empty ( $id)) {
# Update (don't let them change global status).
if (!dbi_execute(
'UPDATE webcal_categories
Expand All @@ -88,7 +88,7 @@ function renameIcon($id)
))
$error = db_error();

if (!empty($delIcon) && $delIcon == 'Y')
if (!empty ( $delIcon) && $delIcon == 'Y')
renameIcon($id);
} else {
// Add new category.
Expand All @@ -109,10 +109,10 @@ function renameIcon($id)
} else
$error = db_error();
}
if (empty($delIcon) && is_dir($icon_path) && (!empty($ENABLE_ICON_UPLOADS) && $ENABLE_ICON_UPLOADS == 'Y' ||
if (empty ( $delIcon) && is_dir($icon_path) && (!empty ( $ENABLE_ICON_UPLOADS) && $ENABLE_ICON_UPLOADS == 'Y' ||
$is_admin)) {
// Save icon if uploaded.
if (!empty($file['tmp_name'])) {
if (!empty ( $file['tmp_name'])) {
if (($file['type'] == 'image/gif' || $file['type'] == 'image/png')
&& $file['size'] <= $icon_max_size
) {
Expand Down Expand Up @@ -140,7 +140,7 @@ function renameIcon($id)
}
// Copy icon if local file specified.
$urlname = getPostvalue('urlname');
if (!empty($urlname) && file_exists($icon_path . $urlname)) {
if (!empty ( $urlname) && file_exists($icon_path . $urlname)) {
if (preg_match('/.(gif|GIF)$/', $urlname))
copy($icon_path . $urlname, $icon_path . 'cat-' . $id . '.gif');
else
Expand All @@ -149,7 +149,7 @@ function renameIcon($id)
}
}

if (empty($error))
if (empty ( $error))
do_redirect('category.php');

print_header();
Expand Down
8 changes: 4 additions & 4 deletions css_cacher.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

load_global_settings();
@session_start();
$empTmp = ( ! empty( $_SESSION['webcal_tmp_login'] ) );
$empTmp = ( ! empty ( $_SESSION['webcal_tmp_login'] ) );

// If calling script uses 'guest', we must also.
$GLOBALS['user'] = ! empty( $_GET['login'] )
$GLOBALS['user'] = ! empty ( $_GET['login'] )
? $_GET['login']
: ( ! empty( $_REQUEST['login'] )
: ( ! empty ( $_REQUEST['login'] )
? $_REQUEST['login']
: ( $empTmp
? $_SESSION['webcal_tmp_login']
: ( empty( $_SESSION['webcal_login'] )
: ( empty ( $_SESSION['webcal_login'] )
? '__public__'
: $_SESSION['webcal_login'] ) ) );
load_user_preferences( $GLOBALS['user'] );
Expand Down
2 changes: 1 addition & 1 deletion day.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

//check UAC
if( ! access_can_access_function( ACCESS_DAY )
|| ( ! empty( $user ) && ! access_user_calendar( 'view', $user ) ) )
|| ( ! empty ( $user ) && ! access_user_calendar( 'view', $user ) ) )
send_to_preferred_view();

load_user_layers ( $user != $login && $is_nonuser_admin ? $user : '' );
Expand Down
Loading

0 comments on commit 787ac2d

Please sign in to comment.