// The default setting for the `private` field in event_store() is false, so mirror that
$private_event = false;
- $start = '0000-00-00 00:00:00';
- $finish = '0000-00-00 00:00:00';
+ $start = NULL_DATE;
+ $finish = NULL_DATE;
if ($start_text) {
$start = $start_text;
goaway($onerror_url);
}
- if ((! $summary) || ($start === '0000-00-00 00:00:00')) {
+ if ((! $summary) || ($start === NULL_DATE)) {
notice(t('Event title and start time are required.') . EOL);
if (intval($_REQUEST['preview'])) {
echo t('Event title and start time are required.');
$c = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
intval(local_user())
);
- if (count($c)) {
+ if (dbm::is_result($c)) {
$self = $c[0]['id'];
} else {
$self = 0;
$str_contact_deny = perms2str($_POST['contact_deny']);
// Undo the pseudo-contact of self, since there are real contacts now
- if (strpos($str_contact_allow, '<' . $self . '>') !== false ) {
+ if (strpos($str_contact_allow, '<' . $self . '>') !== false) {
$str_contact_allow = str_replace('<' . $self . '>', '', $str_contact_allow);
}
// Make sure to set the `private` field as true. This is necessary to
$str_group_allow = $str_contact_deny = $str_group_deny = '';
}
-
+ /// @TODO One-time array initialization, one large block
$datarray = array();
$datarray['guid'] = get_guid(32);
$datarray['start'] = $start;
// Passed parameters overrides anything found in the DB
if ($mode === 'edit' || $mode === 'new') {
- if (!x($orig_event)) {$orig_event = array();}
+ if (!x($orig_event)) {
+ $orig_event = array();
+ }
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];}