Changeset 1825 for trunk/wp-admin/post.php
- Timestamp:
- 10/22/2004 02:41:01 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/post.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/post.php
r1822 r1825 5 5 6 6 for ($i=0; $i<count($wpvarstoreset); $i += 1) { 7 $wpvar = $wpvarstoreset[$i]; 8 if (!isset($$wpvar)) { 9 if (empty($_POST["$wpvar"])) { 10 if (empty($_GET["$wpvar"])) { 11 $$wpvar = ''; 7 $wpvar = $wpvarstoreset[$i]; 8 if (!isset($$wpvar)) { 9 if (empty($_POST["$wpvar"])) { 10 if (empty($_GET["$wpvar"])) { 11 $$wpvar = ''; 12 } else { 13 $$wpvar = $_GET["$wpvar"]; 14 } 12 15 } else { 13 $$wpvar = $_ GET["$wpvar"];16 $$wpvar = $_POST["$wpvar"]; 14 17 } 15 } else { 16 $$wpvar = $_POST["$wpvar"]; 17 } 18 } 18 } 19 19 } 20 20 … … 149 149 if ($post_pingback) 150 150 pingback($content, $post_ID); 151 do_enclose( $content, $post_ID );151 do_enclose( $content, $post_ID ); 152 152 do_trackbacks($post_ID); 153 153 do_action('publish_post', $post_ID); … … 175 175 } 176 176 177 $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");178 $content = $postdata->post_content;179 $content = format_to_edit($content);180 $content = apply_filters('content_edit_pre', $content);181 $excerpt = $postdata->post_excerpt;182 $excerpt = format_to_edit($excerpt);183 $excerpt = apply_filters('excerpt_edit_pre', $excerpt);184 $edited_post_title = format_to_edit($postdata->post_title);185 $edited_post_title = apply_filters('title_edit_pre', $edited_post_title);186 $post_status = $postdata->post_status;187 $comment_status = $postdata->comment_status;188 $ping_status = $postdata->ping_status;189 $post_password = $postdata->post_password;190 $to_ping = $postdata->to_ping;191 $pinged = $postdata->pinged;192 $post_name = $postdata->post_name;193 $post_parent = $postdata->post_parent;194 195 if ($post_status == 'static') {196 $page_template = get_post_meta($post_ID, '_wp_page_template', true);197 include('edit-page-form.php');198 } else {199 include('edit-form-advanced.php');200 }201 202 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");203 ?>204 <div id='preview' class='wrap'>205 <h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>206 <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), the_title()); ?>"><?php the_title(); ?></a></h3>207 <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> — <?php the_author() ?> @ <?php the_time() ?></div>208 209 <div class="storycontent">210 <?php211 $content = apply_filters('the_content', $post->post_content);212 echo $content;213 ?>214 </div>215 </div>216 <?php177 $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'"); 178 $content = $postdata->post_content; 179 $content = format_to_edit($content); 180 $content = apply_filters('content_edit_pre', $content); 181 $excerpt = $postdata->post_excerpt; 182 $excerpt = format_to_edit($excerpt); 183 $excerpt = apply_filters('excerpt_edit_pre', $excerpt); 184 $edited_post_title = format_to_edit($postdata->post_title); 185 $edited_post_title = apply_filters('title_edit_pre', $edited_post_title); 186 $post_status = $postdata->post_status; 187 $comment_status = $postdata->comment_status; 188 $ping_status = $postdata->ping_status; 189 $post_password = $postdata->post_password; 190 $to_ping = $postdata->to_ping; 191 $pinged = $postdata->pinged; 192 $post_name = $postdata->post_name; 193 $post_parent = $postdata->post_parent; 194 195 if ($post_status == 'static') { 196 $page_template = get_post_meta($post_ID, '_wp_page_template', true); 197 include('edit-page-form.php'); 198 } else { 199 include('edit-form-advanced.php'); 200 } 201 202 $post = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'"); 203 ?> 204 <div id='preview' class='wrap'> 205 <h2><?php _e('Post Preview (updated when post is saved)'); ?></h2> 206 <h3 class="storytitle" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php printf(__("Permanent Link: %s"), the_title()); ?>"><?php the_title(); ?></a></h3> 207 <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> — <?php the_author() ?> @ <?php the_time() ?></div> 208 209 <div class="storycontent"> 210 <?php 211 $content = apply_filters('the_content', $post->post_content); 212 echo $content; 213 ?> 214 </div> 215 </div> 216 <?php 217 217 break; 218 218 219 219 case 'editpost': 220 // die(var_dump('<pre>', $_POST));220 // die(var_dump('<pre>', $_POST)); 221 221 if (!isset($blog_ID)) { 222 222 $blog_ID = 1; … … 227 227 die('You are not allowed to edit this post.'); 228 228 } 229 $post_categories = $_POST['post_category']; 230 if (!$post_categories) $post_categories[] = 1; 231 $content = apply_filters('content_save_pre', $_POST['content']); 232 $content = format_to_post($content); 233 $excerpt = apply_filters('excerpt_save_pre', $_POST['excerpt']); 234 $excerpt = format_to_post($excerpt); 235 $post_title = $_POST['post_title']; 236 $prev_status = $_POST['prev_status']; 237 $post_status = $_POST['post_status']; 238 $comment_status = $_POST['comment_status']; 239 if (empty($comment_status)) $comment_status = 'closed'; 240 //if (!$_POST['comment_status']) $comment_status = get_settings('default_comment_status'); 241 242 $ping_status = $_POST['ping_status']; 243 if (empty($ping_status)) $ping_status = 'closed'; 244 //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status'); 245 $post_password = $_POST['post_password']; 246 $post_name = $_POST['post_name']; 247 if (empty($post_name)) { 248 $post_name = $post_title; 229 $post_categories = $_POST['post_category']; 230 if (!$post_categories) $post_categories[] = 1; 231 $content = apply_filters('content_save_pre', $_POST['content']); 232 $content = format_to_post($content); 233 $excerpt = apply_filters('excerpt_save_pre', $_POST['excerpt']); 234 $excerpt = format_to_post($excerpt); 235 $post_title = $_POST['post_title']; 236 $prev_status = $_POST['prev_status']; 237 $post_status = $_POST['post_status']; 238 $comment_status = $_POST['comment_status']; 239 if (empty($comment_status)) $comment_status = 'closed'; 240 //if (!$_POST['comment_status']) $comment_status = get_settings('default_comment_status'); 241 242 $ping_status = $_POST['ping_status']; 243 if (empty($ping_status)) $ping_status = 'closed'; 244 //if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status'); 245 $post_password = $_POST['post_password']; 246 $post_name = $_POST['post_name']; 247 if (empty($post_name)) { 248 $post_name = $post_title; 249 } 250 251 $post_parent = 0; 252 if (isset($_POST['parent_id'])) { 253 $post_parent = $_POST['parent_id']; 254 } 255 256 if (empty($post_name)) { 257 if (! empty($post_title)) { 258 $post_name = sanitize_title($post_title, $post_ID); 249 259 } 250 251 $post_parent = 0; 252 if (isset($_POST['parent_id'])) { 253 $post_parent = $_POST['parent_id']; 254 } 255 256 if (empty($post_name)) { 257 if (! empty($post_title)) { 258 $post_name = sanitize_title($post_title, $post_ID); 259 } 260 } else { 261 $post_name = sanitize_title($post_name, $post_ID); 262 } 263 264 $trackback = $_POST['trackback_url']; 260 } else { 261 $post_name = sanitize_title($post_name, $post_ID); 262 } 263 264 $trackback = $_POST['trackback_url']; 265 265 // Format trackbacks 266 266 $trackback = preg_replace('|\s+|', '\n', $trackback); … … 302 302 header ('Location: ' . $location); // Send user on their way while we keep working 303 303 304 $now = current_time('mysql');305 $now_gmt = current_time('mysql', 1);304 $now = current_time('mysql'); 305 $now_gmt = current_time('mysql', 1); 306 306 307 307 $result = $wpdb->query(" … … 360 360 do_action('publish_post', $post_ID); 361 361 do_trackbacks($post_ID); 362 do_enclose( $content, $post_ID );362 do_enclose( $content, $post_ID ); 363 363 if ( get_option('default_pingback_flag') ) 364 364 pingback($content, $post_ID); … … 393 393 $categories = $wpdb->query("DELETE FROM $wpdb->post2cat WHERE post_id = $post_id"); 394 394 395 $meta = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $post_id");395 $meta = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $post_id"); 396 396 397 397 $sendback = $_SERVER['HTTP_REFERER']; … … 426 426 case 'confirmdeletecomment': 427 427 428 require_once('./admin-header.php');429 430 $comment = $_GET['comment'];431 $p = $_GET['p'];432 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));433 434 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_id'])) {435 die('You are not allowed to delete comments on this post.');436 }437 438 echo "<div class=\"wrap\">\n";439 echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n";440 echo "<table border=\"0\">\n";441 echo "<tr><td>" . __('Author:') . "</td><td>" . $commentdata["comment_author"] . "</td></tr>\n";442 echo "<tr><td>" . __('E-mail:') . "</td><td>" . $commentdata["comment_author_email"] . "</td></tr>\n";443 echo "<tr><td>". __('URL:') . "</td><td>" . $commentdata["comment_author_url"] . "</td></tr>\n";444 echo "<tr><td>". __('Comment:') . "</td><td>" . stripslashes($commentdata["comment_content"]) . "</td></tr>\n";445 echo "</table>\n";446 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n";447 448 echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n";449 echo "<input type=\"hidden\" name=\"action\" value=\"deletecomment\" />\n";450 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n";451 echo "<input type=\"hidden\" name=\"comment\" value=\"$comment\" />\n";452 echo "<input type=\"hidden\" name=\"noredir\" value=\"1\" />\n";453 echo "<input type=\"submit\" value=\"" . __('Yes') . "\" />";454 echo " ";455 echo "<input type=\"button\" value=\"" . __('No') . "\" onClick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments';\" />\n";456 echo "</form>\n";457 echo "</div>\n";458 459 break;428 require_once('./admin-header.php'); 429 430 $comment = $_GET['comment']; 431 $p = $_GET['p']; 432 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 433 434 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_id'])) { 435 die('You are not allowed to delete comments on this post.'); 436 } 437 438 echo "<div class=\"wrap\">\n"; 439 echo "<p>" . __('<strong>Caution:</strong> You are about to delete the following comment:') . "</p>\n"; 440 echo "<table border=\"0\">\n"; 441 echo "<tr><td>" . __('Author:') . "</td><td>" . $commentdata["comment_author"] . "</td></tr>\n"; 442 echo "<tr><td>" . __('E-mail:') . "</td><td>" . $commentdata["comment_author_email"] . "</td></tr>\n"; 443 echo "<tr><td>". __('URL:') . "</td><td>" . $commentdata["comment_author_url"] . "</td></tr>\n"; 444 echo "<tr><td>". __('Comment:') . "</td><td>" . stripslashes($commentdata["comment_content"]) . "</td></tr>\n"; 445 echo "</table>\n"; 446 echo "<p>" . __('Are you sure you want to do that?') . "</p>\n"; 447 448 echo "<form action='".get_settings('siteurl')."/wp-admin/post.php' method='get'>\n"; 449 echo "<input type=\"hidden\" name=\"action\" value=\"deletecomment\" />\n"; 450 echo "<input type=\"hidden\" name=\"p\" value=\"$p\" />\n"; 451 echo "<input type=\"hidden\" name=\"comment\" value=\"$comment\" />\n"; 452 echo "<input type=\"hidden\" name=\"noredir\" value=\"1\" />\n"; 453 echo "<input type=\"submit\" value=\"" . __('Yes') . "\" />"; 454 echo " "; 455 echo "<input type=\"button\" value=\"" . __('No') . "\" onClick=\"self.location='". get_settings('siteurl') ."/wp-admin/edit.php?p=$p&c=1#comments';\" />\n"; 456 echo "</form>\n"; 457 echo "</div>\n"; 458 459 break; 460 460 461 461 case 'deletecomment': 462 462 463 check_admin_referer(); 464 465 $comment = $_GET['comment']; 466 $p = $_GET['p']; 467 if (isset($_GET['noredir'])) { 468 $noredir = true; 469 } else { 470 $noredir = false; 471 } 472 473 $postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 474 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 475 476 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_id'])) { 477 die('You are not allowed to edit comments on this post.'); 478 } 479 480 wp_set_comment_status($comment, "delete"); 481 do_action('delete_comment', $comment); 482 483 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 484 header('Location: ' . $_SERVER['HTTP_REFERER']); 485 } else { 486 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 487 } 488 489 break; 463 check_admin_referer(); 464 465 $comment = $_GET['comment']; 466 $p = $_GET['p']; 467 if (isset($_GET['noredir'])) { 468 $noredir = true; 469 } else { 470 $noredir = false; 471 } 472 473 $postdata = get_postdata($p) or die(sprintf(__('Oops, no post with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 474 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'post.php')); 475 476 if (!user_can_delete_post_comments($user_ID, $commentdata['comment_post_id'])) { 477 die('You are not allowed to edit comments on this post.'); 478 } 479 480 wp_set_comment_status($comment, "delete"); 481 do_action('delete_comment', $comment); 482 483 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 484 header('Location: ' . $_SERVER['HTTP_REFERER']); 485 } else { 486 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 487 } 488 clear_smarty_cache(); 489 490 break; 490 491 491 492 case 'unapprovecomment': 492 493 493 require_once('./admin-header.php');494 495 check_admin_referer();496 497 $comment = $_GET['comment'];498 $p = $_GET['p'];499 if (isset($_GET['noredir'])) {500 $noredir = true;501 } else {502 $noredir = false;503 }504 505 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php'));506 507 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) {508 die('You are not allowed to edit comments on this post, so you cannot disapprove this comment.');509 }510 511 wp_set_comment_status($comment, "hold");512 513 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) {514 header('Location: ' . $_SERVER['HTTP_REFERER']);515 } else {516 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments');517 }518 519 break;494 require_once('./admin-header.php'); 495 496 check_admin_referer(); 497 498 $comment = $_GET['comment']; 499 $p = $_GET['p']; 500 if (isset($_GET['noredir'])) { 501 $noredir = true; 502 } else { 503 $noredir = false; 504 } 505 506 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 507 508 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) { 509 die('You are not allowed to edit comments on this post, so you cannot disapprove this comment.'); 510 } 511 512 wp_set_comment_status($comment, "hold"); 513 514 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 515 header('Location: ' . $_SERVER['HTTP_REFERER']); 516 } else { 517 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 518 } 519 520 break; 520 521 521 522 case 'mailapprovecomment': 522 523 523 $comment = (int) $_GET['comment']; 524 525 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 526 527 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) { 528 die('You are not allowed to edit comments on this post, so you cannot approve this comment.'); 529 } 530 531 if ('1' != $commentdata['comment_approved']) { 532 wp_set_comment_status($comment, 'approve'); 533 if (true == get_option('comments_notify')) 524 $comment = (int) $_GET['comment']; 525 526 $commentdata = get_commentdata($comment, 1, true) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 527 528 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) { 529 die('You are not allowed to edit comments on this post, so you cannot approve this comment.'); 530 } 531 532 if ('1' != $commentdata['comment_approved']) { 533 wp_set_comment_status($comment, 'approve'); 534 if (true == get_option('comments_notify')) 535 wp_notify_postauthor($comment); 536 } 537 538 header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1'); 539 540 break; 541 542 case 'approvecomment': 543 544 $comment = $_GET['comment']; 545 $p = $_GET['p']; 546 if (isset($_GET['noredir'])) { 547 $noredir = true; 548 } else { 549 $noredir = false; 550 } 551 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 552 553 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) { 554 die('You are not allowed to edit comments on this post, so you cannot approve this comment.'); 555 } 556 557 wp_set_comment_status($comment, "approve"); 558 if (get_settings("comments_notify") == true) { 534 559 wp_notify_postauthor($comment); 535 } 536 537 header('Location: ' . get_option('siteurl') . '/wp-admin/moderation.php?approved=1'); 538 539 break; 540 541 case 'approvecomment': 542 543 $comment = $_GET['comment']; 544 $p = $_GET['p']; 545 if (isset($_GET['noredir'])) { 546 $noredir = true; 547 } else { 548 $noredir = false; 549 } 550 $commentdata = get_commentdata($comment) or die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 551 552 if (!user_can_edit_post_comments($user_ID, $commentdata['comment_post_id'])) { 553 die('You are not allowed to edit comments on this post, so you cannot approve this comment.'); 554 } 555 556 wp_set_comment_status($comment, "approve"); 557 if (get_settings("comments_notify") == true) { 558 wp_notify_postauthor($comment); 559 } 560 561 562 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 563 header('Location: ' . $_SERVER['HTTP_REFERER']); 564 } else { 565 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 566 } 567 568 break; 560 } 561 562 563 if (($_SERVER['HTTP_REFERER'] != "") && (false == $noredir)) { 564 header('Location: ' . $_SERVER['HTTP_REFERER']); 565 } else { 566 header('Location: '. get_settings('siteurl') .'/wp-admin/edit.php?p='.$p.'&c=1#comments'); 567 } 568 569 break; 569 570 570 571 case 'editedcomment': … … 608 609 609 610 $referredby = $_POST['referredby']; 610 if (!empty($referredby)) header('Location: ' . $referredby); 611 else header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 611 if (!empty($referredby)) { 612 header('Location: ' . $referredby); 613 } else { 614 header ("Location: edit.php?p=$comment_post_ID&c=1#comments"); 615 } 612 616 do_action('edit_comment', $comment_ID); 613 617 break; … … 663 667 664 668 <?php 665 $bookmarklet_height= (get_settings('use_trackback')) ? 4 60 : 420;669 $bookmarklet_height= (get_settings('use_trackback')) ? 480 : 440; 666 670 667 671 if ($is_NS4 || $is_gecko) { … … 697 701 </div> 698 702 <?php 699 } else { 700 701 703 } else { 702 704 ?> 703 705 <div class="wrap"> 704 <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 />706 <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 /> 705 707 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br /> 706 708 When you’re promoted, just reload this page and you’ll be able to blog. :)'), get_settings('admin_email')); ?> 707 </p>709 </p> 708 710 </div> 709 711 <?php 710 711 } 712 } 712 713 713 714 break;
Note: See TracChangeset
for help on using the changeset viewer.