function remove($cid, $redirect = true)
 {
     global $my, $mainframe, $database, $option, $priTask, $subTask;
     global $WBG_CONFIG, $wbGalleryDB_cat, $wbGallery_eng;
     $row = new wbGalleryDB_img($database);
     for ($i = 0, $n = count($cid); $i < $n; $i++) {
         $id = intval($cid[$i]);
         $row->load($id);
         $wbGallery_eng->remove($row->file);
         $cat_id = $row->cat_id;
         $row->delete();
         $row->updateOrder('cat_id = ' . $cat_id);
     }
     if ($redirect) {
         mosRedirect('index2.php?option=' . $option . '&task=image', 'Selected items have been removed');
     } else {
         return true;
     }
 }