Make WordPress Core


Ignore:
Timestamp:
10/30/2006 07:27:24 PM (20 years ago)
Author:
matt
Message:

Make these links shorter and remove unneeded vars

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/comment.php

    r4424 r4432  
    1616        require_once ('admin-header.php');
    1717
    18         $comment = (int) $_GET['comment'];
     18        $comment = (int) $_GET['c'];
    1919
    2020        if ( ! $comment = get_comment($comment) )
     
    3030        break;
    3131
    32 case 'confirmdeletecomment':
    33 case 'mailapprovecomment':
     32case 'cdc':
     33case 'mac':
    3434
    3535        require_once('./admin-header.php');
    3636
    37         $comment = (int) $_GET['comment'];
    38         $p = (int) $_GET['p'];
    39         $formaction = 'confirmdeletecomment' == $action ? 'deletecomment' : 'approvecomment';
    40         $nonce_action = 'confirmdeletecomment' == $action ? 'delete-comment_' : 'approve-comment_';
     37        $comment = (int) $_GET['c'];
     38        $formaction = 'cdc' == $action ? 'deletecomment' : 'approvecomment';
     39        $nonce_action = 'cdc' == $action ? 'delete-comment_' : 'approve-comment_';
    4140        $nonce_action .= $comment;
    4241
     
    4544
    4645        if ( !current_user_can('edit_post', $comment->comment_post_ID) )
    47                 wp_die( 'confirmdeletecomment' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
     46                wp_die( 'cdc' == $action ? __('You are not allowed to delete comments on this post.') : __('You are not allowed to edit comments on this post, so you cannot approve this comment.') );
    4847?>
    4948<div class='wrap'>
    5049
    5150<div class="narrow">
    52 <?php if ( 'spam' == $_GET['delete_type'] ) { ?>
     51<?php if ( 'spam' == $_GET['dt'] ) { ?>
    5352<p><?php _e('<strong>Caution:</strong> You are about to mark the following comment as spam:'); ?></p>
    54 <?php } elseif ( 'confirmdeletecomment' == $action ) { ?>
     53<?php } elseif ( 'cdc' == $action ) { ?>
    5554<p><?php _e('<strong>Caution:</strong> You are about to delete the following comment:'); ?></p>
    5655<?php } else { ?>
     
    7170<?php wp_nonce_field($nonce_action); ?>
    7271<input type='hidden' name='action' value='<?php echo $formaction; ?>' />
    73 <?php if ( 'spam' == $_GET['delete_type'] ) { ?>
    74 <input type='hidden' name='delete_type' value='spam' />
     72<?php if ( 'spam' == $_GET['dt'] ) { ?>
     73<input type='hidden' name='dt' value='spam' />
    7574<?php } ?>
    7675<input type='hidden' name='p' value='<?php echo $comment->comment_post_ID; ?>' />
     
    108107
    109108case 'deletecomment':
    110         $comment = (int) $_REQUEST['comment'];
     109        $comment = (int) $_REQUEST['c'];
    111110        check_admin_referer('delete-comment_' . $comment);
    112111
    113         $p = (int) $_REQUEST['p'];
    114112        if ( isset($_REQUEST['noredir']) ) {
    115113                $noredir = true;
     
    118116        }
    119117
    120         $postdata = get_post($p) or
    121                 wp_die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php'));
    122 
    123118        if ( ! $comment = get_comment($comment) )
    124119                         wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php'));
     
    127122                wp_die( __('You are not allowed to edit comments on this post.') );
    128123
    129         if ( 'spam' == $_REQUEST['delete_type'] )
     124        if ( 'spam' == $_REQUEST['dt'] )
    130125                wp_set_comment_status($comment->comment_ID, 'spam');
    131126        else
     
    141136
    142137case 'unapprovecomment':
    143         $comment = (int) $_GET['comment'];
     138        $comment = (int) $_GET['c'];
    144139        check_admin_referer('unapprove-comment_' . $comment);
    145        
    146         $p = (int) $_GET['p'];
     140
    147141        if (isset($_GET['noredir'])) {
    148142                $noredir = true;
     
    162156                wp_redirect(wp_get_referer());
    163157        } else {
    164                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     158                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments');
    165159        }
    166160        exit();
     
    168162
    169163case 'approvecomment':
    170         $comment = (int) $_GET['comment'];
     164        $comment = (int) $_GET['c'];
    171165        check_admin_referer('approve-comment_' . $comment);
    172166
    173         $p = (int) $_GET['p'];
    174167        if (isset($_GET['noredir'])) {
    175168                $noredir = true;
     
    193186                wp_redirect(wp_get_referer());
    194187        } else {
    195                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');
     188                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments');
    196189        }
    197190        exit();
Note: See TracChangeset for help on using the changeset viewer.