]> git.mxchange.org Git - friendica.git/blob - mod/localtime.php
Updated modules to allow for partial overrides without errors
[friendica.git] / mod / localtime.php
1 <?php
2
3 require_once('include/datetime.php');
4
5 if(! function_exists('localtime_post')) {
6 function localtime_post(&$a) {
7
8         $t = $_REQUEST['time'];
9         if(! $t)
10                 $t = 'now';
11
12         $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM
13
14         if($_POST['timezone'])
15                 $a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format);
16 }
17 }
18
19 if(! function_exists('localtime_content')) {
20 function localtime_content(&$a) {
21         $t = $_REQUEST['time'];
22         if(! $t)
23                 $t = 'now';
24
25         $o .= '<h3>' . t('Time Conversion') . '</h3>';
26
27         $o .= '<p>' . t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
28
29
30
31         $o .= '<p>' . sprintf( t('UTC time: %s'), $t) . '</p>';
32
33         if($_REQUEST['timezone'])
34                 $o .= '<p>' . sprintf( t('Current timezone: %s'), $_REQUEST['timezone']) . '</p>';
35
36         if(x($a->data,'mod-localtime'))
37                 $o .= '<p>' . sprintf( t('Converted localtime: %s'),$a->data['mod-localtime']) . '</p>';
38
39
40         $o .= '<form action ="' . $a->get_baseurl() . '/localtime?f=&time=' . $t . '" method="post" >';
41
42         $o .= '<p>' . t('Please select your timezone:') . '</p>';
43
44         $o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles');
45
46         $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
47
48         return $o;
49 }
50 }