Skip to content

Commit

Permalink
#1663 Update time formating for profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Jun 12, 2018
1 parent 27a4b51 commit 02f8acc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1237,22 +1237,26 @@ function is_subforum($id, $self_subforum = '0')
//
// Format a time string according to $time_format and time zones
//
function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false)
function format_time($timestamp, $date_only = false, $date_format = null, $time_format = null, $time_only = false, $no_text = false, $user = null)
{
global $luna_config, $luna_user, $forum_date_formats, $forum_time_formats;

if ($timestamp == '') {
return __('Never', 'luna');
}

if (is_null($user))
$user = $pun_user;

$diff = ($user['timezone'] + $user['dst']) * 3600;
$now = time();

if (is_null($date_format)) {
$date_format = $forum_date_formats[$luna_user['date_format']];
$date_format = $forum_date_formats[$user['date_format']];
}

if (is_null($time_format)) {
$time_format = $forum_time_formats[$luna_user['time_format']];
$time_format = $forum_time_formats[$user['time_format']];
}

$date = date($date_format, $timestamp);
Expand Down
4 changes: 2 additions & 2 deletions themes/Fifteen/views/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@
echo "\t\t\t\t\t\t\t\t".'<option value="'.$key.'"';
if ($user['time_format'] == $key)
echo ' selected';
echo '>'. format_time(time(), false, null, $time_format, true, true);
echo '>'. format_time(time(), false, null, $time_format, true, true, $user);
if ($key == 0)
echo ' ('.__('Default', 'luna').')';
echo "</option>\n";
Expand All @@ -449,7 +449,7 @@
echo "\t\t\t\t\t\t\t\t".'<option value="'.$key.'"';
if ($user['date_format'] == $key)
echo ' selected';
echo '>'. format_time(time(), true, $date_format, null, false, true);
echo '>'. format_time(time(), true, $date_format, null, false, true, $user);
if ($key == 0)
echo ' ('.__('Default', 'luna').')';
echo "</option>\n";
Expand Down

0 comments on commit 02f8acc

Please sign in to comment.