Browse Source

Automatically mark ISOs neutral leech and give uploader a bonus point award

spaghetti 8 years ago
parent
commit
323a004807
1 changed files with 23 additions and 0 deletions
  1. 23
    0
      sections/upload/upload_handle.php

+ 23
- 0
sections/upload/upload_handle.php View File

552
   $T['FreeLeechType'] = 0;
552
   $T['FreeLeechType'] = 0;
553
 }
553
 }
554
 
554
 
555
+// movie and anime ISOs are neutral leech, and receive a BP bounty
556
+if (($Type == "Movies" || $Type == "Anime") && $T['Container'] == "'ISO'") {
557
+  $T['FreeTorrent'] = 2;
558
+  $T['FreeLeechType'] = 2;
559
+}
560
+
555
 // Torrent
561
 // Torrent
556
 $DB->query("
562
 $DB->query("
557
   INSERT INTO torrents
563
   INSERT INTO torrents
573
 // (expire the key after 10 minutes to prevent locking it for too long in case there's a fatal error below)
579
 // (expire the key after 10 minutes to prevent locking it for too long in case there's a fatal error below)
574
 $Cache->cache_value("torrent_{$TorrentID}_lock", true, 600);
580
 $Cache->cache_value("torrent_{$TorrentID}_lock", true, 600);
575
 
581
 
582
+//give BP if necessary
583
+if (($Type == "Movies" || $Type == "Anime") && $T['Container'] == "'ISO'") {
584
+  $BPAmt = 2*($TotalSize / (1024*1024*1024))*1000;
585
+
586
+  $DB->query("
587
+    UPDATE users_main
588
+    SET BonusPoints = BonusPoints + $BPAmt
589
+    WHERE ID = $LoggedUser[ID]");
590
+
591
+   $DB->query("
592
+    UPDATE users_info
593
+    SET AdminComment = CONCAT('".sqltime()." - Received $BPAmt ".BONUS_POINTS." for uploading a torrent $TorrentID\n\n', AdminComment)
594
+    WHERE UserID = $LoggedUser[ID]");
595
+    $Cache->delete_value('user_info_heavy_'.$LoggedUser['ID']);
596
+    $Cache->delete_value('user_stats_'.$LoggedUser['ID']);
597
+}
598
+
576
 // Add to shop freeleeches if necessary
599
 // Add to shop freeleeches if necessary
577
 if ($T['FreeLeechType'] == 3) {
600
 if ($T['FreeLeechType'] == 3) {
578
 // Figure out which duration to use
601
 // Figure out which duration to use

Loading…
Cancel
Save