Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro
Author Message
geoff_bell
Hangin' Around



Joined: Dec 07, 2006
Posts: 41

PostPosted: Fri Dec 08, 2006 7:10 am Reply with quote

from faq

Quote:
· How do I adjust the server time for News articles?
In mainfile.php, find the function formatTimestamp(). Assuming it resembles this code

function formatTimestamp($time) {
global $datetime, $locale;
setlocale (LC_TIME, $locale);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2})Sad[0-9]{1,2})Sad[0-9]{1,2})", $time, $datetime);
$datetime = strftime(""._DATESTRING."", mktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
$datetime = ucfirst($datetime);
return($datetime);
}

Modify it to this. Note the -15? That is the number of hours to offset the timestamp.

function formatTimestamp($time) {
global $datetime, $locale;
setlocale (LC_TIME, $locale);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2})Sad[0-9]{1,2})Sad[0-9]{1,2})", $time, $datetime);
$datetime = strftime(""._DATESTRING."", mktime(($datetime[4]-15),$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]));
$datetime = ucfirst($datetime);
return($datetime);
}


i am looking to add six hours to the time shown on news articles. i have managed to change the timezone courtesy of a search through these forums, but can't seem to find where to add hours/minutes onto the server time.

i think this is the part of the mainfile.php i need to change
Code:
// Beta 3 code by Quake 08/19/2005

// Written for Nuke-Evolution and Nuke Patched
function formatTimestamp($time) {
    global $datetime, $locale;
    setlocale(LC_TIME, $locale);
    if (!is_numeric($time)) {
        preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/', $time, $datetime);
        $time = gmmktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]);
    }
    $time -= date("Z");
    $datetime = strftime(_DATESTRING, $time);
    $datetime = ucfirst($datetime);
    return $datetime;
}
 
View user's profile Send private message
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Fri Dec 08, 2006 8:40 am Reply with quote

mmm,have you read this... [ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message
geoff_bell







PostPosted: Fri Dec 08, 2006 3:47 pm Reply with quote

firstly, thanks for replying.

it's the second batch of code that's in my mainfile.php. the link you quoted does not contain code in my file.
 
hitwalker







PostPosted: Fri Dec 08, 2006 6:08 pm Reply with quote

mmm, your on nuke-evolution ?
 
geoff_bell







PostPosted: Fri Dec 08, 2006 6:37 pm Reply with quote

nope. ravennuke.

the original fix might relate to the original phpnuke, but not after the various patches that raven et al have applied.

it's no big thing anyway. it's just that after being able to change the timezone to something more at home (i live in gmt-land, the server is in cst-land) it would have been nice to have the time i posted a story reflected with the timestamp.

i was just thinking that if a "fix" was found, then it would be great for anybody who really needs to have an acurate timestamp.
 
hitwalker







PostPosted: Fri Dec 08, 2006 6:42 pm Reply with quote

but its a bit unclear...
you tried your posted code or not realy sure how to do that / edit it....
 
geoff_bell







PostPosted: Fri Dec 08, 2006 7:04 pm Reply with quote

the quote containing the code is lifted directly from the faq about changing the timestamp.

the code under "i think this is the part of the mainfile.php i need to change" is what i think i have to change in my mainfile.php, but i have no idea what to change in it. i've tried a few things, but i think the "gmmktime" must mean someting different in php to "strftime" and knocks the fix for whack.
 
hitwalker







PostPosted: Fri Dec 08, 2006 7:31 pm Reply with quote

well strftime is a stringformat that works with local and gmmktime gets a unix timestamp.
maybe if you search on php.net it might help a bit..
i tried a few edits on my testsite but end up with the same time.
 
kguske
Site Admin



Joined: Jun 04, 2004
Posts: 6432

PostPosted: Sat Dec 09, 2006 5:52 am Reply with quote

Remember that your user time is defined on your profile. Unless you change the time stored in the database for when the article was written, the time for a story is relative to your user profile time.

If it's just the news articles you want to change, I'd suggest looking into the news admin function for approving and creating stories and add 6 hours (in seconds) before updating or inserting.

Are you using the standard news in RavenNuke?

_________________
I search, therefore I exist...
nukeSEO - nukeFEED - nukePIE - nukeSPAM - nukeWYSIWYG
 
View user's profile Send private message
geoff_bell







PostPosted: Sat Dec 09, 2006 6:13 am Reply with quote

found it! i knew it was a matter of adding either the difference in minutes or hours somewhere in the mainfile.php, but was unable to find anywhere that said how/where to do it to the nuke-evolution/nuke patched mainfile.php

after failed searching on a number of my fave nuke forums, i found the answer here ( [ Only registered users can see links on this board! Get registered or login! ] )

find:
Code:
$time = gmmktime($datetime[4],$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]);

remplace with
Code:
$time = gmmktime($datetime[4]+6,$datetime[5],$datetime[6],$datetime[2],$datetime[3],$datetime[1]);

where +6 is the difference in hours between your local time and that of the server.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> Raven's RavenNuke(tm) v2.00.00 - v2.02.00 Distro

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 ©