From 7f51b1035d3289ce3053fb88ffc17efc3348ba52 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Thu, 18 Mar 2010 21:19:01 -0400 Subject: [PATCH] changes for FS#150 --- comicpress_manager_admin.php | 16 ++++++++-------- comicpress_manager_count_missing_entries.php | 7 +++++-- comicpress_manager_library.php | 3 ++- js/comicpress_script.js | 3 ++- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/comicpress_manager_admin.php b/comicpress_manager_admin.php index ddb595d..d5a512e 100644 --- a/comicpress_manager_admin.php +++ b/comicpress_manager_admin.php @@ -504,7 +504,7 @@ function cpm_generate_additional_categories_checkboxes($override_name = null) { $additional_categories = array(); $invalid_ids = array($cpm_config->properties['blogcat']); - + extract(cpm_get_all_comic_categories()); foreach ($category_tree as $node) { $invalid_ids[] = end(explode('/', $node)); @@ -666,7 +666,7 @@ function cpm_post_editor($width = 435, $is_import = false) { $form_titles_and_fields[] = array( __("Upload Date Format:", 'comicpress-manager'), - '' . + '' . __(" (if the files you are uploading have a different date format, specify it here. ex: Ymd for a file named 20080101-my-new-years-day.jpg)", 'comicpress-manager') ); @@ -1416,7 +1416,7 @@ function cpm_handle_file_uploads($files) { if (($subdir = cpm_get_subcomic_directory()) !== false) { $target_root .= '/' . $subdir; } - + $write_thumbnails = isset($_POST['thumbnails']) && ($_POST['upload-destination'] == "comic"); $new_post = isset($_POST['new_post']) && ($_POST['upload-destination'] == "comic"); @@ -1748,7 +1748,7 @@ function cpm_display_operation_messages($info) { if (count($thumbnails_written) > 0) { $cpm_config->messages[] = __("Thumbnails were written for the following files: ", 'comicpress-manager') . implode(", ", $thumbnails_written); } - + if (count($thumbnails_not_written) > 0) { $cpm_config->messages[] = __("Thumbnails were not written for the following files. Check the permissions on the rss & archive folders, and make sure the files you're processing are valid image files: ", 'comicpress-manager') . implode(", ", $thumbnails_not_written); } @@ -2049,7 +2049,7 @@ function cpm_available_backup_files_sort($a, $b) { function cpm_handle_actions() { global $cpm_config; - $valid_actions = array('multiple-upload-file', 'create-missing-posts', + $valid_actions = array('multiple-upload-file', 'create-missing-posts', 'update-config', 'restore-backup', 'change-dates', 'write-comic-post', 'update-cpm-config', 'do-first-run', 'skip-first-run', 'build-storyline-schema', 'batch-processing', 'manage-subcomic'); @@ -2362,7 +2362,7 @@ function cpm_manager_edit_config() { $files = glob($file . "/*"); if (is_array($files)) { $folder_stack = array_merge($folder_stack, $files); - } + } } else { if (!$max_depth_message) { $cpm_config->messages[] = sprintf(__("I went %s levels deep in my search for comic directories. Are you sure you have your site set up correctly?", 'comicpress-manager'), $max_depth); @@ -2418,13 +2418,13 @@ function cpm_manager_edit_config() { />
- + />
diff --git a/comicpress_manager_count_missing_entries.php b/comicpress_manager_count_missing_entries.php index ba41bf4..5257bfe 100644 --- a/comicpress_manager_count_missing_entries.php +++ b/comicpress_manager_count_missing_entries.php @@ -23,8 +23,11 @@ // toward one blog/one comic... $all_post_dates = array(); + $format = CPM_DATE_FORMAT; + if (isset($_POST['format'])) { $format = $_POST['format']; } + foreach (cpm_query_posts() as $comic_post) { - $all_post_dates[] = date(CPM_DATE_FORMAT, strtotime($comic_post->post_date)); + $all_post_dates[] = date($format, strtotime($comic_post->post_date)); } $all_post_dates = array_unique($all_post_dates); @@ -32,7 +35,7 @@ $missing_comic_count = 0; foreach (cpm_read_comics_folder() as $comic_file) { $comic_file = pathinfo($comic_file, PATHINFO_BASENAME); - if (($result = cpm_breakdown_comic_filename($comic_file)) !== false) { + if (($result = cpm_breakdown_comic_filename($comic_file, $format)) !== false) { if (!in_array($result['date'], $all_post_dates)) { if (($post_hash = generate_post_hash($result['date'], $result['converted_title'])) !== false) { $missing_comic_count++; diff --git a/comicpress_manager_library.php b/comicpress_manager_library.php index dfe8539..8292ae3 100644 --- a/comicpress_manager_library.php +++ b/comicpress_manager_library.php @@ -172,7 +172,8 @@ function cpm_build_comic_uri($filename, $base_dir = null) { */ function cpm_breakdown_comic_filename($filename, $allow_override = false) { $pattern = CPM_DATE_FORMAT; - if ($allow_override) { + if ($allow_override !== false) { + $pattern = $allow_override; if (isset($_POST['upload-date-format']) && !empty($_POST['upload-date-format'])) { $pattern = $_POST['upload-date-format']; } } diff --git a/js/comicpress_script.js b/js/comicpress_script.js index c882ffe..1ffb77b 100644 --- a/js/comicpress_script.js +++ b/js/comicpress_script.js @@ -143,7 +143,8 @@ function prepare_comicpress_manager() { { method: 'post', parameters: { - action: "count-missing-posts" + action: "count-missing-posts", + format: $('upload-date-format').value }, onSuccess: function(transport) { if (transport.headerJSON) {