Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x
Author Message
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1772

PostPosted: Tue May 01, 2012 1:59 pm Reply with quote

hey!

The following date string for the autonews is not stored correctly as timestamp in the database.

File: modules/News/admin/index.php

check in function postAdminStory and function postStory:

Code:
$date = $year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';


the correct string is:

Code:
$date = ''.$year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';


Wink


Last edited by neralex on Thu May 03, 2012 1:50 pm; edited 2 times in total 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Wed May 02, 2012 5:45 pm Reply with quote

I haven't tried this, and maybe I'm missing something, but I'm not seeing how that change does anything different.
 
View user's profile Send private message Visit poster's website
neralex







PostPosted: Wed May 02, 2012 5:54 pm Reply with quote

if you use the first version, then the date string was not stored correctly.

stored: 2012-05-01 021:06:3
correct: 2012-05-01 21:06:30

i suspect it is on the field type of column in the database. it is not at all a datetime column type. if you stored a submit news, you have a timestamp as varchar, in the stories table you have a datetime field. i know this issue from old php nuke version. it was the same crazy thing. Smile
 
spasticdonkey







PostPosted: Wed May 02, 2012 9:46 pm Reply with quote

ok that makes sense and good find Smile
 
fkelly
Former Moderator in Good Standing



Joined: Aug 30, 2005
Posts: 3312
Location: near Albany NY

PostPosted: Thu May 03, 2012 9:20 am Reply with quote

I'm not following, sorry. The way dates are stored in the autonews, queue and stories tables is crazy, I will concede that. The stories table has a time field, which is datetime datatype. That's as it should be I think. The queue table, which stores news articles submitted through submit news has a field called timestamp which is also in datetime format. Aside from naming confusion, that's okay. The autonews table, which stores news articles that are "programmed" to be effective at a future time, uses a varchar(19) field named time. 19 characters works out to be just the right number to store a datetime field but the field type should really be datetime.

I noticed a few other errors popping up on my localhost when I was testing but I was unable to replicate the problem with date format you posted, either for an article created as autonews or for one created through submit news.

I've sat here parsing mentally,

$date = $year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';

versus

$date = ''.$year.'-'.$month.'-'.$day.' '.$hour.':'.$min.':00';

The second of which you said is correct. I don't see why we'd put quote marks in front the .$year???

We could put out fires with this horrible code until the cows come home but what we really need to do is start over with news. We don't need a whole module for submit news nor do we need separate tables for the queue and for autonews. We need a field in the stories table that tells us that the story is pending administrative approval and thus should be skipped in news/index.php and anything else that displays stories for users. And we need an effective (starting) date for stories and again anything displaying stories for users would just use a beginning date in the SQL that is >= to the starting date. Not to mention that we don't need separate functions for adminstory, autoedit, autosavedit, changestory, displaystory, editstory, previewadminstory and previewstory, to name just some. I think the original author must have been getting paid by the line of code produced and the result is a maintenance nightmare.
 
View user's profile Send private message Visit poster's website
neralex







PostPosted: Thu May 03, 2012 1:47 pm Reply with quote

ok i have checked my variables and you have fully right, fkelly! there was an error of the order of my variables that i give over into the function.

so we let the cow in the village Smile

with the functions and tables of the news module you have fully right, too. its a good idea to put all in one table. but its a hard work to refresh this "maintenance nightmare".
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> RavenNuke(tm) v2.5x

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©