Changeset 872

Show
Ignore:
Timestamp:
02/13/04 15:36:28 (5 years ago)
Author:
saxmatt
Message:

Admin interface improvements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/edit-comments.php

    r657 r872  
    33$parent_file = 'edit.php'; 
    44require_once('admin-header.php'); 
    5  
    6 if (!$showcomments) { 
    7     if ($comments_per_page) { 
    8         $showcomments=$comments_per_page; 
    9     } else { 
    10         $showcomments=10; 
    11         $comments_per_page=$showcomments; 
    12     } 
    13 } else { 
    14     $comments_per_page = $showcomments; 
    15 } 
    16  
    17 if ((!empty($commentstart)) && (!empty($commentend)) && ($commentstart == $commentend)) { 
    18     $p=$commentstart; 
    19     $commentstart=0; 
    20     $commentend=0; 
    21 } 
    22  
    23 if (!$commentstart) { 
    24     $commentstart=0; 
    25     $commentend=$showcomments; 
    26 } 
    27  
    28 $nextXstart=$commentend; 
    29 $nextXend=$commentend+$showcomments; 
    30  
    31 $previousXstart=($commentstart-$showcomments); 
    32 $previousXend=$commentstart; 
    33 if ($previousXstart < 0) { 
    34     $previousXstart=0; 
    35     $previousXend=$showcomments; 
    36 } 
    37  
    38 ob_start(); 
    395?> 
    406<ul id="adminmenu2"> 
    41     <li><a href="edit.php">Latest Posts</a></li> 
    42     <li><a href="edit-comments.php" class="current">Latest Comments</a></li> 
    43     <li class="last"><a href="moderation.php">Comments Awaiting Moderation</a></li> 
     7    <li><a href="edit.php">Posts</a></li> 
     8    <li><a href="edit-comments.php" class="current">Comments</a></li> 
     9    <li class="last"><a href="moderation.php">Awaiting Moderation</a></li> 
    4410</ul> 
    4511 
    4612<div class="wrap"> 
    47 <table width="100%"> 
    48   <tr> 
    49     <td valign="top" width="200"> 
    50       Show comments: 
    51     </td> 
    52     <td> 
    53       <table cellpadding="0" cellspacing="0" border="0"> 
    54         <tr> 
    55           <td colspan="2" align="center"><!-- show next/previous X comments --> 
    56             <form name="previousXcomments" method="get" action=""> 
     13<form name="searchform" action="" method="get">  
     14  <fieldset>  
     15  <legend>Show Comments That Contain...</legend>  
     16  <input type="text" name="s" value="<?php echo $s; ?>" size="17" />  
     17  <input type="submit" name="submit" value="Search"  />  
     18  </fieldset>  
     19</form> 
     20<p><a href="?mode=view">View Mode</a> | <a href="?mode=edit">Mass Edit Mode</a></p> 
    5721<?php 
    58 if ($previousXstart > 0) { 
    59 ?> 
    60               <input type="hidden" name="showcomments" value="<?php echo $showcomments; ?>" /> 
    61               <input type="hidden" name="commentstart" value="<?php echo $previousXstart; ?>" /> 
    62               <input type="hidden" name="commentend" value="<?php echo $previousXend; ?>" /> 
    63               <input type="submit" name="submitprevious" class="search" value="< <?php echo $showcomments ?>" /> 
    64 <?php 
     22if ($s) { 
     23    $s = $wpdb->escape($s); 
     24    $comments = $wpdb->get_results("SELECT * FROM $tablecomments  WHERE 
     25        comment_author LIKE '%$s%' OR 
     26        comment_author_email LIKE '%$s%' OR 
     27        comment_author_url LIKE ('%$s%') OR 
     28        comment_author_IP LIKE ('%$s%') OR 
     29        comment_content LIKE ('%$s%') 
     30        ORDER BY comment_date"); 
     31} else { 
     32    $comments = $wpdb->get_results("SELECT * FROM $tablecomments ORDER BY comment_date $commentorder LIMIT 20"); 
    6533} 
    66 ?> 
    67             </form> 
    68           </td> 
    69           <td> 
    70             <form name="nextXcomments" method="get" action=""> 
    71               <input type="hidden" name="showcomments" value="<?php echo $showcomments; ?>" /> 
    72               <input type="hidden" name="commentstart" value="<?php echo $nextXstart; ?>" /> 
    73               <input type="hidden" name="commentend" value="<?php echo $nextXend; ?>" /> 
    74               <input type="submit" name="submitnext" class="search" value="<?php echo $showcomments ?> >" /> 
    75             </form> 
    76           </td> 
    77         </tr> 
    78       </table> 
    79     </td> 
    80   </tr> 
    81   <tr> 
    82     <td valign="top" width="200"><!-- show X first/last comments --> 
    83       <form name="showXfirstlastcomments" method="get" action=""> 
    84         <input type="text" name="showcomments" value="<?php echo $showcomments ?>" style="width:40px;" /?> 
    85 <?php 
    86 if (empty($commentorder)) 
    87   $commentorder="DESC"; 
    88 $i = $commentorder; 
    89 if ($i == "DESC") 
    90  $besp_selected = "selected='selected'"; 
    91 ?> 
    92         <select name="commentorder"> 
    93           <option value="DESC" <?php echo $besp_selected ?>>last comments</option> 
    94 <?php 
    95 $besp_selected = ""; 
    96 if ($i == "ASC") 
    97 $besp_selected = "selected='selected'"; 
    98 ?> 
    99           <option value="ASC" <?php echo $besp_selected?>>first comments</option> 
    100         </select>&nbsp; 
    101         <input type="submit" name="submitfirstlast" class="search" value="OK" /> 
    102       </form> 
    103     </td> 
    104     <td valign="top"><!-- show comment X to comment X --> 
    105       <form name="showXfirstlastcomments" method="get" action=""> 
    106         <input type="text" name="commentstart" value="<?php echo $commentstart ?>" style="width:40px;" /?>&nbsp;to&nbsp;<input type="text" name="commentend" value="<?php echo $commentend ?>" style="width:40px;" /?>&nbsp; 
    107         <select name="commentorder"> 
    108 <?php 
    109 $besp_selected = ""; 
    110 $i = $commentorder; 
    111 if ($i == "DESC") 
    112   $besp_selected = "selected='selected'"; 
    113 ?> 
    114           <option value="DESC" "<?php echo $besp_selected ?>">from the end</option> 
    115 <?php 
    116 $besp_selected = ""; 
    117 if ($i == "ASC") 
    118   $besp_selected = "selected='selected'"; 
    119 ?>        <option value="ASC" "<?php echo $besp_selected ?>">from the start</option> 
    120         </select>&nbsp; 
    121         <input type="submit" name="submitXtoX" class="search" value="OK" /> 
    122       </form> 
    123     </td> 
    124   </tr> 
    125 </table> 
    126 </div> 
    127 <?php 
    128 $comments_nav_bar = ob_get_contents(); 
    129 ob_end_clean(); 
    130 echo $comments_nav_bar; 
    131 ?> 
    132  
    133 <div class="wrap"> 
    134  
    135     <?php 
    136     $comments = $wpdb->get_results("SELECT * FROM $tablecomments 
    137                                     ORDER BY comment_date $commentorder  
    138                                     LIMIT $commentstart, $commentend" 
    139                                   ); 
    140  
    141 // need to account for offet, etc. 
    142  
    14334    if ($comments) { 
    14435        echo '<ol>'; 
     
    18374 
    18475<?php  
    185 echo $comments_nav_bar;  
    18676include('admin-footer.php'); 
    18777?> 
  • trunk/wp-admin/edit-form-comment.php

    r771 r872  
    1  
    2 <div class="wrap"> 
    31<?php 
    42 
    53$allowed_users = explode(" ", trim($fileupload_allowedusers)); 
    64 
    7 function selected($selected, $current) { 
    8     if ($selected == $current) echo ' selected="selected"'; 
    9 
    10  
    11 function checked($checked, $current) { 
    12     if ($checked == $current) echo ' checked="checked"'; 
    13 
    14  
    15  
    16         $submitbutton_text = 'Edit this!'; 
    17         $toprow_title = 'Editing Comment # '.$commentdata['comment_ID']; 
    18         $form_action = 'editedcomment'; 
    19         $form_extra = "' />\n<input type='hidden' name='comment_ID' value='$comment' />\n<input type='hidden' name='comment_post_ID' value='".$commentdata["comment_post_ID"]; 
    20  
    21  
    22  
    23  
     5$submitbutton_text = 'Edit this!'; 
     6$toprow_title = 'Editing Comment # '.$commentdata['comment_ID']; 
     7$form_action = 'editedcomment'; 
     8$form_extra = "' />\n<input type='hidden' name='comment_ID' value='$comment' />\n<input type='hidden' name='comment_post_ID' value='".$commentdata["comment_post_ID"]; 
    249?> 
     10<div class="wrap"> 
    2511 
    2612<form name="post" action="post.php" method="post" id="post"> 
  • trunk/wp-admin/edit.php

    r808 r872  
    11<?php 
    2 $title = 'Edit Posts'; 
     2$title = 'Posts'; 
    33require_once('admin-header.php'); 
    4 if (!$showposts) { 
    5     if ($posts_per_page) { 
    6         $showposts=$posts_per_page; 
    7     } else { 
    8         $showposts=10; 
    9         $posts_per_page=$showposts; 
    10     } 
    11 } else { 
    12     $posts_per_page = $showposts; 
    13 } 
    144 
    15 if ((!empty($poststart)) && (!empty($postend)) && ($poststart == $postend)) { 
    16     $p=$poststart; 
    17     $poststart=0; 
    18     $postend=0; 
    19 } 
    20  
    21 if (!$poststart) { 
    22     $poststart=0; 
    23     $postend=$showposts; 
    24 } 
    25  
    26 $nextXstart=$postend; 
    27 $nextXend=$postend+$showposts; 
    28  
    29 $previousXstart=($poststart-$showposts); 
    30 $previousXend=$poststart; 
    31 if ($previousXstart < 0) { 
    32     $previousXstart=0; 
    33     $previousXend=$showposts; 
    34 } 
    35  
    36 ob_start(); 
    375?> 
    38 <ul id="adminmenu2"> 
    39     <li><a href="edit.php" class="current">Latest Posts</a></li> 
    40     <li><a href="edit-comments.php">Latest Comments</a></li> 
    41     <li class="last"><a href="moderation.php">Comments Awaiting Moderation</a></li> 
    42 </ul> 
     6 <ul id="adminmenu2">  
     7  <li><a href="edit.php" class="current">Posts</a></li>  
     8  <li><a href="edit-comments.php">Comments</a></li>  
     9  <li class="last"><a href="moderation.php">Awaiting Moderation</a></li>  
     10</ul>  
    4311<?php 
    4412get_currentuserinfo(); 
    4513$drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID"); 
    4614if ($drafts) { 
    47     ?> 
    48     <div class="wrap"> 
    49     <p><strong>Your Drafts:</strong> 
    50    <?php 
     15    ?>  
     16<div class="wrap">  
     17  <p><strong>Your Drafts:</strong>  
     18    <?php 
    5119    $i = 0; 
    5220    foreach ($drafts as $draft) { 
     
    5927        ++$i; 
    6028        } 
    61     ?>.</p> 
    62     </div> 
    63     <?php 
    64 
    65 ?> 
    66 <div class="wrap"> 
    67 <table width="100%"> 
    68   <tr> 
    69     <td valign="top" width="200"> 
    70       Show posts: 
    71     </td> 
    72     <td> 
    73       <table cellpadding="0" cellspacing="0" border="0"> 
    74         <tr> 
    75           <td colspan="2" align="center"><!-- show next/previous X posts --> 
    76             <form name="previousXposts" method="get" action=""> 
    77 <?php 
    78 if ($previousXstart > 0) { 
    79 ?> 
    80               <input type="hidden" name="showposts" value="<?php echo $showposts; ?>" /> 
    81               <input type="hidden" name="poststart" value="<?php echo $previousXstart; ?>" /> 
    82               <input type="hidden" name="postend" value="<?php echo $previousXend; ?>" /> 
    83               <input type="submit" name="submitprevious" class="search" value="< <?php echo $showposts ?>" /> 
     29    ?>  
     30    .</p>  
     31</div>  
    8432<?php 
    8533} 
    86 ?> 
    87             </form> 
    88           </td> 
    89           <td> 
    90             <form name="nextXposts" method="get" action=""> 
    91               <input type="hidden" name="showposts" value="<?php echo $showposts; ?>" /> 
    92               <input type="hidden" name="poststart" value="<?php echo $nextXstart; ?>" /> 
    93               <input type="hidden" name="postend" value="<?php echo $nextXend; ?>" /> 
    94               <input type="submit" name="submitnext" class="search" value="<?php echo $showposts ?> >" /> 
    95             </form> 
    96           </td> 
    97         </tr> 
    98       </table> 
    99     </td> 
    100   </tr> 
    101   <tr> 
    102     <td valign="top" width="200"><!-- show X first/last posts --> 
    103       <form name="showXfirstlastposts" method="get" action=""> 
    104         <input type="text" name="showposts" value="<?php echo $showposts ?>" style="width:40px;" /?> 
    105 <?php 
    106 if (!isset($order)) 
    107   $order="DESC"; 
    108 $i = $order; 
    109 if ($i == "DESC") 
    110  $besp_selected = "selected='selected'"; 
    111 ?> 
    112         <select name="order"> 
    113           <option value="DESC" <?php echo $besp_selected ?>>last posts</option> 
    114 <?php 
    115 $besp_selected = ""; 
    116 if ($i == "ASC") 
    117 $besp_selected = "selected='selected'"; 
    118 ?> 
    119           <option value="ASC" <?php echo $besp_selected?>>first posts</option> 
    120         </select>&nbsp; 
    121         <input type="submit" name="submitfirstlast" class="search" value="OK" /> 
    122       </form> 
    123     </td> 
    124     <td valign="top"><!-- show post X to post X --> 
    125       <form name="showXfirstlastposts" method="get" action=""> 
    126         <input type="text" name="poststart" value="<?php echo $poststart ?>" style="width:40px;" /?>&nbsp;to&nbsp;<input type="text" name="postend" value="<?php echo $postend ?>" style="width:40px;" /?>&nbsp; 
    127         <select name="order"> 
    128 <?php 
    129 $besp_selected = ""; 
    130 $i = $order; 
    131 if ($i == "DESC") 
    132   $besp_selected = "selected='selected'"; 
    133 ?> 
    134           <option value="DESC" "<?php echo $besp_selected ?>">from the end</option> 
    135 <?php 
    136 $besp_selected = ""; 
    137 if ($i == "ASC") 
    138   $besp_selected = "selected='selected'"; 
    139 ?>        <option value="ASC" "<?php echo $besp_selected ?>">from the start</option> 
    140         </select>&nbsp; 
    141         <input type="submit" name="submitXtoX" class="search" value="OK" /> 
    142       </form> 
    143     </td> 
    144   </tr> 
    145 </table> 
    146 </div> 
    147  
    148 <?php 
    149 $posts_nav_bar = ob_get_contents(); 
    150 ob_end_clean(); 
    151 echo $posts_nav_bar; 
    152 ?> 
    153  
    154 <div class="wrap"> 
    155 <table width="100%"> 
    156   <tr> 
    157     <td valign="top" width="33%"> 
    158         <form name="searchform" action="" method="get"> 
    159             <input type="hidden" name="a" value="s" /> 
    160             <input onfocus="this.value='';" onblur="if (this.value=='') {this.value='search...';}" type="text" name="s" value="search..." size="7" style="width: 100px;" /> 
    161             <input type="submit" name="submit" value="search" class="search" /> 
    162         </form> 
    163     </td> 
    164     <td valign="top" width="33%" align="center"> 
    165       <form name="viewcat" action="" method="get"> 
    166         <select name="cat" style="width:140px;"> 
    167         <option value="all">All Categories</option> 
    168         <?php 
    169     $categories = $wpdb->get_results("SELECT * FROM $tablecategories"); 
    170     $width = ($mode=="sidebar") ? "100%" : "170px"; 
    171     foreach ($categories as $category) { 
    172         echo "<option value=\"".$category->cat_ID."\""; 
    173         if ($category->cat_ID == $postdata["Category"]) 
    174             echo " selected='selected'"; 
    175         echo ">".$category->cat_name."</option>"; 
    176     } 
    177         ?> 
    178         </select> 
    179         <input type="submit" name="submit" value="View" class="search" /> 
    180       </form> 
    181     </td> 
    182     <td valign="top" width="33%" align="right"> 
    183     <form name="viewarc" action="" method="get"> 
    184     <?php 
    185  
    186     if ($archive_mode == "monthly") { 
    187         echo "<select name=\"m\" style=\"width:120px;\">"; 
    188         $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date) FROM $tableposts ORDER BY post_date DESC",ARRAY_A); 
    189         foreach ($arc_result as $arc_row) { 
    190             $arc_year  = $arc_row["YEAR(post_date)"]; 
    191             $arc_month = $arc_row["MONTH(post_date)"]; 
    192             echo "<option value=\"$arc_year".zeroise($arc_month,2)."\">"; 
    193             echo $month[zeroise($arc_month,2)]." $arc_year"; 
    194             echo "</option>\n"; 
    195         } 
    196     } elseif ($archive_mode == "daily") { 
    197         echo "<select name=\"d\" style=\"width:120px;\">"; 
    198         $archive_day_date_format = "Y/m/d"; 
    199         $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) FROM $tableposts ORDER BY post_date DESC", ARRAY_A); 
    200         foreach ($arc_result as $arc_row) { 
    201             $arc_year  = $arc_row["YEAR(post_date)"]; 
    202             $arc_month = $arc_row["MONTH(post_date)"]; 
    203             $arc_dayofmonth = $arc_row["DAYOFMONTH(post_date)"]; 
    204             echo "<option value=\"$arc_year".zeroise($arc_month,2).zeroise($arc_dayofmonth,2)."\">"; 
    205             echo mysql2date($archive_day_date_format, $arc_year.zeroise($arc_month,2).zeroise($arc_dayofmonth,2)." 00:00:00"); 
    206             echo "</option>\n"; 
    207         } 
    208     } elseif ($archive_mode == "weekly") { 
    209         echo "<select name=\"w\" style=\"width:120px;\">"; 
    210         if (!isset($start_of_week)) { 
    211             $start_of_week = 1; 
    212         } 
    213         $archive_week_start_date_format = "Y/m/d"; 
    214         $archive_week_end_date_format   = "Y/m/d"; 
    215         $archive_week_separator = " - "; 
    216         $arc_result=$wpdb->geT_results("SELECT DISTINCT YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date), WEEK(post_date) FROM $tableposts ORDER BY post_date DESC", ARRAY_A); 
    217         $arc_w_last = ''; 
    218         foreach ($arc_result as $arc_row) { 
    219             $arc_year = $arc_row["YEAR(post_date)"]; 
    220             $arc_w = $arc_row["WEEK(post_date)"]; 
    221             if ($arc_w != $arc_w_last) { 
    222                 $arc_w_last = $arc_w; 
    223                 $arc_ymd = $arc_year."-".zeroise($arc_row["MONTH(post_date)"],2)."-" .zeroise($arc_row["DAYOFMONTH(post_date)"],2); 
    224                 $arc_week = get_weekstartend($arc_ymd, $start_of_week); 
    225                 $arc_week_start = date($archive_week_start_date_format, $arc_week['start']); 
    226                 $arc_week_end = date($archive_week_end_date_format, $arc_week['end']); 
    227                 echo "<option value=\"$arc_w\">"; 
    228                 echo $arc_week_start.$archive_week_separator.$arc_week_end; 
    229                 echo "</option>\n"; 
    230             } 
    231         } 
    232     } elseif ($archive_mode == "postbypost") { 
    233         echo '<input type="hidden" name="more" value="1" />'; 
    234         echo '<select name="p" style="width:120px;">'; 
    235         $resultarc = $wpdb->get_results("SELECT ID,post_date,post_title FROM $tableposts ORDER BY post_date DESC"); 
    236         foreach ($resultarc as $row) { 
    237             if ($row->post_date != "0000-00-00 00:00:00") { 
    238                 echo "<option value=\"".$row->ID."\">"; 
    239                 if (strip_tags($row->post_title)) { 
    240                     echo strip_tags(stripslashes($row->post_title)); 
    241                 } else { 
    242                     echo $row->ID; 
    243                 } 
    244                 echo "</option>\n"; 
    245             } 
    246         } 
    247     } 
    248  
    249     echo "</select>"; 
    250     ?> 
    251         <input type="submit" name="submit" value="View" class="search" /> 
    252       </form> 
    253     </td> 
    254   </tr> 
    255 </table> 
    256  
    257 <?php 
     34?>  
     35<div class="wrap">  
     36<form name="searchform" action="" method="get">  
     37  <fieldset>  
     38  <legend>Show Posts That Contain...</legend>  
     39  <input type="text" name="s" value="<?php echo $s; ?>" size="17" />  
     40  <input type="submit" name="submit" value="Search"  />  
     41  </fieldset>  
     42</form>  
     43<table width="100%" cellpadding="3" cellspacing="3">  
     44  <tr>  
     45    <th scope="col">ID</th>  
     46    <th scope="col">When</th>  
     47    <th scope="col">Title</th>  
     48    <th scope="col">Categories</th>  
     49    <th scope="col">Comments</th>  
     50    <th scope="col">Author</th>  
     51    <th scope="col">Edit</th>  
     52    <th scope="col">Delete</th>  
     53  </tr>  
     54  <?php 
    25855include(ABSPATH.'wp-blog-header.php'); 
    25956 
    26057if ($posts) { 
    26158foreach ($posts as $post) { start_wp(); 
     59$bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee'; 
     60?>  
     61  <tr style='background-color: <?php echo $bgcolor; ?>'>  
     62    <th scope="row"><?php echo $id ?></th>  
     63    <td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td>  
     64    <td><a href="<?php permalink_link(); ?>" rel="permalink">  
     65      <?php the_title() ?>  
     66      </a>  
     67      <?php if ('private' == $post->post_status) echo ' - <strong>Private</strong>'; ?></td>  
     68    <td><?php the_category(','); ?></td>  
     69    <td><a href="edit.php?p=<?php echo $id ?>&c=1">  
     70      <?php comments_number('no comments', '1 comment', "% comments") ?>  
     71      </a></td>  
     72    <td><?php the_author() ?></td>  
     73    <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>Edit</a>"; } ?></td>  
     74    <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&amp;post=$id' class='delete' onclick=\"return confirm('You are about to delete this post \'".the_title('','',0)."\'\\n  \'OK\' to delete, \'Cancel\' to stop.')\">Delete</a>"; } ?></td>  
     75  </tr>  
     76<?php 
     77} 
     78} else { 
    26279?> 
    263             <p> 
    264                 <strong><?php the_time('Y/m/d @ H:i:s'); ?></strong> [ <a href="edit.php?p=<?php echo $id ?>&c=1"><?php comments_number('no comments', '1 comment', "% comments") ?></a> 
    265                 <?php 
    266                 if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 
    267                 echo " - <a href='post.php?action=edit&amp;post=$id"; 
    268                 if ($m) 
    269                 echo "&m=$m"; 
    270                 echo "'>Edit</a>"; 
    271                 echo " - <a href='post.php?action=delete&amp;post=$id' onclick=\"return confirm('You are about to delete this post \'".the_title('','',0)."\'\\n  \'OK\' to delete, \'Cancel\' to stop.')\">Delete</a> "; 
     80  <tr style='background-color: <?php echo $bgcolor; ?>'>  
     81    <td colspan="8">No posts found.</td>  
     82  </tr>  
     83<?php 
     84} // end if ($posts) 
     85?>  
     86</table>  
     87<?php 
     88if (($withcomments) or ($single)) { 
     89 
     90    $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 
     91    if ($comments) { 
     92    ?>  
     93<h3>Comments</h3>  
     94<ol id="comments">  
     95<?php 
     96foreach ($comments as $comment) { 
     97$comment_status = wp_get_comment_status($comment->comment_ID); 
     98?>  
     99 
     100<li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> > 
     101  <?php comment_date('Y-n-j') ?>  
     102  @ 
     103  <?php comment_time('g:m:s a') ?>  
     104  <?php  
     105            if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 
     106                echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">Edit</a>"; 
     107                echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('You are about to delete this comment by \'".$comment->comment_author."\'\\n  \'OK\' to delete, \'Cancel\' to stop.')\">Delete</a> "; 
     108                if ( ('none' != $comment_status) && ($user_level >= 3) ) { 
     109                    if ('approved' == wp_get_comment_status($comment->comment_ID)) { 
     110                        echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">Unapprove</a> "; 
     111                    } else { 
     112                        echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">Approve</a> "; 
     113                    } 
    272114                } 
    273                 if ('private' == $post->post_status) echo ' - <strong>Private</strong>'; 
    274                 ?> 
    275                 ] 
    276                 <br /> 
    277                 <strong><a href="<?php permalink_link(); ?>" rel="permalink"><?php the_title() ?></a></strong> &#8212; <cite><?php the_author() ?> (<a href="javascript:profile(<?php the_author_ID() ?>)"><?php the_author_nickname() ?></a>)</cite>, in <strong><?php the_category() ?></strong><br /> 
    278                 <?php 
    279                 the_content(); 
    280                 ?> 
    281             </p> 
    282                 <?php 
     115                echo "]"; 
     116            } // end if any comments to show 
     117            ?>  
     118  <br />  
     119  <strong>  
     120  <?php comment_author() ?>  
     121  ( 
     122  <?php comment_author_email_link() ?>  
     123  / 
     124  <?php comment_author_url_link() ?>  
     125  )</strong> (IP: 
     126  <?php comment_author_IP() ?>  
     127  ) 
     128  <?php comment_text() ?>  
    283129 
    284                 // comments 
    285                 if (($withcomments) or ($single)) { 
    286  
    287                     $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date"); 
    288                     if ($comments) { 
    289                     ?> 
    290  
    291                     <h3>Comments</h3> 
    292                     <ol id="comments"> 
    293                         <?php 
    294                         foreach ($comments as $comment) { 
    295                         ?> 
    296                  
    297                     <!-- comment --> 
    298                     <li> 
    299                         <?php 
    300                         $comment_status = wp_get_comment_status($comment->comment_ID); 
    301                          
    302                         if ("unapproved" == $comment_status) { 
    303                             echo "<span class=\"unapproved\">"; 
    304                         } 
    305                         ?> 
    306                             <?php comment_date('Y/m/d') ?> @ <?php comment_time() ?>  
    307                             <?php  
    308                             if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { 
    309                                 echo "[ <a href=\"post.php?action=editcomment&amp;comment=".$comment->comment_ID."\">Edit</a>"; 
    310                                 echo " - <a href=\"post.php?action=deletecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return confirm('You are about to delete this comment by \'".$comment->comment_author."\'\\n  \'OK\' to delete, \'Cancel\' to stop.')\">Delete</a> "; 
    311                                 if ( ('none' != $comment_status) && ($user_level >= 3) ) { 
    312                                     if ('approved' == wp_get_comment_status($comment->comment_ID)) { 
    313                                         echo " - <a href=\"post.php?action=unapprovecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">Unapprove</a> "; 
    314                                     } else { 
    315                                         echo " - <a href=\"post.php?action=approvecomment&amp;p=".$post->ID."&amp;comment=".$comment->comment_ID."\">Approve</a> "; 
    316                                     } 
    317                                 } 
    318                                 echo "]"; 
    319                             } // end if any comments to show 
    320                             ?> 
    321                         <br /> 
    322                         <strong><?php comment_author() ?> ( <?php comment_author_email_link() ?> / <?php comment_author_url_link() ?> )</strong> (IP: <?php comment_author_IP() ?>) 
    323                             <?php comment_text() ?> 
    324                         <?php 
    325                         if ("unapproved" == $comment_status) { 
    326                             echo "</span>"; 
    327                         } 
    328                         ?> 
    329                     </li> 
    330                     <!-- /comment --> 
    331  
    332                         <?php //end of the loop, don't delete 
    333                         } // end foreach 
    334                     echo '</ol>'; 
    335                     }//end if comments 
    336                     if ($comment_error) 
    337                         echo "<p>Error: please fill the required fields (name & comment)</p>"; 
    338                     ?> 
    339  
    340                     <h3>Leave Comment</h3> 
    341  
    342  
    343                     <!-- form to add a comment --> 
    344  
    345                     <form action="<?php echo $siteurl.'/wp-comments-post.php'?>" method="post"> 
    346                         <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" /> 
    347                         <input type="hidden" name="redirect_to" value="<?php echo $HTTP_SERVER_VARS["REQUEST_URI"]; ?>" /> 
    348                         <input type="text" name="author" class="textarea" value="<?php echo $user_nickname ?>" size="20" tabindex="1" /><br /> 
    349                         <input type="text" name="email" class="textarea" value="<?php echo $user_email ?>" size="20" tabindex="2" /><br /> 
    350                         <input type="text" name="url" class="textarea" value="<?php echo $user_url ?>" size="20" tabindex="3" /><br /> 
    351                         <textarea cols="40" rows="4" name="comment" tabindex="4" class="textarea">comment</textarea><br /> 
    352                         <input type="submit" name="submit" class="buttonarea" value="ok" tabindex="5" /> 
    353                     </form> 
    354                     <!-- /form --> 
    355  
    356                     <?php // if you delete this the sky will fall on your head 
    357                 } 
    358                 ?> 
    359             <br /> 
    360  
    361     <?php 
    362  
    363     } // end b2 loop 
    364      
    365     } else { 
    366  
    367         ?> 
    368         <p> 
    369         <strong>No results found.</strong> 
    370         </p> 
    371          
    372         <?php 
    373     } // end if ($posts) 
    374  
     130</li>  
     131<!-- /comment -->  
     132<?php //end of the loop, don't delete 
     133        } // end foreach 
     134    echo '</ol>'; 
     135    }//end if comments 
    375136    ?> 
    376  
    377 </div> 
    378  
     137    <p><a href="edit.php">Back to posts</a></p> 
     138<?php } ?>  
     139</div>  
    379140<?php  
    380 // uncomment this to show the nav bar at the bottom as well 
    381  echo $posts_nav_bar;  
    382141 include('admin-footer.php'); 
    383 ?> 
     142?>  
  • trunk/wp-admin/menu.php

    r831 r872  
    1212        // 0 = user level, 1 = file, 2 = name 
    1313        $self = str_replace('/wp-admin/', '', $PHP_SELF); 
    14         if ((substr($self, -20) == substr($item[1], -20)) || ($parent_file && ($item[1] == $parent_file))) $class = ' class="current"'; 
     14        if ((substr($self, -20) == substr($item[1], -20) && empty($parent_file)) || ($parent_file && ($item[1] == $parent_file))) $class = ' class="current"'; 
    1515        if ($user_level >= $item[0]) { 
    1616            if (('upload.php' == $item[1] && $use_fileupload && ($user_level >= $fileupload_minlevel) 
  • trunk/wp-admin/post.php

    r870 r872  
    432432        $title = 'Edit Comment'; 
    433433        $standalone = 0; 
     434        $parent_file = 'edit.php'; 
    434435        require_once ('admin-header.php'); 
    435436