Skip to content

Commit

Permalink
Fixed Calendar Bug
Browse files Browse the repository at this point in the history
Fixed problem with Calendar identifying if submitted event was a master or personal type.
  • Loading branch information
eSilverStrike committed Mar 25, 2022
1 parent 3632516 commit dde5798
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions plugins/calendar/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ function plugin_savesubmission_calendar($A)
} elseif ($_CA_CONF['personalcalendars'] == 1) { // add to personal calendar
if (COM_isAnonUser()) {
// anonymous users don't have personal calendars - bail
COM_accessLog("Attempt to write to the personal calendar of user '{$A['uid']}'.");
COM_accessLog("Anonymous user attempted to write to a personal calendar which anonymous users do not have.");
COM_redirect($_CONF['site_url'] . '/calendar/index.php');
} else {
DB_save($_TABLES['personal_events'],
Expand Down Expand Up @@ -692,15 +692,18 @@ function plugin_submit_calendar($mode = 'master')
exit;
}

$mode = Geeklog\Input::fPost('calendar_type', null);
$passed_mode = Geeklog\Input::fPost('calendar_type', null);
if ($passed_mode != null) {
$mode = $passed_mode;
}

if ($mode !== null) {
if (!in_array($mode, array('master', 'personal', 'quickadd'))) {
$mode = 'master';
}
} elseif (Geeklog\Input::fRequest('mode') === 'personal') {
$mode = 'personal';
}
}

if (($_CA_CONF['personalcalendars'] == 1) && ($mode === 'quickadd')) {
// check for missing event title field
Expand Down
4 changes: 2 additions & 2 deletions public_html/calendar/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -403,14 +403,14 @@ function isWithinCurrentWindow($year, $month, $day)
// MAIN
$mode = Geeklog\Input::fRequest('mode', '');
if ($mode !== 'personal' && $mode !== 'quickadd') {
$mode = '';
$mode = 'master';
}

$pagetitle = ($mode === 'personal') ? $LANG_CAL_1[42] : $LANG_CAL_1[41];

// Set mode back to master if user refreshes screen after their session expires
if (($mode === 'personal') && COM_isAnonUser()) {
$mode = '';
$mode = 'master';
}

if ($mode === 'personal' && $_CA_CONF['personalcalendars'] == 0) {
Expand Down
2 changes: 1 addition & 1 deletion system/lib-plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,7 @@ function PLG_getModerationValues($type)
}

/**
* This function is resonsible for calling plugin_submit_<pluginname> so
* This function is responsible for calling plugin_submit_<pluginname> so
* that the submission form for the plugin is displayed.
*
* @param string $type Plugin to show submission form for
Expand Down

0 comments on commit dde5798

Please sign in to comment.