PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
geoff_bell
Hangin' Around


Joined: Dec 07, 2006
Posts: 41

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

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
persona_non_grata



Joined:
Posts: 0

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

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


Joined: Dec 07, 2006
Posts: 41

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

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.
View user's profile Send private message
persona_non_grata



Joined:
Posts: 0

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

mmm, your on nuke-evolution ?
View user's profile Send private message
geoff_bell
Hangin' Around


Joined: Dec 07, 2006
Posts: 41

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

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.
View user's profile Send private message
persona_non_grata



Joined:
Posts: 0

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

but its a bit unclear...
you tried your posted code or not realy sure how to do that / edit it....
View user's profile Send private message
geoff_bell
Hangin' Around


Joined: Dec 07, 2006
Posts: 41

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

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.
View user's profile Send private message
persona_non_grata



Joined:
Posts: 0

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

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.
View user's profile Send private message
kguske
Site Admin


Joined: Jun 04, 2004
Posts: 4980

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

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?
View user's profile Send private message
geoff_bell
Hangin' Around


Joined: Dec 07, 2006
Posts: 41

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

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 to the forums!
)

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.
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum