[ Index ]
 

Code source de WordPress 2.1.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/wp-admin/ -> edit.php (source)

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


Généré le : Fri Mar 30 19:41:27 2007 par Balluche grâce à PHPXref 0.7