more work on standards compliance
This commit is contained in:
parent
8ae8465d48
commit
c785eb29c6
2 changed files with 100 additions and 100 deletions
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* @fiel mod/events.php
|
||||
* @file mod/events.php
|
||||
* @brief The events module
|
||||
*/
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/datetime.php');
|
||||
require_once('include/event.php');
|
||||
require_once('include/items.php');
|
||||
require_once 'include/bbcode.php';
|
||||
require_once 'include/datetime.php';
|
||||
require_once 'include/event.php';
|
||||
require_once 'include/items.php';
|
||||
|
||||
function events_init(App $a) {
|
||||
if (! local_user()) {
|
||||
|
@ -16,8 +16,9 @@ function events_init(App $a) {
|
|||
if ($a->argc == 1) {
|
||||
// if it's a json request abort here becaus we don't
|
||||
// need the widget data
|
||||
if ($a->argv[1] === 'json')
|
||||
if ($a->argv[1] === 'json') {
|
||||
return;
|
||||
}
|
||||
|
||||
$cal_widget = widget_events();
|
||||
|
||||
|
@ -96,7 +97,7 @@ function events_post(App $a) {
|
|||
if (strcmp($finish, $start) < 0 && !$nofinish) {
|
||||
notice(t('Event can not end before it has started.') . EOL);
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
echo( t('Event can not end before it has started.'));
|
||||
echo t('Event can not end before it has started.');
|
||||
killme();
|
||||
}
|
||||
goaway($onerror_url);
|
||||
|
@ -105,7 +106,7 @@ function events_post(App $a) {
|
|||
if ((! $summary) || (! $start)) {
|
||||
notice(t('Event title and start time are required.') . EOL);
|
||||
if (intval($_REQUEST['preview'])) {
|
||||
echo( t('Event title and start time are required.'));
|
||||
echo t('Event title and start time are required.');
|
||||
killme();
|
||||
}
|
||||
goaway($onerror_url);
|
||||
|
@ -308,8 +309,8 @@ function events_content(App $a) {
|
|||
|
||||
|
||||
if ($a->argv[1] === 'json') {
|
||||
if (x($_GET,'start')) $start = $_GET['start'];
|
||||
if (x($_GET,'end')) $finish = $_GET['end'];
|
||||
if (x($_GET, 'start')) {$start = $_GET['start'];}
|
||||
if (x($_GET, 'end')) {$finish = $_GET['end'];}
|
||||
}
|
||||
|
||||
$start = datetime_convert('UTC', 'UTC', $start);
|
||||
|
@ -320,7 +321,7 @@ function events_content(App $a) {
|
|||
|
||||
// put the event parametes in an array so we can better transmit them
|
||||
$event_params = array(
|
||||
'event_id' => (x($_GET,'id') ? $_GET["id"] : 0),
|
||||
'event_id' => (x($_GET, 'id') ? $_GET['id'] : 0),
|
||||
'start' => $start,
|
||||
'finish' => $finish,
|
||||
'adjust_start' => $adjust_start,
|
||||
|
@ -398,11 +399,9 @@ function events_content(App $a) {
|
|||
if (x($_GET, 'id')) {
|
||||
echo $o;
|
||||
killme();
|
||||
|
||||
}
|
||||
|
||||
return $o;
|
||||
|
||||
}
|
||||
|
||||
if ($mode === 'edit' && $event_id) {
|
||||
|
@ -410,27 +409,29 @@ function events_content(App $a) {
|
|||
intval($event_id),
|
||||
intval(local_user())
|
||||
);
|
||||
if (dbm::is_result($r))
|
||||
if (dbm::is_result($r)) {
|
||||
$orig_event = $r[0];
|
||||
}
|
||||
}
|
||||
|
||||
// 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'];
|
||||
if (x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
|
||||
if (x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
|
||||
if (x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
|
||||
if (x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
|
||||
if (x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
|
||||
if (x($_REQUEST, 'nofinish')) {$orig_event['nofinish'] = $_REQUEST['nofinish'];}
|
||||
if (x($_REQUEST, 'adjust')) {$orig_event['adjust'] = $_REQUEST['adjust'];}
|
||||
if (x($_REQUEST, 'summary')) {$orig_event['summary'] = $_REQUEST['summary'];}
|
||||
if (x($_REQUEST, 'description')) {$orig_event['description'] = $_REQUEST['description'];}
|
||||
if (x($_REQUEST, 'location')) {$orig_event['location'] = $_REQUEST['location'];}
|
||||
if (x($_REQUEST, 'start')) {$orig_event['start'] = $_REQUEST['start'];}
|
||||
if (x($_REQUEST, 'finish')) {$orig_event['finish'] = $_REQUEST['finish'];}
|
||||
}
|
||||
|
||||
if ($mode === 'edit' || $mode === 'new') {
|
||||
|
||||
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
|
||||
$a_checked = ((x($orig_event) && $orig_event['adjust']) ? ' checked="checked" ' : '');
|
||||
|
||||
$t_orig = ((x($orig_event)) ? $orig_event['summary'] : '');
|
||||
$d_orig = ((x($orig_event)) ? $orig_event['desc'] : '');
|
||||
$l_orig = ((x($orig_event)) ? $orig_event['location'] : '');
|
||||
|
@ -477,7 +478,7 @@ function events_content(App $a) {
|
|||
$f = 'ymd';
|
||||
}
|
||||
|
||||
require_once('include/acl_selectors.php');
|
||||
require_once 'include/acl_selectors.php' ;
|
||||
|
||||
if ($mode === 'new') {
|
||||
$acl = (($cid) ? '' : populate_acl(((x($orig_event)) ? $orig_event : $a->user)));
|
||||
|
@ -529,8 +530,8 @@ function events_content(App $a) {
|
|||
if ($mode === 'drop' && $event_id) {
|
||||
$del = 0;
|
||||
|
||||
$event_params = array('event_id' => ($event_id));
|
||||
$ev = event_by_id(local_user(), $event_params);
|
||||
$params = array('event_id' => ($event_id));
|
||||
$ev = event_by_id(local_user(), $params);
|
||||
|
||||
// Delete only real events (no birthdays)
|
||||
if (dbm::is_result($ev) && $ev[0]['type'] == 'event') {
|
||||
|
@ -544,6 +545,5 @@ function events_content(App $a) {
|
|||
}
|
||||
|
||||
goaway(App::get_baseurl() . '/events');
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue