Changeset 1976
- Timestamp:
- 12/19/2004 12:10:10 AM (20 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/index.php
r1947 r1976 1 1 <?php 2 require_once('admin.php'); 3 $title = __('Dashboard'); 4 require_once('admin-header.php'); 2 5 3 require('../wp-config.php');4 auth_redirect(); 6 $today = current_time('mysql'); 7 ?> 5 8 9 <div class="wrap"> 10 <div id="zeitgeist"> 11 <h2><?php _e('Latest Activity'); ?></h2> 12 <?php 13 if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) : 14 ?> 15 <div> 16 <h3><?php _e('Posts'); ?></h3> 17 <ul> 18 <?php 19 foreach ($recentposts as $post) { 20 if ($post->post_title == '') 21 $post->post_title = sprintf(__('Post #%s'), $post->ID); 22 echo "<li><a href='post.php?action=edit&post=$post->ID'>"; 23 the_title(); 24 echo '</a></li>'; 25 } 26 ?> 27 </ul> 28 </div> 29 <?php endif; ?> 30 31 <?php 32 if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today'") ) : 33 ?> 34 <div> 35 <h3><?php _e('Scheduled Entries:') ?></h3> 36 <ul> 37 <?php 38 foreach ($scheduled as $post) { 39 if ($post->post_title == '') 40 $post->post_title = sprintf(__('Post #%s'), $post->ID); 41 echo "<li><a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a> in " . human_time_diff( time(), strtotime($post->post_date) ) . "</li>"; 42 } 43 ?> 44 </ul> 45 </div> 46 <?php endif; ?> 47 48 <?php 49 if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT 5") ) : 50 ?> 51 <div> 52 <h3><?php _e('Comments'); ?></h3> 53 <ul> 54 <?php 55 foreach ($comments as $comment) { 56 echo '<li>' . sprintf('%s on %s', get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>'); 57 edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 58 echo '</li>'; 59 } 60 ?> 61 </ul> 62 <?php 63 if ( $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_approved = '0'") ) : 64 ?> 65 <p><a href="moderation.php"><?php echo sprintf(__('There are comments in moderation (%s)'), number_format($numcomments) ); ?> »</a></p> 66 <?php endif; ?> 67 </div> 68 69 <?php endif; ?> 70 71 <div> 72 <h3><?php _e('Blog Stats'); ?></h3> 73 <?php 74 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'"); 75 if (0 < $numposts) $numposts = number_format($numposts); 76 77 $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'"); 78 if (0 < $numcomms) $numcomms = number_format($numcomms); 79 80 $numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories"); 81 if (0 < $numcats) $numcats = number_format($numcats); 82 ?> 83 <p>There are currently <?php echo $numposts ?> <a href="edit.php" title="posts">posts</a> and <?php echo $numcomms ?> <a href="edit-comments.php" title="Comments">comments</a>, contained within <?php echo $numcats ?> <a href="categories.php" title="categories">categories</a>.</p> 84 </div> 85 86 </div> 87 88 <h2><?php _e('Dashboard'); ?></h2> 89 <br clear="all" /> 90 </div> 91 <div class="wrap"> 92 <p> 93 <strong> 94 <?php _e('Your Drafts:') ?> 95 </strong> 96 <br /> 97 <?php 6 98 get_currentuserinfo(); 7 8 if (0 == $user_level) { 9 $redirect_to = get_settings('siteurl') . '/wp-admin/profile.php'; 10 } else { 11 $redirect_to = get_settings('siteurl') . '/wp-admin/post.php'; 12 } 13 header ("Location: $redirect_to"); 99 $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID"); 100 if ($drafts) { 101 ?> 102 <?php 103 $i = 0; 104 foreach ($drafts as $draft) { 105 if (0 != $i) 106 echo ', '; 107 $draft->post_title = stripslashes($draft->post_title); 108 if ($draft->post_title == '') 109 $draft->post_title = sprintf(__('Post #%s'), $draft->ID); 110 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; 111 ++$i; 112 } 113 }else{ 114 echo ('No Entries found.'); 115 } 116 ?> 117 </p> 118 </div> 119 <?php 120 require('./admin-footer.php'); 14 121 ?> -
trunk/wp-admin/wp-admin.css
r1951 r1976 1 #zeitgeist { 2 width: 27%; 3 float: right; 4 font-size: 90%; 5 background-color: #eee; 6 padding: 1em; 7 border: 1px solid #ccc; 8 } 9 10 #zeitgeist h2 { 11 border-bottom: none; 12 } 13 #zeitgeist ul { 14 margin: 0 0 .3em .6em; 15 padding: 0 0 0 .6em; 16 } 17 #zeitgeist li, #zeitgeist p { 18 margin: .2em 0; 19 } 20 #zeitgeist h3 { 21 border-top: 1px solid #ccc; 22 font-size: 16px; 23 margin: .5em 0; 24 } 25 1 26 * html #poststuff { 2 27 height: 100%; /* kill peekaboo bug in IE */ -
trunk/wp-includes/functions-formatting.php
r1964 r1976 551 551 } 552 552 553 function human_time_diff( $from, $to = '' ) { 554 if ( empty($to) ) 555 $to = time(); 556 $diff = (int) ($to - $from); 557 if ($diff <= 3600) { 558 $mins = round($diff / 60); 559 $since = sprintf( __('%s mins', $mins) ); 560 } else if (($diff <= 86400) && ($diff > 3600)) { 561 $hours = round($diff / 3600); 562 if ($hours <= 1) 563 $since = __('1 hour'); 564 else 565 $since = sprintf( __('%s hours'), $hours ); 566 } elseif ($diff >= 86400) { 567 $days = round($diff / 86400); 568 if ($days <= 1) 569 $since = __('1 day'); 570 else 571 $since = sprintf( __('%s days'), $days ); 572 } 573 return $since; 574 } 575 553 576 ?> -
trunk/wp-includes/template-functions-post.php
r1966 r1976 47 47 } 48 48 49 function get_the_title() { 50 global $post; 51 $output = $post->post_title; 52 if (!empty($post->post_password)) { // if there's a password 53 $output = 'Protected: ' . $output; 54 } 55 return $output; 49 function get_the_title($id = 0) { 50 global $post, $wpdb; 51 $title = $post->post_title; 52 if ( 0 != $id ) 53 $title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $id"); 54 55 if ( !empty($post->post_password) ) { // if there's a password 56 $title = 'Protected: ' . $title; 57 } 58 return $title; 56 59 } 57 60
Note: See TracChangeset
for help on using the changeset viewer.