some code cleanup
This commit is contained in:
parent
c785eb29c6
commit
e1d22ef5d4
|
@ -14,7 +14,7 @@ function events_init(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($a->argc == 1) {
|
if ($a->argc == 1) {
|
||||||
// if it's a json request abort here becaus we don't
|
// If it's a json request abort here because we don't
|
||||||
// need the widget data
|
// need the widget data
|
||||||
if ($a->argv[1] === 'json') {
|
if ($a->argv[1] === 'json') {
|
||||||
return;
|
return;
|
||||||
|
@ -34,7 +34,7 @@ function events_init(App $a) {
|
||||||
|
|
||||||
function events_post(App $a) {
|
function events_post(App $a) {
|
||||||
|
|
||||||
logger('post: ' . print_r($_REQUEST, true));
|
logger('post: ' . print_r($_REQUEST, true), LOGGER_DATA);
|
||||||
|
|
||||||
if (! local_user()) {
|
if (! local_user()) {
|
||||||
return;
|
return;
|
||||||
|
@ -53,20 +53,15 @@ function events_post(App $a) {
|
||||||
// The default setting for the `private` field in event_store() is false, so mirror that
|
// The default setting for the `private` field in event_store() is false, so mirror that
|
||||||
$private_event = false;
|
$private_event = false;
|
||||||
|
|
||||||
|
$start = '0000-00-00 00:00:00';
|
||||||
|
$finish = '0000-00-00 00:00:00';
|
||||||
|
|
||||||
if ($start_text) {
|
if ($start_text) {
|
||||||
$start = $start_text;
|
$start = $start_text;
|
||||||
} else {
|
|
||||||
$start = sprintf('%d-%d-%d %d:%d:0', $startyear, $startmonth, $startday, $starthour, $startminute);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($nofinish) {
|
|
||||||
$finish = '0000-00-00 00:00:00';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($finish_text) {
|
if ($finish_text) {
|
||||||
$finish = $finish_text;
|
$finish = $finish_text;
|
||||||
} else {
|
|
||||||
$finish = sprintf('%d-%d-%d %d:%d:0', $finishyear, $finishmonth, $finishday, $finishhour, $finishminute);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($adjust) {
|
if ($adjust) {
|
||||||
|
@ -103,7 +98,7 @@ function events_post(App $a) {
|
||||||
goaway($onerror_url);
|
goaway($onerror_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((! $summary) || (! $start)) {
|
if ((! $summary) || ($start === '0000-00-00 00:00:00')) {
|
||||||
notice(t('Event title and start time are required.') . EOL);
|
notice(t('Event title and start time are required.') . EOL);
|
||||||
if (intval($_REQUEST['preview'])) {
|
if (intval($_REQUEST['preview'])) {
|
||||||
echo t('Event title and start time are required.');
|
echo t('Event title and start time are required.');
|
||||||
|
@ -184,8 +179,6 @@ function events_post(App $a) {
|
||||||
goaway($_SESSION['return_url']);
|
goaway($_SESSION['return_url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function events_content(App $a) {
|
function events_content(App $a) {
|
||||||
|
|
||||||
if (! local_user()) {
|
if (! local_user()) {
|
||||||
|
@ -239,8 +232,6 @@ function events_content(App $a) {
|
||||||
$tabs = profile_tabs($a, true);
|
$tabs = profile_tabs($a, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$mode = 'view';
|
$mode = 'view';
|
||||||
$y = 0;
|
$y = 0;
|
||||||
$m = 0;
|
$m = 0;
|
||||||
|
@ -425,9 +416,6 @@ function events_content(App $a) {
|
||||||
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
||||||
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
||||||
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||||
}
|
|
||||||
|
|
||||||
if ($mode === 'edit' || $mode === 'new') {
|
|
||||||
|
|
||||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||||
|
@ -439,7 +427,6 @@ function events_content(App $a) {
|
||||||
$cid = ((x($orig_event)) ? $orig_event['cid'] : 0);
|
$cid = ((x($orig_event)) ? $orig_event['cid'] : 0);
|
||||||
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
|
$uri = ((x($orig_event)) ? $orig_event['uri'] : '');
|
||||||
|
|
||||||
|
|
||||||
if (! x($orig_event)) {
|
if (! x($orig_event)) {
|
||||||
$sh_checked = '';
|
$sh_checked = '';
|
||||||
} else {
|
} else {
|
||||||
|
@ -450,7 +437,6 @@ function events_content(App $a) {
|
||||||
$sh_checked .= ' disabled="disabled" ';
|
$sh_checked .= ' disabled="disabled" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
|
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
|
||||||
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
|
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user