[geeklog-cvs] Geeklog-1.x/system/classes story.class.php, 1.26, 1.27

Dirk Haun dhaun at qs1489.pair.com
Sat May 24 15:46:15 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/system/classes
In directory qs1489.pair.com:/tmp/cvs-serv10520/system/classes

Modified Files:
	story.class.php 
Log Message:
Let the DB server do the conversion of a story's date and time to ensure compatibility with the "timezone hack" (bug #0000639)


Index: story.class.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/classes/story.class.php,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** story.class.php	3 May 2008 19:04:08 -0000	1.26
--- story.class.php	24 May 2008 19:46:13 -0000	1.27
***************
*** 619,624 ****
  
          /* Format dates for storage: */
!         $this->_date = date('Y-m-d H:i:s', $this->_date);
!         $this->_expire = date('Y-m-d H:i:s', $this->_expire);
  
          // Get the related URLs
--- 619,631 ----
  
          /* Format dates for storage: */
!         /*
!          * Doing this here would use the webserver's timezone, but we need
!          * to use the DB server's timezone so that ye olde timezone hack
!          * still works. See use of FROM_UNIXTIME in the SQL below.
!          *
!          * $this->_date = date('Y-m-d H:i:s', $this->_date);
!          * $this->_expire = date('Y-m-d H:i:s', $this->_expire);
!          *
!          */
  
          // Get the related URLs
***************
*** 637,641 ****
                  $varname = '_' . $fieldname;
                  $sql .= $fieldname . ', ';
!                 $values .= '\'' . addslashes($this->{$varname}) . '\', ';
              }
          }
--- 644,653 ----
                  $varname = '_' . $fieldname;
                  $sql .= $fieldname . ', ';
!                 if (($fieldname == 'date') || ($fieldname == 'expire')) {
!                     // let the DB server do this conversion (cf. timezone hack)
!                     $values .= 'FROM_UNIXTIME(' . $this->{$varname} . '), ';
!                 } else {
!                     $values .= '\'' . addslashes($this->{$varname}) . '\', ';
!                 }
              }
          }




More information about the geeklog-cvs mailing list