changes for FS#150

This commit is contained in:
John Bintz 2010-03-18 21:19:01 -04:00
parent 56205c1722
commit 7f51b1035d
4 changed files with 17 additions and 12 deletions

View File

@ -666,7 +666,7 @@ function cpm_post_editor($width = 435, $is_import = false) {
$form_titles_and_fields[] = array(
__("Upload Date Format:", 'comicpress-manager'),
'<input type="text" name="upload-date-format" />' .
'<input type="text" id="upload-date-format" name="upload-date-format" />' .
__(" <em>(if the files you are uploading have a different date format, specify it here. ex: <strong>Ymd</strong> for a file named <strong>20080101-my-new-years-day.jpg</strong>)</em>", 'comicpress-manager')
);

View File

@ -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++;

View File

@ -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']; }
}

View File

@ -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) {