some code safety work

This commit is contained in:
John Bintz 2009-08-20 19:46:42 -04:00
parent e2c51b0d22
commit b44c6db194
2 changed files with 47 additions and 39 deletions

View File

@ -151,6 +151,7 @@ function cpm_handle_pre_post_update($post_id) {
if (!$cpm_config->is_cpm_managing_posts) { if (!$cpm_config->is_cpm_managing_posts) {
if (cpm_option("cpm-edit-post-integrate") == 1) { if (cpm_option("cpm-edit-post-integrate") == 1) {
if ($post_id > 0) {
$post = get_post($post_id); $post = get_post($post_id);
if (!in_array($post->post_type, array("attachment", "revision", "page"))) { if (!in_array($post->post_type, array("attachment", "revision", "page"))) {
$ok = false; $ok = false;
@ -203,6 +204,7 @@ function cpm_handle_pre_post_update($post_id) {
} }
} }
} }
}
} }
/** /**

View File

@ -376,8 +376,14 @@ function cpm_read_information_and_check_config() {
$cpm_config->thumbs_folder_writable[$thumb_type] = true; $cpm_config->thumbs_folder_writable[$thumb_type] = true;
} }
} }
$cpm_config->comic_category_info = get_object_vars(get_category($cpm_config->properties['comiccat']));
$cpm_config->blog_category_info = get_object_vars(get_category($cpm_config->properties['blogcat'])); foreach (array('comic', 'blog') as $type) {
$result = (object)get_category($cpm_config->properties["${type}cat"]);
if (!is_wp_error($result)) {
$cpm_config->{"${type}_category_info"} = get_object_vars($result);
}
}
$cpm_config->comic_files = cpm_read_comics_folder(); $cpm_config->comic_files = cpm_read_comics_folder();
} else { } else {
// quick check to see if the theme is ComicPress. // quick check to see if the theme is ComicPress.