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