Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-02-13 23:39:29

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Article Posted & Expires oddities

Hi,

I’ve been mucking around with article posted & expires timestamps & have noticed some odd behaviour. Can’t find it mentioned anywhere else, so here goes.

Invalid Posted date/time:

  • 4.4.1 & the latest dev (r3636) – article not posted, changes lost, ‘invalid_postdate’ error message (missing language string)

- something along the lines of “Invalid posted date/time” might be suitable? But see below regarding losing other article changes.

Invalid Expires date/time:

  • 4.4.1 – article posted, no error message, invalid expires date/time ignored (& reset to blanks)
  • r3636 – article not posted, changes lost, “Error: Article expires before post date” error message

- a correct error message would be helpful: “Invalid expires date/time”, but the behaviour in r3636 results in all other changes (body, title etc) to the article being lost

I wouldn’t like to make a lot of changes to an article only to lose them by entering a dodgy date/time. Could there be a move to the 4.4.1 “invalid expires” behaviour but with additional messages – “Article posted but invalid posted date/time ignored”, “Article posted but invalid expires date/time ignored”? And then the article could be saved with the invalid date/times restored to their old values.

Interestingly, publishing a new article with invalid date/times doesn’t result in you losing everything – the article’s not posted but the data is still on the screen. But again the behaviour is different:

  • 4.4.1 – the invalid date/times are restored (posted) or set to blanks (expires)
  • r3636 – date/time set to 1970-01-01 10:00:00

Adi

Offline

#2 2012-02-16 07:04:22

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Article Posted & Expires oddities

Please try r3640.

Offline

#3 2012-02-16 09:10:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Article Posted & Expires oddities

Hi Robert,

Thanks for that. All seems to be OK, except the italics:

  • if you “reset to now” the posted date, which then causes it to go after the expiry date:
    • the article changes are taken (very good)
    • “Error: Article expires before post date” message generated (perfect)
    • the new posted (later than expiry) date is saved (er, not sure about that)
  • setting the date/time to all blanks:
    • blank expires date is saved (perfect)
    • blank posted date generates “invalid_postdate” message (perfect)
  • setting the date/time to all zeroes:
    • zeroed expires date is blanked out (fair enough)
    • zeroed posted date saved as 1999-11-30 00:00:00 (this happens in 4.4.1 as well, so not sure if it’s an issue or not)

Offline

#4 2012-02-16 09:20:43

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Article Posted & Expires oddities

gomedia wrote:

** zeroed posted date saved as 1999-11-30 00:00:00 (this happens in 4.4.1 as well, so not sure if it’s an issue or not)

This is a funny side effect of how PHP parses date strings. See, literally “00-00-00” is the day and month before 2000-01-01, i.e. 1999-11-30. I’m not sure either what to make of this.

Offline

#5 2012-02-16 11:30:05

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Article Posted & Expires oddities

Change set r3641 similarly improves timestamp behaviour for the initial article post.

Offline

#6 2012-02-16 22:32:00

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Article Posted & Expires oddities

Thanks for the update, here’s a summary of what I’m currently seeing:

New article Edit existing article
Invalid posted timestamp error message & posted set to 1970-01-01 10:00:001 error message & original timestamp restored
Invalid expires timestamp error message & expires set to 1970-01-01 10:00:002 error message & expires set to blanks
All-zeroes posted timestamp article saved & posted set to 1999-11-30 00:00:003 article saved & posted set to 1999-11-30 00:00:003
All-zeroes expires timestamp article saved & expires set to blanks article saved & expires set to blanks
All-blanks posted timestamp error message & posted set to now error message & original timestamp restored
All-blanks expires timestamp expires left blank expires left blank
Set posted date to after expires error message & article not saved error message, article (& later posted timestamp) saved4
Set expires date to before posted error message, (too early) expires left in place, article not saved error message, original expires restored, article saved

Some suggestions:

1 – set posted to “now” not 1970
2 – set expires to “blanks” not 1970
3 – ignored the all-zeroes, generate “invalid_postdate” message & set to “now” (new article) or restore original timestamp (existing article)
4 – restore original posted timestamp to avoid articles being saved with posted > expires

Maybe I’m being too picky with 1-3 (I’ll let you decide) … but number 4 is possibly of more concern.

Offline

#7 2012-02-17 11:22:13

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,330
Website Mastodon

Re: Article Posted & Expires oddities

gomedia wrote:

but number 4 is possibly of more concern.

A different yet valid concern: The user gives us two timestamps and we do not what she really intends. Thus we cannot assume that ‘posted’ is in error and ‘expires’ is correct. She might just have got the posted date right and forgot to adjust the expiry year, and then we throw away her carefully chosen new posting date.

Offline

#8 2012-02-17 23:32:47

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Article Posted & Expires oddities

wet wrote:

A different yet valid concern: The user gives us two timestamps and we do not what she really intends. Thus we cannot assume that ‘posted’ is in error and ‘expires’ is correct. She might just have got the posted date right and forgot to adjust the expiry year, and then we throw away her carefully chosen new posting date.

The system can only act on what’s submitted by the user – so to try and second-guess the user’s intentions & attempt to not hurt her feelings is futile.

My concern is that we are now allowing the database to be populated with articles that have posted > expires timestamps.

Besides, 4.4.1 doesn’t allow you to reset or change the posted timestamp to be after expires. And neither 4.4.1 nor r3641 allow you to post a new article with posted>expires.

Offline

#9 2015-06-28 01:05:17

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Article Posted & Expires oddities

Nudge for missing language string.

Offline

#10 2015-06-28 10:41:35

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,259
GitHub

Re: Article Posted & Expires oddities

Missing language string PR raised: github.com/textpattern/textpacks/pull/78

Offline

Board footer

Powered by FluxBB