| 1 |
<?php |
|---|
| 2 |
require_once('admin.php'); |
|---|
| 3 |
|
|---|
| 4 |
$title = __('Posts'); |
|---|
| 5 |
$parent_file = 'edit.php'; |
|---|
| 6 |
require_once('admin-header.php'); |
|---|
| 7 |
|
|---|
| 8 |
$_GET['m'] = (int) $_GET['m']; |
|---|
| 9 |
|
|---|
| 10 |
$drafts = get_users_drafts( $user_ID ); |
|---|
| 11 |
$other_drafts = get_others_drafts( $user_ID); |
|---|
| 12 |
|
|---|
| 13 |
if ($drafts || $other_drafts) { |
|---|
| 14 |
?> |
|---|
| 15 |
<div class="wrap"> |
|---|
| 16 |
<?php if ($drafts) { ?> |
|---|
| 17 |
<p><strong><?php _e('Your Drafts:') ?></strong> |
|---|
| 18 |
<?php |
|---|
| 19 |
$i = 0; |
|---|
| 20 |
foreach ($drafts as $draft) { |
|---|
| 21 |
if (0 != $i) |
|---|
| 22 |
echo ', '; |
|---|
| 23 |
$draft->post_title = stripslashes($draft->post_title); |
|---|
| 24 |
if ($draft->post_title == '') |
|---|
| 25 |
$draft->post_title = sprintf(__('Post #%s'), $draft->ID); |
|---|
| 26 |
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; |
|---|
| 27 |
++$i; |
|---|
| 28 |
} |
|---|
| 29 |
?> |
|---|
| 30 |
.</p> |
|---|
| 31 |
<?php } ?> |
|---|
| 32 |
|
|---|
| 33 |
<?php if ($other_drafts) { ?> |
|---|
| 34 |
<p><strong><?php _e('Other’s Drafts:') ?></strong> |
|---|
| 35 |
<?php |
|---|
| 36 |
$i = 0; |
|---|
| 37 |
foreach ($other_drafts as $draft) { |
|---|
| 38 |
if (0 != $i) |
|---|
| 39 |
echo ', '; |
|---|
| 40 |
$draft->post_title = stripslashes($draft->post_title); |
|---|
| 41 |
if ($draft->post_title == '') |
|---|
| 42 |
$draft->post_title = sprintf(__('Post #%s'), $draft->ID); |
|---|
| 43 |
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; |
|---|
| 44 |
++$i; |
|---|
| 45 |
} |
|---|
| 46 |
?> |
|---|
| 47 |
.</p> |
|---|
| 48 |
|
|---|
| 49 |
<?php } ?> |
|---|
| 50 |
|
|---|
| 51 |
</div> |
|---|
| 52 |
<?php } ?> |
|---|
| 53 |
|
|---|
| 54 |
<div class="wrap"> |
|---|
| 55 |
<h2> |
|---|
| 56 |
<?php |
|---|
| 57 |
$what_to_show = 'posts'; |
|---|
| 58 |
$posts_per_page = 15; |
|---|
| 59 |
$posts_per_archive_page = -1; |
|---|
| 60 |
|
|---|
| 61 |
wp(); |
|---|
| 62 |
|
|---|
| 63 |
if ( is_month() ) { |
|---|
| 64 |
single_month_title(' '); |
|---|
| 65 |
} elseif ( is_search() ) { |
|---|
| 66 |
printf(__('Search for “%s”'), wp_specialchars($_GET['s']) ); |
|---|
| 67 |
} else { |
|---|
| 68 |
if ( is_single() ) |
|---|
| 69 |
printf(__('Comments on %s'), $post->post_title); |
|---|
| 70 |
elseif ( ! is_paged() || get_query_var('paged') == 1 ) |
|---|
| 71 |
_e('Last 15 Posts'); |
|---|
| 72 |
else |
|---|
| 73 |
_e('Previous Posts'); |
|---|
| 74 |
} |
|---|
| 75 |
?> |
|---|
| 76 |
</h2> |
|---|
| 77 |
|
|---|
| 78 |
<form name="searchform" action="" method="get" style="float: left; width: 16em; margin-right: 3em;"> |
|---|
| 79 |
<fieldset> |
|---|
| 80 |
<legend><?php _e('Search Posts…') ?></legend> |
|---|
| 81 |
<input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" /> |
|---|
| 82 |
<input type="submit" name="submit" value="<?php _e('Search') ?>" /> |
|---|
| 83 |
</fieldset> |
|---|
| 84 |
</form> |
|---|
| 85 |
|
|---|
| 86 |
<?php $arc_result = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_date != '0000-00-00 00:00:00' ORDER BY post_date DESC"); |
|---|
| 87 |
|
|---|
| 88 |
if ( count($arc_result) ) { ?> |
|---|
| 89 |
|
|---|
| 90 |
<form name="viewarc" action="" method="get" style="float: left; width: 20em; margin-bottom: 1em;"> |
|---|
| 91 |
<fieldset> |
|---|
| 92 |
<legend><?php _e('Browse Month…') ?></legend> |
|---|
| 93 |
<select name='m'> |
|---|
| 94 |
<?php |
|---|
| 95 |
foreach ($arc_result as $arc_row) { |
|---|
| 96 |
$arc_year = $arc_row->yyear; |
|---|
| 97 |
$arc_month = $arc_row->mmonth; |
|---|
| 98 |
|
|---|
| 99 |
if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == (int) $_GET['m'] ) |
|---|
| 100 |
$default = 'selected="selected"'; |
|---|
| 101 |
else |
|---|
| 102 |
$default = null; |
|---|
| 103 |
|
|---|
| 104 |
echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">'; |
|---|
| 105 |
echo $month[zeroise($arc_month, 2)] . " $arc_year"; |
|---|
| 106 |
echo "</option>\n"; |
|---|
| 107 |
} |
|---|
| 108 |
?> |
|---|
| 109 |
</select> |
|---|
| 110 |
<input type="submit" name="submit" value="<?php _e('Show Month') ?>" /> |
|---|
| 111 |
</fieldset> |
|---|
| 112 |
</form> |
|---|
| 113 |
|
|---|
| 114 |
<?php } ?> |
|---|
| 115 |
|
|---|
| 116 |
<br style="clear:both;" /> |
|---|
| 117 |
|
|---|
| 118 |
<?php |
|---|
| 119 |
|
|---|
| 120 |
|
|---|
| 121 |
$posts_columns = array( |
|---|
| 122 |
'id' => __('ID'), |
|---|
| 123 |
'date' => __('When'), |
|---|
| 124 |
'title' => __('Title'), |
|---|
| 125 |
'categories' => __('Categories'), |
|---|
| 126 |
'comments' => __('Comments'), |
|---|
| 127 |
'author' => __('Author') |
|---|
| 128 |
); |
|---|
| 129 |
$posts_columns = apply_filters('manage_posts_columns', $posts_columns); |
|---|
| 130 |
|
|---|
| 131 |
|
|---|
| 132 |
$posts_columns['control_view'] = ''; |
|---|
| 133 |
$posts_columns['control_edit'] = ''; |
|---|
| 134 |
$posts_columns['control_delete'] = ''; |
|---|
| 135 |
|
|---|
| 136 |
?> |
|---|
| 137 |
|
|---|
| 138 |
<table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> |
|---|
| 139 |
<tr> |
|---|
| 140 |
|
|---|
| 141 |
<?php foreach($posts_columns as $column_display_name) { ?> |
|---|
| 142 |
<th scope="col"><?php echo $column_display_name; ?></th> |
|---|
| 143 |
<?php } ?> |
|---|
| 144 |
|
|---|
| 145 |
</tr> |
|---|
| 146 |
<?php |
|---|
| 147 |
if ($posts) { |
|---|
| 148 |
$bgcolor = ''; |
|---|
| 149 |
foreach ($posts as $post) { start_wp(); |
|---|
| 150 |
$class = ('alternate' == $class) ? '' : 'alternate'; |
|---|
| 151 |
?> |
|---|
| 152 |
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'> |
|---|
| 153 |
|
|---|
| 154 |
<?php |
|---|
| 155 |
|
|---|
| 156 |
foreach($posts_columns as $column_name=>$column_display_name) { |
|---|
| 157 |
|
|---|
| 158 |
switch($column_name) { |
|---|
| 159 |
|
|---|
| 160 |
case 'id': |
|---|
| 161 |
?> |
|---|
| 162 |
<th scope="row"><?php echo $id ?></th> |
|---|
| 163 |
<?php |
|---|
| 164 |
break; |
|---|
| 165 |
|
|---|
| 166 |
case 'date': |
|---|
| 167 |
?> |
|---|
| 168 |
<td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td> |
|---|
| 169 |
<?php |
|---|
| 170 |
break; |
|---|
| 171 |
case 'title': |
|---|
| 172 |
?> |
|---|
| 173 |
<td><?php the_title() ?> |
|---|
| 174 |
<?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td> |
|---|
| 175 |
<?php |
|---|
| 176 |
break; |
|---|
| 177 |
|
|---|
| 178 |
case 'categories': |
|---|
| 179 |
?> |
|---|
| 180 |
<td><?php the_category(','); ?></td> |
|---|
| 181 |
<?php |
|---|
| 182 |
break; |
|---|
| 183 |
|
|---|
| 184 |
case 'comments': |
|---|
| 185 |
?> |
|---|
| 186 |
<td><a href="edit.php?p=<?php echo $id ?>&c=1"> |
|---|
| 187 |
<?php comments_number(__('0'), __('1'), __('%')) ?> |
|---|
| 188 |
</a></td> |
|---|
| 189 |
<?php |
|---|
| 190 |
break; |
|---|
| 191 |
|
|---|
| 192 |
case 'author': |
|---|
| 193 |
?> |
|---|
| 194 |
<td><?php the_author() ?></td> |
|---|
| 195 |
<?php |
|---|
| 196 |
break; |
|---|
| 197 |
|
|---|
| 198 |
case 'control_view': |
|---|
| 199 |
?> |
|---|
| 200 |
<td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> |
|---|
| 201 |
<?php |
|---|
| 202 |
break; |
|---|
| 203 |
|
|---|
| 204 |
case 'control_edit': |
|---|
| 205 |
?> |
|---|
| 206 |
<td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> |
|---|
| 207 |
<?php |
|---|
| 208 |
break; |
|---|
| 209 |
|
|---|
| 210 |
case 'control_delete': |
|---|
| 211 |
?> |
|---|
| 212 |
<td><?php if ( current_user_can('edit_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."), wp_specialchars(get_the_title('', ''), 1) ) . "' );\">" . __('Delete') . "</a>"; } ?></td> |
|---|
| 213 |
<?php |
|---|
| 214 |
break; |
|---|
| 215 |
|
|---|
| 216 |
default: |
|---|
| 217 |
?> |
|---|
| 218 |
<td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td> |
|---|
| 219 |
<?php |
|---|
| 220 |
break; |
|---|
| 221 |
} |
|---|
| 222 |
} |
|---|
| 223 |
?> |
|---|
| 224 |
</tr> |
|---|
| 225 |
<?php |
|---|
| 226 |
} |
|---|
| 227 |
} else { |
|---|
| 228 |
?> |
|---|
| 229 |
<tr style='background-color: <?php echo $bgcolor; ?>'> |
|---|
| 230 |
<td colspan="8"><?php _e('No posts found.') ?></td> |
|---|
| 231 |
</tr> |
|---|
| 232 |
<?php |
|---|
| 233 |
} |
|---|
| 234 |
?> |
|---|
| 235 |
</table> |
|---|
| 236 |
|
|---|
| 237 |
<div id="ajax-response"></div> |
|---|
| 238 |
|
|---|
| 239 |
<div class="navigation"> |
|---|
| 240 |
<div class="alignleft"><?php next_posts_link(__('« Previous Entries')) ?></div> |
|---|
| 241 |
<div class="alignright"><?php previous_posts_link(__('Next Entries »')) ?></div> |
|---|
| 242 |
</div> |
|---|
| 243 |
|
|---|
| 244 |
<?php |
|---|
| 245 |
if ( 1 == count($posts) ) { |
|---|
| 246 |
|
|---|
| 247 |
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); |
|---|
| 248 |
if ($comments) { |
|---|
| 249 |
?> |
|---|
| 250 |
<h3><?php _e('Comments') ?></h3> |
|---|
| 251 |
<ol id="comments"> |
|---|
| 252 |
<?php |
|---|
| 253 |
foreach ($comments as $comment) { |
|---|
| 254 |
$comment_status = wp_get_comment_status($comment->comment_ID); |
|---|
| 255 |
?> |
|---|
| 256 |
|
|---|
| 257 |
<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> > |
|---|
| 258 |
<?php comment_date('Y-n-j') ?> |
|---|
| 259 |
@ |
|---|
| 260 |
<?php comment_time('g:m:s a') ?> |
|---|
| 261 |
<?php |
|---|
| 262 |
if ( current_user_can('edit_post', $post->ID) ) { |
|---|
| 263 |
echo "[ <a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" . __('Edit') . "</a>"; |
|---|
| 264 |
echo " - <a href=\"post.php?action=deletecomment&p=".$post->ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> "; |
|---|
| 265 |
if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { |
|---|
| 266 |
if ('approved' == wp_get_comment_status($comment->comment_ID)) { |
|---|
| 267 |
echo " - <a href=\"post.php?action=unapprovecomment&p=".$post->ID."&comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> "; |
|---|
| 268 |
} else { |
|---|
| 269 |
echo " - <a href=\"post.php?action=approvecomment&p=".$post->ID."&comment=".$comment->comment_ID."\">" . __('Approve') . "</a> "; |
|---|
| 270 |
} |
|---|
| 271 |
} |
|---|
| 272 |
echo "]"; |
|---|
| 273 |
} |
|---|
| 274 |
?> |
|---|
| 275 |
<br /> |
|---|
| 276 |
<strong> |
|---|
| 277 |
<?php comment_author() ?> |
|---|
| 278 |
( |
|---|
| 279 |
<?php comment_author_email_link() ?> |
|---|
| 280 |
/ |
|---|
| 281 |
<?php comment_author_url_link() ?> |
|---|
| 282 |
)</strong> (IP: |
|---|
| 283 |
<?php comment_author_IP() ?> |
|---|
| 284 |
) |
|---|
| 285 |
<?php comment_text() ?> |
|---|
| 286 |
|
|---|
| 287 |
</li> |
|---|
| 288 |
<!-- /comment --> |
|---|
| 289 |
<?php |
|---|
| 290 |
} |
|---|
| 291 |
echo '</ol>'; |
|---|
| 292 |
} |
|---|
| 293 |
?> |
|---|
| 294 |
<?php } ?> |
|---|
| 295 |
</div> |
|---|
| 296 |
<?php |
|---|
| 297 |
include('admin-footer.php'); |
|---|
| 298 |
?> |
|---|
| 299 |
|
|---|