3 namespace Friendica\Module\Debug;
5 use Friendica\BaseModule;
6 use Friendica\Core\Installer;
8 use Friendica\Util\DateTimeFormat;
9 use Friendica\Util\Temporal;
11 class Localtime extends BaseModule
13 public static function post(array $parameters = [])
15 $time = ($_REQUEST['time'] ?? '') ?: 'now';
17 $bd_format = DI::l10n()->t('l F d, Y \@ g:i A');
19 if (!empty($_POST['timezone'])) {
20 DI::app()->data['mod-localtime'] = DateTimeFormat::convert($time, $_POST['timezone'], 'UTC', $bd_format);
24 public static function content(array $parameters = [])
28 $time = ($_REQUEST['time'] ?? '') ?: 'now';
30 $output = '<h3>' . DI::l10n()->t('Time Conversion') . '</h3>';
31 $output .= '<p>' . DI::l10n()->t('Friendica provides this service for sharing events with other networks and friends in unknown timezones.') . '</p>';
32 $output .= '<p>' . DI::l10n()->t('UTC time: %s', $time) . '</p>';
34 if (!empty($_REQUEST['timezone'])) {
35 $output .= '<p>' . DI::l10n()->t('Current timezone: %s', $_REQUEST['timezone']) . '</p>';
38 if (!empty($app->data['mod-localtime'])) {
39 $output .= '<p>' . DI::l10n()->t('Converted localtime: %s', $app->data['mod-localtime']) . '</p>';
42 $output .= '<form action ="' . DI::baseUrl()->get() . '/localtime?time=' . $time . '" method="post" >';
43 $output .= '<p>' . DI::l10n()->t('Please select your timezone:') . '</p>';
44 $output .= Temporal::getTimezoneSelect(($_REQUEST['timezone'] ?? '') ?: Installer::DEFAULT_TZ);
45 $output .= '<input type="submit" name="submit" value="' . DI::l10n()->t('Submit') . '" /></form>';