4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: thunderstrike on January 13, 2008, 01:13:10 AM

Title: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 13, 2008, 01:13:10 AM
Hi,

I like MOD so much - I publish FREE ! ;)
Some user is ask this before in forum. Is plan I code today. Is look right.

// Is do ?

MOD is check for today and yesterday (day before - I find definition !! :)). If upload date for image is same day now, is say: today . If user upload image day before - is say: yesterday image date. After 48 hour, is back for normal date. ;)

// Universal ?

This is right. Is no single 4images. Use for all MOD in forum with use: format_date and replace . ;)
Note: date field is MUST for microtime type.

// Test ?

Yes - here: http://www.4homepages.de/forum/index.php?topic=9598.msg109730#msg109730

[v1.0 - 01/12/2008]

Please backup all file:

- member.php
- details.php
- lightbox.php
- admin/home.php
- admin/users.php
- admin/admin_functions.php
- admin/images.php
- admin/comments.php
- admin/validateimages.php
- includes/functions.php

// Step 1

In member.php file

find:

Code: [Select]
"user_join_date" => (isset($user_row['user_joindate'])) ? format_date($config['date_format'], $user_row['user_joindate']) : REPLACE_EMPTY,
"user_last_action" => (isset($user_row['user_lastaction'])) ? format_date($config['date_format']." ".$config['time_format'], $user_row['user_lastaction']) : REPLACE_EMPTY,

replace:

Code: [Select]
"user_join_date" => (isset($user_row['user_joindate'])) ? get_universal_field_date($user_row['user_joindate']) : REPLACE_EMPTY,
"user_last_action" => (isset($user_row['user_lastaction'])) ? get_universal_field_date($user_row['user_lastaction']) : REPLACE_EMPTY,

// Step 2

In details.php file,

find:

Code: [Select]
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";

replace:

Code: [Select]
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".get_universal_field_date($comment_row[$i][$user_table_fields['user_joindate']]) : "";

// Step 2.1

find:

Code: [Select]
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),

replace:

Code: [Select]
"comment_date" => get_universal_field_date($comment_row[$i]['comment_date']),

// Step 3

In lightbox.php file,

find:

Code: [Select]
$lightbox_lastaction = format_date($config['date_format']." ".$config['time_format'], $user_info['lightbox_lastaction']);

replace:

Code: [Select]
$lightbox_lastaction = get_universal_field_date($user_info['lightbox_lastaction']);

// Step 4

In admin/home.php file,

find:

Code: [Select]
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($row[$user_table_fields['user_lastaction']])."</td>\n";

// Step 4.1

find:

Code: [Select]
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $row['session_lastaction'])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($row['session_lastaction'])."</td>\n";

// Step 5

In admin/users.php file,

find:

Code: [Select]
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $user_row[$user_table_fields['user_joindate']])."</td>\n";
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $user_row[$user_table_fields['user_lastaction']])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($user_row[$user_table_fields['user_joindate']])."</td>\n";
echo "<td>".get_universal_field_date($user_row[$user_table_fields['user_lastaction']])."</td>\n";

// Step 6

In admin/admin_functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $date_separator = preg_replace("/[a-zA-Z]+/i", "", $config['date_format']);               
       
        $day = getdate();
       
        // Today date.       
        $today_image_date = format_date($config['date_format'], $image_date);
       
        if ($config['date_format'][0] == "d" && $config['date_format'][2] == "m" && $config['date_format'][4] == "Y") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $date_separator[0] . $today_image_date[6] . $today_image_date[7] . $today_image_date[8] . $today_image_date[9];
            $today = $day['mday'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['year'];           
           
        } elseif ($config['date_format'][0] == "d" && $config['date_format'][2] == "Y" && $config['date_format'][4] == "m") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['mday'] . $date_separator[0] . $day['year'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']);
       
        } elseif ($config['date_format'][0] == "m" && $config['date_format'][2] == "d" && $config['date_format'][4] == "Y") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $date_separator[0] . $today_image_date[6] . $today_image_date[7] . $today_image_date[8] . $today_image_date[9];
            $today = (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['mday'] . $date_separator[0] . $day['year'];
           
        } elseif ($config['date_format'][0] == "m" && $config['date_format'][2] == "Y" && $config['date_format'][4] == "d") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['year'] . $date_separator[0] . $day['mday'];
           
        } elseif ($config['date_format'][0] == "Y" && $config['date_format'][2] == "m" && $config['date_format'][4] == "d") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $today_image_date[2] . $today_image_date[3] . $date_separator[0] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['year'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['mday'];
           
        } elseif ($config['date_format'][0] == "Y" && $config['date_format'][2] == "d" && $config['date_format'][4] == "m") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $today_image_date[2] . $today_image_date[3] . $date_separator[0] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['year'] . $date_separator[0] . $day['mday'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']);           
        }
       
        $yesterday_upload = format_date($config['date_format'], time() + 60 * 60 * 24 * 1);       
               
        // Show today image date if uploaded in same day.
        if ($today == $today_upload_image) {
            return str_replace(array("{uploaded_today_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        } elseif ($today_upload_image == $yesterday_upload) {
            $calc_past_upload = $yesterday_upload - $today + 1 - 1;           
            if ($calc_past_upload == 1) {
                return str_replace(array("{uploaded_yesterday_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
            }
       
        } elseif ($today_upload_image > $yesterday_upload || $today_upload_image < $yesterday_upload) {
            return format_date($config['date_format'] . " " . $config['time_format'], $image_date);           
        }
    }   
}

// Step 7

In admin/images.php file,

find:

Code: [Select]
echo "<td>".format_date($config['date_format'], $image_row['image_date'])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($image_row['image_date'])."</td>\n";

// Step 8

In admin/comments.php file,

find:

Code: [Select]
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $comment_row['comment_date'])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($comment_row['comment_date'])."</td>\n";

// Step 9

In admin/validateimages.php file,

find:

Code: [Select]
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $image_row['image_date'])."</td>\n";

replace:

Code: [Select]
echo "<td>".get_universal_field_date($image_row['image_date'])."</td>\n";

// Step 10

In includes/functions.php file,

add in top ?>:

Code: [Select]
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $date_separator = preg_replace("/[a-zA-Z]+/i", "", $config['date_format']);               
       
        $day = getdate();
       
        // Today date.       
        $today_image_date = format_date($config['date_format'], $image_date);
       
        if ($config['date_format'][0] == "d" && $config['date_format'][2] == "m" && $config['date_format'][4] == "Y") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $date_separator[0] . $today_image_date[6] . $today_image_date[7] . $today_image_date[8] . $today_image_date[9];
            $today = $day['mday'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['year'];           
           
        } elseif ($config['date_format'][0] == "d" && $config['date_format'][2] == "Y" && $config['date_format'][4] == "m") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['mday'] . $date_separator[0] . $day['year'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']);
       
        } elseif ($config['date_format'][0] == "m" && $config['date_format'][2] == "d" && $config['date_format'][4] == "Y") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $date_separator[0] . $today_image_date[6] . $today_image_date[7] . $today_image_date[8] . $today_image_date[9];
            $today = (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['mday'] . $date_separator[0] . $day['year'];
           
        } elseif ($config['date_format'][0] == "m" && $config['date_format'][2] == "Y" && $config['date_format'][4] == "d") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $date_separator[0] . $today_image_date[3] . $today_image_date[4] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['year'] . $date_separator[0] . $day['mday'];
           
        } elseif ($config['date_format'][0] == "Y" && $config['date_format'][2] == "m" && $config['date_format'][4] == "d") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $today_image_date[2] . $today_image_date[3] . $date_separator[0] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['year'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']) . $date_separator[0] . $day['mday'];
           
        } elseif ($config['date_format'][0] == "Y" && $config['date_format'][2] == "d" && $config['date_format'][4] == "m") {
            $today_upload_image = $today_image_date[0] . $today_image_date[1] . $today_image_date[2] . $today_image_date[3] . $date_separator[0] . $today_image_date[5] . $today_image_date[6] . $date_separator[0] . $today_image_date[8] . $today_image_date[9];
            $today = $day['year'] . $date_separator[0] . $day['mday'] . $date_separator[0] . (($day['mon'] < 10) ? "0" . $day['mon'] : $day['mon']);           
        }
       
        $yesterday_upload = format_date($config['date_format'], time() + 60 * 60 * 24 * 1);       
               
        // Show today image date if uploaded in same day.
        if ($today == $today_upload_image) {
            return str_replace(array("{uploaded_today_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        } elseif ($today_upload_image == $yesterday_upload) {
            $calc_past_upload = $yesterday_upload - $today + 1 - 1;           
            if ($calc_past_upload == 1) {
                return str_replace(array("{uploaded_yesterday_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
            }
       
        } elseif ($today_upload_image > $yesterday_upload || $today_upload_image < $yesterday_upload) {
            return format_date($config['date_format'] . " " . $config['time_format'], $image_date);           
        }
    }   
}

// Step 11

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['uploaded_images_today'] = "<b>Today</b> at: {uploaded_today_date}";
$lang['uploaded_images_yesterday'] = "<b>Yesterday</b> at: {uploaded_yesterday_date}";

// INTEGRATION

If use memberlist:

In memberlist.php file,

find:

Code: [Select]
format_date($config['date_format'], $user_row['user_joindate'])

replace:

Code: [Select]
get_universal_field_date($user_row[$user_table_fields['user_joindate']])

[v1.1 - upgrade - 01/13/2008]

I code upgrade (fix include with addon) .

// Is do ?

Is now say: today, yesterday, x days ago (if image is old - start of 2 days), x day(s) in near future (if image date is change from image owner or admin for after same day upload date). :)

// Upgrade file:

- includes/functions.php.
- admin/admin_functions.php
- lang/english/main.php

// Step 1

In includes/functions.php file,

replace full function with this:

Code: [Select]
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $start_time = $image_date;
        $now = time();
       
        $total_secs = ($now - $start_time);
        $total_days = intval($total_secs / 86400);       
           
        // Show today image date if uploaded in same day.       
        if ($total_days == 0) {
            return str_replace(array("{uploaded_today_time}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        // Show yesterday image (if upload yesterday).
        } elseif ($total_days == 1) {
            return str_replace(array("{uploaded_yesterday_date}", "{uploaded_yesterday_time}"), array(format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
           
        // Show after 2 days image upload date.
        } elseif ($total_days > 1) {                       
            return str_replace(array("{total_days}", "{uploaded_days_ago_date}", "{uploaded_days_ago_time}"), array($total_days, format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_days_ago']);
               
        // Show invalid date set from image owner or admin (if set after date upload).
        } else {
            $total_days = preg_replace("/[^0-9]+/i", "", $total_days);
            return str_replace(array("{total_days}"), array($total_days), $lang['uploaded_images_near_future']);
        }
    }   
}

// Step 2

Replace full function but with this:

Code: [Select]
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $start_time = $image_date;
        $now = time();
       
        $total_secs = ($now - $start_time);
        $total_days = intval($total_secs / 86400);       
           
        // Show today image date if uploaded in same day.       
        if ($total_days == 0) {
            return str_replace(array("{uploaded_today_time}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        // Show yesterday image (if upload yesterday).
        } elseif ($total_days == 1) {
            return str_replace(array("{uploaded_yesterday_date}", "{uploaded_yesterday_time}"), array(format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
           
        // Show after 2 days image upload date.
        } elseif ($total_days > 1) {                       
            return str_replace(array("{total_days}", "{uploaded_days_ago_date}", "{uploaded_days_ago_time}"), array($total_days, format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_days_ago']);
               
        // Show invalid date set from image owner or admin (if set after date upload).
        } else {
            $total_days = preg_replace("/[^0-9]+/i", "", $total_days);
            return str_replace(array("{total_days}"), array($total_days), $lang['uploaded_images_near_future']);
        }
    }   
}

// Step 3

In lang/english/main.php file,

find:

Code: [Select]
$lang['uploaded_images_today'] = "<b>Today</b> at {uploaded_today_date}";
$lang['uploaded_images_yesterday'] = "<b>Yesterday</b> at {uploaded_yesterday_date}";

add after:

Code: [Select]
$lang['uploaded_images_days_ago'] = "<b>{calc_distant_days} days ago</b> at: {uploaded_days_ago_time}";
$lang['uploaded_images_near_future'] = "<b>{calc_distant_days}</b> day(s) in the near future";

[v1.1 - End upgrade - 01/13/2008]

[v1.2 - Upgrade - 01/13/2008]

Do same thing for v1.1 (replace code in includes/functions.php and admin/functions.php file). Fix and addon. Function is small for same thing now. ;)

Note: I post screenshot. ;)

After - in lang/english/main.php file,

find:

Code: [Select]
$lang['uploaded_images_today'] = "<b>Today</b> at {uploaded_today_date}";
$lang['uploaded_images_yesterday'] = "<b>Yesterday</b> at {uploaded_yesterday_date}";
$lang['uploaded_images_days_ago'] = "<b>{calc_distant_days} days ago</b> at: {uploaded_days_ago_time}";
$lang['uploaded_images_near_future'] = "<b>{calc_distant_days}</b> day(s) in the near future";

replace:

Code: [Select]
$lang['uploaded_images_today'] = "<b>Today</b> at {uploaded_today_time}";
$lang['uploaded_images_yesterday'] = "<b>Yesterday</b> ({uploaded_yesterday_date}) at {uploaded_yesterday_time}";
$lang['uploaded_images_days_ago'] = "<b>{total_days} days ago</b> ({uploaded_days_ago_date}) at {uploaded_days_ago_time}";
$lang['uploaded_images_near_future'] = "<b>{total_days}</b> day(s) in the near future";

Screenshot 1: Today image date.
Screenshot 2: Yesterday image date.
Screenshot 3: If more 2 day upload image date.
Screenshot 4: If image owner or admin is set image date day after today.

[v1.2 - End upgrade - 01/13/2008]

Finish.
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 13, 2008, 11:38:50 AM
I add step 11. Now, is work right. ;)
I fix Step 2.
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 13, 2008, 03:35:49 PM
I code upgrade (fix and addon include). ;)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: kai on January 13, 2008, 04:36:31 PM
Any demo available?
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 13, 2008, 08:44:58 PM
V1.2 - FINAL upgrade ready. ;)
Fix and addon include.
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 20, 2008, 07:40:14 PM
Hallo thunderstrike,

as you know I added this MOD for my dreamboard.
It works fine but just "today" is shown. "yestserday" does not?!? Also in comments and images...

I checked my files two times but it seems ok, like your description...

I Use vers. 1.7.1

 
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 20, 2008, 07:45:25 PM
1 - You install all step (include upgrade) ?
2 - I use fresh 4images v1.74 for test this ...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 20, 2008, 07:58:15 PM
After upgrade:

 "today"- not work
"Yesterday" - ok, work
"days ago" - not work

For me its ok when today and yesterday is working
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 20, 2008, 08:26:37 PM
Quote
"today"- not work
"days ago" - not work

Please check screenshot.

Quote
For me its ok when today and yesterday is working

If install fresh 4images v1.74 in test folder - is work ?
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 20, 2008, 08:33:55 PM
hmm... I have no posibility to test it on 1.7.4 at the monent.
I will try to combine your MOD without upgrate with the upgrade version, because today works in standard and yesterday works with the upgrade version.

However, thank you very much for your help.

 
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 20, 2008, 08:44:07 PM
Is no problem. ;)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 20, 2008, 09:25:16 PM
I made it!


Quote
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $start_time = $image_date;
        $now = time();
       
        $total_secs = ($now - $start_time);
        $total_days = intval($total_secs / 86400);       
           
        // Show today image date if uploaded in same day.       
        if ($total_days == 0) {
            return str_replace(array("{uploaded_today_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        // Show yesterday image (if upload yesterday).
        } elseif ($total_days == 1) {
            return str_replace(array("{uploaded_yesterday_date}", "{uploaded_yesterday_time}"), array(format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
           
        // Show after 2 days image upload date.
        } elseif ($total_days > 1) {                       
            return format_date($config['date_format'] . " " . $config['time_format'], $image_date);
               
        // Show invalid date set from image owner or admin (if set after date upload).
        } else {
            $total_days = preg_replace("/[^0-9]+/i", "", $total_days);
            return str_replace(array("{total_days}"), array($total_days), $lang['uploaded_images_near_future']);
        }
    }   
}

for all 1.7.1 users  :D :D :lol:
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 20, 2008, 09:57:31 PM
What is change in this code ? ...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 20, 2008, 10:23:20 PM
Quote
if (!function_exists('get_universal_field_date')) {
    function get_universal_field_date($image_date) {
        global $lang, $config;
       
        $start_time = $image_date;
        $now = time();
       
        $total_secs = ($now - $start_time);
        $total_days = intval($total_secs / 86400);       
           
        // Show today image date if uploaded in same day.       
        if ($total_days == 0) {
            return str_replace(array("{uploaded_today_date}"), array(format_date($config['time_format'], $image_date)), $lang['uploaded_images_today']);
           
        // Show yesterday image (if upload yesterday).
        } elseif ($total_days == 1) {
            return str_replace(array("{uploaded_yesterday_date}", "{uploaded_yesterday_time}"), array(format_date($config['date_format'], $image_date), format_date($config['time_format'], $image_date)), $lang['uploaded_images_yesterday']);
           
        // Show after 2 days image upload date.
        } elseif ($total_days > 1) {                       
            return format_date($config['date_format'] . " " . $config['time_format'], $image_date);
               
        // Show invalid date set from image owner or admin (if set after date upload).
        } else {
            $total_days = preg_replace("/[^0-9]+/i", "", $total_days);
            return str_replace(array("{total_days}"), array($total_days), $lang['uploaded_images_near_future']);
        }
    }   
}


...and it works - live Demo:
http://www.katzen.ag/board.php (http://www.katzen.ag/board.php)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 20, 2008, 11:04:11 PM
I no see what is in live demo ... but the line you change is no show xx days ago ...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: rinaldos on January 21, 2008, 09:43:56 AM
Hi Thunderstrike,
i installed this MOD, but it seems that is not working perfekt....
When i open my ACP and look what the users last action the calculation doesn't work correct
The last action from one user was yesterday at 18:53 and it was shown today at 18:53. I looked at 09:36. Is ist correct that your MOD calculates 24 from now and not from 00:00am?

Take a look at the screenshot..... the sixt row

(http://rinaldos.homeip.net/grafics/gif/Bildschirmfoto.gif)
Title: @ Thunderstrike
Post by: www.katzen.ag on January 21, 2008, 12:34:06 PM
Yes, xx days ago is not activated. For me it's ok... 8O
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 21, 2008, 02:15:51 PM
Hi Thunderstrike,
i installed this MOD, but it seems that is not working perfekt....
When i open my ACP and look what the users last action the calculation doesn't work correct
The last action from one user was yesterday at 18:53 and it was shown today at 18:53. I looked at 09:36. Is ist correct that your MOD calculates 24 from now and not from 00:00am?

Take a look at the screenshot..... the sixt row

(http://rinaldos.homeip.net/Grafics/gif/Bildschirmfoto.gif)

1 - You install all step in topic (include upgrade) ?
2 - I no get screenshot - is German ...

Quote
Is ist correct that your MOD calculates 24 from now and not from 00:00am?

Is calculate with now time and image date time.

Quote
Yes, xx days ago is not activated. For me it's ok...

If good for you, very good. ;)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: rinaldos on January 21, 2008, 02:24:53 PM
I installed all steps, incl. the upgrade.....
you did not see the gif picture?
Here is the Url for the GIF....

http://rinaldos.homeip.net/Grafics/gif/Bildschirmfoto.gif

Then you look at the username elefant. The User logged in yesterday (Gestern) at 18:43 and not today (Heute) at 18:43. I take this screenshot today at 09:26 .... I think the time calculation did not work perfectly.....
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 21, 2008, 02:35:55 PM
Quote
you did not see the gif picture?
Here is the Url for the GIF....

http://rinaldos.homeip.net/Grafics/gif/Bildschirmfoto.gif

Again, is German picture. Please post english.

Quote
Then you look at the username elefant. The User logged in yesterday (Gestern) at 18:43 and not today (Heute) at 18:43. I take this screenshot today at 09:26 .... I think the time calculation did not work perfectly.....

Hum ... ok I post screenshot for profile. If check this, is say 20 days for register and last activity for today. This is right day of now and register time ... is GMT time of server good ?
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: rinaldos on January 21, 2008, 02:47:09 PM
Time of Server is OK, the server work on GMT +1 (CET)

The Registration Date and activity time works ok, but the word TODAY (HEUTE) is wrong. It should be yesterday, because the last activity from the user was yesterday at 18:53 not today (heute) at 18:53. Today at 18:53 is future. How could an activity displayed that happend in Future  :wink:
I hope you understand my problem :-)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 21, 2008, 02:49:02 PM
Ok ... is how work.

Yesterday at 18:53, you upload picture. If today is no 18:53, is say today . Now, start of 24 hour (18:53 next day) - is say yesterday . ;)
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: rinaldos on January 21, 2008, 03:02:12 PM
Ok, the calculating works TODAY= from now minus  24hours. Yesterday = NOW minus 24:01hours?

Is it possible to change that today is 00:01am up to NOW and yesterday is everything later than 23:59 pm?
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 21, 2008, 03:07:46 PM
Quote
Ok, the calculating works TODAY= from now minus  24hours. Yesterday = NOW minus 24:01hours?

Today is correct but no right for yesterday. Yesterday is work = 24 hours after (24:00) and before 48 hours. After 48 hours, is say xx days ago ...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 22, 2008, 04:30:16 PM
I have the same problem:

For example, when yesterday a Pic uploaded 21.01.2007 at 22:00h then the next day e.g 15:00h still shows "today". Ok, it's newer than 24 ours but it's not "today" it should show "yesterday" although is not older than 24 ours - isn't it?

Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 22, 2008, 05:02:42 PM
I have the same problem:

For example, when yesterday a Pic uploaded 21.01.2007 at 22:00h then the next day e.g 15:00h still shows "today". Ok, it's newer than 24 ours but it's not "today" it should show "yesterday" although is not older than 24 ours - isn't it?

http://www.4homepages.de/forum/index.php?topic=20160.msg109824#msg109824
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 22, 2008, 07:22:53 PM
Yes. I have been read the threats before. In my opinion this MOD confusing my members (and me!).
If a picture is uploaded at 23:59h and I look at 00:01h it should show "yesterday"

All my MOD's which installed are working logical... this MOD does not.
Especial in Dreamboard this is not useable...this is my opinion.
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: mawenzi on January 22, 2008, 10:47:46 PM
@ www.katzen.ag
... ich kann deine Meinung absolut verstehen und teilen ...
... und das für den Aufwand der Änderung in ... ich glaube ... 11 Dateien ...
... der zunächst versprochene und scheinbar attraktive Effekt wird nicht erzielt ...
... im Gegenteil ... nur Verwirrung entsteht über die Tatsächliche Datumslage ...
... gestern beginnt nun mal  ab 24:00 ...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 22, 2008, 11:22:17 PM
Hallo Mawenzi,

das ist es was ich versuche Thunderstike zu erklären. Aber er möchte offensichtlich keine Korrekturen vornehmen.
Naja, werde den MOD eben wieder rausschmeissen....vieleicht hat ja an Anderer mal Lust sich dieser Sache anzunehmen...

Grüße
KatzenAG

Title: Re: [MOD] - Universal field date - gallery and admin
Post by: rinaldos on January 23, 2008, 12:02:14 AM
Ich habe den MOD auch wieder entfernt. Schade eigentlich. Ich habe die Zeitberechnung nicht hinbekommen, aber vielleicht schafft es ja ein anderer :-)


Gruß
Ingo
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: thunderstrike on January 23, 2008, 03:39:43 AM
You no like MOD - please no install it. I work hard and FREE for this publish. Again, no complain for something FREE !

@www.katzen.org & Mawenzi:

If get better version - code it :!:
Offlist for support.

@Nicky & Kai:

No more FREE MODs !
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: www.katzen.ag on January 23, 2008, 08:05:50 AM
Sounds really unfriendy. A free Mod is noththing without support...

Thanks...
Title: Re: [MOD] - Universal field date - gallery and admin
Post by: mawenzi on January 23, 2008, 10:29:26 AM
@ thunderstrike
... "Offlist for support" ... "No more FREE MODs !" ...
... what is your problem ... with this statement ...  :?  :roll:  :?
... nobody can give you a hint for your MODs ...
... and what about all your hints / fixes to other MODs ...
... my god ... be not a child ...

P.S : please give us a link to your paid MODs ... ;)