diff --git a/b2-include/b2functions.php b/b2-include/b2functions.php index b56678af61..4bdc8b531f 100644 --- a/b2-include/b2functions.php +++ b/b2-include/b2functions.php @@ -680,10 +680,10 @@ function dropdown_categories($default = 0) { foreach($categories as $category) { ++$i; $category->cat_name = stripslashes($category->cat_name); - echo "cat_ID, $postcategories)) echo " checked='checked'"; - echo ">$category->cat_name "; + echo " /> $category->cat_name "; } } @@ -713,7 +713,7 @@ function touch_time($edit = 1) { for ($i=1; $i < 13; $i=$i+1) { echo "\t\t\t'; foreach ($categories as $category) { + $category->cat_name = stripslashes($category->cat_name); echo "\n\t$category->cat_name"; } echo ''; } else { $i = 0; foreach ($categories as $category) { + $category->cat_name = stripslashes($category->cat_name); if (0 < $i) echo $seperator . ' '; echo "$category->cat_name"; ++$i; diff --git a/blog.header.php b/blog.header.php index ff3d5e1fd2..db46516217 100644 --- a/blog.header.php +++ b/blog.header.php @@ -278,8 +278,9 @@ if ($pagenow != 'wp-post.php') { if ((empty($poststart)) || (empty($postend)) || !($postend > $poststart)) { $where .= ' AND post_date <= \''.$now.'\''; } - $where .= ' AND post_category > 0'; + $distinct = 'DISTINCT'; + if ($use_gzipcompression) { // gzipping the output of the script gzip_compression(); diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css index 3130df552c..e168948bcd 100644 --- a/wp-admin/wp-admin.css +++ b/wp-admin/wp-admin.css @@ -1,6 +1,7 @@ a { + border-bottom: 1px solid #69c; color: #00019b; - font-weight: bold; + text-decoration: none; } a:visited { @@ -8,6 +9,7 @@ a:visited { } a:hover { + border-bottom: 1px solid #3a75ae; color: #069; } @@ -22,7 +24,31 @@ body, td { font: 10pt Georgia, "Times New Roman", Times, serif; } -form { +fieldset { + border: 1px solid #ccc; + padding: 2px; +} + +fieldset label.selectit { + background: #f0f0f0; + display: block; + font-size: 11px; + padding: 0 2px; +} + +fieldset label.selectit:hover { + background: #dadada; +} + +fieldset legend { + padding: .1em; +} + +fieldset:hover { + border: 1px solid #999; +} + +form, label input { margin: 0; padding: 0; } @@ -64,9 +90,9 @@ textarea, input, select { .checkbox { background: #fff; - border-width: 0px; - margin: 0px; - padding: 0px; + border: none; + margin: 0; + padding: 0; } .quicktags, .search { @@ -75,32 +101,31 @@ textarea, input, select { font: 12px Georgia, "Times New Roman", Times, serif; } -.wrap { - border: 1px solid #ccc; - margin: 20px auto 10px auto; - padding: 10px; - width: 85%; -} - -.wrap h2 { - font-size: 18px; - margin: 6px 0; -} - .unapproved { color: #888; } .unapproved a:link { - color: #B9BCFF; + color: #b9bcff; } .unapproved a:visited { - color: #696DFF; + color: #696dff; } .unapproved a:hover { - color: #009EF0; + color: #009ef0; +} + +.wrap { + border: 1px solid #ccc; + margin: 15px 5%; + padding: 0 1em; +} + +.wrap h2 { + font-size: 18px; + margin: 6px 0; } #adminmenu .last, #adminmenu2 .last { @@ -112,30 +137,28 @@ textarea, input, select { color: #333; font-size: 16px; font-weight: normal; - padding: 3px; + margin: 0; + padding: 3px 5px; text-decoration: none; - margin: 0 1px; } #adminmenu a:hover, .current, #adminmenu2 a:hover { - background: #e9e9e9; - border: 1px solid #808080; - color: #333; + background: #eaeaea; + border: 1px solid #9d9d9d; + color: #171717; } #adminmenu li, #adminmenu2 li { - border-right: 1px solid #ccc; display: inline; + line-height: 2.0em; list-style: none; text-align: center; - line-height: 2.0em; } #adminmenu, #adminmenu2 { border-bottom: 2px solid #5a5a5a; margin: 2px; - padding: 2px; - padding-top: 5px; + padding: 0 2px; } #adminmenu2 { @@ -148,17 +171,15 @@ textarea, input, select { } #categorydiv { - float: right; - width: 10%; line-height: 130%; + margin-right: 5px; + position: absolute; + right: 5%; + width: 9em; } -#poststuff { - width: 88%; -} - -#poststuff textarea { - width: 100%; +#categorydiv input, #poststatusdiv input, #commentstatusdiv input, #pingstatusdiv input { + border: none; } #ed_button { @@ -211,23 +232,16 @@ textarea, input, select { clear: both; } -#post label.selectit { - background-color: #eee; - padding: 0 2px; - display: block; - margin-bottom: 1px; - margin-top: 1px; - border-bottom: 1px solid #666; - font-size: 11px; +#poststatusdiv, #commentstatusdiv, #pingstatusdiv { + width: 6.5em; } -#post label.selectit:hover { - background-color: #dadada; +#poststuff { + margin-right: 11em; } -label input { - padding: 0; - margin: 0; +#poststuff textarea { + width: 100%; } #profile { @@ -261,7 +275,6 @@ label input { margin-right: 5px; } - #wphead { background: url(../b2-img/wp-small.png) no-repeat; border-bottom: 4px solid #333; @@ -273,6 +286,6 @@ label input { display: block; height: 42px; text-decoration: none; - text-indent: -100em; + text-indent: -1000px; width: 200px; } diff --git a/wp-admin/wp-edit.form.php b/wp-admin/wp-edit.form.php index 864fb22cff..7927129abf 100644 --- a/wp-admin/wp-edit.form.php +++ b/wp-admin/wp-edit.form.php @@ -38,7 +38,7 @@ switch($action) { $submitbutton_text = 'Edit this!'; $toprow_title = 'Editing Post #' . $postdata['ID']; $form_action = 'editpost'; - $form_extra = "' />\n\n'; $form_prevstatus = ''; @@ -65,51 +65,48 @@ switch($action) { // this is for everything but comment editing ?> - - Title: - - - - Categories: - - - - Post - Status: - /> Publish - /> Draft - /> Private - - - Comments: - /> Open - /> - Closed - - - Pings: - /> Open - /> Closed - - - - Post - Password: - - - - - - + Title + + + + Categories + + + + + Post Status + /> Publish + /> Draft + /> Private + + + Comments + /> Open + /> Closed + + + Pings + /> Open + /> Closed + + + Post Password + + + + -Excerpt: - - - + +Excerpt + + + - - - + Post:'; + echo 'Post'; } else { - echo 'Comment:'; + echo 'Comment'; } ?> - - + Quicktags: '; include('wp-quicktags.php'); } ?> - - - + 100)) { $rows = 10; } ?> - + + + @@ -234,6 +229,7 @@ if ('edit' == $action) echo " Delete this post"; ?> + - + diff --git a/wp-admin/wp-post.php b/wp-admin/wp-post.php index 482a0f7153..0853ab19fb 100644 --- a/wp-admin/wp-post.php +++ b/wp-admin/wp-post.php @@ -48,7 +48,7 @@ switch($action) { $excerpt = balanceTags($HTTP_POST_VARS['excerpt']); $excerpt = format_to_post($excerpt); $post_title = addslashes($HTTP_POST_VARS['post_title']); - $post_category = intval($HTTP_POST_VARS['post_category']); + $post_categories = $HTTP_POST_VARS['post_category']; if(get_settings('use_geo_positions')) { $latstr = $HTTP_POST_VARS['post_latf']; $lonstr = $HTTP_POST_VARS['post_lonf']; @@ -86,15 +86,15 @@ switch($action) { if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) { $postquery ="INSERT INTO $tableposts - (ID, post_author, post_date, post_content, post_title, post_category, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name) + (ID, post_author, post_date, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name) VALUES - ('0','$user_ID','$now','$content','$post_title','$post_category',$post_latf,$post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name') + ('0', '$user_ID', '$now', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name') "; } else { $postquery ="INSERT INTO $tableposts - (ID, post_author, post_date, post_content, post_title, post_category, post_excerpt, post_status, comment_status, ping_status, post_password, post_name) + (ID, post_author, post_date, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name) VALUES - ('0','$user_ID','$now','$content','$post_title','$post_category','$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name') + ('0', '$user_ID', '$now', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name') "; } $postquery = @@ -102,6 +102,21 @@ switch($action) { $post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1"); + // Insert categories + foreach ($post_categories as $post_category) { + // Double check it's not there already + $exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category"); + + if (!$exists && $result) { + $wpdb->query(" + INSERT INTO $tablepost2cat + (post_id, category_id) + VALUES + ($post_ID, $post_category) + "); + } + } + if (isset($sleep_after_edit) && $sleep_after_edit > 0) { sleep($sleep_after_edit); } @@ -203,7 +218,7 @@ switch($action) { $blog_ID = 1; } $post_ID = $HTTP_POST_VARS['post_ID']; - $post_category = intval($HTTP_POST_VARS['post_category']); + $post_categories = $HTTP_POST_VARS['post_category']; $post_autobr = intval($HTTP_POST_VARS['post_autobr']); $content = balanceTags($HTTP_POST_VARS['content']); $content = format_to_post($content); @@ -248,9 +263,9 @@ switch($action) { UPDATE $tableposts SET post_content = '$content', post_excerpt = '$excerpt', - post_title = '$post_title', - post_category = '$post_category'".$datemodif.", - ".$latlonaddition." + post_title = '$post_title'" + .$datemodif."," + .$latlonaddition." post_status = '$post_status', comment_status = '$comment_status', ping_status = '$ping_status', @@ -258,6 +273,23 @@ switch($action) { post_name = '$post_name' WHERE ID = $post_ID "); + + // Now it's category time! + // First the old categories + $old_categories = $wpdb->get_col("SELECT category_id FROM $tablepost2cat WHERE post_id = $post_ID"); + + // Delete any? + foreach ($old_categories as $old_cat) { + if (!in_array($old_cat, $post_categories)) // If a category was there before but isn't now + $wpdb->query("DELETE FROM $tablepost2cat WHERE category_id = $old_cat AND post_id = $post_ID LIMIT 1"); + } + + // Add any? + foreach ($post_categories as $new_cat) { + if (!in_array($new_cat, $old_categories)) + $wpdb->query("INSERT INTO $tablepost2cat (post_id, category_id) VALUES ($post_ID, $new_cat)"); + } + if (isset($sleep_after_edit) && $sleep_after_edit > 0) { sleep($sleep_after_edit); } @@ -294,7 +326,7 @@ switch($action) { if ($user_level == 0) die ('Cheatin’ uh?'); - $post = $HTTP_GET_VARS['post']; + $post_id = $HTTP_GET_VARS['post']; $postdata = get_postdata($post) or die('Oops, no post with this ID. Go back!'); $authordata = get_userdata($postdata['Author_ID']); @@ -302,7 +334,7 @@ switch($action) { die ('You don’t have the right to delete '.$authordata[1].'’s posts.'); // send geoURL ping to "erase" from their DB - $query = "SELECT post_lat from $tableposts WHERE ID=$post"; + $query = "SELECT post_lat from $tableposts WHERE ID=$post_id"; $rows = $wpdb->query($query); $myrow = $rows[0]; $latf = $myrow->post_lat; @@ -310,11 +342,13 @@ switch($action) { pingGeoUrl($post); } - $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post"); + $result = $wpdb->query("DELETE FROM $tableposts WHERE ID=$post_id"); if (!$result) die('Error in deleting... contact the webmaster.'); - $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post"); + $result = $wpdb->query("DELETE FROM $tablecomments WHERE comment_post_ID=$post_id"); + + $categories = $wpdb->query("DELETE FROM $tablepost2cat WHERE post_id = $post_id"); if (isset($sleep_after_edit) && $sleep_after_edit > 0) { sleep($sleep_after_edit); diff --git a/wp-admin/wp-quicktags.php b/wp-admin/wp-quicktags.php index 274344058f..57c9e0005c 100644 --- a/wp-admin/wp-quicktags.php +++ b/wp-admin/wp-quicktags.php @@ -1,2 +1,2 @@ - \ No newline at end of file + \ No newline at end of file
Excerpt: - -
Delete this post