diff --git a/about.php b/about.php index 195e4a4cf..10ba67efd 100644 --- a/about.php +++ b/about.php @@ -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 (); @@ -18,7 +18,7 @@ } print_header ( [], '', '', true, false, true ); -echo '
' . ( empty( $credits ) ? ' +echo '
' . ( empty ( $credits ) ? '

' . translate( 'Title' ) . '

@@ -29,7 +29,7 @@
'; print_form_key(); -echo ' ', - ( ! 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 ) { @@ -170,7 +170,7 @@ // If we are here... we must need to print out a list of users. echo '

' . translate( 'User Access Control' ) - . ( empty( $user_fullname ) ? '' : ': ' . $user_fullname ) . '

+ . ( empty ( $user_fullname ) ? '' : ': ' . $user_fullname ) . ' ' . display_admin_link( false ) . ' '; print_form_key(); @@ -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 ); @@ -296,7 +296,7 @@ if( $userlist[$i]['cal_login'] != $guser ) echo ' '; } @@ -304,7 +304,7 @@ } } -if( ! empty( $otheruser ) ) { +if( ! empty ( $otheruser ) ) { if( $allow_view_other ) { $typeStr = translate( 'Type' ); echo ''; @@ -349,15 +349,15 @@ . '">' . 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'; @@ -367,40 +367,40 @@ . $access_type[$j] . ' ' . ' ' . ( $guser != '__public__' ? ' ' : '' ) . ' '; diff --git a/adminhome.php b/adminhome.php index 771f3b817..98d217dc3 100644 --- a/adminhome.php +++ b/adminhome.php @@ -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' ); @@ -168,7 +168,7 @@ '; for ( $i = 0, $cnt = count( $names ); $i < $cnt; $i++ ) { - $empLink = empty( $links[$i] ); + $empLink = empty ( $links[$i] ); echo ( $i % COLUMNS == 0 ? ' ' : '' ) . ' - + ' - . ( ! empty( $_SESSION['tz_conversion'] ) && $_SESSION['tz_conversion'] != 'Y' ? ' + . ( ! empty ( $_SESSION['tz_conversion'] ) && $_SESSION['tz_conversion'] != 'Y' ? ' @@ -1528,7 +1528,7 @@ function chkPassword() { . translate( 'Application Settings' ) . ' @@ -1628,17 +1628,17 @@ function chkPassword() {
' . ( $empLink ? '' : '' ) diff --git a/autocomplete_ajax.php b/autocomplete_ajax.php index 0e288b7a5..2fa1c2da7 100644 --- a/autocomplete_ajax.php +++ b/autocomplete_ajax.php @@ -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; @@ -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; @@ -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]) . ')'; diff --git a/category_handler.php b/category_handler.php index fc52f198d..c5963cbd8 100644 --- a/category_handler.php +++ b/category_handler.php @@ -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 @@ -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. @@ -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 @@ -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 @@ -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. @@ -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 ) { @@ -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 @@ -149,7 +149,7 @@ function renameIcon($id) } } -if (empty($error)) +if (empty ( $error)) do_redirect('category.php'); print_header(); diff --git a/css_cacher.php b/css_cacher.php index 08453cd0f..a1934dd49 100644 --- a/css_cacher.php +++ b/css_cacher.php @@ -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'] ); diff --git a/day.php b/day.php index 5e900ab46..10cc4ba5c 100644 --- a/day.php +++ b/day.php @@ -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 : '' ); diff --git a/edit_entry.php b/edit_entry.php index ab140740a..2e6cbf73d 100644 --- a/edit_entry.php +++ b/edit_entry.php @@ -112,19 +112,19 @@ function time_selection($prefix, $time = '', $trigger = false) $description = getValue('desc'); // Public access can only add events, not edit. -if (empty($login) || ($login == '__public__' && $id > 0)) +if (empty ( $login) || ($login == '__public__' && $id > 0)) $id = 0; if (!in_array($eType, ['event', 'task', 'journal'])) $eType = 'event'; -if (empty($date) && empty($month)) { - if (empty($year)) +if (empty ( $date) && empty ( $month)) { + if (empty ( $year)) $year = date('Y'); $month = date('m'); - if (empty($day)) + if (empty ( $day)) $day = date('d'); $date = sprintf("%04d%02d%02d", $year, $month, $day); @@ -147,14 +147,14 @@ function time_selection($prefix, $time = '', $trigger = false) // We could override it and use $byday_names[$WEEK_START']. $wkst = 'MO'; -$real_user = ((!empty($user) && strlen($user)) && +$real_user = ((!empty ( $user) && strlen($user)) && ($is_assistant || $is_admin)) ? $user : $login; print_header($INC, $HEAD, $BodyX); if ($readonly == 'Y' || $is_nonuser) $can_edit = false; -else if (!empty($id) && $id > 0) { +else if (!empty ( $id) && $id > 0) { // First see who has access to edit this entry. if ($is_admin) $can_edit = true; @@ -170,7 +170,7 @@ function time_selection($prefix, $time = '', $trigger = false) if ($row[0] == $login) $can_edit = true; - $cal_date = (!empty($override) && !empty($date) + $cal_date = (!empty ( $override) && !empty ( $date) ? $date // Leave $cal_date to what was set in URL with date=YYYYMMDD. : $row[1]); @@ -204,7 +204,7 @@ function time_selection($prefix, $time = '', $trigger = false) $description = $row[10]; $parent = $row[11]; $location = $row[12]; - $completed = (empty($row[15]) ? date('Ymd') : $row[15]); + $completed = (empty ( $row[15]) ? date('Ymd') : $row[15]); $cal_url = $row[16]; // What kind of entry are we dealing with? @@ -240,7 +240,7 @@ function time_selection($prefix, $time = '', $trigger = false) // Check for repeating event info... // but not if we're overriding a single entry of an already repeating event... // confusing, eh? - if (!empty($override)) { + if (!empty ( $override)) { $rpt_end = 0; $rpt_end_date = $cal_date; $rpt_freq = 1; @@ -255,7 +255,7 @@ function time_selection($prefix, $time = '', $trigger = false) $rpt_type = $row[1]; $rpt_end = ($row[2] > 0 ? date_to_epoch($row[2] . $row[3]) : 0); - if (empty($row[2])) { + if (empty ( $row[2])) { $rpt_end_date = $cal_date; $rpt_end_time = $cal_time; } else { @@ -264,18 +264,18 @@ function time_selection($prefix, $time = '', $trigger = false) $rpt_end_time = date('His', $rpt_endTS); } $rpt_freq = $row[4]; - if (!empty($row[5])) + if (!empty ( $row[5])) $byday = explode(',', $row[5]); $bydayStr = $row[5]; - if (!empty($row[6])) + if (!empty ( $row[6])) $bymonth = explode(',', $row[6]); - if (!empty($row[7])) + if (!empty ( $row[7])) $bymonthday = explode(',', $row[7]); $bymonthdayStr = $row[7]; - if (!empty($row[8])) + if (!empty ( $row[8])) $bysetpos = explode(',', $row[8]); $bysetposStr = $row[8]; @@ -324,7 +324,7 @@ function time_selection($prefix, $time = '', $trigger = false) } if ($CATEGORIES_ENABLED == 'Y') { $catById = get_categories_by_id($id, $real_user, true); - if (!empty($catById)) { + if (!empty ( $catById)) { $catNames = implode(', ', $catById); $catList = implode(',', array_keys($catById)); } @@ -332,10 +332,10 @@ function time_selection($prefix, $time = '', $trigger = false) // Get reminders. $reminder = getReminders($id); - $reminder_offset = (empty($reminder) ? 0 : $reminder['offset']); + $reminder_offset = (empty ( $reminder) ? 0 : $reminder['offset']); $rem_status = (count($reminder)); - $rem_use_date = (!empty($reminder['date'])); + $rem_use_date = (!empty ( $reminder['date'])); // Get participants. $res = dbi_execute("SELECT cal_login, cal_status FROM webcal_entry_user WHERE cal_id = ? " . @@ -348,7 +348,7 @@ function time_selection($prefix, $time = '', $trigger = false) dbi_free_result($res); } // Not allowed for tasks or journals. - if ($eType == 'event' && !empty($ALLOW_EXTERNAL_USERS) && $ALLOW_EXTERNAL_USERS == 'Y') + if ($eType == 'event' && !empty ( $ALLOW_EXTERNAL_USERS) && $ALLOW_EXTERNAL_USERS == 'Y') $external_users = event_get_external_users($id); } else { // ########## New entry ################ @@ -365,7 +365,7 @@ function time_selection($prefix, $time = '', $trigger = false) // Get category if passed in URL as cat_id. $cat_id = getValue('cat_id', '-?[0-9,\-]*', true); - if (!empty($cat_id)) { + if (!empty ( $cat_id)) { $res = dbi_execute( 'SELECT cat_name FROM webcal_categories ' . 'WHERE cat_id = ? AND ( cat_owner = ? OR cat_owner IS NULL )', @@ -395,7 +395,7 @@ function time_selection($prefix, $time = '', $trigger = false) $defusers = getGetValue('defusers'); $defusers_ar = array(); - if (!empty($defusers)) { + if (!empty ( $defusers)) { $defusers_ar = explode(',', $defusers); for ($i = 0, $cnt = count($defusers_ar); $i < $cnt; $i++) { $participants[$defusers_ar[$i]] = 1; @@ -403,7 +403,7 @@ function time_selection($prefix, $time = '', $trigger = false) } //Add the logged in user if none other supplied - if (empty($participants)) + if (empty ( $participants)) $participants[$login] = 1; if ($readonly == 'N') { @@ -418,7 +418,7 @@ function time_selection($prefix, $time = '', $trigger = false) $thisday = $day; $thismonth = $month; $thisyear = $year; -if (empty($rpt_type) || !$rpt_type) +if (empty ( $rpt_type) || !$rpt_type) $rpt_type = 'none'; // Avoid error for using undefined vars. @@ -431,16 +431,16 @@ function time_selection($prefix, $time = '', $trigger = false) } $cal_time = ($hour * 10000) + (isset($minute) ? $minute * 100 : 0); -if (empty($access)) +if (empty ( $access)) $access = ''; -if (empty($cal_url)) +if (empty ( $cal_url)) $cal_url = ''; -if (empty($description) || $description == '
') +if (empty ( $description) || $description == '
') $description = ''; -if (empty($duration)) +if (empty ( $duration)) $duration = 0; if ($duration == 1440 && $time == 0) { @@ -449,51 +449,51 @@ function time_selection($prefix, $time = '', $trigger = false) } else $allday = 'N'; -if (empty($location)) +if (empty ( $location)) $location = ''; -if (empty($name)) +if (empty ( $name)) $name = ''; -if (empty($priority)) +if (empty ( $priority)) $priority = 5; -if (empty($rpt_end_date)) +if (empty ( $rpt_end_date)) $rpt_end_date = 0; -if (empty($rpt_end_time)) +if (empty ( $rpt_end_time)) $rpt_end_time = 0; -if (empty($rpt_freq)) +if (empty ( $rpt_freq)) $rpt_freq = 0; -if (empty($cal_date)) { - $cal_date = (!empty($date) && $eType != 'task' ? $date : $dateYmd); +if (empty ( $cal_date)) { + $cal_date = (!empty ( $date) && $eType != 'task' ? $date : $dateYmd); - if (empty($due_date)) + if (empty ( $due_date)) $due_date = $dateYmd; } -if (empty($thisyear)) +if (empty ( $thisyear)) $thisdate = $dateYmd; else { $thisdate = sprintf( "%04d%02d%02d", $thisyear, - empty($thismonth) ? date('m') : $thismonth, - empty($thisday) ? date('d') : $thisday + empty ( $thismonth) ? date('m') : $thismonth, + empty ( $thisday) ? date('d') : $thisday ); } -if (empty($cal_date) || !$cal_date) +if (empty ( $cal_date) || !$cal_date) $cal_date = $thisdate; -if (empty($due_date) || !$due_date) +if (empty ( $due_date) || !$due_date) $due_date = $thisdate; // Setup to display user's timezone difference if Admin or Assistant. // Even though event is stored in GMT, // an Assistant may need to know that the boss is in a different Timezone. -if ($is_assistant || $is_admin && !empty($user)) { +if ($is_assistant || $is_admin && !empty ( $user)) { $tz_offset = date('Z', date_to_epoch($cal_date . $cal_time)); $user_TIMEZONE = get_pref_setting($user, 'TIMEZONE'); set_env('TZ', $user_TIMEZONE); @@ -529,7 +529,7 @@ function time_selection($prefix, $time = '', $trigger = false) ?>

-  <?php etranslate('Help'); ?>

- + - + - + - + @@ -637,13 +637,13 @@ function time_selection($prefix, $time = '', $trigger = false) - +
- +
@@ -673,7 +673,7 @@ function time_selection($prefix, $time = '', $trigger = false)
@@ -736,7 +736,7 @@ function time_selection($prefix, $time = '', $trigger = false) - + @@ -789,7 +789,7 @@ function time_selection($prefix, $time = '', $trigger = false) $extras = get_site_extra_fields($id); $site_extracnt = count($site_extras); - if ($site_extracnt && !empty($site_extras[0]['FIELDSET'])) { + if ($site_extracnt && !empty ( $site_extras[0]['FIELDSET'])) { echo "
" . translate("Site Extas") . "\n
\n"; } @@ -803,7 +803,7 @@ function time_selection($prefix, $time = '', $trigger = false) $extra_arg1 = $site_extras[$i][3]; $extra_arg2 = $site_extras[$i][4]; // Default value if needed. - $defIdx = (empty($extras[$extra_name]['cal_data']) + $defIdx = (empty ( $extras[$extra_name]['cal_data']) ? $extra_arg2 : $extras[$extra_name]['cal_data']); echo ''; } - if ($site_extracnt && !empty($site_extras[0]['FIELDSET'])) { + if ($site_extracnt && !empty ( $site_extras[0]['FIELDSET'])) { echo "\n"; } // end site-specific extra fields @@ -922,35 +922,35 @@ function time_selection($prefix, $time = '', $trigger = false) for ($i = 0; $i < $usercnt; $i++) { $f = $userlist[$i]['cal_fullname']; $l = $userlist[$i]['cal_login']; - $q = (!empty($selectedStatus[$l]) && $selectedStatus[$l] == 'W' + $q = (!empty ( $selectedStatus[$l]) && $selectedStatus[$l] == 'W' ? ' (?)' : ''); $size++; $users .= ''; if ($id > 0) { - if (!empty($participants[$l])) { + if (!empty ( $participants[$l])) { $myusers .= ' '; } } else { - if (empty($defusers) && !empty($user) && !empty($userlist[$l])) { + if (empty ( $defusers) && !empty ( $user) && !empty ( $userlist[$l])) { // Default selection of participants was in the URL as 'user=XXX' $myusers .= ''; - } else if (!empty($defusers)) { + } else if (!empty ( $defusers)) { // Default selection of participants was in the URL as 'defusers=user1,user2' - if (!empty($participants[$l])) + if (!empty ( $participants[$l])) $myusers .= ''; } else if (($l == $login && !$is_assistant && !$is_nonuser_admin) || - (!empty($user) && $l == $user) + (!empty ( $user) && $l == $user) ) // Default selection of participants is logged in user. $myusers .= ' '; if ( - $l == '__public__' && !empty($PUBLIC_ACCESS_DEFAULT_SELECTED) && + $l == '__public__' && !empty ( $PUBLIC_ACCESS_DEFAULT_SELECTED) && $PUBLIC_ACCESS_DEFAULT_SELECTED == 'Y' ) $myusers .= ''; - if (!empty($participants[$l])) { + if (!empty ( $participants[$l])) { $myusers .= ''; - } else if (!empty($user) && !empty($mynonusers[$l])) { + } else if (!empty ( $user) && !empty ( $mynonusers[$l])) { // Default selection of participants was in the URL. $myusers .= ' - + @@ -1116,13 +1116,13 @@ function time_selection($prefix, $time = '', $trigger = false) . ':
' @@ -813,27 +813,27 @@ function time_selection($prefix, $time = '', $trigger = false) if ($extra_type == EXTRA_URL) echo ''; elseif ($extra_type == EXTRA_EMAIL) echo ''; elseif ($extra_type == EXTRA_DATE) echo date_selection( $extra_name, - (empty($extras[$extra_name]['cal_date']) + (empty ( $extras[$extra_name]['cal_date']) ? $cal_date : $extras[$extra_name]['cal_date']) ); elseif ($extra_type == EXTRA_TEXT) { $size = ($extra_arg1 > 0 ? $extra_arg1 : 50); echo ''; } elseif ($extra_type == EXTRA_MULTILINETEXT) { echo ''; } elseif ($extra_type == EXTRA_USER) { @@ -846,7 +846,7 @@ function time_selection($prefix, $time = '', $trigger = false) if (access_is_enabled() && !access_user_calendar('view', $userlist[$j]['cal_login'])) continue; // Cannot view calendar so cannot add to their cal. echo ''; @@ -861,14 +861,14 @@ function time_selection($prefix, $time = '', $trigger = false) $multiselect = ' multiple="multiple" size="' . min($extra_arg2, $extra_arg1cnt) . '" '; $isMultiple = '[]'; - if (!empty($extras)) + if (!empty ( $extras)) $extraSelectArr = explode(',', $extras[$extra_name]['cal_data']); } echo '
@@ -1055,7 +1055,7 @@ function time_selection($prefix, $time = '', $trigger = false)
' . ( empty ( $_SESSION['validuser'] ) ? '' : ' + . 'size="20" value="' . ( empty ( $settings['db_host']) ? '' : $settings['db_host']) . '" /> + . 'size="20" value="' . ( empty ( $settings['db_login']) ? '' : $settings['db_login']) . '" /> + . 'size="20" value="' . (empty ( $settings['db_password']) ? '' : $settings['db_password']) . '" />'; } //end test for file_get_contents - echo ( empty( $_SESSION['validuser'] ) ? '' : ' + echo ( empty ( $_SESSION['validuser'] ) ? '' : ' @@ -1341,13 +1341,13 @@ function chkPassword() { @@ -1356,7 +1356,7 @@ function chkPassword() { } elseif( $_SESSION['step'] == 3 ) { $_SESSION['db_updated'] = false; if( $_SESSION['old_program_version'] == $PROGRAM_VERSION && - empty( $_SESSION['blank_database'] ) ) { + empty ( $_SESSION['blank_database'] ) ) { $response_msg = translate( 'All your database tables appear to be up...' ); $_SESSION['db_updated'] = true; // $response_msg .= '
Previous Version: ' . @@ -1365,7 +1365,7 @@ function chkPassword() { } else $response_msg = ( $_SESSION['old_program_version'] == 'new_install' ? translate( 'This appears to be a new installation...' ) - : ( empty( $_SESSION['blank_database'] ) + : ( empty ( $_SESSION['blank_database'] ) ? str_replace( array('XXX', 'YYY'), array( $_SESSION['old_program_version'], $PROGRAM_VERSION ), translate( 'This appears to be an upgrade...' ) ) @@ -1391,7 +1391,7 @@ function chkPassword() { '; else { @@ -1399,8 +1399,8 @@ function chkPassword() { . translate( 'The following database actions are required' ) . ':'; - if( $settings['db_type'] == 'odbc' && empty( $_SESSION['db_updated'] ) ) { - if( empty( $_SESSION['odbc_db'] ) ) + if( $settings['db_type'] == 'odbc' && empty ( $_SESSION['db_updated'] ) ) { + if( empty ( $_SESSION['odbc_db'] ) ) $_SESSION['odbc_db'] = 'mysql'; echo ' @@ -1432,15 +1432,15 @@ function chkPassword() { echo ' ' - . ( ! empty( $settings['db_type'] ) && $settings['db_type'] != 'sqlite' + . ( ! empty ( $settings['db_type'] ) && $settings['db_type'] != 'sqlite' && $settings['db_type'] != 'sqlite3' - && empty( $_SESSION['blank_database'] ) ? ' + && empty ( $_SESSION['blank_database'] ) ? '
@@ -1170,16 +1170,16 @@ function chkPassword() { . translate( 'Supported databases for your PHP installation' ) . ': -->'; - if( ! empty( $_SESSION['db_success'] ) && $_SESSION['db_success'] ) { + if( ! empty ( $_SESSION['db_success'] ) && $_SESSION['db_success'] ) { echo ' '; - if( ! empty( $response_msg ) && empty( $response_msg2 ) ) + if( ! empty ( $response_msg ) && empty ( $response_msg2 ) ) echo ' '; - elseif( empty( $response_msg2 ) && empty( $_SESSION['db_success'] ) ) + elseif( empty ( $response_msg2 ) && empty ( $_SESSION['db_success'] ) ) echo '
  • ' . $setting_wrong_img . ' ' . translate( 'Please Test Settings' ) . '
  • '; @@ -1188,11 +1188,11 @@ function chkPassword() {
  • ' - . ( empty( $response_msg ) ? '' : ' + . ( empty ( $response_msg ) ? '' : '
  • ' . $setting_wrong_img . ' ' . $response_msg . '
  • ' ); - echo ( empty( $response_msg2 ) ? '' : ' + echo ( empty ( $response_msg2 ) ? '' : '
  • ' . $setting_wrong_img . ' ' . $response_msg2 . '
  • ' ) . ' @@ -1262,19 +1262,19 @@ function chkPassword() {
    ' . ( ! empty( $_SESSION['db_noexist'] ) && - empty( $_SESSION['db_success'] ) ? ' + . '" class="' . ( empty ( $_SESSION['db_success'] ) ? 'not' : '' ) + . 'recommended' . '" />' . ( ! empty ( $_SESSION['db_noexist'] ) && + empty ( $_SESSION['db_success'] ) ? ' ' : '' ) . '
    ' . csrf_form_key() . ' + . ( empty ( $_SESSION['db_success'] ) ? 'disabled' : '' ) . ' />
    ' . csrf_form_key() . '
    ' . translate( 'No database actions are required.' ) . '
    ' . csrf_form_key() . ' @@ -1459,7 +1459,7 @@ function chkPassword() { . $_SESSION['install_file'] . '" />
    ' . ( empty( $str_parsed_sql ) ? '' : ' + . '" />
    ' . ( empty ( $str_parsed_sql ) ? '' : '
    ' . csrf_form_key() . ' + . ( empty ( $_SESSION['db_updated'] ) ? 'disabled' : '' ) . ' />
    ' . csrf_form_key() . '
    '; } elseif( $_SESSION['step'] == 4 ) { - if( empty( $settings['mode'] ) ) + if( empty ( $settings['mode'] ) ) $settings['mode'] = 'prod'; $mode = ( preg_match( '/dev/', $settings['mode'] ) @@ -1510,7 +1510,7 @@ function chkPassword() { . translate( 'This is the final step in setting up your WebCalendar Installation.' ) . '
    ' . translate( 'Timezone Conversion' ) . '
    -
    • ' . ( empty( $PHP_AUTH_USER ) +
      • ' . ( empty ( $PHP_AUTH_USER ) ? translate( 'HTTP-based authentication was not detected...' ) : translate( 'HTTP-based authentication was detected...' ) ) . '
      @@ -1575,7 +1575,7 @@ function chkPassword() { ' . ( function_exists( 'ldap_connect' ) ? '
    - + @@ -132,7 +132,7 @@ - +
    @@ -320,7 +320,7 @@ function(data, status) { var id = u.login.substring(0, 5) == '' ? u.login.substring(5) : u.login; tbody += '
    \n'; @@ -450,7 +450,7 @@ function edit_user(login) { $('#editUsername').prop("disabled", false); $('#editUsername').prop("value", ""); $('#editName').prop("value", ""); - + $('#editPublic_N').prop("checked", true); $('#editURL').prop("value", ""); @@ -461,7 +461,7 @@ function edit_user(login) { $('#editUsername').prop("value", user['login'].substring(''.length)); $('#editUsername').prop("disabled", true); $('#editName').prop("value", user['fullname']); - + if (user['public'] == 'Y') $('#editPublic_Y').prop("checked", true); else @@ -477,7 +477,7 @@ function save_handler() { var login = '' + $('#editUsername').val(); var lastname = $('#editName').val(); var firstname = ''; - + console.log('editPublic_Y: ' + $('#editPublic_Y').is(':checked')); var public = $('#editPublic_Y').is(':checked') ? 'Y' : 'N'; diff --git a/resourcecal_mgmt.php b/resourcecal_mgmt.php index 1cc6fb54b..5b0c24cc1 100644 --- a/resourcecal_mgmt.php +++ b/resourcecal_mgmt.php @@ -9,13 +9,13 @@ include_once 'includes/init.php'; // Verify access to this page is allowed. -if (empty($login) || $login == '__public__') { +if (empty ( $login) || $login == '__public__') { // Do not allow public access. - do_redirect(empty($STARTVIEW) ? 'month.php' : $STARTVIEW); + do_redirect(empty ( $STARTVIEW) ? 'month.php' : $STARTVIEW); exit; } if ($NONUSER_ENABLED != 'Y' || (access_is_enabled() && !access_can_access_function(ACCESS_USER_MANAGEMENT))) { - do_redirect(empty($STARTVIEW) ? 'month.php' : $STARTVIEW); + do_redirect(empty ( $STARTVIEW) ? 'month.php' : $STARTVIEW); } $LOADING = '
    Loading...
    '; @@ -53,7 +53,7 @@ - + @@ -121,7 +121,7 @@ ?> - +
    @@ -254,7 +254,7 @@ function(data, status) { var id = u.login.substring(0, 5) == '' ? u.login.substring(5) : u.login; tbody += '
    \n'; } @@ -307,7 +307,7 @@ function edit_user(login) { $('#editName').prop("value", ""); // Select first admin in list by default $("#editAdmin option:first").prop('selected', true); - + $('#editPublic_N').prop("checked", true); } else { @@ -320,7 +320,7 @@ function edit_user(login) { $('#editName').prop("value", user['fullname']); // Set Admin in select list $("#editAdmin").val(user['admin']).attr("selected", "selected"); - + if (user['public'] == 'Y') $('#editPublic_Y').prop("checked", true); else @@ -334,7 +334,7 @@ function save_handler() { var login = '' + $('#editUsername').val(); var lastname = $('#editName').val(); var firstname = ''; - + console.log('editPublic_Y: ' + $('#editPublic_Y').is(':checked')); var public = $('#editPublic_Y').is(':checked') ? 'Y' : 'N'; diff --git a/search.php b/search.php index 9b73387eb..f7cf77c63 100644 --- a/search.php +++ b/search.php @@ -12,12 +12,12 @@ } else if (access_is_enabled()) { $show_others = access_can_access_function(ACCESS_ADVANCED_SEARCH); } else if ( - $login != '__public__' && !$is_nonuser && !empty($ALLOW_VIEW_OTHER) + $login != '__public__' && !$is_nonuser && !empty ( $ALLOW_VIEW_OTHER) && $ALLOW_VIEW_OTHER == 'Y' ) { $show_others = true; } else if ( - $login == '__public__' && !empty($PUBLIC_ACCESS_OTHERS) + $login == '__public__' && !empty ( $PUBLIC_ACCESS_OTHERS) && $PUBLIC_ACCESS_OTHERS == 'Y' ) { $show_others = true; @@ -125,9 +125,9 @@ if ($show_others) { $users = get_my_users('', 'view'); // Get non-user calendars (if enabled) - if (!empty($NONUSER_ENABLED) && $NONUSER_ENABLED == 'Y') { + if (!empty ( $NONUSER_ENABLED) && $NONUSER_ENABLED == 'Y') { $nonusers = get_my_nonusers($login, true, 'view'); - $users = (!empty($NONUSER_AT_TOP) && $NONUSER_AT_TOP == 'Y' + $users = (!empty ( $NONUSER_AT_TOP) && $NONUSER_AT_TOP == 'Y' ? array_merge($nonusers, $users) : array_merge($users, $nonusers)); } diff --git a/search_handler.php b/search_handler.php index 5be2a5d2e..ce5656de2 100644 --- a/search_handler.php +++ b/search_handler.php @@ -160,10 +160,10 @@ $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 ( ?'; if ( $search_others ) { diff --git a/security_audit.php b/security_audit.php index dcb07db4e..3153a3136 100644 --- a/security_audit.php +++ b/security_audit.php @@ -163,7 +163,7 @@ // Is db cache directory a subdirectory of WebCalendar? $isOk = true; - if (!empty($settings['db_cachedir']) && $wcDir != '.') { + if (!empty ( $settings['db_cachedir']) && $wcDir != '.') { $cache = str_replace('\\', '/', $settings['db_cachedir']); $wcDir = str_replace('\\', '/', $wcDir); if ( diff --git a/tools/reload_remotes.php b/tools/reload_remotes.php index 74786bfcc..4f32b64cd 100644 --- a/tools/reload_remotes.php +++ b/tools/reload_remotes.php @@ -98,7 +98,7 @@ /* $data = parse_ical($cal_url, $type); // we may be processing an hCalendar - if (empty($data) == 0 && function_exists('simplexml_load_string')) { + if (empty ( $data) == 0 && function_exists('simplexml_load_string')) { if ($debug) echo " No data found. Trying hcal...\n"; $h = new hKit; $h->tidy_mode = 'proxy'; @@ -107,14 +107,14 @@ $data = parse_hcal($result, $type); } */ - if (empty($errormsg) && !empty($cal_url)) { + if (empty ( $errormsg) && !empty ( $cal_url)) { if ($debug) { echo "Loading calendar \"$calUser\" from URL: $cal_url\n"; } $arr = load_remote_calendar($calUser, $cal_url); - if (empty($arr[0])) { + if (empty ( $arr[0])) { // Success (or not updated) - if (!empty($arr[3])) { + if (!empty ( $arr[3])) { $message = $arr[3]; } else { $message = $arr[1] . ' ' . translate('events added') . ', ' . $arr[2] . ' ' . translate('events deleted'); diff --git a/upcoming.php b/upcoming.php index e203fb820..a73274331 100644 --- a/upcoming.php +++ b/upcoming.php @@ -187,7 +187,7 @@ function print_upcoming_event ( $e, $date ) { htmlspecialchars ( $e->getName() ) . '" href="' . $SERVER_URL . 'view_entry.php?id=' . $e->getID() . "&date=$date&user=" . $e->getLogin() - . ( empty( $link_target ) ? '>' : "\" target=\"$link_target\">" ); + . ( empty ( $link_target ) ? '>' : "\" target=\"$link_target\">" ); if ( empty ( $UPCOMING_DISPLAY_CAT_ICONS ) || $UPCOMING_DISPLAY_CAT_ICONS != 'N' ) { $catNum = abs ( $e->getCategory() ); diff --git a/user_mgmt.php b/user_mgmt.php index 5dfec60c1..9af63d932 100644 --- a/user_mgmt.php +++ b/user_mgmt.php @@ -9,9 +9,9 @@ include_once 'includes/init.php'; -if (empty($login) || $login == '__public__') { +if (empty ( $login) || $login == '__public__') { // Do not allow public access. - do_redirect(empty($STARTVIEW) ? 'month.php' : $STARTVIEW); + do_redirect(empty ( $STARTVIEW) ? 'month.php' : $STARTVIEW); exit; } diff --git a/users_ajax.php b/users_ajax.php index a3b1371d3..7f086e43e 100644 --- a/users_ajax.php +++ b/users_ajax.php @@ -33,7 +33,7 @@ $sendPlainText = false; $format = getValue('format'); if ( - !empty($format) && + !empty ( $format) && ($format == 'text' || $format == 'plain') ) { $sendPlainText = true; @@ -48,9 +48,9 @@ $invalidLastName = translate('Invalid last name.'); // Make sure this is only called from user_mgmt.php -if (!empty($_SERVER['HTTP_REFERER'])) { +if (!empty ( $_SERVER['HTTP_REFERER'])) { $refurl = parse_url($_SERVER['HTTP_REFERER']); - if (!empty($refurl['path'])) + if (!empty ( $refurl['path'])) $referer = strrchr($refurl['path'], '/(user_mgmt|resourcecal_mgmt).php'); } $error = ''; @@ -66,8 +66,8 @@ 'login' => $user['cal_login'], 'lastname' => $user['cal_lastname'], 'firstname' => $user['cal_firstname'], - 'is_admin' => empty($user['cal_is_admin']) ? 'N' : $user['cal_is_admin'], - 'enabled' => empty($user['cal_enabled']) ? 'Y' : $user['cal_enabled'], + 'is_admin' => empty ( $user['cal_is_admin']) ? 'N' : $user['cal_is_admin'], + 'enabled' => empty ( $user['cal_enabled']) ? 'Y' : $user['cal_enabled'], 'email' => $user['cal_email'], 'fullname' => $user['cal_fullname'] ]; @@ -91,7 +91,7 @@ if (addslashes($post_lastname) != $post_lastname || strip_tags_content($post_lastname) != $post_lastname) { $error = $invalidLastName; } - if (empty($error)) { + if (empty ( $error)) { save_user( getPostValue('add') == '1' ? true : false, getPostValue('login'), @@ -111,15 +111,15 @@ $password = getPostValue('password'); $user = getPostValue('login'); - if (empty($user)) { + if (empty ( $user)) { $error = translate('Unsupported action'); - } else if (empty($password)) { + } else if (empty ( $password)) { $error = $blankUserStr; } else { if (!access_can_access_function(ACCESS_USER_MANAGEMENT) && !access_can_access_function(ACCESS_ACCOUNT_INFO)) $error = $notAuthStr; } - if (empty($error)) { + if (empty ( $error)) { user_update_user_password($user, $password); activity_log( 0, @@ -141,13 +141,13 @@ $error = $notAuthStr; } else if (!$admin_can_add_user) { $error = translate('Unsupported action'); - } else if (empty($user)) { + } else if (empty ( $user)) { $error = translate('Unsupported action') . ': ' . $blankUserStr; } else if ($user == $login) { // Cannot delete yourself $error = translate('Unsupported action'); } - if (empty($error)) { + if (empty ( $error)) { // TODO: user_delete_user doesn't do any error checking... user_delete_user($user); // Will also delete user's events. activity_log(0, $login, $user, LOG_USER_DELETE, ''); @@ -170,7 +170,7 @@ foreach ($userlist as $user) { // Skip public user if ($user['cal_login'] != '__public__') { - $cnt = empty($active_layers[$user['cal_login']]) ? 0 : 1; + $cnt = empty ( $active_layers[$user['cal_login']]) ? 0 : 1; $event_cnt = get_event_count_for_user($user['cal_login']); $last_upd = get_remote_calendar_last_update($user['cal_login']); $last_checked = get_remote_calendar_last_checked($user['cal_login']); @@ -179,13 +179,13 @@ 'lastname' => $user['cal_lastname'], 'firstname' => $user['cal_firstname'], 'admin' => $user['cal_admin'], - 'public' => empty($user['cal_is_public']) ? 'Y' : $user['cal_is_public'], + 'public' => empty ( $user['cal_is_public']) ? 'Y' : $user['cal_is_public'], 'url' => $user['cal_url'], 'fullname' => $user['cal_fullname'], 'layercount' => $cnt, 'eventcount' => $event_cnt, - 'lastupdated' => empty($last_upd) ? '' : date_to_str($last_upd, '', false), - 'lastchecked' => empty($last_checked) ? '' : date_to_str($last_checked, '', false) + 'lastupdated' => empty ( $last_upd) ? '' : date_to_str($last_upd, '', false), + 'lastchecked' => empty ( $last_checked) ? '' : date_to_str($last_checked, '', false) ]; // Not including password hash 'cal_password' } @@ -202,7 +202,7 @@ if (addslashes($lastname) != $lastname || strip_tags_content($lastname) != $lastname) { $error = $invalidLastName; } - if (empty($error)) { + if (empty ( $error)) { $error = save_remote_calendar( getPostValue('add') == '1' ? true : false, getPostValue('login'), @@ -233,7 +233,7 @@ if (!ini_get('allow_url_fopen')) { $error = 'Your PHP setting for allow_url_fopen will not allow a remote calendar to be downloaded.'; } - if (empty($error)) { + if (empty ( $error)) { $username = getPostValue('login'); $cals = get_nonuser_cals($login, true); $url = ''; @@ -246,16 +246,16 @@ } if (!$found) { $error = 'No such remote calendar ' . $username; - } else if (empty($url)) { + } else if (empty ( $url)) { $error = 'Calendar is not a remote calendar'; } } $message = ''; - if (empty($error) && !empty($url)) { + if (empty ( $error) && !empty ( $url)) { $arr = load_remote_calendar($username, $url); - if (empty($arr[0])) { + if (empty ( $arr[0])) { // Success (or not updated) - if (!empty($arr[3])) { + if (!empty ( $arr[3])) { $message = $arr[3]; } else { $message = $arr[1] . ' ' . translate('events added') . ', ' . $arr[2] . ' ' . translate('events deleted'); @@ -279,14 +279,14 @@ $ret_users = []; foreach ($userlist as $user) { // Skip public user && and ignore those with URL (remote calendars) - if ($user['cal_login'] != '__public__' && empty($user['cal_url'])) { + if ($user['cal_login'] != '__public__' && empty ( $user['cal_url'])) { $event_cnt = get_event_count_for_user($user['cal_login']); $ret_users[] = [ 'login' => $user['cal_login'], 'lastname' => $user['cal_lastname'], 'firstname' => $user['cal_firstname'], 'admin' => $user['cal_admin'], - 'public' => empty($user['cal_is_public']) ? 'Y' : $user['cal_is_public'], + 'public' => empty ( $user['cal_is_public']) ? 'Y' : $user['cal_is_public'], 'url' => $user['cal_url'], 'fullname' => $user['cal_fullname'], 'eventcount' => $event_cnt @@ -306,7 +306,7 @@ if (addslashes($lastname) != $lastname || strip_tags_content($lastname) != $lastname) { $error = $invalidLastName; } - if (empty($error)) { + if (empty ( $error)) { $error = save_resource_calendar( getPostValue('add') == '1' ? true : false, getPostValue('login'), @@ -329,7 +329,7 @@ 'group_id' => $group['cal_group_id'], 'name' => $group['cal_name'], 'owner' => $group['cal_owner'], - 'last_update' => empty($group['cal_last_update']) ? '' : date_to_str($group['cal_last_update'], '', false), + 'last_update' => empty ( $group['cal_last_update']) ? '' : date_to_str($group['cal_last_update'], '', false), 'users' => $group['cal_users'] ]; } @@ -349,7 +349,7 @@ ajax_send_error($error); } else if ($action == 'delete-group') { $id = getPostValue('id'); - if (empty($id)) { + if (empty ( $id)) { $error = "Missing Group Id from delete request"; } else { // Delete this group. @@ -382,7 +382,7 @@ function save_user($add, $user, $lastname, $firstname, $is_admin, $enabled, $ema if (addslashes($user) != $user || strip_tags_content($user) != $user) { $error = 'Invalid characters in login.'; - } else if ($add && empty($user)) { + } else if ($add && empty ( $user)) { $error = $blankUserStr; } @@ -393,7 +393,7 @@ function save_user($add, $user, $lastname, $firstname, $is_admin, $enabled, $ema $error = $invalidLastName; } - if (empty($error) && $add) { + if (empty ( $error) && $add) { // Add user user_add_user( $user, @@ -410,9 +410,9 @@ function save_user($add, $user, $lastname, $firstname, $is_admin, $enabled, $ema $user, LOG_USER_ADD, "$firstname $lastname" - . (empty($email) ? '' : " <$email>") + . (empty ( $email) ? '' : " <$email>") ); - } else if (empty($error)) { + } else if (empty ( $error)) { // Update user user_update_user($user, $firstname, $lastname, $email, $is_admin, $enabled); activity_log( @@ -420,7 +420,7 @@ function save_user($add, $user, $lastname, $firstname, $is_admin, $enabled, $ema $login, $user, LOG_USER_UPDATE, - "$firstname $lastname" . (empty($email) ? '' : " <$email>") + "$firstname $lastname" . (empty ( $email) ? '' : " <$email>") ); } } @@ -441,9 +441,9 @@ function save_remote_calendar($isAdd, $username, $lastname, $firstname, $url, $i // This calendar cannot be used as a public calendar if Public Access is // not enabled in settings. - if (empty($PUBLIC_ACCESS) || $PUBLIC_ACCESS != 'Y') { + if (empty ( $PUBLIC_ACCESS) || $PUBLIC_ACCESS != 'Y') { $ispublic = 'N'; - } else if (empty($ispublic) || $ispublic != 'Y') { + } else if (empty ( $ispublic) || $ispublic != 'Y') { $ispublic = 'N'; } @@ -452,8 +452,8 @@ function save_remote_calendar($isAdd, $username, $lastname, $firstname, $url, $i return translate('Calendar ID') . ' ' . translate('word characters only') . '.'; } - // Might want to move this into user.php instead of having SQL here... - if (empty($error) && !$isAdd) { + // Might want to move this into user.php instead of having SQL here... + if (empty ( $error) && !$isAdd) { // Updating $query_params = []; $sql = 'UPDATE webcal_nonuser_cals SET cal_lastname = ?'; @@ -462,7 +462,7 @@ function save_remote_calendar($isAdd, $username, $lastname, $firstname, $url, $i $query_params[] = $firstname; $sql .= ', cal_url = ?'; $query_params[] = $url; - if (!empty($owner)) { + if (!empty ( $owner)) { $sql .= ', cal_admin = ?'; $query_params[] = $owner; } @@ -485,9 +485,9 @@ function save_remote_calendar($isAdd, $username, $lastname, $firstname, $url, $i ); } return $error; - } else if (empty($error)) { + } else if (empty ( $error)) { // If no owner set, use the current user - if (empty($owner)) { + if (empty ( $owner)) { $owner = $login; } // Add @@ -522,7 +522,7 @@ function delete_remote_calendar($username) global $login, $notAuthStr; // Make sure the current user is the admin of this remote calendar. nonuser_load_variables($username, "TESTLOAD"); - if (empty($GLOBALS["TESTLOADadmin"]) || $GLOBALS["TESTLOADadmin"] != $login) { + if (empty ( $GLOBALS["TESTLOADadmin"]) || $GLOBALS["TESTLOADadmin"] != $login) { return $notAuthStr; } @@ -553,7 +553,7 @@ function delete_remote_calendar($username) $error = db_error(); } - if (empty($error)) { + if (empty ( $error)) { activity_log( 0, $login, @@ -573,7 +573,7 @@ function save_group($isAdd, $id, $name, $users) { $dateYmd = date('Ymd'); $msg = 'None'; - // Might want to move this into user.php instead of having SQL here... + // Might want to move this into user.php instead of having SQL here... if (!$isAdd) { // Updating $query_params = []; @@ -626,7 +626,7 @@ function save_group($isAdd, $id, $name, $users) { } // Now delete old group members and add new ones. - if (empty($error)) { + if (empty ( $error)) { $msg .= ' Users added:'; if (!$isAdd) { dbi_execute('DELETE FROM webcal_group_user where cal_group_id = ?', [$id]); diff --git a/view_entry.php b/view_entry.php index e6dd59234..5756a126a 100644 --- a/view_entry.php +++ b/view_entry.php @@ -418,19 +418,19 @@ } echo '
    ' . "\n"; -if ($DISABLE_LOCATION_FIELD != 'Y' && !empty($location)) { +if ($DISABLE_LOCATION_FIELD != 'Y' && !empty ( $location)) { echo '
    ' . translate('Location') . "
    \n"; echo '
    ' . htmlentities($location) . "
    \n"; echo '
    ' . "\n"; } -if (!empty($url)) { +if (!empty ( $url)) { echo '
    ' . translate('URL') . "
    \n"; echo '
    ' . activate_urls($url) . "
    \n"; echo '
    ' . "\n"; } -if ($event_status != 'A' && !empty($event_status)) { +if ($event_status != 'A' && !empty ( $event_status)) { echo '
    ' . translate('Status') . "
    \n"; echo '
    '; if ($event_status == 'D') @@ -455,7 +455,7 @@ echo '
    ' . translate('Due Date') . "
    \n"; echo '
    ' . date_to_str($due_date); echo '
    ' . "\n"; -if (!empty($cal_completed)) { +if (!empty ( $cal_completed)) { echo '
    ' . translate('Completed') . "
    \n"; echo '
    ' . date_to_str($cal_completed); echo '
    ' . "\n"; @@ -476,7 +476,7 @@ : display_time( $display_date . sprintf("%06d", $event_time), // Display TZID if no end time -(empty($end_str) ? 2 : 0) +(empty ( $end_str) ? 2 : 0) ) . $end_str); echo '
    ' . "\n"; @@ -514,7 +514,7 @@ } echo '
    ' . "\n"; -if ($CATEGORIES_ENABLED == 'Y' && !empty($category)) { +if ($CATEGORIES_ENABLED == 'Y' && !empty ( $category)) { echo '
    ' . translate('Category') . "
    \n"; echo '
    ' . $category; echo '
    ' . "\n"; @@ -538,7 +538,7 @@ } } -if ($single_user == 'N' && !empty($createby_fullname)) { +if ($single_user == 'N' && !empty ( $createby_fullname)) { echo '
    ' . translate('Created by') . "
    \n"; echo '
    '; if ($is_private && !access_is_enabled()) { @@ -561,10 +561,10 @@ echo '
    ' . "\n"; } -if (!empty($mod_date)) { +if (!empty ( $mod_date)) { echo '
    ' . translate('Updated') . "
    \n"; echo '
    '; -//if (!empty($GENERAL_USE_GMT) && $GENERAL_USE_GMT == 'Y') { +//if (!empty ( $GENERAL_USE_GMT) && $GENERAL_USE_GMT == 'Y') { //echo date_to_str($mod_date) . ' ' . display_time($mod_date . $mod_time, 3); //} else { echo date_to_str(date('Ymd', date_to_epoch($mod_date . $mod_time))) @@ -574,7 +574,7 @@ } // Display the reminder info if found. -if (!empty($reminder)) { +if (!empty ( $reminder)) { echo '
    ' . translate('Send Reminder') . "
    \n"; echo '
    ' . $reminder; echo '
    ' . "\n"; @@ -589,13 +589,13 @@ $extra_type = $site_extras[$i][2]; $extra_arg1 = $site_extras[$i][3]; $extra_arg2 = $site_extras[$i][4]; -if (!empty($site_extras[$i][5])) +if (!empty ( $site_extras[$i][5])) $extra_view = $site_extras[$i][5] & EXTRA_DISPLAY_VIEW; -if (!empty($extras[$extra_name]['cal_name']) && !empty($extra_view)) { +if (!empty ( $extras[$extra_name]['cal_name']) && !empty ( $extra_view)) { echo '
    ' . translate($site_extras[$i][1]) . "
    \n"; echo '
    '; if ($extra_type == EXTRA_URL) { -$target = (!empty($extra_arg1) ? ' target="' . $extra_arg1 . '" ' : ''); +$target = (!empty ( $extra_arg1) ? ' target="' . $extra_arg1 . '" ' : ''); echo (strlen($extras[$extra_name]['cal_data']) ? '' . $extras[$extra_name]['cal_data'] . '' : ''); @@ -809,8 +809,8 @@ echo ' ' . $a->getSummary(); // Dropdown menu for actions on this attachment -echo ' 
    ' . -'
    ' - . ( ! empty( $_SESSION['db_success'] ) && $_SESSION['db_success'] && - empty( $dologin ) ? ' + . ( ! empty ( $_SESSION['db_success'] ) && $_SESSION['db_success'] && + empty ( $dologin ) ? ' ' - . ( ! empty( $_SESSION['old_program_version'] ) && + . ( ! empty ( $_SESSION['old_program_version'] ) && ( $_SESSION['old_program_version'] == $PROGRAM_VERSION ) && ! - empty( $setup_complete ) ? ' + empty ( $setup_complete ) ? ' ' - : '' ) : '' ) . ( ! empty( $_SESSION['validuser'] ) ? ' + : '' ) : '' ) . ( ! empty ( $_SESSION['validuser'] ) ? ' ' : '' ) . ' diff --git a/install/install_functions.php b/install/install_functions.php index 8a1935c94..e5d5889bc 100644 --- a/install/install_functions.php +++ b/install/install_functions.php @@ -350,8 +350,8 @@ function get_installed_version ( $postinstall = false ) { $sql = $database_upgrade_matrix[$i][0]; //echo "SQL: $sql
    \n"; - if (empty($sql)) { - // We reached the end of database_upgrade_matrix[] with no errors, which + if (empty ( $sql)) { + // We reached the end of database_upgrade_matrix[] with no errors, which // means the database is structurally up-to-date. } else { try{ diff --git a/js_cacher.php b/js_cacher.php index 79a6e793c..72451cb9e 100644 --- a/js_cacher.php +++ b/js_cacher.php @@ -3,10 +3,10 @@ // this file should not be called. define( '_ISVALID', true ); -if( empty( $inc ) ) +if( empty ( $inc ) ) $inc = $_GET['inc']; -if( empty( $inc ) && ! empty( $_REQUEST['inc'] ) ) +if( empty ( $inc ) && ! empty ( $_REQUEST['inc'] ) ) $inc = $_REQUEST['inc']; $arinc = explode( '/', $inc ); @@ -47,7 +47,7 @@ load_global_settings(); @session_start(); -$login = ( empty( $_SESSION['webcal_login'] ) +$login = ( empty ( $_SESSION['webcal_login'] ) ? '__public__' : $_SESSION['webcal_login'] ); load_user_preferences(); diff --git a/layers.php b/layers.php index e6e8d9918..dfa75ba40 100644 --- a/layers.php +++ b/layers.php @@ -11,7 +11,7 @@ $u_url = ''; $updating_public = false; -if ($is_admin && !empty($public) && $PUBLIC_ACCESS == 'Y') { +if ($is_admin && !empty ( $public) && $PUBLIC_ACCESS == 'Y') { $layer_user = '__public__'; $u_url = '&public=1'; $updating_public = true; @@ -26,7 +26,7 @@ if ($res) { $row = dbi_fetch_row($res); - $layers_enabled = ($row && !empty($row) && $row[0] == 'Y' ? 1 : 0); + $layers_enabled = ($row && !empty ( $row) && $row[0] == 'Y' ? 1 : 0); dbi_free_result($res); } @@ -60,10 +60,10 @@ if ($ALLOW_VIEW_OTHER != 'Y') echo print_not_auth(); else { - if (empty($PUBLIC_ACCESS)) + if (empty ( $PUBLIC_ACCESS)) $PUBLIC_ACCESS = 'N'; - if ($is_admin && empty($public) && $PUBLIC_ACCESS == 'Y') { + if ($is_admin && empty ( $public) && $PUBLIC_ACCESS == 'Y') { ?>
    diff --git a/login.php b/login.php index 31fd2dc92..82388e912 100644 --- a/login.php +++ b/login.php @@ -34,7 +34,7 @@ load_global_settings(); // Set this true to show "no such user" or "invalid password" on login failures. -$showLoginFailureReason = (!empty($settings['mode']) && $settings['mode'] = 'dev'); +$showLoginFailureReason = (!empty ( $settings['mode']) && $settings['mode'] = 'dev'); $message = ''; if ( ! empty ( $last_login ) ) @@ -53,19 +53,19 @@ // Look for action=logout. $logout = false; $action = getGetValue('action'); -if (!empty($action) && $action == 'logout') { +if (!empty ( $action) && $action == 'logout') { $logout = true; $return_path = ''; sendCookie('webcalendar_login', '', 0); sendCookie('webcalendar_last_view', '', 0); $message = translate('You have been logged out.'); } else -if (empty($return_path)) { +if (empty ( $return_path)) { // See if a return path was set. $return_path = get_last_view(false); } -if (!empty($return_path)) { +if (!empty ( $return_path)) { $url = $return_path = clean_whitespace($return_path); } else { $url = 'index.php'; @@ -80,7 +80,7 @@ $remember = getPostValue('remember'); // Calculate path for cookie. -if (empty($PHP_SELF)) { +if (empty ( $PHP_SELF)) { $PHP_SELF = $_SERVER['PHP_SELF']; } @@ -90,7 +90,7 @@ // No login for single-user mode or when using HTTP authorization. do_redirect('index.php'); } else { - if (!empty($login) && !$logout) { + if (!empty ( $login) && !$logout) { $login = trim($login); $badLoginStr = translate('Illegal characters in login XXX.'); @@ -99,10 +99,10 @@ str_replace('XXX', htmlentities($login), $badLoginStr) ); - if (empty($password)) { - if (empty($error) && $showLoginFailureReason) { + if (empty ( $password)) { + if (empty ( $error) && $showLoginFailureReason) { $error = translate('You must provide a password.'); - } else if (empty($error)) { + } else if (empty ( $error)) { $error = translate('Invalid login'); } } else if (user_valid_login($login, $password)) { @@ -112,7 +112,7 @@ . chr(rand(ord('A'), ord('z'))); $encoded_login = encode_string($login . '|' . crypt($password, $salt)); // If $remember, set login to expire in 365 days. - $timeStr = (!empty($remember) && $remember == 'yes' + $timeStr = (!empty ( $remember) && $remember == 'yes' ? time() + 31536000 : 0); sendCookie('webcalendar_session', $encoded_login, $timeStr, $cookie_path); @@ -125,14 +125,14 @@ // if $REMEMBER_LAST_LOGIN is set to "Y" (in admin.php). sendCookie('webcalendar_login', $login, $timeStr, $cookie_path); - if (!empty($GLOBALS['newUserUrl'])) { + if (!empty ( $GLOBALS['newUserUrl'])) { $url = $GLOBALS['newUserUrl']; } do_redirect($url); } else { // Invalid login. - if (empty($error) || !$showLoginFailureReason) { + if (empty ( $error) || !$showLoginFailureReason) { $error = translate('Invalid login', true); echo "ERROR: $error"; exit; } diff --git a/month.php b/month.php index c2766cb58..a83ab854b 100644 --- a/month.php +++ b/month.php @@ -3,7 +3,7 @@ //check UAC if( ! access_can_access_function( ACCESS_MONTH ) - || ( ! empty( $user ) && ! access_user_calendar( 'view', $user ) ) ) + || ( ! empty ( $user ) && ! access_user_calendar( 'view', $user ) ) ) send_to_preferred_view(); if ( ( $user != $login ) && $is_nonuser_admin ) diff --git a/nulogin.php b/nulogin.php index 12f2a2bbb..6e98c7305 100644 --- a/nulogin.php +++ b/nulogin.php @@ -29,7 +29,7 @@ die_miserable_death ( print_not_auth() ); $login = getValue ('login'); -if (empty($login)) +if (empty ( $login)) die_miserable_death( translate( 'A login must be specified.' ) ); $login2 = chkXSS('login'); if($login != $login2) diff --git a/pref.php b/pref.php index 208500f05..476db6e32 100644 --- a/pref.php +++ b/pref.php @@ -50,7 +50,7 @@ function save_pref( $prefs, $src) { // Handle "Reset Preferences" button $action = getValue('action'); -if ($action == "reset" && empty($error)) { +if ($action == "reset" && empty ( $error)) { $user = getValue('user'); if ($user != $login && ! $is_admin) { // Make sure this person is either an admin or the owner/admin of the nonuser cal. @@ -59,7 +59,7 @@ function save_pref( $prefs, $src) { $error = translate('Not authorized'); } } - if(empty($error)) { + if(empty ( $error)) { dbi_execute('DELETE FROM webcal_user_pref WHERE cal_login = ?', [$user]); $message = translate('Preferences reset to system defaults.'); } @@ -193,7 +193,7 @@ function save_pref( $prefs, $src) { ?> <?php etranslate ( 'Help' )?> -
    ""> +
    "">
    @@ -233,7 +233,7 @@ function save_pref( $prefs, $src) { if ( $NONUSER_ENABLED == 'Y' || $PUBLIC_ACCESS == 'Y' ) { if ( ( empty ( $user ) || $user == $login ) && ! $updating_public ) { $nulist = get_my_nonusers ( $login ); - if (!empty($nulist)) { + if (!empty ( $nulist)) { ?>
    ">
    ' + warning + id + '' + (u.fullname == null ? '' : u.fullname) + '' + (u.admin == null ? '' : u.admin) + - '' + (u.public == 'Y' ? '' : '') + + '' + (u.public == 'Y' ? '' : '') + '' + u.eventcount + '' + u.lastupdated + '' + u.lastchecked + '' + (u.url == null ? '' : u.url) + '' + user_menu(u.login, u.layercount == 0) + '
    ' + id + '' + (u.fullname == null ? '' : u.fullname) + '' + (u.admin == null ? '' : u.admin) + - '' + (u.public == 'Y' ? '' : '') + + '' + (u.public == 'Y' ? '' : '') + '' + u.eventcount + '' + user_menu(u.login) + '
    ' - . ( empty( $eventinfo ) ? '' : $eventinfo ) . $printerStr . print_trailer(); + . ( empty ( $eventinfo ) ? '' : $eventinfo ) . $printerStr . print_trailer(); ?> diff --git a/view_v.php b/view_v.php index 37c78ac94..3e3d66602 100644 --- a/view_v.php +++ b/view_v.php @@ -74,7 +74,7 @@ // this user is not a member of any group assigned to this view. $error = translate( 'No users for this view.' ); -if ( ! empty( $error ) ) { +if ( ! empty ( $error ) ) { echo print_error( $error ) . print_trailer(); exit; } diff --git a/view_w.php b/view_w.php index ea83171b3..52713d83b 100644 --- a/view_w.php +++ b/view_w.php @@ -166,6 +166,6 @@ } $user = ''; // reset -echo ( empty( $eventinfo ) ? '' : $eventinfo ) . $printerStr . print_trailer(); +echo ( empty ( $eventinfo ) ? '' : $eventinfo ) . $printerStr . print_trailer(); ?> diff --git a/views_edit.php b/views_edit.php index e2d90b1bf..fdd607f10 100644 --- a/views_edit.php +++ b/views_edit.php @@ -73,7 +73,7 @@ } -if ( ! empty( $error ) ) { +if ( ! empty ( $error ) ) { echo print_error( $error ) . print_trailer(); exit; } @@ -175,4 +175,3 @@ - diff --git a/views_edit_handler.php b/views_edit_handler.php index d0c0d7d1e..e8a981cd0 100644 --- a/views_edit_handler.php +++ b/views_edit_handler.php @@ -51,7 +51,7 @@ if ( getPostValue ( 'viewuserall' ) == 'Y' ) $users = ['__all__']; - $cnt = empty($users) ? 0 : count($users); + $cnt = empty ( $users) ? 0 : count($users); for ($i = 0; $i < $cnt; $i++ ) { dbi_execute ( 'INSERT INTO webcal_view_user ( cal_view_id, cal_login ) VALUES ( ?, ? )', [$id, $users[$i]] ); diff --git a/week.php b/week.php index 51ab52b97..c8b06882e 100644 --- a/week.php +++ b/week.php @@ -3,7 +3,7 @@ //check UAC if( ! access_can_access_function( ACCESS_WEEK ) - || ( ! 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 : '' ); diff --git a/year.php b/year.php index ce22389e2..f3ef1240b 100644 --- a/year.php +++ b/year.php @@ -4,7 +4,7 @@ //check UAC if( ! access_can_access_function( ACCESS_YEAR ) - || ( ! empty( $user ) && ! access_user_calendar( 'view', $user ) ) ) + || ( ! empty ( $user ) && ! access_user_calendar( 'view', $user ) ) ) send_to_preferred_view(); if ( ( $user != $login ) && $is_nonuser_admin ) @@ -15,7 +15,7 @@ load_user_categories(); if ( empty ( $year ) ) { - if (! empty($date)) { + if (! empty ( $date)) { $year = substr($date, 0, 4); } else { $year = date ( 'Y' );