Page 1 of 1

[Solved] Expiration Date in News articles causes error?

Posted: Tue Apr 23, 2013 7:12 am
by pwg
Hi,

I am having a problem on a clients site, where if they use the Expiration Date checkbox in the News module, when you click on the article, it can't be found and the error page loads.

However if the Expiration Date checkbox is left unchecked, all is well and good.

System info below, I ran Checksum, and errors below resulted, however all files are on the server (I uploaded new ones just in case).

/admin/eventhandlers.php
/tmp/cache/index.html
/tmp/templates_c/index.html


Anyone with any ideas?


Cms Version: 1.11.6

Installed Modules:

CMSMailer: 5.2.1
FileManager: 1.4.3
MenuManager: 1.8.5
ModuleManager: 1.5.5
News: 2.12.12
CGSimpleSmarty: 1.6.1
Search: 1.7.8
ThemeManager: 1.1.8
TinyMCE: 2.9.12
FormBuilder: 0.5.12
simpletagging: 0.2.1
RSS: 1.1
CGBlog: 1.9.12
Comments: 1.9.2
Album: 0.9.3
CGExtensions: 1.32.6
CGFeedMaker: 1.0.17
Play: 1.0.3
DewPlayer: 0.2.1
avplayer: 1.0
FLVPlayer: 1.0.3
Twitter: 0.0.6
Backup: 0.5
CMSPrinting: 1.0.4
MicroTiny: 1.2.5

Config Information:

php_memory_limit:
process_whole_template:
output_compression:
max_upload_size: 50000000
url_rewriting: mod_rewrite
page_extension:
query_var: page
image_manipulation_prog: GD
auto_alias_content: true
locale:
default_encoding: utf-8
admin_encoding: utf-8
set_names: true

Php Information:

phpversion: 5.3.17
md5_function: On (True)
gd_version: 2
tempnam_function: On (True)
magic_quotes_runtime: Off (False)
E_STRICT: 0
E_DEPRECATED: 0
memory_limit: 64M
max_execution_time: 30
output_buffering: 4096
safe_mode: Off (False)
file_uploads: On (True)
post_max_size: 50M
upload_max_filesize: 50M
session_save_path: /tmp (1777)
session_use_cookies: On (True)
xml_function: On (True)
xmlreader_class: On (True)

Server Information:

Server Api: cgi-fcgi
Server Db Type: MySQL (mysqli)
Server Db Version: 5.1.63
Server Db Grants: Found a "GRANT ALL" statement that appears to be suitable

Thanks for any help.

Re: Expiration Date in News articles causes error?

Posted: Tue Apr 23, 2013 9:10 am
by staartmees
Did you set the correct TimeZone in your config.php?

Re: Expiration Date in News articles causes error?

Posted: Tue Apr 23, 2013 3:05 pm
by calguy1000
Expiration dates in the News module do work (tested them just a few days ago).

However: The timezone in the config.php has to match the timezone of the SERVER not where you think that most of your users may come from. Also, all times entered are wrt the server. This applies to all modules that have date dependant data. Unfortunately this means if you are building a website that uses News Expiry (or a blog or calendar module) for a local club or organization you should probably host it on a server that is in the same timezone as that club and organization. CMSMS has no capability to convert date data back and forth between a users timezone and server timezone..

When a URL comes in that represents an expired News article (or if the article is not available for display yet according to server time) a 404 error is generated. This is the intent.

Re: Expiration Date in News articles causes error?

Posted: Tue Apr 23, 2013 10:39 pm
by pwg
Thanks so much for the replies.

I can see that I now need to alter my config file, as it is set to the clients time-zone (Australia/Sydney) whilst the server is set to GMT.

I just tested using $config['timezone'] = 'Etc/GMT'; and the Expiration date works.

Just checking on my hosting site, and they have some script to customise timezones.

See below.

<?
echo "Original Time: ". date("h:i:s")."\n";
putenv("TZ=Australia/Sydney");
echo "New Time: ". date("h:i:s")."\n";
?>

Do you think this would work? And where would I install it?

Thanks again for any help.

Cheers,

Paul

Re: Expiration Date in News articles causes error?

Posted: Tue Apr 23, 2013 11:43 pm
by calguy1000
Unfortunately that will not work either as that does not effect date comparisons done on the database itself... like

SELECT News.id FROM News where start_date > NOW();