Ticket #1: gmt_timezones.diff
| File gmt_timezones.diff, 31.2 kB (added by enobrev, 10 months ago) |
|---|
-
conf.php
old new 24 24 "/(\d{4})/" => "archive", 25 25 "/([^/]+)/" => "author", 26 26 "/([^/]+)/statuses/" => "author_statuses" 27 ); 28 29 $timezones = array( 30 'USA Hawaii' => '-10:00', 31 'USA Alaska' => '-09:00', 32 'USA Pacific' => '-08:00', 33 'USA Mountain' => '-07:00', 34 'USA Central' => '-06:00', 35 'USA Eastern' => '-05:00', 36 'American Samoa' => '-11:00', 37 'Samoa' => '-11:00', 38 'Christmas Is.' => '-10:00', 39 'Cook Is.' => '-10:00', 40 'French Polynesia' => '-10:00', 41 'USA Hawaii' => '-10:00', 42 'USA Alaska' => '-09:00', 43 'Canada Pacific' => '-08:00', 44 'USA Pacific' => '-08:00', 45 'Canada Mountain' => '-07:00', 46 'Mexico West' => '-07:00', 47 'USA Mountain' => '-07:00', 48 'Belize' => '-06:00', 49 'Canada Central' => '-06:00', 50 'Costa Rica' => '-06:00', 51 'El Salvador' => '-06:00', 52 'Guatemala' => '-06:00', 53 'Honduras' => '-06:00', 54 'Mexico Central' => '-06:00', 55 'Nicaragua' => '-06:00', 56 'USA Central' => '-06:00', 57 'Bahamas' => '-05:00', 58 'Canada Eastern' => '-05:00', 59 'Cayman Islands' => '-05:00', 60 'Colombia' => '-05:00', 61 'Cuba' => '-05:00', 62 'Ecuador' => '-05:00', 63 'Haiti' => '-05:00', 64 'Jamaica' => '-05:00', 65 'Mexico East' => '-05:00', 66 'Panama, Republic Of' => '-05:00', 67 'Peru' => '-05:00', 68 'Turks and Caicos' => '-05:00', 69 'USA Eastern' => '-05:00', 70 'Antigua and Barbuda' => '-04:00', 71 'Aruba' => '-04:00', 72 'Barbados' => '-04:00', 73 'Bermuda' => '-04:00', 74 'Bolivia' => '-04:00', 75 'Brazil West' => '-04:00', 76 'British Virgin Islands' => '-04:00', 77 'Chile' => '-04:00', 78 'Dominica' => '-04:00', 79 'Dominican Republic' => '-04:00', 80 'Falkland Islands' => '-04:00', 81 'Grenada' => '-04:00', 82 'Guadalupe' => '-04:00', 83 'Netherlands Antilles' => '-04:00', 84 'Paraguay' => '-04:00', 85 'Puerto Rico' => '-04:00', 86 'Saba' => '-04:00', 87 'St Lucia' => '-04:00', 88 'St Marten' => '-04:00', 89 'St Thomas' => '-04:00', 90 'St Vincent' => '-04:00', 91 'Trinidad and Tobago' => '-04:00', 92 'Venezuela' => '-04:00', 93 'Canada Newfoundland' => '-03:30', 94 'Argentina' => '-03:00', 95 'Brazil East' => '-03:00', 96 'French Antilles (Martinique)' => '-03:00', 97 'French Guinea' => '-03:00', 98 'Greenland' => '-03:00', 99 'Guyana' => '-03:00', 100 'St Pierre & Miquelon' => '-03:00', 101 'Suriname' => '-03:00', 102 'Uruguay' => '-03:00', 103 'Antarctica' => '-02:00', 104 'Cape Verde' => '-01:00', 105 'Ascension' => '+00:00', 106 'Burkina Faso' => '+00:00', 107 'Faeroe Islands' => '+00:00', 108 'Gambia' => '+00:00', 109 'Ghana' => '+00:00', 110 'Guinea-Bissau' => '+00:00', 111 'Guinea' => '+00:00', 112 'Iceland' => '+00:00', 113 'Ireland' => '+00:00', 114 'Liberia' => '+00:00', 115 'Mali Republic' => '+00:00', 116 'Mauritania' => '+00:00', 117 'Morocco' => '+00:00', 118 'Sao Tome' => '+00:00', 119 'Senegal' => '+00:00', 120 'Sierra Leone' => '+00:00', 121 'Togo' => '+00:00', 122 'United Kingdom' => '+00:00', 123 'Albania' => '+01:00', 124 'Algeria' => '+01:00', 125 'Andorra' => '+01:00', 126 'Angola' => '+01:00', 127 'Austria' => '+01:00', 128 'Belgium' => '+01:00', 129 'Benin' => '+01:00', 130 'Bosnia Herzegovina' => '+01:00', 131 'Cameroon' => '+01:00', 132 'Central African Rep' => '+01:00', 133 'Chad Rep' => '+01:00', 134 'Congo' => '+01:00', 135 'Croatia' => '+01:00', 136 'Czech Republic' => '+01:00', 137 'Denmark' => '+01:00', 138 'Equatorial Guinea' => '+01:00', 139 'France' => '+01:00', 140 'Gabon Republic' => '+01:00', 141 'Germany' => '+01:00', 142 'Gibraltar' => '+01:00', 143 'Hungary' => '+01:00', 144 'Italy' => '+01:00', 145 'Liechtenstein' => '+01:00', 146 'Luxembourg' => '+01:00', 147 'Macedonia' => '+01:00', 148 'Malta' => '+01:00', 149 'Monaco' => '+01:00', 150 'Namibia' => '+01:00', 151 'Netherlands' => '+01:00', 152 'Nigeria' => '+01:00', 153 'Niger Republic' => '+01:00', 154 'Norway' => '+01:00', 155 'Poland' => '+01:00', 156 'Portugal' => '+01:00', 157 'San Marino' => '+01:00', 158 'Slovakia' => '+01:00', 159 'Slovenia' => '+01:00', 160 'Spain' => '+01:00', 161 'Sweden' => '+01:00', 162 'Switzerland' => '+01:00', 163 'Tunisia' => '+01:00', 164 'Vatican City' => '+01:00', 165 'Yugoslavia' => '+01:00', 166 'Belarus' => '+02:00', 167 'Botswana' => '+02:00', 168 'Bulgaria' => '+02:00', 169 'Burundi' => '+02:00', 170 'Cyprus' => '+02:00', 171 'Egypt' => '+02:00', 172 'Estonia' => '+02:00', 173 'Finland' => '+02:00', 174 'Greece' => '+02:00', 175 'Israel' => '+02:00', 176 'Jordan' => '+02:00', 177 'Latvia' => '+02:00', 178 'Lebanon' => '+02:00', 179 'Lesotho' => '+02:00', 180 'Libya' => '+02:00', 181 'Lithuania' => '+02:00', 182 'Malawi' => '+02:00', 183 'Moldova' => '+02:00', 184 'Mozambique' => '+02:00', 185 'Romania' => '+02:00', 186 'Russia West' => '+02:00', 187 'Rwanda' => '+02:00', 188 'South Africa' => '+02:00', 189 'Sudan' => '+02:00', 190 'Swaziland' => '+02:00', 191 'Syria' => '+02:00', 192 'Turkey' => '+02:00', 193 'Ukraine' => '+02:00', 194 'Zaire' => '+02:00', 195 'Zambia' => '+02:00', 196 'Zimbabwe' => '+02:00', 197 'Azerbaijan' => '+03:00', 198 'Bahrain' => '+03:00', 199 'Djibouti' => '+03:00', 200 'Eritrea' => '+03:00', 201 'Ethiopia' => '+03:00', 202 'Iraq' => '+03:00', 203 'Kenya' => '+03:00', 204 'Kuwait' => '+03:00', 205 'Madagascar' => '+03:00', 206 'Mayotte' => '+03:00', 207 'Qatar' => '+03:00', 208 'Saudi Arabia' => '+03:00', 209 'Somalia' => '+03:00', 210 'Tanzania' => '+03:00', 211 'Uganda' => '+03:00', 212 'Yemen' => '+03:00', 213 'Iran' => '+03:30', 214 'Armenia' => '+04:00', 215 'Georgia' => '+04:00', 216 'Mauritius' => '+04:00', 217 'Oman' => '+04:00', 218 'Reunion Island' => '+04:00', 219 'Russia Central 1' => '+04:00', 220 'Seychelles Islands' => '+04:00', 221 'United Arab Emirates' => '+04:00', 222 'Afghanistan ' => '+04:30', 223 'Kyrgyzstan' => '+05:00', 224 'Maldives' => '+05:00', 225 'Pakistan' => '+05:00', 226 'Turkmenistan' => '+05:00', 227 'Uzbekistan' => '+05:00', 228 'India' => '+05:30', 229 'Nepal' => '+05:30', 230 'Sri Lanka' => '+05:30', 231 'Bangladesh' => '+06:00', 232 'Bhutan' => '+06:00', 233 'Kazakhstan' => '+06:00', 234 'Tajikistan' => '+06:00', 235 'Myanmar' => '+06:30', 236 'Cambodia' => '+07:00', 237 'Indonesia West' => '+07:00', 238 'Laos' => '+07:00', 239 'Russia Central 2' => '+07:00', 240 'Thailand' => '+07:00', 241 'Vietnam' => '+07:00', 242 'Australia West' => '+08:00', 243 'Brunei' => '+08:00', 244 'China' => '+08:00', 245 'Hong Kong' => '+08:00', 246 'Indonesia Central' => '+08:00', 247 'Malaysia' => '+08:00', 248 'Mongolia' => '+08:00', 249 'Philippines' => '+08:00', 250 'Singapore' => '+08:00', 251 'Taiwan' => '+08:00', 252 'Indonesia East' => '+09:00', 253 'Japan' => '+09:00', 254 'Korea, North' => '+09:00', 255 'Korea, South' => '+09:00', 256 'Palau' => '+09:00', 257 'Australia North' => '+09:30', 258 'Australia South' => '+10:00', 259 'Australia East' => '+10:00', 260 'Guam' => '+10:00', 261 'Papua New Guinea' => '+10:00', 262 'New Caledonia' => '+11:00', 263 'Russia East' => '+11:00', 264 'Solomon Islands' => '+11:00', 265 'Vanuatu' => '+11:00', 266 'Norfolk Island' => '+11:30', 267 'Fiji Islands' => '+12:00', 268 'Kiribati' => '+12:00', 269 'Marshall Islands' => '+12:00', 270 'Nauru' => '+12:00', 271 'New Zealand' => '+12:00', 272 'Tuvalu' => '+12:00', 273 'Wallis And Futuna Islands' => '+12:00', 274 'Tonga Islands' => '+13:00' 27 275 ); 28 29 276 ?> -
index.php
old new 55 55 56 56 if ( $_POST['text'] ) { 57 57 $profile = get_profile(); 58 mysql_query("INSERT INTO log (user_id,created_at,text) VALUES(" . $profile['id'] . ", NOW(),'" . ereg_replace( "'", "\\'", $_POST['text'] ) . "');");58 mysql_query("INSERT INTO log (user_id,created_at,text) VALUES(" . $profile['id'] . ", CONVERT_TZ(NOW(), '" . $timezones[$conf['site.tz']] . "', '+00:00'),'" . ereg_replace( "'", "\\'", $_POST['text'] ) . "');"); 59 59 60 60 if ( is_ajax() ) { 61 61 load_single_post(); -
install.sql
old new 6 6 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 7 7 8 8 LOCK TABLES `conf` WRITE; 9 INSERT INTO `conf` VALUES ('site.title','bitlog'),('site.desc','a simple bitlog'),('site.admin','test'),('site.url',''),('site.theme','simple'),('site.charset','UTF-8'),('site. lang','en-US'),('posts.num','15'),('feed.theme','rss2'),('site.register','single'),('urls.theme','bitlog');9 INSERT INTO `conf` VALUES ('site.title','bitlog'),('site.desc','a simple bitlog'),('site.admin','test'),('site.url',''),('site.theme','simple'),('site.charset','UTF-8'),('site.tz','USA Eastern'),('site.lang','en-US'),('posts.num','15'),('feed.theme','rss2'),('site.register','single'),('urls.theme','bitlog'); 10 10 UNLOCK TABLES; 11 11 12 12 DROP TABLE IF EXISTS `log`; … … 30 30 `location` varchar(75) collate utf8_unicode_ci NOT NULL, 31 31 `is_admin` tinyint(4) NOT NULL, 32 32 `fullname` varchar(75) collate utf8_unicode_ci NOT NULL, 33 `timezone` varchar(50) collate utf8_unicode_ci NOT NULL, 33 34 `icon` varchar(255) collate utf8_unicode_ci NOT NULL, 34 35 PRIMARY KEY (`id`) 35 36 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 36 37 37 38 LOCK TABLES `users` WRITE; 38 INSERT INTO `users` VALUES (1,'test','5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8','Somewhere',1,'Test User',' ');39 INSERT INTO `users` VALUES (1,'test','5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8','Somewhere',1,'Test User','USA Eastern',''); 39 40 UNLOCK TABLES; -
lib/auth.php
old new 69 69 $query = mysql_query( "SELECT * FROM users WHERE users.name = '" . $_SESSION['bit_user'] . "' LIMIT 1;" ); 70 70 $profile = mysql_fetch_assoc($query); 71 71 $profile['password'] = ''; 72 } 73 74 function get_profile_timezone() { 75 global $conf, $timezones; 76 77 $profile = get_profile(); 78 79 if (array_key_exists('timezone', $profile) 80 && array_key_exists($profile['timezone'], $timezones)) { 81 return $timezones[$profile['timezone']]; 82 } 83 84 return $timezones[$conf['site.tz']]; 72 85 } 73 86 74 87 function is_admin() { -
lib/pages.php
old new 59 59 60 60 // Settings Page 61 61 function page_settings() { 62 global $theme_path, $conf, $ti tle;62 global $theme_path, $conf, $timezones, $title; 63 63 64 64 if ( !loggedin() ) { 65 65 page_error( 'You must be logged in.' ); … … 69 69 if ( $_POST['form'] == 'account' ) { 70 70 71 71 // Update the profile information 72 mysql_query(sprintf("UPDATE users SET location='%s', fullname='%s', icon='%s' WHERE id=%s;",73 $_POST['location'], $_POST['fullname'], $_POST[' icon'], $profile['id'] ));72 mysql_query(sprintf("UPDATE users SET location='%s', fullname='%s', timezone='%s', icon='%s' WHERE id=%s;", 73 $_POST['location'], $_POST['fullname'], $_POST['timezone'], $_POST['icon'], $profile['id'] )); 74 74 75 75 // Update the password (when necessary) 76 76 if ( !empty($_POST['pass']) && $_POST['pass'] == $_POST['pass2'] ) { -
lib/posts.php
old new 6 6 $offset = ( $page - 1 ) * $conf['posts.num']; 7 7 $num = $conf['posts.num'] + 1; 8 8 9 load_posts( "SELECT * FROM users, log WHERE users.name='$author' AND users.id = log.user_id" .10 " ORDER BY created_at DESC LIMIT $offset,$num;" ); 11 9 load_posts( "SELECT *, CONVERT_TZ(created_at, '+00:00', '" . get_profile_timezone() . "') AS created_at FROM users, log WHERE users.name='$author' AND users.id = log.user_id" . 10 " ORDER BY created_at DESC LIMIT $offset,$num;" ); 11 12 12 $prev_link = $page - 1; 13 13 $next_link = 0; 14 14 … … 22 22 global $conf, $posts, $prev_link, $next_link; 23 23 24 24 $offset = ( $page - 1 ) * $conf['posts.num']; 25 $num = $conf['posts.num'] + 1;26 27 load_posts( "SELECT * FROM users, log WHERE log.user_id=users.id" .25 $num = $conf['posts.num'] + 1; 26 27 load_posts( "SELECT *, CONVERT_TZ(created_at, '+00:00', '" . get_profile_timezone() . "') AS created_at FROM users, log WHERE log.user_id=users.id" . 28 28 ( $year > 0 ? " AND YEAR(created_at) = $year" : "" ) . 29 29 ( $month > 0 ? " AND MONTH(created_at) = $month" : "" ) . 30 30 " ORDER BY created_at DESC LIMIT $offset,$num;" ); … … 43 43 $id = mysql_insert_id(); 44 44 } 45 45 46 load_posts( "SELECT * FROM users, log WHERE log.id = $id AND users.id = log.user_id LIMIT 1;" );46 load_posts( "SELECT *, CONVERT_TZ(created_at, '+00:00', '" . get_profile_timezone() . "') AS created_at FROM users, log WHERE log.id = $id AND users.id = log.user_id LIMIT 1;" ); 47 47 } 48 48 49 49 function load_posts( $query ) { -
themes/simple/settings.php
old new 5 5 <form action="" method="POST" class="form"> 6 6 <b>Personal Profile:</b><br/><br/> 7 7 <label for="name">Full Name:</label><input type="text" name="fullname" class="text" value="<?=$profile['fullname']?>"/><br/> 8 <label for="name">Location:</label><input type="text" name="location" class="text" value="<?=$profile['location']?>"/><br/> 8 <label for="name">Location:</label><input type="text" name="location" class="text" value="<?=$profile['location']?>"/><br/> 9 <label for="timezone">Time Zone:</label> 10 <select name="timezone"> 11 <?php foreach ($timezones as $country => $gmt) { 12 $selected = ''; 13 if ($country == $profile['timezone']) { 14 $selected = 'selected="selected"'; 15 } 16 ?> 17 <option value="<?= $country ?>" <?= $selected ?>>(<?= $gmt ?>) <?= $country ?></option> 18 <?php } ?> 19 </select><br/> 9 20 <label for="name">Icon (URL):</label><input type="text" name="icon" class="text" value="<?=$profile['icon']?>"/><br/> 10 21 <label> </label><small>(Should be square, 48x48 pixels is best.)</small><br/><br/> 11 22 … … 22 33 23 34 <form action="" method="POST" class="form"> 24 35 <?php foreach ( $conf as $name => $value ) { 25 if ( strrpos($name,"db.") === false ) { 36 if ( strrpos($name,"db.") === false ) { 37 if ( $name == 'site.tz' ) { 38 ?> 39 <label><?=$name?></label> 40 <select name="<?= $name ?>"> 41 <?php foreach ($timezones as $country => $gmt) { 42 $selected = ''; 43 if ($country == $value) { 44 $selected = 'selected="selected"'; 45 } 46 ?> 47 <option value="<?= $country ?>" <?= $selected ?>>(<?= $gmt ?>) <?= $country ?></option> 48 <?php } ?> 49 </select><br/> 50 <?php 51 } else { 26 52 ?> 27 <label><?=$name?></label><input type="text" class="text" name="<?=$name?>" value="<?=$value?>"/><br/>28 <?php } } ?>53 <label><?=$name?></label><input type="text" class="text" name="<?=$name?>" value="<?=$value?>"/><br/> 54 <?php } } } ?> 29 55 <input type="submit" class="submit" value="Save"/> 30 56 <input type="hidden" name="form" value="settings"/> 31 57 </form>
