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