diff options
Diffstat (limited to 'admin/batch_manager_global.php')
-rw-r--r-- | admin/batch_manager_global.php | 111 |
1 files changed, 46 insertions, 65 deletions
diff --git a/admin/batch_manager_global.php b/admin/batch_manager_global.php index e74a6dd9d..2828d8b9b 100644 --- a/admin/batch_manager_global.php +++ b/admin/batch_manager_global.php @@ -2,7 +2,7 @@ // +-----------------------------------------------------------------------+ // | Piwigo - a PHP based photo gallery | // +-----------------------------------------------------------------------+ -// | Copyright(C) 2008-2013 Piwigo Team http://piwigo.org | +// | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | // +-----------------------------------------------------------------------+ @@ -82,7 +82,7 @@ if (isset($_POST['submit'])) // photo in the selection if (count($collection) == 0) { - array_push($page['errors'], l10n('Select at least one photo')); + $page['errors'][] = l10n('Select at least one photo'); } $action = $_POST['selectAction']; @@ -105,14 +105,14 @@ DELETE { if (empty($_POST['add_tags'])) { - array_push($page['errors'], l10n('Select at least one tag')); + $page['errors'][] = l10n('Select at least one tag'); } else { $tag_ids = get_tag_ids($_POST['add_tags']); add_tags($tag_ids, $collection); - if ('with no tag' == $page['prefilter']) + if ('no_tag' == $page['prefilter']) { redirect($redirect_url); } @@ -121,11 +121,8 @@ DELETE if ('del_tags' == $action) { - if (count($_POST['del_tags']) == 0) - { - array_push($page['errors'], l10n('Select at least one tag')); - } - + if (isset($_POST['del_tags']) and count($_POST['del_tags']) > 0) + { $query = ' DELETE FROM '.IMAGE_TAG_TABLE.' @@ -133,6 +130,11 @@ DELETE AND tag_id IN ('.implode(',', $_POST['del_tags']).') ;'; pwg_query($query); + } + else + { + $page['errors'][] = l10n('Select at least one tag'); + } } if ('associate' == $action) @@ -147,12 +149,12 @@ DELETE ); // let's refresh the page because we the current set might be modified - if ('with no album' == $page['prefilter']) + if ('no_album' == $page['prefilter']) { redirect($redirect_url); } - if ('with no virtual album' == $page['prefilter']) + if ('no_virtual_album' == $page['prefilter']) { $category_info = get_cat_info($_POST['associate']); if (empty($category_info['dir'])) @@ -171,12 +173,12 @@ DELETE ); // let's refresh the page because we the current set might be modified - if ('with no album' == $page['prefilter']) + if ('no_album' == $page['prefilter']) { redirect($redirect_url); } - if ('with no virtual album' == $page['prefilter']) + if ('no_virtual_album' == $page['prefilter']) { $category_info = get_cat_info($_POST['move']); if (empty($category_info['dir'])) @@ -239,12 +241,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'author' => $_POST['author'] - ) + $datas[] = array( + 'id' => $image_id, + 'author' => $_POST['author'] ); } @@ -266,12 +265,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'name' => $_POST['title'] - ) + $datas[] = array( + 'id' => $image_id, + 'name' => $_POST['title'] ); } @@ -300,12 +296,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'date_creation' => $date_creation - ) + $datas[] = array( + 'id' => $image_id, + 'date_creation' => $date_creation ); } @@ -322,12 +315,9 @@ DELETE $datas = array(); foreach ($collection as $image_id) { - array_push( - $datas, - array( - 'id' => $image_id, - 'level' => $_POST['level'] - ) + $datas[] = array( + 'id' => $image_id, + 'level' => $_POST['level'] ); } @@ -360,15 +350,9 @@ DELETE $deleted_count = delete_elements($collection, true); if ($deleted_count > 0) { - $_SESSION['page_infos'] = array( - sprintf( - l10n_dec( - '%d photo was deleted', - '%d photos were deleted', - $deleted_count - ), - $deleted_count - ) + $_SESSION['page_infos'][] = l10n_dec( + '%d photo was deleted', '%d photos were deleted', + $deleted_count ); $redirect_url = get_root_url().'admin.php?page='.$_GET['page']; @@ -376,12 +360,12 @@ DELETE } else { - array_push($page['errors'], l10n('No photo can be deleted')); + $page['errors'][] = l10n('No photo can be deleted'); } } else { - array_push($page['errors'], l10n('You need to confirm deletion')); + $page['errors'][] = l10n('You need to confirm deletion'); } } @@ -389,11 +373,7 @@ DELETE if ('metadata' == $action) { sync_metadata($collection); - - array_push( - $page['infos'], - l10n('Metadata synchronized from file') - ); + $page['infos'][] = l10n('Metadata synchronized from file'); } if ('delete_derivatives' == $action) @@ -413,11 +393,13 @@ DELETE if ('generate_derivatives' == $action) { if ($_POST['regenerateSuccess'] != '0') - array_push($page['infos'], sprintf(l10n('%s photos have been regenerated'), $_POST['regenerateSuccess'])); - + { + $page['infos'][] = l10n('%s photos have been regenerated', $_POST['regenerateSuccess']); + } if ($_POST['regenerateError'] != '0') - array_push($page['warnings'], sprintf(l10n('%s photos can not be regenerated'), $_POST['regenerateError'])); - + { + $page['warnings'][] = l10n('%s photos can not be regenerated', $_POST['regenerateError']); + } } trigger_action('element_set_global_action', $action, $collection); @@ -432,18 +414,17 @@ $base_url = get_root_url().'admin.php'; $prefilters = array( array('ID' => 'caddie', 'NAME' => l10n('Caddie')), - array('ID' => 'last import', 'NAME' => l10n('Last import')), - array('ID' => 'with no album', 'NAME' => l10n('With no album')), - array('ID' => 'with no tag', 'NAME' => l10n('With no tag')), + array('ID' => 'favorites', 'NAME' => l10n('Your favorites')), + array('ID' => 'last_import', 'NAME' => l10n('Last import')), + array('ID' => 'no_album', 'NAME' => l10n('With no album')), + array('ID' => 'no_tag', 'NAME' => l10n('With no tag')), array('ID' => 'duplicates', 'NAME' => l10n('Duplicates')), - array('ID' => 'all photos', 'NAME' => l10n('All')) + array('ID' => 'all_photos', 'NAME' => l10n('All')) ); if ($conf['enable_synchronization']) { - array_push($prefilters, - array('ID' => 'with no virtual album', 'NAME' => l10n('With no virtual album')) - ); + $prefilters[] = array('ID' => 'no_virtual_album', 'NAME' => l10n('With no virtual album')); } $prefilters = trigger_event('get_batch_manager_prefilters', $prefilters); @@ -457,7 +438,7 @@ $template->assign( 'all_elements' => $page['cat_elements_id'], 'START' => $page['start'], 'U_DISPLAY'=>$base_url.get_query_string_diff(array('display')), - 'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start','tag')), + 'F_ACTION'=>$base_url.get_query_string_diff(array('cat','start','tag','filter')), ) ); |