Welcome to Geeklog Saturday, October 21 2017 @ 10:04 am EDT


Status: offline

Sticks

Forum User
Newbie
Registered: 11/11/2004
Posts: 4
Location:Melbourne, Australia
Further investigation found this bug report for apache and PHP which is very relevant to this timezone hack.

config.php uses:

$_CONF['timezone'] = 'Australia/Melbourne';


lib-common.php uses:

if( !empty( $_CONF['timezone'] ) && !ini_get( 'safe_mode' ) &&
function_exists( 'putenv' )) {
putenv( 'TZ=' . $_CONF['timezone'] );
}


The bugzilla report states:

Remember that the TZ variable is global to the process. If a mod_perl
or PHP script sets that variable, it will I think affect logs written
out by Apache in the future.


Maybe telling Geeklog to use TZ as it's variable isn't a smart thing to do given it's frelling up logging!?!!

--- Sticks

zapatoes

Anonymous
sad
Quote by Anonymous: How do I tell if I'm in safe mode?


I can't find the "safe mode=on" location Please help!

zapatoes

Anonymous
excited
It worked with{timezone} = PST8PDT! Thanks everyone!

Check out our site: renoimc.org

six mix

Anonymous
How do I know if I'm in safe mode?

Status: offline

r_f_o_t

Forum User
Full Member
Registered: 30/07/2003
Posts: 241
Location:Illinois
Quote by six mix: How do I know if I'm in safe mode?

Create a file named something like info.php with this in it.
PHP Formatted Code
<?php phpinfo(); ?>
 

Upload it to your server and call it with your browser. (Like http://www.example.com/info.php) That will give you all kinds of info, including if safe mode is on or off.

HTH,

Chuck
Too many hands on my time.

Status: offline

b.raven

Forum User
Newbie
Registered: 14/01/2005
Posts: 14
Location:Los Angeles
Mine works now just 15min SLOW but closer than it was! thanks!

Status: offline

Porkchop

Forum User
Newbie
Registered: 16/05/2005
Posts: 4
Awesome... I can confirm this works just as originally posted on GL 1.3.11

-Porkchop
www.squalidlittlehobo.com
.:.Porkchop.:. www.squalidlittlehobo.com

Status: offline

nightshadow

Forum User
Newbie
Registered: 19/12/2004
Posts: 8
Location:Brisbane, AU
I applied the timezone hack, both parts as per page 1 and set it to EST -25hrs with australia/brisbane.
it works perfectly fine on the site and date / time is displayed correctly.
My syndicated feed on livejournal displays the wrong time date etc (~14 hrs off).
any ideas on how to overcome this?
my timezone is GMT+10, the server resides in netherlands i think.

Scootertaj

Anonymous
cheerful
Works perfectly! And exactly what I was looking for

Status: offline

IanKorman

Forum User
Newbie
Registered: 25/07/2005
Posts: 1
This hack is awesome. Just what I was looking for!! You rock Sticks!!

Name1

Anonymous
Worked perfectly for me, THankyou
Make sure you don't ever use cpanel's text editor

Aleem

Anonymous
cheerful
This was a great hack. It worked for me.

Thanks to the person who came up with it and I'd also like to take the opportunity to thank the great guys who came up with Geeklog in the first place.

Status: offline

geekmom

Forum User
Newbie
Registered: 10/02/2006
Posts: 2
Quote by tobymiller: That's it, change the timezone property to the one you want and you're done. I'm running v1.3.9sr1.


This worked like a charm. I had a prompt to put the hack on the config.php page, but placed it below the prompt and went nuts trying to figure out why it didn't work.

Toby's clear cut instructions did the trick!

Thanks

AcidReign

Anonymous
Quote by Joe: I think I found the issue with changing timezones and the story edit not working properly.

On line 910, I changed the DB_save call a little. Instead of storing $date, I changed it to FROM_UNIXTIME($unixdate).

That seemed to solve the issue with having a different time after a story is stored.


I actually found that the reason this works, because loggically it shouldn't as you're theoretically still using the same date. However you are not, some code above this actually changes $unixdate and updates it to the current value returned by time()

PHP Formatted Code

        $date = date("Y-m-d H:i:s",$unixdate); #### here $date is set from $unixdate

        if (empty($hits)) {
            $hits = 0;
        }

        // Get draft flag value
        if ($draft_flag == 'on') {
            $draft_flag = 1;
        } else {
            $draft_flag = 0;

            // OK, if this story was already in the database and the user
            // changed this from a draft to an actual story then update the
            // date to be now
            if (DB_count($_TABLES['stories'],'sid',$sid) == 1) {
                if (DB_getItem($_TABLES['stories'],'draft_flag',"sid = '$sid'") == 1) {
                    $unixdate = time(); #### here it is changed
               }
            }
        }

 

so a better fix is to move the assignment to $date below this code block, in theory anyway. I haven't fully tested this out yet.

AcidReign

Anonymous
Quote by Sticks:
Maybe telling Geeklog to use TZ as it's variable isn't a smart thing to do given it's frelling up logging!?!!


one option is to try this:
PHP Formatted Code

if( !empty( $_CONF['timezone'] ) && !ini_get( "safe_mode" ) ) {
        register_shutdown_function( create_function( '$tz', 'putenv( "TZ=".$tz );' ), getenv( "TZ" ) );
        putenv( "TZ=" . $_CONF['timezone'] );
}

 

Levi

Anonymous
Parse error: syntax error, unexpected T_DEC, expecting T_VARIABLE or '$' in /home/eighty/public_html/portal/config.php on line 287

How do I fixed this error?

Thanks

Wealthykitty

Anonymous
Hi,

I was also following the instructions to change the time zone, but i got the following errors:

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/o/r/morelook/html/geeklog/config.php:1753) in /home/content/m/o/r/morelook/html/geeklog/system/lib-sessions.php on line 311

Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/o/r/morelook/html/geeklog/config.php:1753) in /home/content/m/o/r/morelook/html/geeklog/public_html/lib-common.php on line 811

May I ask why this happens, and how I can resolve the issues, as I urgently need to change the timezone?

Thanks.

Status: offline

jmucchiello

Forum User
Full Member
Registered: 29/08/2005
Posts: 985
Quote by Wealthykitty:Warning: Cannot modify header information - headers already sent by (output started at /home/content/m/o/r/morelook/html/geeklog/config.php:1753) in /home/content/m/o/r/morelook/html/geeklog/system/lib-sessions.php on line 311
What's on line 1753 of config.php? I'm guessing you have extra spaces or line break after the ?> tag. Check the FAQ: Cannot modify header information - headers already sent by ...

moscow

Anonymous
I had a slightly different problem to most here, though related!

As I'm in the UK, display of time should be in GMT. So I used the two hacks given at the start of this thread (the timezone in config.php and the hack to lib-common). This gave me corrected time display in the browser - well, almost - it still does not show the AM/PM, but that is another story - and also gave correct timestamp to saved stories in the database.

For some reason, though - perhaps becuase my ISP is only running php 4.4.4, and not 5 - these hacks made no difference to my other problem. The NOW() used by MySQL in the database queries is still on Mountain Time, but the data is GMT! So any new stories I put up do not appear for six hours, unless I hack the story and back up the saved time.

This change to my \system\databases\mysql.class.php file - as the top lines within the function dbQuery(). Mine now reads (around line 254):

function dbQuery($sql,$ignore_errors=0)
{
$tempsql = str_replace('NOW()',"'". gmdate('Y-m-d H:i:s', time()) . "'", $sql);
$sql = $tempsql; ........

Once that had been uploaded, any story I post is now immediately available.

There are probably drawbacks elsewhere from this hack, but I noted that the MSSQL class had some replacement texts for NOW(), so I though that this one might just work; and it did. (There is probably also a simpler way to do this code, but I couldn't think of one.)

Hope this helps someone else, though I don't know what you do if you aren't on GMT.
:banana:

HELP ME....

Anonymous
angry
I've tried following these instructions but i'm having no luck... this is a PITA!

Can someone please explain how I change the timezone?

I am using Geeklog 1.4

All times are EDT. The time is now 10:04 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content