Oppaitime's version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

rename.php 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?
  2. authorize();
  3. $GroupID = $_POST['groupid'];
  4. $OldGroupID = $GroupID;
  5. $NewName = $_POST['name'];
  6. $NewJP = $_POST['namejp'];
  7. $DB->query("
  8. SELECT ID
  9. FROM torrents
  10. WHERE GroupID = " . db_string($GroupID) . "
  11. AND UserID = " . $LoggedUser['ID']);
  12. $Contributed = $DB->has_results();
  13. if (!$GroupID || !is_number($GroupID)) {
  14. error(404);
  15. }
  16. if (empty($NewName) || empty($NewJP)) {
  17. error('Torrent groups must have a name');
  18. }
  19. if (!($Contributed || check_perms('torrents_edit'))) {
  20. error(403);
  21. }
  22. $DB->query("
  23. SELECT Name
  24. FROM torrents_group
  25. WHERE ID = $GroupID");
  26. list($OldName) = $DB->next_record(MYSQLI_NUM, false);
  27. $DB->query("
  28. UPDATE torrents_group
  29. SET Name = '".db_string($NewName)."',
  30. NameJP = '".db_string($NewJP)."'
  31. WHERE ID = '$GroupID'");
  32. $Cache->delete_value("torrents_details_$GroupID");
  33. Torrents::update_hash($GroupID);
  34. Misc::write_log("Torrent Group $GroupID ($OldName) was renamed to \"$NewName\" from \"$OldName\" by ".$LoggedUser['Username']);
  35. Torrents::write_group_log($GroupID, 0, $LoggedUser['ID'], "renamed to \"$NewName\" from \"$OldName\"", 0);
  36. header("Location: torrents.php?id=$GroupID");