aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-06-06 22:27:38 -0700
committerFriendika <info@friendika.com>2011-06-06 22:27:38 -0700
commitc1b2e90e3720961c280f6378e48fda7bad7c3ad0 (patch)
tree717ed873e30031dec2e7b4d136cdcdb648571cd0
parentfcb4316c2943d881eeb4d77bb6e3e51815bb59d6 (diff)
downloadvolse-hubzilla-c1b2e90e3720961c280f6378e48fda7bad7c3ad0.tar.gz
volse-hubzilla-c1b2e90e3720961c280f6378e48fda7bad7c3ad0.tar.bz2
volse-hubzilla-c1b2e90e3720961c280f6378e48fda7bad7c3ad0.zip
basic saving of events
-rw-r--r--include/event.php12
-rw-r--r--mod/events.php41
2 files changed, 42 insertions, 11 deletions
diff --git a/include/event.php b/include/event.php
index ecaa9213a..38ab83316 100644
--- a/include/event.php
+++ b/include/event.php
@@ -15,15 +15,19 @@ function format_event_html($ev) {
$o .= '<p>' . t('Starts: ') . '<abbr class="dtstart" title="'
. datetime_convert('UTC','UTC',$ev['start'], ATOM_TIME)
. '" >'
- . datetime_convert('UTC', date_default_timezone_get(),
- $ev['start'] /*, format */ )
+ . (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(),
+ $ev['start'] /*, format */ )
+ : datetime_convert('UTC', 'UTC',
+ $ev['start'] /*, format */ ))
. '</abbr></p>';
$o .= '<p>' . t('Ends: ') . '<abbr class="dtend" title="'
. datetime_convert('UTC','UTC',$ev['finish'], ATOM_TIME)
. '" >'
- . datetime_convert('UTC', date_default_timezone_get(),
- $ev['finish'] /*, format */ )
+ . (($ev['adjust']) ? datetime_convert('UTC', date_default_timezone_get(),
+ $ev['finish'] /*, format */ )
+ : datetime_convert('UTC', 'UTC',
+ $ev['finish'] /*, format */ ))
. '</abbr></p>';
$o .= '<p> ' . t('Location:') . '<span class="location">'
diff --git a/mod/events.php b/mod/events.php
index 3888d6fe3..293e9a260 100644
--- a/mod/events.php
+++ b/mod/events.php
@@ -10,19 +10,44 @@ function events_post(&$a) {
$event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
$uid = local_user();
- $start = strip_tags($_POST['start']);
- $finish = strip_tags($_POST['finish']);
+ $startyear = intval($_POST['startyear']);
+ $startmonth = intval($_POST['startmonth']);
+ $startday = intval($_POST['startday']);
+ $starthour = intval($_POST['starthour']);
+ $startminute = intval($_POST['startminute']);
+
+ $finishyear = intval($_POST['finishyear']);
+ $finishmonth = intval($_POST['finishmonth']);
+ $finishday = intval($_POST['finishday']);
+ $finishhour = intval($_POST['finishhour']);
+ $finishminute = intval($_POST['finishminute']);
+
+ $adjust = intval($_POST['adjust']);
+
+
+ $start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
+ $finish = sprintf('%d-%d-%d %d:%d:0',$finishyear,$finishmonth,$finishday,$finishhour,$finishminute);
+
+ if($adjust) {
+ $start = datetime_convert(date_default_timezone_get(),'UTC',$start);
+ $finish = datetime_convert(date_default_timezone_get(),'UTC',$finish);
+ }
+ else {
+ $start = datetime_convert('UTC','UTC',$start);
+ $finish = datetime_convert('UTC','UTC',$finish);
+ }
+
+
$desc = escape_tags($_POST['desc']);
$location = escape_tags($_POST['location']);
$type = 'event';
- $adjust = intval($_POST['adjust']);
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
$str_contact_deny = perms2str($_POST['contact_deny']);
-
+dbg(1);
if($event_id) {
$r = q("UPDATE `event` SET
`edited` = '%s',
@@ -62,7 +87,7 @@ function events_post(&$a) {
`adjust`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s' ) ",
intval(local_user()),
-
+ dbesc($uri),
dbesc(datetime_convert()),
dbesc(datetime_convert()),
dbesc($start),
@@ -174,8 +199,10 @@ function events_content(&$a) {
'$s_dsel' => datesel('start',$year+5,$year,false,$year,$month,$day),
'$s_tsel' => timesel('start',0,0),
'$f_text' => t('Finish: year-month-day hour:minute'),
- '$f_dsel' => datesel('start',$year+5,$year,false,$year,$month,$day),
- '$f_tsel' => timesel('start',0,0),
+ '$f_dsel' => datesel('finish',$year+5,$year,false,$year,$month,$day),
+ '$f_tsel' => timesel('finish',0,0),
+ '$a_text' => t('Adjust for viewer timezone'),
+ '$a_checked' => '',
'$d_text' => t('Description:'),
'$d_orig' => '',
'$l_text' => t('Location:'),