News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Recent posts

#1
Mod Requests / Re: media gallery for videos
Last post by Steve - Today at 11:35:26 AM
Do you want this to be free or paid?
#2
SMF 2.1.x Support / Re: Potential Hacking Attempts
Last post by Steve - Today at 11:34:18 AM
And why is this mark solved?
#3
Modifications and Packages / Re: Relative Time Formats
Last post by Senkusha - Today at 11:31:50 AM
I may have noticed a bug?

I noticed on my board (I'm using the Default theme), the MOD installed and defaulted to Day, Month, Year 24 hour.  I changed it to Month Day, Year 24 Hour, and noticed it didn't change anything.  I've forced a refresh, and Emptied SMF Cache.  Still no difference, it's still showing my dates as like 24 November.

I tried it with Month Day, Year 12 hour and it works just fine.
#4
Theme Site Themes / Re: Potato
Last post by depmod - Today at 11:24:35 AM
Quote from: depmod on Today at 08:55:41 AMhm - in which file the script for the news is stated?

solved
#5
Modifications and Packages / Re: Relative Dates
Last post by Senkusha - Today at 11:16:10 AM
Thank you!  I don't know why this didn't come up with I tried looking for it.
#6
Modifications and Packages / Re: Relative Dates
Last post by Pipke - Today at 10:31:18 AM
Relative Time Formats mod for smf 2.1
#7
Modifications and Packages / Re: Relative Dates
Last post by Senkusha - Today at 10:14:19 AM
Quote from: Kindred on January 27, 2021, 03:24:47 PMYou want *ALL* dates to be relative?



Instead of doing the Subs.php and modifications.english.php edits that this mod originally suggested...
comment out or delete these lines.

Code ("find this in Subs.php") Select
// Today and Yesterday?
if ($modSettings['todayMod'] >= 1 && $show_today === true)
{
// Get the current time.
$nowtime = forum_time();

$then = @getdate($time);
$now = @getdate($nowtime);

// Try to make something of a time format string...
$s = strpos($user_info['time_format'], '%S') === false ? '' : ':%S';
if (strpos($user_info['time_format'], '%H') === false && strpos($user_info['time_format'], '%T') === false)
{
$h = strpos($user_info['time_format'], '%l') === false ? '%I' : '%l';
$today_fmt = $h . ':%M' . $s . ' %p';
}
else
$today_fmt = '%H:%M' . $s;

// Same day of the year, same year.... Today!
if ($then['yday'] == $now['yday'] && $then['year'] == $now['year'])
return $txt['today'] . timeformat($log_time, $today_fmt, $offset_type);

// Day-of-year is one less and same year, or it's the first of the year and that's the last of the year...
if ($modSettings['todayMod'] == '2' && (($then['yday'] == $now['yday'] - 1 && $then['year'] == $now['year']) || ($now['yday'] == 0 && $then['year'] == $now['year'] - 1) && $then['mon'] == 12 && $then['mday'] == 31))
return $txt['yesterday'] . timeformat($log_time, $today_fmt, $offset_type);
}

Code ("replace the above code with this") Select
$nowtime = forum_time(); 
$retVal = time_ago($nowtime, $time);

return $retVal;

Code ("add the follow to the end of Subs.php") Select
function time_ago($now, $then)
    {
    global $txt;
 
        if(!is_numeric($then))
            $then = strtotime($then);

        $periods_sing = array($txt['rel_second'], $txt['rel_minute'], $txt['rel_hour'], $txt['rel_day'], $txt['rel_week'], $txt['rel_month'], $txt['rel_year'], $txt['rel_age']);
        $periods_plur = array($txt['rel_seconds'], $txt['rel_minutes'], $txt['rel_hours'], $txt['rel_days'], $txt['rel_weeks'], $txt['rel_months'], $txt['rel_years'], $txt['rel_ages']);
        $lengths = array("60","60","24","7","4.35","12","100");

        $difference = $now - $then;
        if ($difference <= 10 && $difference >= 0)
            return $tense = $txt['just_now'];
        elseif($difference > 0)
            $tense = $txt['ago'];
        elseif($difference < 0)
            $tense = $txt['later'];

        for($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) {
            $difference /= $lengths[$j];
        }

        $difference = round($difference);

        if ($difference > 1)
          $period = $periods_plur[$j];
        else
          $period = $periods_sing[$j];

        return "{$difference} {$period} {$tense} ";
    }

Code ("add the following to Modifications.English.php") Select

$txt['just_now'] = 'just now';
$txt['ago'] = 'ago';
$txt['later'] = 'later';
$txt['rel_second'] = 'second';
$txt['rel_minute'] = 'minute';
$txt['rel_hour'] = 'hour';
$txt['rel_day'] = 'day';
$txt['rel_week'] = 'week';
$txt['rel_month'] = 'month';
$txt['rel_year'] = 'year';
$txt['rel_age'] = 'age';
$txt['rel_seconds'] = 'seconds';
$txt['rel_minutes'] = 'minutes';
$txt['rel_hours'] = 'hours';
$txt['rel_days'] = 'days';
$txt['rel_weeks'] = 'weeks';
$txt['rel_months'] = 'months';
$txt['rel_years'] = 'years';
$txt['rel_ages'] = 'ages';
$txt['relative_today'] = 'All times are Relative';



(Edit -- do note that my code changes above will install the relative dates/times REGARDLESS of the setting in the admin. The code I put together was a hack to REPLACE, not add an option, to the current code)

Is this the code that I would need to use to enable this MOD to work with 2.1.x?
#8
SMF 2.1.x Support / Re: Potential Hacking Attempts
Last post by Kindred - Today at 08:56:47 AM
Those are not hacking attempts... at least not the error messages...

Those errors indicate the,  somewhere,  either in your theme or mods, you have a very badly formed/called php call that is not loading the $context variable.

What is the ACTUAL URL being called the triggers the errors?
#9
Theme Site Themes / Re: Potato
Last post by depmod - Today at 08:55:41 AM
hm - in which file the script for the news is stated?
#10
SMF 2.1.x Support / Re: Potential Hacking Attempts
Last post by brianb2 - Today at 08:40:56 AM
Today's round of error messages. I did go in an ensure I didn't have any unnecessary packages/mods installed.

47.91.104.88   Guest   2: Invalid argument supplied for foreach() ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: template_layers ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: can_register ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: session_id ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: session_var ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: id ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: id ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: is_guest ?sslRedirect   Today at 07:59:07 AM
47.91.104.88   Guest   8: Undefined index: can_mod ?sslRedirect   Today at 07:59:07 AM
Advertisement: