function advSortResortCategory($category = "main")
{
    /*
     * First, grab all groups that have the category
     */
    $rstGroupList = @mysql_query("SELECT `group_id` from `subgrouping` WHERE `category` = \"{$category}\"");
    if ($rstGroupList === false) {
        return false;
    }
    /*
     * Sort ungrouped torrents first
     */
    advSortResortGrp($category, 0);
    /*
     * Sort the remaining groups
     */
    while ($rowGroup = mysql_fetch_row($rstGroupList)) {
        if (!advSortResortGrp($category, $rowGroup[0])) {
            return false;
        }
    }
    return true;
}
          * Finally, we can remove the category itself
          */
         @mysql_query("DELETE FROM `subgrouping` WHERE `group_id` = " . $_GET["group"]);
     }
     admShowMsg("All torrents were ungrouped and the group removed", "Redirecting to advanced sorting page.", "Redirecting", true, "bta_advsort.php", 3);
     exit;
     break;
 case "grpautosort":
     /*
      * Requires the group_id to be specified.  All this does is sort the torrents by name in the specified group.
      */
     if (!isset($_GET["group"]) || !is_numeric($_GET["group"])) {
         admShowMsg("Invalid group specified", "Redirecting to advanced sorting page.", "Redirecting", true, "bta_advsort.php", 3);
         exit;
     }
     advSortResortGrp($category, $_GET["group"]);
     admShowMsg("Resorting completed", "Redirecting to advanced sorting page.", "Redirecting", true, "bta_advsort.php", 3);
     exit;
     break;
 case "rootsort":
     /*
      * Requires root access
      */
     if (!isset($_SESSION["admin_perms"]["root"])) {
         admShowMsg("Not allowed", "Redirecting to advanced sorting page.", "Redirecting", true, "bta_advsort.php", 3);
         exit;
     }
     advSortResortAll();
     admShowMsg("Global resort complete", "Redirecting to advanced sorting page.", "Redirecting", true, "bta_advsort.php", 3);
     exit;
     break;