Fixes for post screen.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e9514b7846
commit
9eff118f7c
|
@ -23,13 +23,13 @@ function checked($checked, $current) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_nested_categories($default = 0) {
|
function get_nested_categories($default = 0) {
|
||||||
global $post, $tablecategories, $tablepost2cat, $mode, $wpdb;
|
global $post_ID, $tablecategories, $tablepost2cat, $mode, $wpdb;
|
||||||
|
|
||||||
if ($post->ID) {
|
if ($post_ID) {
|
||||||
$checked_categories = $wpdb->get_col("
|
$checked_categories = $wpdb->get_col("
|
||||||
SELECT category_id
|
SELECT category_id
|
||||||
FROM $tablecategories, $tablepost2cat
|
FROM $tablecategories, $tablepost2cat
|
||||||
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post->ID'
|
WHERE $tablepost2cat.category_id = cat_ID AND $tablepost2cat.post_id = '$post_ID'
|
||||||
");
|
");
|
||||||
} else {
|
} else {
|
||||||
$checked_categories[] = $default;
|
$checked_categories[] = $default;
|
||||||
|
@ -325,4 +325,46 @@ function update_meta($mid, $mkey, $mvalue) {
|
||||||
return $wpdb->query("UPDATE $tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
|
return $wpdb->query("UPDATE $tablepostmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function touch_time($edit = 1) {
|
||||||
|
global $month, $postdata;
|
||||||
|
// echo $postdata['Date'];
|
||||||
|
if ('draft' == $postdata->post_status) {
|
||||||
|
$checked = 'checked="checked" ';
|
||||||
|
$edit = false;
|
||||||
|
} else {
|
||||||
|
$checked = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '<p><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label> <a href="http://wordpress.org/docs/reference/post/#edit_timestamp" title="' . __('Help on changing the timestamp') . '">?</a><br />';
|
||||||
|
|
||||||
|
$time_adj = time() + (get_settings('gmt_offset') * 3600);
|
||||||
|
$post_date = $postdata->post_date;
|
||||||
|
$jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
|
||||||
|
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
|
||||||
|
$aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
|
||||||
|
$hh = ($edit) ? mysql2date('H', $post_date) : gmdate('H', $time_adj);
|
||||||
|
$mn = ($edit) ? mysql2date('i', $post_date) : gmdate('i', $time_adj);
|
||||||
|
$ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj);
|
||||||
|
|
||||||
|
echo '<input type="text" name="jj" value="'.$jj.'" size="2" maxlength="2" />'."\n";
|
||||||
|
echo "<select name=\"mm\">\n";
|
||||||
|
for ($i=1; $i < 13; $i=$i+1) {
|
||||||
|
echo "\t\t\t<option value=\"$i\"";
|
||||||
|
if ($i == $mm)
|
||||||
|
echo " selected='selected'";
|
||||||
|
if ($i < 10) {
|
||||||
|
$ii = "0".$i;
|
||||||
|
} else {
|
||||||
|
$ii = "$i";
|
||||||
|
}
|
||||||
|
echo ">".$month["$ii"]."</option>\n";
|
||||||
|
} ?>
|
||||||
|
</select>
|
||||||
|
<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
|
||||||
|
<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
|
||||||
|
<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" /> :
|
||||||
|
<input type="text" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> </p>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -11,8 +11,6 @@ $messages[3] = __('Custom field deleted.');
|
||||||
|
|
||||||
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
|
$allowed_users = explode(" ", trim(get_settings('fileupload_allowedusers')));
|
||||||
|
|
||||||
$post_ID = intval($postdata['ID']);
|
|
||||||
|
|
||||||
$submitbutton_text = __('Save');
|
$submitbutton_text = __('Save');
|
||||||
$toprow_title = sprintf(__('Editing Post #%s'), $post_ID);
|
$toprow_title = sprintf(__('Editing Post #%s'), $post_ID);
|
||||||
if (0 == $post_ID) {
|
if (0 == $post_ID) {
|
||||||
|
@ -73,7 +71,7 @@ window.onload = focusit;
|
||||||
|
|
||||||
<fieldset id="categorydiv">
|
<fieldset id="categorydiv">
|
||||||
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
|
<legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
|
||||||
<div><?php dropdown_categories($default_post_cat); ?></div>
|
<div><?php dropdown_categories(get_settings('default_category')); ?></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="poststatusdiv">
|
<fieldset id="poststatusdiv">
|
||||||
|
|
|
@ -206,40 +206,43 @@ case 'edit':
|
||||||
$standalone = 0;
|
$standalone = 0;
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
$post = $_GET['post'];
|
$post = $post_ID = $p = (int) $_GET['post'];
|
||||||
if ($user_level > 0) {
|
if ($user_level > 0) {
|
||||||
$postdata = get_postdata($post);
|
$postdata = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
|
||||||
$authordata = get_userdata($postdata['Author_ID']);
|
$authordata = get_userdata($postdata->post_author);
|
||||||
if ($user_level < $authordata->user_level)
|
if ($user_level < $authordata->user_level)
|
||||||
die ('You don’t have the right to edit <strong>'.$authordata[1].'</strong>’s posts.');
|
die ('You don’t have the right to edit <strong>'.$authordata[1].'</strong>’s posts.');
|
||||||
|
|
||||||
$content = $postdata['Content'];
|
$content = $postdata->post_content;
|
||||||
$content = format_to_edit($content);
|
$content = format_to_edit($content);
|
||||||
$edited_lat = $postdata["Lat"];
|
$edited_lat = $postdata->post_lat;
|
||||||
$edited_lon = $postdata["Lon"];
|
$edited_lon = $postdata->post_lon;
|
||||||
$excerpt = $postdata['Excerpt'];
|
$excerpt = $postdata->post_excerpt;
|
||||||
$excerpt = format_to_edit($excerpt);
|
$excerpt = format_to_edit($excerpt);
|
||||||
$edited_post_title = format_to_edit($postdata['Title']);
|
$edited_post_title = format_to_edit($postdata->post_title);
|
||||||
$post_status = $postdata['post_status'];
|
$post_status = $postdata->post_status;
|
||||||
$comment_status = $postdata['comment_status'];
|
$comment_status = $postdata->comment_status;
|
||||||
$ping_status = $postdata['ping_status'];
|
$ping_status = $postdata->ping_status;
|
||||||
$post_password = $postdata['post_password'];
|
$post_password = $postdata->post_password;
|
||||||
$to_ping = $postdata['to_ping'];
|
$to_ping = $postdata->to_ping;
|
||||||
$pinged = $postdata['pinged'];
|
$pinged = $postdata->pinged;
|
||||||
$post_name = $postdata['post_name'];
|
$post_name = $postdata->post_name;
|
||||||
|
|
||||||
include('edit-form-advanced.php');
|
include('edit-form-advanced.php');
|
||||||
$p = $_GET['post'];
|
|
||||||
include(ABSPATH.'wp-blog-header.php');
|
include(ABSPATH.'wp-blog-header.php');
|
||||||
start_wp();
|
$post = $wpdb->get_row("SELECT * FROM $tableposts WHERE ID = '$post_ID'");
|
||||||
?>
|
?>
|
||||||
<div id='preview' class='wrap'>
|
<div id='preview' class='wrap'>
|
||||||
<h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>
|
<h2><?php _e('Post Preview (updated when post is saved)'); ?></h2>
|
||||||
<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>
|
<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>
|
||||||
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> — <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(); ?></div>
|
<div class="meta"><?php _e("Filed under:"); ?> <?php the_category(','); ?> — <?php the_author() ?> @ <?php the_time() ?></div>
|
||||||
|
|
||||||
<div class="storycontent">
|
<div class="storycontent">
|
||||||
<?php the_content(); ?>
|
<?php
|
||||||
|
$content = apply_filters('the_content', $post->post_content);
|
||||||
|
echo $content;
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
@ -287,9 +290,12 @@ case 'editpost':
|
||||||
$prev_status = $_POST['prev_status'];
|
$prev_status = $_POST['prev_status'];
|
||||||
$post_status = $_POST['post_status'];
|
$post_status = $_POST['post_status'];
|
||||||
$comment_status = $_POST['comment_status'];
|
$comment_status = $_POST['comment_status'];
|
||||||
if (empty($comment_status)) $comment_status = get_settings('default_comment_status');
|
if (empty($comment_status)) $comment_status = 'closed';
|
||||||
|
//if (!$_POST['comment_status']) $comment_status = get_settings('default_comment_status');
|
||||||
|
|
||||||
$ping_status = $_POST['ping_status'];
|
$ping_status = $_POST['ping_status'];
|
||||||
if (empty($ping_status)) $ping_status = get_settings('default_ping_status');
|
if (empty($ping_status)) $ping_status = 'closed';
|
||||||
|
//if (!$_POST['ping_status']) $ping_status = get_settings('default_ping_status');
|
||||||
$post_password = addslashes($_POST['post_password']);
|
$post_password = addslashes($_POST['post_password']);
|
||||||
$post_name = sanitize_title($_POST['post_name']);
|
$post_name = sanitize_title($_POST['post_name']);
|
||||||
if (empty($post_name)) $post_name = sanitize_title($post_title);
|
if (empty($post_name)) $post_name = sanitize_title($post_title);
|
||||||
|
@ -410,6 +416,7 @@ $now_gmt = current_time('mysql', 1);
|
||||||
}
|
}
|
||||||
header ('Location: ' . $location);
|
header ('Location: ' . $location);
|
||||||
do_action('edit_post', $post_ID);
|
do_action('edit_post', $post_ID);
|
||||||
|
exit();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'delete':
|
case 'delete':
|
||||||
|
|
|
@ -366,7 +366,7 @@ textarea, input, select {
|
||||||
margin-right: 11em;
|
margin-right: 11em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#content {
|
#content, #excerpt {
|
||||||
margin-left: 1%;
|
margin-left: 1%;
|
||||||
width: 97%;
|
width: 97%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -436,48 +436,6 @@ function get_catname($cat_ID) {
|
||||||
return $cat_name;
|
return $cat_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function touch_time($edit = 1) {
|
|
||||||
global $month, $postdata;
|
|
||||||
// echo $postdata['Date'];
|
|
||||||
if ('draft' == $postdata['post_status']) {
|
|
||||||
$checked = 'checked="checked" ';
|
|
||||||
$edit = false;
|
|
||||||
} else {
|
|
||||||
$checked = ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<p><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp" '.$checked.'/> <label for="timestamp">' . __('Edit timestamp') . '</label> <a href="http://wordpress.org/docs/reference/post/#edit_timestamp" title="' . __('Help on changing the timestamp') . '">?</a><br />';
|
|
||||||
|
|
||||||
$time_adj = time() + (get_settings('gmt_offset') * 3600);
|
|
||||||
$post_date = $postdata['Date'];
|
|
||||||
$jj = ($edit) ? mysql2date('d', $post_date) : gmdate('d', $time_adj);
|
|
||||||
$mm = ($edit) ? mysql2date('m', $post_date) : gmdate('m', $time_adj);
|
|
||||||
$aa = ($edit) ? mysql2date('Y', $post_date) : gmdate('Y', $time_adj);
|
|
||||||
$hh = ($edit) ? mysql2date('H', $post_date) : gmdate('H', $time_adj);
|
|
||||||
$mn = ($edit) ? mysql2date('i', $post_date) : gmdate('i', $time_adj);
|
|
||||||
$ss = ($edit) ? mysql2date('s', $post_date) : gmdate('s', $time_adj);
|
|
||||||
|
|
||||||
echo '<input type="text" name="jj" value="'.$jj.'" size="2" maxlength="2" />'."\n";
|
|
||||||
echo "<select name=\"mm\">\n";
|
|
||||||
for ($i=1; $i < 13; $i=$i+1) {
|
|
||||||
echo "\t\t\t<option value=\"$i\"";
|
|
||||||
if ($i == $mm)
|
|
||||||
echo " selected='selected'";
|
|
||||||
if ($i < 10) {
|
|
||||||
$ii = "0".$i;
|
|
||||||
} else {
|
|
||||||
$ii = "$i";
|
|
||||||
}
|
|
||||||
echo ">".$month["$ii"]."</option>\n";
|
|
||||||
} ?>
|
|
||||||
</select>
|
|
||||||
<input type="text" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" /> @
|
|
||||||
<input type="text" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" /> :
|
|
||||||
<input type="text" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" /> :
|
|
||||||
<input type="text" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> </p>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
|
|
||||||
function gzip_compression() {
|
function gzip_compression() {
|
||||||
global $gzip_compressed;
|
global $gzip_compressed;
|
||||||
if (!$gzip_compressed) {
|
if (!$gzip_compressed) {
|
||||||
|
|
Loading…
Reference in New Issue