# HG changeset patch # User Dan # Date 1260650676 18000 # Node ID c0e0a1787a635b2ad00f8ec4e05479c1f57cdfe0 # Parent e154e8176700a574bf51c8e3c5c9e63ff9eef4a2# Parent a1cca4472a5867900de1c66925b1dce7a502da8c Re-merge changes from a2hosting dev diff -r e154e8176700 -r c0e0a1787a63 includes/functions.php --- a/includes/functions.php Fri Dec 11 17:11:47 2009 -0500 +++ b/includes/functions.php Sat Dec 12 15:44:36 2009 -0500 @@ -348,10 +348,34 @@ // are we in DST? global $dst_params; + $dst_offset = 0; if ( check_timestamp_dst($timestamp, $dst_params[0], $dst_params[1], $dst_params[2], $dst_params[3]) ) { // offset for DST $timestamp += ( $dst_params[4] * 60 ); + $dst_offset = $dst_params[4]; + } + + // Does this date string include a timezone? If so, gmdate() will report UTC, which is wrong + // FIXME This is kind of a halfass replacement... + foreach ( array('e', 'T', 'O', 'P') as $char ) + { + if ( ($pos = strpos($string, $char)) !== false ) + { + if ( $string{ $pos - 1 } != '\\' ) + { + // add in our own timezone string + // FIXME: l10n? (do we need to? does anyone really not know what "GMT" means? even uglier escaping?) + $tzi = '\\G\\M\\T'; + $tzo = $timezone + $dst_offset; + $sign = $tzo > 0 ? '+' : '-'; + $tzi .= $sign . (intval(abs($tzo / 60))); + if ( $tzo % 60 ) + $tzi .= sprintf(":%02d", abs($tzo) % 60); + + $string = substr($string, 0, $pos) . $tzi . substr($string, $pos + 1); + } + } } // Let PHP do the work for us =) diff -r e154e8176700 -r c0e0a1787a63 includes/sessions.php --- a/includes/sessions.php Fri Dec 11 17:11:47 2009 -0500 +++ b/includes/sessions.php Sat Dec 12 15:44:36 2009 -0500 @@ -3488,10 +3488,11 @@ /** * For the given code ID, returns the correct CAPTCHA code, or false on failure * @param string $hash The unique ID assigned to the code + * @param bool If true, the code is NOT deleted from the database. Use with caution! * @return string The correct confirmation code */ - function get_captcha($hash) + function get_captcha($hash, $nodelete = false) { global $db, $session, $paths, $template, $plugins; // Common objects @@ -3517,7 +3518,10 @@ list($code_id, $code) = $db->fetchrow_num(); $db->free_result(); - $this->sql('DELETE FROM ' . table_prefix . "captcha WHERE code_id = $code_id;"); + + // delete it + if ( !$nodelete ) + $this->sql('DELETE FROM ' . table_prefix . "captcha WHERE code_id = $code_id;"); return $code; } diff -r e154e8176700 -r c0e0a1787a63 install/schemas/mysql_stage2.sql --- a/install/schemas/mysql_stage2.sql Fri Dec 11 17:11:47 2009 -0500 +++ b/install/schemas/mysql_stage2.sql Sat Dec 12 15:44:36 2009 -0500 @@ -116,7 +116,7 @@ user_registration_ip varchar(39), user_rank int(12) UNSIGNED DEFAULT NULL, user_rank_userset tinyint(1) NOT NULL DEFAULT 0, - user_timezone int(12) UNSIGNED NOT NULL DEFAULT 0, + user_timezone int(12) UNSIGNED NOT NULL DEFAULT 1440, user_title varchar(64) DEFAULT NULL, user_group mediumint(5) NOT NULL DEFAULT 1, user_dst varchar(11) NOT NULL DEFAULT '0;0;0;0;60', diff -r e154e8176700 -r c0e0a1787a63 install/schemas/postgresql_stage2.sql --- a/install/schemas/postgresql_stage2.sql Fri Dec 11 17:11:47 2009 -0500 +++ b/install/schemas/postgresql_stage2.sql Sat Dec 12 15:44:36 2009 -0500 @@ -116,7 +116,7 @@ user_registration_ip varchar(39), user_rank int DEFAULT NULL, user_rank_userset smallint NOT NULL DEFAULT 0, - user_timezone int NOT NULL DEFAULT 0, + user_timezone int NOT NULL DEFAULT 1440, user_title varchar(64) DEFAULT NULL, user_group int NOT NULL DEFAULT 1, user_dst varchar(11) NOT NULL DEFAULT '0;0;0;0;60', diff -r e154e8176700 -r c0e0a1787a63 install/schemas/upgrade/1.1.1-1.1.2-mysql.sql --- a/install/schemas/upgrade/1.1.1-1.1.2-mysql.sql Fri Dec 11 17:11:47 2009 -0500 +++ b/install/schemas/upgrade/1.1.1-1.1.2-mysql.sql Sat Dec 12 15:44:36 2009 -0500 @@ -5,7 +5,7 @@ ALTER TABLE {{TABLE_PREFIX}}logs ADD COLUMN is_draft tinyint(1) NOT NULL DEFAULT 0; ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_rank int(12) UNSIGNED NOT NULL DEFAULT 1; -ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_timezone int(12) UNSIGNED NOT NULL DEFAULT 0; +ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_timezone int(12) UNSIGNED NOT NULL DEFAULT 1440; @ALTER TABLE {{TABLE_PREFIX}}tags CHANGE user user_id mediumint(8) NOT NULL DEFAULT 1; ALTER TABLE {{TABLE_PREFIX}}themes diff -r e154e8176700 -r c0e0a1787a63 install/schemas/upgrade/1.1.1-1.1.2-postgresql.sql --- a/install/schemas/upgrade/1.1.1-1.1.2-postgresql.sql Fri Dec 11 17:11:47 2009 -0500 +++ b/install/schemas/upgrade/1.1.1-1.1.2-postgresql.sql Sat Dec 12 15:44:36 2009 -0500 @@ -6,7 +6,7 @@ ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_rank int NOT NULL DEFAULT 1; @ALTER TABLE {{TABLE_PREFIX}}users DROP user_timezone; -ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_timezone int NOT NULL DEFAULT 0; +ALTER TABLE {{TABLE_PREFIX}}users ADD COLUMN user_timezone int NOT NULL DEFAULT 1440; ALTER TABLE {{TABLE_PREFIX}}themes ADD COLUMN group_list text DEFAULT NULL, diff -r e154e8176700 -r c0e0a1787a63 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Fri Dec 11 17:11:47 2009 -0500 +++ b/plugins/SpecialUserFuncs.php Sat Dec 12 15:44:36 2009 -0500 @@ -817,10 +817,10 @@