Changeset 28701 for trunk/admin


Ignore:
Timestamp:
Jun 14, 2014, 10:28:59 AM (10 years ago)
Author:
mistic100
Message:

too much redirects

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/batch_manager_global.php

    r28700 r28701  
    8787
    8888  $action = $_POST['selectAction'];
     89  $redirect = false;
    8990
    9091  if ('remove_from_caddie' == $action)
     
    99100
    100101    // remove from caddie action available only in caddie so reload content
    101     redirect($redirect_url);
    102   }
    103 
    104   if ('add_tags' == $action)
     102    $redirect = true;
     103  }
     104
     105  else if ('add_tags' == $action)
    105106  {
    106107    if (empty($_POST['add_tags']))
     
    115116      if ('no_tag' == $page['prefilter'])
    116117      {
    117         redirect($redirect_url);
    118       }
    119     }
    120   }
    121 
    122   if ('del_tags' == $action)
    123   {
    124      if (isset($_POST['del_tags']) and count($_POST['del_tags']) > 0)
    125      {
    126     $query = '
     118        $redirect = true;
     119      }
     120    }
     121  }
     122
     123  else if ('del_tags' == $action)
     124  {
     125    if (isset($_POST['del_tags']) and count($_POST['del_tags']) > 0)
     126    {
     127      $query = '
    127128DELETE
    128129  FROM '.IMAGE_TAG_TABLE.'
     
    130131    AND tag_id IN ('.implode(',', $_POST['del_tags']).')
    131132;';
    132     pwg_query($query);
    133     }
    134      else
    135      {
     133      pwg_query($query);
     134     
     135      if (isset($_SESSION['bulk_manager_filter']['tags']) &&
     136        count(array_intersect($_SESSION['bulk_manager_filter']['tags'], $_POST['del_tags'])))
     137      {
     138        $redirect = true;
     139      }
     140    }
     141    else
     142    {
    136143      $page['errors'][] = l10n('Select at least one tag');
    137      }
     144    }
    138145  }
    139146
     
    152159    if ('no_album' == $page['prefilter'])
    153160    {
    154       redirect($redirect_url);
    155     }
    156 
    157     if ('no_virtual_album' == $page['prefilter'])
     161      $redirect = true;
     162    }
     163
     164    else if ('no_virtual_album' == $page['prefilter'])
    158165    {
    159166      $category_info = get_cat_info($_POST['associate']);
    160167      if (empty($category_info['dir']))
    161168      {
    162         redirect($redirect_url);
    163       }
    164     }
    165   }
    166 
    167   if ('move' == $action)
     169        $redirect = true;
     170      }
     171    }
     172  }
     173
     174  else if ('move' == $action)
    168175  {
    169176    move_images_to_categories($collection, array($_POST['move']));
     
    176183    if ('no_album' == $page['prefilter'])
    177184    {
    178       redirect($redirect_url);
    179     }
    180 
    181     if ('no_virtual_album' == $page['prefilter'])
     185      $redirect = true;
     186    }
     187
     188    else if ('no_virtual_album' == $page['prefilter'])
    182189    {
    183190      $category_info = get_cat_info($_POST['move']);
    184191      if (empty($category_info['dir']))
    185192      {
    186         redirect($redirect_url);
    187       }
    188     }
    189 
    190     if (isset($_SESSION['bulk_manager_filter']['category'])
     193        $redirect = true;
     194      }
     195    }
     196
     197    else if (isset($_SESSION['bulk_manager_filter']['category'])
    191198        and $_POST['move'] != $_SESSION['bulk_manager_filter']['category'])
    192199    {
    193       redirect($redirect_url);
    194     }
    195   }
    196 
    197   if ('dissociate' == $action)
     200      $redirect = true;
     201    }
     202  }
     203
     204  else if ('dissociate' == $action)
    198205  {
    199206    // physical links must not be broken, so we must first retrieve image_id
     
    227234
    228235      // let's refresh the page because the current set might be modified
    229       redirect($redirect_url);
     236      $redirect = true;
    230237    }
    231238  }
    232239
    233240  // author
    234   if ('author' == $action)
     241  else if ('author' == $action)
    235242  {
    236243    if (isset($_POST['remove_author']))
     
    256263
    257264  // title
    258   if ('title' == $action)
     265  else if ('title' == $action)
    259266  {
    260267    if (isset($_POST['remove_title']))
     
    280287
    281288  // date_creation
    282   if ('date_creation' == $action)
     289  else if ('date_creation' == $action)
    283290  {
    284291    if (isset($_POST['remove_date_creation']) || empty($_POST['date_creation']))
     
    308315
    309316  // privacy_level
    310   if ('level' == $action)
     317  else if ('level' == $action)
    311318  {
    312319    $datas = array();
     
    329336      if ($_POST['level'] < $_SESSION['bulk_manager_filter']['level'])
    330337      {
    331         redirect($redirect_url);
     338        $redirect = true;
    332339      }
    333340    }
     
    335342
    336343  // add_to_caddie
    337   if ('add_to_caddie' == $action)
     344  else if ('add_to_caddie' == $action)
    338345  {
    339346    fill_caddie($collection);
     
    341348
    342349  // delete
    343   if ('delete' == $action)
     350  else if ('delete' == $action)
    344351  {
    345352    if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
     
    354361
    355362        $redirect_url = get_root_url().'admin.php?page='.$_GET['page'];
    356         redirect($redirect_url);
     363        $redirect = true;
    357364      }
    358365      else
     
    368375
    369376  // synchronize metadata
    370   if ('metadata' == $action)
     377  else if ('metadata' == $action)
    371378  {
    372379    sync_metadata($collection);
     
    374381  }
    375382
    376   if ('delete_derivatives' == $action && !empty($_POST['del_derivatives_type']))
     383  else if ('delete_derivatives' == $action && !empty($_POST['del_derivatives_type']))
    377384  {
    378385    $query='SELECT path,representative_ext FROM '.IMAGES_TABLE.'
     
    388395  }
    389396
    390   if ('generate_derivatives' == $action)
     397  else if ('generate_derivatives' == $action)
    391398  {
    392399    if ($_POST['regenerateSuccess'] != '0')
     
    406413
    407414  trigger_notify('element_set_global_action', $action, $collection);
     415
     416  if ($redirect)
     417  {
     418    redirect($redirect_url);
     419  }
    408420}
    409421
Note: See TracChangeset for help on using the changeset viewer.