query("UPDATE $wpdb->nggpictures SET sortorder = '$sortindex' WHERE pid = $pic_id"); $sortindex++; } do_action('ngg_gallery_sort', $galleryID); nggGallery::show_message(__('Sort order changed','nggallery')); } } // look for presort args $presort = isset($_GET['presort']) ? $_GET['presort'] : false; $dir = ( isset($_GET['dir']) && $_GET['dir'] == 'DESC' ) ? 'DESC' : 'ASC'; $sortitems = array('pid', 'filename', 'alttext', 'imagedate'); // ensure that nobody added some evil sorting :-) if (in_array( $presort, $sortitems) ) $picturelist = $nggdb->get_gallery($galleryID, $presort, $dir, false); else $picturelist = $nggdb->get_gallery($galleryID, 'sortorder', $dir, false); //this is the url without any presort variable $clean_url = 'admin.php?page=nggallery-manage-gallery&mode=sort&gid=' . $galleryID; //if we go back , then the mode should be edit $back_url = 'admin.php?page=nggallery-manage-gallery&mode=edit&gid=' . $galleryID; // In the case somebody presort, then we take this url if ( isset($_GET['dir']) || isset($_GET['presort']) ) $base_url = $_SERVER['REQUEST_URI']; else $base_url = $clean_url; ?>

alttext) ); ?>