Changeset 933
- Timestamp:
- 02/25/2004 05:11:26 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/template-functions-general.php
r898 r933 321 321 } 322 322 $time_difference = get_settings('time_difference'); 323 $add_hours = intval($time_difference); 324 $add_minutes = intval(60 * ($time_difference - $add_hours)); 325 $wp_posts_post_date_field = "DATE_ADD(post_date, INTERVAL '$add_hours:$add_minutes' HOUR_MINUTE)"; 323 326 324 327 // Let's figure out when we are 325 328 if (!empty($monthnum) && !empty($year)) { 326 $thismonth = ''. intval($monthnum);329 $thismonth = ''.zeroise(intval($monthnum), 2); 327 330 $thisyear = ''.intval($year); 328 331 } elseif (!empty($w)) { … … 337 340 $thismonth = '01'; 338 341 } else { 339 $thismonth = ''.intval(substr($m, 4, 2));340 } 341 } else { 342 $thisyear = intval(date('Y', time()+($time_difference * 3600)));343 $thismonth = intval(date('m', time()+($time_difference * 3600)));342 $thismonth = ''.zeroise(intval(substr($m, 4, 2), 2)); 343 } 344 } else { 345 $thisyear = gmdate('Y', current_time('timestamp')); 346 $thismonth = gmdate('m', current_time('timestamp')); 344 347 } 345 348 … … 347 350 348 351 // Get the next and previous month and year with at least one post 349 $previous = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date) AS year352 $previous = $wpdb->get_row("SELECT DISTINCT MONTH(post_date) AS month, YEAR(post_date) AS year 350 353 FROM $tableposts 351 WHERE post_date< '$thisyear-$thismonth-01'354 WHERE $wp_posts_post_date_field < '$thisyear-$thismonth-01' 352 355 AND post_status = 'publish' 353 356 ORDER BY post_date DESC 354 357 LIMIT 1"); 355 $next = $wpdb->get_row("SELECT DISTINCT MONTH( post_date ) AS month, YEAR( post_date) AS year358 $next = $wpdb->get_row("SELECT DISTINCT MONTH($wp_posts_post_date_field) AS month, YEAR($wp_posts_post_date_field) AS year 356 359 FROM $tableposts 357 360 WHERE post_date > '$thisyear-$thismonth-01' … … 402 405 403 406 // Get days with posts 404 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH( post_date)405 FROM $tableposts WHERE MONTH( post_date) = $thismonth407 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH($wp_posts_post_date_field) 408 FROM $tableposts WHERE MONTH($wp_posts_post_date_field) = $thismonth 406 409 AND YEAR(post_date) = $thisyear 407 410 AND post_status = 'publish' 408 AND post_date < '" . date('Y-m-d H:i:s', (time() + ($time_difference * 3600))).'\'', ARRAY_N);411 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); 409 412 if ($dayswithposts) { 410 413 foreach ($dayswithposts as $daywith) { … … 426 429 427 430 $ak_titles_for_day = array(); 428 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH( post_date) as dom "431 $ak_post_titles = $wpdb->get_results("SELECT post_title, DAYOFMONTH($wp_posts_post_date_field) as dom " 429 432 ."FROM $tableposts " 430 ."WHERE YEAR( post_date) = '$thisyear' "431 ."AND MONTH( post_date) = '$thismonth' "432 ."AND post_date < '". date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."' "433 ."WHERE YEAR($wp_posts_post_date_field) = '$thisyear' " 434 ."AND MONTH($wp_posts_post_date_field) = '$thismonth' " 435 ."AND post_date < '".current_time('mysql')."' " 433 436 ."AND post_status = 'publish'" 434 437 );
Note: See TracChangeset
for help on using the changeset viewer.