Changeset 509
- Timestamp:
- 11/03/2003 04:14:54 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/b2-include/b2template.functions.php
r508 r509 230 230 231 231 function get_calendar() { 232 global $wpdb, $HTTP_GET_VARS, $m, $monthnum, $year, $timedifference, $month, $tableposts; 232 233 // Quick check. If we have no posts at all, abort! 233 234 if (!$posts) { … … 306 307 echo '<th abbr="' . $month[zeroise($next->month, 2)] . '" colspan="3" id="next"><a href="' . 307 308 get_month_link($previous->year, $next->month) . '" title="View posts for ' . $month[zeroise($next->month, 2)] . ' ' . 308 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '"> » ' . substr($month[zeroise($next->month, 2)], 0, 3) . '</a>';309 date('Y', mktime(0, 0 , 0, $next->month, 1, $next->year)) . '">' . substr($month[zeroise($next->month, 2)], 0, 3) . ' »</a>'; 309 310 } else { 310 311 echo '<th colspan="3" id="next">»</th>'; … … 319 320 // Get days with posts 320 321 $dayswithposts = $wpdb->get_results("SELECT DISTINCT DAYOFMONTH(post_date) 321 FROM wp_posts WHERE MONTH(post_date) = $thismonth322 FROM $tableposts WHERE MONTH(post_date) = $thismonth 322 323 AND YEAR(post_date) = $thisyear 323 324 AND post_status = 'publish' 324 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600))), ARRAY_N); 325 326 // TODO: Make days with posts linked 325 AND post_date < '" . date("Y-m-d H:i:s", (time() + ($time_difference * 3600)))."'", ARRAY_N); 326 foreach ($dayswithposts as $daywith) { 327 $daywithpost[] = $daywith[0]; 328 } 327 329 328 330 // See how much we should pad in the beginning … … 334 336 if ($newrow) echo "\n</tr>\n <tr>"; 335 337 $newrow = false; 336 echo "\n\t<td>$day</td>"; 338 echo "\n\t<td>"; 339 340 if (in_array($day, $daywithpost)) { 341 echo '<a href="' . get_day_link($thisyear, $thismonth, $day) . "\">$day</a>"; 342 } else { 343 echo $day; 344 } 345 346 echo '</td>'; 337 347 if (6 == date('w', mktime(0, 0 , 0, $thismonth, $day, $thisyear))) $newrow = true; 338 348 } … … 399 409 return $monthlink; 400 410 } else { 401 return $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$year.$month; 411 return $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2); 412 } 413 } 414 415 function get_day_link($year, $month, $day) { 416 global $siteurl, $blogfilename, $querystring_start, $querystring_equal; 417 if (!$year) $year = date('Y', time()+($time_difference * 3600)); 418 if (!$month) $month = date('m', time()+($time_difference * 3600)); 419 if (!$day) $day = date('j', time()+($time_difference * 3600)); 420 if ('' != get_settings('permalink_structure')) { 421 $off = strpos(get_settings('permalink_structure'), '%day%'); 422 $offset = $off + 6; 423 $daylink = substr(get_settings('permalink_structure'), 0, $offset); 424 if ('/' != substr($daylink, -1)) $daylink = substr($daylink, 0, -1); 425 $daylink = str_replace('%year%', $year, $daylink); 426 $daylink = str_replace('%monthnum%', intval($month), $daylink); 427 $daylink = str_replace('%day%', intval($day), $daylink); 428 return $daylink; 429 } else { 430 return $siteurl.'/'.$blogfilename.$querystring_start.'m'.$querystring_equal.$year.zeroise($month, 2).zeroise($day, 2); 402 431 } 403 432 }
Note: See TracChangeset
for help on using the changeset viewer.