2004-04-28 15:49:27 -04:00
< ? php
2004-10-18 23:03:06 -04:00
require_once ( 'admin.php' );
2004-04-24 00:47:27 -04:00
$title = __ ( 'Posts' );
2004-08-22 19:24:50 -04:00
$parent_file = 'edit.php' ;
2006-01-10 00:16:17 -05:00
$list_js = true ;
2003-12-10 19:22:36 -05:00
require_once ( 'admin-header.php' );
2003-10-26 15:34:24 -05:00
2004-12-12 15:41:19 -05:00
$_GET [ 'm' ] = ( int ) $_GET [ 'm' ];
2005-07-08 18:59:15 -04:00
$drafts = get_users_drafts ( $user_ID );
$other_drafts = get_others_drafts ( $user_ID );
2004-09-14 07:24:50 -04:00
if ( $drafts || $other_drafts ) {
?>
< div class = " wrap " >
< ? php if ( $drafts ) { ?>
2004-04-24 00:47:27 -04:00
< p >< strong >< ? php _e ( 'Your Drafts:' ) ?> </strong>
2004-02-13 10:36:28 -05:00
< ? php
2003-12-31 17:21:50 -05:00
$i = 0 ;
foreach ( $drafts as $draft ) {
if ( 0 != $i )
echo ', ' ;
$draft -> post_title = stripslashes ( $draft -> post_title );
if ( $draft -> post_title == '' )
2004-04-24 00:47:27 -04:00
$draft -> post_title = sprintf ( __ ( 'Post #%s' ), $draft -> ID );
echo " <a href='post.php?action=edit&post= $draft->ID ' title=' " . __ ( 'Edit this draft' ) . " '> $draft->post_title </a> " ;
2003-12-31 17:21:50 -05:00
++ $i ;
}
2004-02-13 10:36:28 -05:00
?>
.</ p >
2004-09-14 06:02:48 -04:00
< ? php } ?>
2004-09-14 07:24:50 -04:00
< ? php if ( $other_drafts ) { ?>
2004-09-14 06:02:48 -04:00
< p >< strong >< ? php _e ( 'Other’s Drafts:' ) ?> </strong>
< ? php
$i = 0 ;
foreach ( $other_drafts as $draft ) {
if ( 0 != $i )
echo ', ' ;
$draft -> post_title = stripslashes ( $draft -> post_title );
if ( $draft -> post_title == '' )
$draft -> post_title = sprintf ( __ ( 'Post #%s' ), $draft -> ID );
echo " <a href='post.php?action=edit&post= $draft->ID ' title=' " . __ ( 'Edit this draft' ) . " '> $draft->post_title </a> " ;
++ $i ;
}
?>
.</ p >
2004-09-14 07:24:50 -04:00
< ? php } ?>
</ div >
< ? php } ?>
< div class = " wrap " >
< h2 >
2004-04-28 04:57:11 -04:00
< ? php
2005-03-27 21:34:16 -05:00
2006-02-21 03:39:58 -05:00
wp ( 'what_to_show=posts&posts_per_page=15&posts_per_archive_page=-1' );
2005-03-27 21:34:16 -05:00
if ( is_month () ) {
single_month_title ( ' ' );
} elseif ( is_search () ) {
2004-12-12 15:41:19 -05:00
printf ( __ ( 'Search for “%s”' ), wp_specialchars ( $_GET [ 's' ]) );
2004-09-14 07:24:50 -04:00
} else {
2005-12-13 14:19:56 -05:00
if ( is_single () )
printf ( __ ( 'Comments on %s' ), $post -> post_title );
elseif ( ! is_paged () || get_query_var ( 'paged' ) == 1 )
2005-03-27 21:34:16 -05:00
_e ( 'Last 15 Posts' );
else
_e ( 'Previous Posts' );
2004-04-28 04:57:11 -04:00
}
?>
2004-09-14 07:24:50 -04:00
</ h2 >
2004-04-28 04:57:11 -04:00
2004-09-14 07:24:50 -04:00
< form name = " searchform " action = " " method = " get " style = " float: left; width: 16em; margin-right: 3em; " >
< fieldset >
< legend >< ? php _e ( 'Search Posts…' ) ?> </legend>
2005-04-20 00:06:37 -04:00
< input type = " text " name = " s " value = " <?php if (isset( $s )) echo wp_specialchars( $s , 1); ?> " size = " 17 " />
2004-09-14 07:24:50 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Search') ?> " />
</ fieldset >
</ form >
2006-02-14 01:23:03 -05:00
< ? php $arc_result = $wpdb -> get_results ( " SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC " );
2005-11-23 02:57:58 -05:00
2005-11-10 18:36:50 -05:00
if ( count ( $arc_result ) ) { ?>
2004-09-14 07:24:50 -04:00
< form name = " viewarc " action = " " method = " get " style = " float: left; width: 20em; margin-bottom: 1em; " >
2004-04-28 04:57:11 -04:00
< fieldset >
2004-09-14 07:24:50 -04:00
< legend >< ? php _e ( 'Browse Month…' ) ?> </legend>
2004-05-09 01:47:02 -04:00
< select name = 'm' >
2004-04-28 04:57:11 -04:00
< ? php
2006-02-12 02:53:23 -05:00
foreach ( $arc_result as $arc_row ) {
2004-05-09 01:47:02 -04:00
$arc_year = $arc_row -> yyear ;
$arc_month = $arc_row -> mmonth ;
2006-04-01 19:20:11 -05:00
$arc_month = zeroise ( $arc_month , 2 );
2006-02-12 02:53:23 -05:00
2006-04-01 19:20:11 -05:00
if ( isset ( $_GET [ 'm' ]) && $arc_year . $arc_month == ( int ) $_GET [ 'm' ] )
2004-05-09 01:47:02 -04:00
$default = 'selected="selected"' ;
2004-04-28 04:57:11 -04:00
else
$default = null ;
2006-02-12 02:53:23 -05:00
2006-04-01 19:20:11 -05:00
echo " <option $default value= \" " . $arc_year . $arc_month . '">' ;
echo $wp_locale -> get_month ( $arc_month ) . " $arc_year " ;
2004-04-28 04:57:11 -04:00
echo " </option> \n " ;
}
?>
2004-05-09 01:47:02 -04:00
</ select >
2004-04-28 04:57:11 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Show Month') ?> " />
</ fieldset >
</ form >
2005-11-10 18:36:50 -05:00
< ? php } ?>
2004-04-28 15:49:27 -04:00
< br style = " clear:both; " />
2004-04-28 04:57:11 -04:00
2005-02-11 12:58:11 -05:00
< ? php
// define the columns to display, the syntax is 'internal name' => 'display name'
$posts_columns = array (
'id' => __ ( 'ID' ),
'date' => __ ( 'When' ),
'title' => __ ( 'Title' ),
'categories' => __ ( 'Categories' ),
'comments' => __ ( 'Comments' ),
'author' => __ ( 'Author' )
);
$posts_columns = apply_filters ( 'manage_posts_columns' , $posts_columns );
// you can not edit these at the moment
$posts_columns [ 'control_view' ] = '' ;
$posts_columns [ 'control_edit' ] = '' ;
$posts_columns [ 'control_delete' ] = '' ;
?>
2006-03-28 20:51:55 -05:00
< table width = " 100% " cellpadding = " 3 " cellspacing = " 3 " >
< thead >
2005-02-11 12:58:11 -05:00
< tr >
< ? php foreach ( $posts_columns as $column_display_name ) { ?>
< th scope = " col " >< ? php echo $column_display_name ; ?> </th>
< ? php } ?>
</ tr >
2006-03-28 20:51:55 -05:00
</ thead >
< tbody id = " the-list " >
2004-05-14 02:19:46 -04:00
< ? php
2003-10-26 15:34:24 -05:00
if ( $posts ) {
2004-05-09 01:47:02 -04:00
$bgcolor = '' ;
2003-12-18 04:36:13 -05:00
foreach ( $posts as $post ) { start_wp ();
2006-03-28 20:51:55 -05:00
add_filter ( 'the_title' , 'wp_specialchars' );
2004-07-06 14:14:42 -04:00
$class = ( 'alternate' == $class ) ? '' : 'alternate' ;
2004-02-13 10:36:28 -05:00
?>
2005-08-30 22:39:17 -04:00
< tr id = 'post-<?php echo $id; ?>' class = '<?php echo $class; ?>' >
2005-02-11 12:58:11 -05:00
< ? php
foreach ( $posts_columns as $column_name => $column_display_name ) {
switch ( $column_name ) {
2006-02-12 02:53:23 -05:00
2005-02-11 12:58:11 -05:00
case 'id' :
?>
< th scope = " row " >< ? php echo $id ?> </th>
< ? php
break ;
case 'date' :
?>
< td >< ? php the_time ( 'Y-m-d \<\b\r \/\> g:i:s a' ); ?> </td>
< ? php
break ;
case 'title' :
?>
< td >< ? php the_title () ?>
< ? php if ( 'private' == $post -> post_status ) _e ( ' - <strong>Private</strong>' ); ?> </td>
< ? php
break ;
case 'categories' :
?>
< td >< ? php the_category ( ',' ); ?> </td>
< ? php
break ;
case 'comments' :
?>
< td >< a href = " edit.php?p=<?php echo $id ?>&c=1 " >
2004-07-28 03:18:59 -04:00
< ? php comments_number ( __ ( '0' ), __ ( '1' ), __ ( '%' )) ?>
2005-02-11 12:58:11 -05:00
</ a ></ td >
< ? php
break ;
case 'author' :
?>
< td >< ? php the_author () ?> </td>
< ? php
break ;
case 'control_view' :
?>
< td >< a href = " <?php the_permalink(); ?> " rel = " permalink " class = " edit " >< ? php _e ( 'View' ); ?> </a></td>
< ? php
break ;
case 'control_edit' :
?>
2005-07-13 18:26:26 -04:00
< td >< ? php if ( current_user_can ( 'edit_post' , $post -> ID ) ) { echo " <a href='post.php?action=edit&post= $id ' class='edit'> " . __ ( 'Edit' ) . " </a> " ; } ?> </td>
2005-02-11 12:58:11 -05:00
< ? php
break ;
case 'control_delete' :
?>
2006-03-28 20:51:55 -05:00
< td >< ? php if ( current_user_can ( 'delete_post' , $post -> ID ) ) { echo " <a href='post.php?action=delete&post= $id ' class='delete' onclick= \" return deleteSomething( 'post', " . $id . " , ' " . sprintf ( __ ( " You are about to delete this post "%s". \\ n"OK" to delete, "Cancel" to stop. " ), addslashes ( wp_specialchars ( get_the_title (), 'double' )) ) . " ' ); \" > " . __ ( 'Delete' ) . " </a> " ; } ?> </td>
2005-02-11 12:58:11 -05:00
< ? php
break ;
default :
?>
< td >< ? php do_action ( 'manage_posts_custom_column' , $column_name , $id ); ?> </td>
< ? php
break ;
}
}
?>
</ tr >
2004-02-13 10:36:28 -05:00
< ? php
}
} else {
2003-10-26 15:34:24 -05:00
?>
2004-02-13 10:36:28 -05:00
< tr style = 'background-color: <?php echo $bgcolor; ?>' >
2004-04-24 00:47:27 -04:00
< td colspan = " 8 " >< ? php _e ( 'No posts found.' ) ?> </td>
2004-02-13 10:36:28 -05:00
</ tr >
< ? php
} // end if ($posts)
2006-03-28 20:51:55 -05:00
?>
</ tbody >
2005-08-30 22:39:17 -04:00
</ table >
< div id = " ajax-response " ></ div >
2005-03-27 21:34:16 -05:00
< div class = " navigation " >
< div class = " alignleft " >< ? php next_posts_link ( __ ( '« Previous Entries' )) ?> </div>
< div class = " alignright " >< ? php previous_posts_link ( __ ( 'Next Entries »' )) ?> </div>
</ div >
2004-02-13 10:36:28 -05:00
< ? php
2004-05-09 01:47:02 -04:00
if ( 1 == count ( $posts ) ) {
2003-10-26 15:34:24 -05:00
2005-02-05 13:32:57 -05:00
$comments = $wpdb -> get_results ( " SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date " );
2004-02-13 10:36:28 -05:00
if ( $comments ) {
?>
2006-03-31 03:32:30 -05:00
< h3 id = " comments " >< ? php _e ( 'Comments' ) ?> </h3>
2006-03-28 20:51:55 -05:00
< ol id = " the-list " >
2004-02-13 10:36:28 -05:00
< ? php
2006-03-28 20:51:55 -05:00
$i = 0 ;
2004-02-13 10:36:28 -05:00
foreach ( $comments as $comment ) {
2006-03-28 20:51:55 -05:00
$class = ( ++ $i % 2 ) ? array ( 'alternate' ) : array ();
if ( 'unapproved' == $comment_status = wp_get_comment_status ( $comment -> comment_ID ) )
$class [] = 'unapproved' ;
2004-02-13 10:36:28 -05:00
?>
2006-03-28 20:51:55 -05:00
< li id = 'comment-<?php echo $comment->comment_ID; ?>' < ? php if ( $class ) echo " class=' " . join ( ' ' , $class ) . " ' " ; ?> >
2004-02-13 10:36:28 -05:00
< ? php comment_date ( 'Y-n-j' ) ?>
@
< ? php comment_time ( 'g:m:s a' ) ?>
< ? php
2005-07-14 22:16:45 -04:00
if ( current_user_can ( 'edit_post' , $post -> ID ) ) {
2006-04-07 16:02:18 -04:00
echo " [ <a href='comment.php?action=editcomment&comment= " . $comment -> comment_ID . " \ '> " . __ ( 'Edit' ) . '</a>' ;
echo ' - <a href="comment.php?action=deletecomment&p=' . $post -> ID . '&comment=' . $comment -> comment_ID . '" onclick="return deleteSomething( \'comment\', ' . $comment -> comment_ID . ', \'' . sprintf ( __ ( " You are about to delete this comment by "%s". \\ n"Cancel" to stop, "OK" to delete. " ), wp_specialchars ( $comment -> comment_author , 1 )) . " ' ); \" > " . __ ( 'Delete' ) . '</a> ' ;
2005-07-17 15:29:55 -04:00
if ( ( 'none' != $comment_status ) && ( current_user_can ( 'moderate_comments' ) ) ) {
2006-03-28 20:51:55 -05:00
echo '<span class="unapprove"> - <a href="comment.php?action=unapprovecomment&p=' . $post -> ID . '&comment=' . $comment -> comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment -> comment_ID . ', \'unapproved\' );">' . __ ( 'Unapprove' ) . '</a> </span>' ;
echo '<span class="approve"> - <a href="comment.php?action=approvecomment&p=' . $post -> ID . '&comment=' . $comment -> comment_ID . '" onclick="return dimSomething( \'comment\', ' . $comment -> comment_ID . ', \'unapproved\' );">' . __ ( 'Approve' ) . '</a> </span>' ;
2003-10-26 15:34:24 -05:00
}
2004-02-13 10:36:28 -05:00
echo " ] " ;
} // end if any comments to show
?>
< br />
< strong >
< ? php comment_author () ?>
(
< ? php comment_author_email_link () ?>
/
< ? php comment_author_url_link () ?>
) </ strong > ( IP :
< ? php comment_author_IP () ?>
)
< ? php comment_text () ?>
</ li >
<!-- / comment -->
< ? php //end of the loop, don't delete
} // end foreach
echo '</ol>' ;
} //end if comments
2003-10-26 15:34:24 -05:00
?>
2004-02-13 10:36:28 -05:00
< ? php } ?>
</ div >
2003-10-26 15:34:24 -05:00
< ? php
2003-12-10 19:22:36 -05:00
include ( 'admin-footer.php' );
2004-02-13 10:36:28 -05:00
?>