Changeset 3563 for trunk/wp-admin/post.php
- Timestamp:
- 02/21/2006 06:11:46 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/post.php
r3529 r3563 19 19 } 20 20 21 if (isset($_POST['deletepost'])) {21 if (isset($_POST['deletepost'])) 22 22 $action = "delete"; 23 }24 25 // Fix submenu highlighting for pages.26 if ( isset($_REQUEST['post']) && 'page' == get_post_type($_REQUEST['post']) )27 $submenu_file = 'page-new.php';28 29 $editing = true;30 23 31 24 switch($action) { … … 44 37 break; 45 38 default: 46 $location = 'post .php';39 $location = 'post-new.php'; 47 40 break; 48 41 } 49 42 } else { 50 $location = 'post .php?posted=true';43 $location = 'post-new.php?posted=true'; 51 44 } 52 53 if ( 'page' == $_POST['post_type'] )54 $location = "page-new.php?saved=true";55 45 56 46 if ( isset($_POST['save']) ) … … 63 53 case 'edit': 64 54 $title = __('Edit'); 65 55 $parent_file = 'edit.php'; 56 $submenu_file = 'edit.php'; 57 $editing = true; 66 58 require_once('admin-header.php'); 67 59 68 60 $post_ID = $p = (int) $_GET['post']; 69 61 62 $post = get_post($post_ID); 70 63 if ( !current_user_can('edit_post', $post_ID) ) 71 64 die ( __('You are not allowed to edit this post.') ); … … 73 66 $post = get_post_to_edit($post_ID); 74 67 75 if ($post->post_type == 'page') 76 include('edit-page-form.php'); 77 else 78 include('edit-form-advanced.php'); 68 include('edit-form-advanced.php'); 79 69 80 70 ?> … … 132 122 $post = & get_post($post_id); 133 123 134 if ( !current_user_can(' edit_post', $post_id) )124 if ( !current_user_can('delete_post', $post_id) ) 135 125 die( __('You are not allowed to delete this post.') ); 136 126 … … 148 138 $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback); 149 139 header ('Location: ' . $sendback); 150 break; 151 152 case 'editcomment': 153 $title = __('Edit Comment'); 154 $parent_file = 'edit.php'; 155 require_once ('admin-header.php'); 156 157 get_currentuserinfo(); 158 159 $comment = (int) $_GET['comment']; 160 161 if ( ! $comment = get_comment($comment) ) 162 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 163 164 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 165 die( __('You are not allowed to edit comments on this post.') ); 166 167 $comment = get_comment_to_edit($comment); 168 169 include('edit-form-comment.php'); 170 171 break; 172 173 case 'confirmdeletecomment': 174 175 require_once('./admin-header.php'); 176 177 $comment = (int) $_GET['comment']; 178 $p = (int) $_GET['p']; 179 180 if ( ! $comment = get_comment($comment) ) 181 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 182 183 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 184 die( __('You are not allowed to delete comments on this post.') ); 185 186 echo "<div class='wrap'>\n"; 187 if ( 'spam' == $_GET['delete_type'] ) 188 echo "<p>" . __('<strong>Caution:</strong> You are about to mark the following comment as spam:') . "</p>\n"; 189 else 190 echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n"; 191 echo "<table border='0'>\n"; 192 echo "<tr><td>" . __('Author:') . "</td><td>$comment->comment_author</td></tr>\n"; 193 echo "<tr><td>" . __('E-mail:') . "</td><td>$comment->comment_author_email</td></tr>\n"; 194 echo "<tr><td>". __('URL:') . "</td><td>$comment->comment_author_url</td></tr>\n"; 195 echo "<tr><td>". __('Comment:') . "</td><td>$comment->comment_content</td></tr>\n"; 196 echo "</table>\n"; 197 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; 198 199 echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n"; 200 echo "<input type='hidden' name='action' value='deletecomment' />\n"; 201 if ( 'spam' == $_GET['delete_type'] ) 202 echo "<input type='hidden' name='delete_type' value='spam' />\n"; 203 echo "<input type='hidden' name='p' value='$p' />\n"; 204 echo "<input type='hidden' name='comment' value='{$comment->comment_ID}' />\n"; 205 echo "<input type='hidden' name='noredir' value='1' />\n"; 206 echo "<input type='submit' value='" . __('Yes') . "' />"; 207 echo " "; 208 echo "<input type='button' value='" . __('No') . "' onclick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments';\" />\n"; 209 echo "</form>\n"; 210 echo "</div>\n"; 211 212 break; 213 214 case 'deletecomment': 215 216 check_admin_referer(); 217 218 $comment = (int) $_GET['comment']; 219 $p = (int) $_GET['p']; 220 if (isset($_GET['noredir'])) { 221 $noredir = true; 222 } else { 223 $noredir = false; 224 } 225 226 $postdata = get_post($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 227 228 if ( ! $comment = get_comment($comment) ) 229 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 230 231 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 232 die( __('You are not allowed to edit comments on this post.') ); 233 234 if ( 'spam' == $_GET['delete_type'] ) 235 wp_set_comment_status($comment->comment_ID, 'spam'); 236 else 237 wp_delete_comment($comment->comment_ID); 238 239 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 240 header('Location: ' . $_SERVER['HTTP_REFERER']); 241 } else { 242 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 243 } 244 245 break; 246 247 case 'unapprovecomment': 248 249 check_admin_referer(); 250 251 $comment = (int) $_GET['comment']; 252 $p = (int) $_GET['p']; 253 if (isset($_GET['noredir'])) { 254 $noredir = true; 255 } else { 256 $noredir = false; 257 } 258 259 if ( ! $comment = get_comment($comment) ) 260 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 261 262 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 263 die( __('You are not allowed to edit comments on this post, so you cannot disapprove this comment.') ); 264 265 wp_set_comment_status($comment->comment_ID, "hold"); 266 267 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 268 header('Location: ' . $_SERVER['HTTP_REFERER']); 269 } else { 270 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 271 } 272 273 break; 274 275 case 'mailapprovecomment': 276 277 $comment = (int) $_GET['comment']; 278 279 if ( ! $comment = get_comment($comment) ) 280 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 281 282 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 283 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 284 285 if ('1' != $comment->comment_approved) { 286 wp_set_comment_status($comment->comment_ID, 'approve'); 287 if (true == get_option('comments_notify')) 288 wp_notify_postauthor($comment->comment_ID); 289 } 290 291 header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1'); 292 293 break; 294 295 case 'approvecomment': 296 297 $comment = (int) $_GET['comment']; 298 $p = (int) $_GET['p']; 299 if (isset($_GET['noredir'])) { 300 $noredir = true; 301 } else { 302 $noredir = false; 303 } 304 305 if ( ! $comment = get_comment($comment) ) 306 die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 307 308 if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 309 die( __('You are not allowed to edit comments on this post, so you cannot approve this comment.') ); 310 311 wp_set_comment_status($comment->comment_ID, "approve"); 312 if (get_settings("comments_notify") == true) { 313 wp_notify_postauthor($comment->comment_ID); 314 } 315 316 317 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 318 header('Location: ' . $_SERVER['HTTP_REFERER']); 319 } else { 320 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 321 } 322 323 break; 324 325 case 'editedcomment': 326 327 edit_comment(); 328 329 $referredby = $_POST['referredby']; 330 if (!empty($referredby)) { 331 header('Location: ' . $referredby); 332 } else { 333 header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 334 } 335 140 exit(); 336 141 break; 337 142 338 143 default: 339 $title = __('Create New Post');340 require_once ('./admin-header.php');341 ?>342 <?php if ( isset($_GET['posted']) ) : ?>343 <div id="message" class="updated fade"><p><?php printf(__('Post saved. <a href="%s">View site »</a>'), get_bloginfo('home') . '/'); ?></p></div>344 <?php endif; ?>345 <?php346 if ( current_user_can('edit_posts') ) {347 $action = 'post';348 get_currentuserinfo();349 if ( $drafts = get_users_drafts( $user_ID ) ) {350 ?>351 <div class="wrap">352 <p><strong><?php _e('Your Drafts:') ?></strong>353 <?php354 $num_drafts = count($drafts);355 if ( $num_drafts > 15 ) $num_drafts = 15;356 for ( $i = 0; $i < $num_drafts; $i++ ) {357 $draft = $drafts[$i];358 if ( 0 != $i )359 echo ', ';360 $draft->post_title = stripslashes($draft->post_title);361 if ( empty($draft->post_title) )362 $draft->post_title = sprintf(__('Post # %s'), $draft->ID);363 echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";364 }365 ?>366 <?php if ( 15 < count($drafts) ) { ?>367 , <a href="edit.php"><?php echo sprintf(__('and %s more'), (count($drafts) - 15) ); ?> »</a>368 <?php } ?>369 .</p>370 </div>371 <?php372 }373 374 $post = get_default_post_to_edit();375 376 include('edit-form-advanced.php');377 ?>378 <div class="wrap">379 <?php echo '<h3>'.__('WordPress bookmarklet').'</h3>380 <p>'.__('Right click on the following link and choose "Add to favorites" to create a posting shortcut.').'</p>'; ?>381 <p>382 383 <?php384 if ($is_NS4 || $is_gecko) {385 ?>386 <a href="javascript:if(navigator.userAgent.indexOf('Safari') >= 0){Q=getSelection();}else{Q=document.selection?document.selection.createRange().text:document.getSelection();}location.href='<?php echo get_settings('siteurl') ?>/wp-admin/post.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press It - %s'), wp_specialchars(get_settings('blogname'))); ?></a>387 <?php388 } else if ($is_winIE) {389 ?>390 <a href="javascript:Q='';if(top.frames.length==0)Q=document.selection.createRange().text;location.href='<?php echo get_settings('siteurl') ?>/wp-admin/post.php?text='+encodeURIComponent(Q)+'&popupurl='+encodeURIComponent(location.href)+'&popuptitle='+encodeURIComponent(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>391 <script type="text/javascript">392 <!--393 function oneclickbookmarklet(blah) {394 window.open ("profile.php?action=IErightclick", "oneclickbookmarklet", "width=500, height=450, location=0, menubar=0, resizable=0, scrollbars=1, status=1, titlebar=0, toolbar=0, screenX=120, left=120, screenY=120, top=120");395 }396 // -->397 </script>398 <br />399 <br />400 <?php _e('One-click bookmarklet:') ?><br />401 <a href="javascript:oneclickbookmarklet(0);"><?php _e('click here') ?></a>402 <?php403 } else if ($is_opera) {404 ?>405 <a href="javascript:location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/post.php?popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>406 <?php407 } else if ($is_macIE) {408 ?>409 <a href="javascript:Q='';location.href='<?php echo get_settings('siteurl'); ?>/wp-admin/bookmarklet.php?text='+escape(document.getSelection())+'&popupurl='+escape(location.href)+'&popuptitle='+escape(document.title);"><?php printf(__('Press it - %s'), get_settings('blogname')); ?></a>410 <?php411 }412 ?>413 </p>414 </div>415 <?php416 } else {417 ?>418 <div class="wrap">419 <p><?php printf(__('Since you’re a newcomer, you’ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br />420 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />421 When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_settings('admin_email')); ?>422 </p>423 </div>424 <?php425 }426 427 144 break; 428 145 } // end switch 429 /* </Edit> */430 146 include('admin-footer.php'); 431 147 ?>
Note: See TracChangeset
for help on using the changeset viewer.