PHP Cross Reference of WordPress Subversion HEAD

[ Index ]     [ Classes ]     [ Functions ]     [ Variables ]     [ Constants ]

title

Body

[close]

/wp-admin/includes/ -> comment.php (source)

   1  <?php
   2  
   3  function comment_exists($comment_author, $comment_date) {
   4      global $wpdb;
   5  
   6      return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
   7              WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
   8  }
   9  
  10  function edit_comment() {
  11  
  12      $comment_post_ID = (int) $_POST['comment_post_ID'];
  13  
  14      if (!current_user_can( 'edit_post', $comment_post_ID ))
  15          wp_die( __('You are not allowed to edit comments on this post, so you cannot edit this comment.' ));
  16  
  17      $_POST['comment_author'] = $_POST['newcomment_author'];
  18      $_POST['comment_author_email'] = $_POST['newcomment_author_email'];
  19      $_POST['comment_author_url'] = $_POST['newcomment_author_url'];
  20      $_POST['comment_approved'] = $_POST['comment_status'];
  21      $_POST['comment_content'] = $_POST['content'];
  22      $_POST['comment_ID'] = (int) $_POST['comment_ID'];
  23  
  24      if (!empty ( $_POST['edit_date'] ) ) {
  25          $aa = $_POST['aa'];
  26          $mm = $_POST['mm'];
  27          $jj = $_POST['jj'];
  28          $hh = $_POST['hh'];
  29          $mn = $_POST['mn'];
  30          $ss = $_POST['ss'];
  31          $jj = ($jj > 31 ) ? 31 : $jj;
  32          $hh = ($hh > 23 ) ? $hh -24 : $hh;
  33          $mn = ($mn > 59 ) ? $mn -60 : $mn;
  34          $ss = ($ss > 59 ) ? $ss -60 : $ss;
  35          $_POST['comment_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
  36      }
  37  
  38      wp_update_comment( $_POST);
  39  }
  40  
  41  function get_comment_to_edit( $id ) {
  42      if ( !$comment = get_comment($id) )
  43          return false;
  44  
  45      $comment->comment_ID = (int) $comment->comment_ID;
  46      $comment->comment_post_ID = (int) $comment->comment_post_ID;
  47  
  48      $comment->comment_content = format_to_edit( $comment->comment_content );
  49      $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content);
  50  
  51      $comment->comment_author = format_to_edit( $comment->comment_author );
  52      $comment->comment_author_email = format_to_edit( $comment->comment_author_email );
  53      $comment->comment_author_url = clean_url($comment->comment_author_url);
  54      $comment->comment_author_url = format_to_edit( $comment->comment_author_url );
  55  
  56      return $comment;
  57  }
  58  
  59  function get_pending_comments_num( $post_id ) {
  60      global $wpdb;
  61      $post_id = (int) $post_id;
  62      $pending = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = $post_id AND comment_approved = '0'" );
  63      return $pending;
  64  }
  65  
  66  ?>


Generated Thu Dec 6 06:47:08 2007 for RedAlt XRefs Cross-referenced by PHPXref 0.6 and RedAlt