Browse Source

Random small formattings re: store and FL search

pjc 5 years ago
parent
commit
a9972a59fb

+ 1
- 1
classes/rules.class.php View File

@@ -157,7 +157,7 @@ class Rules
157 157
 <li>Flooding is irritating and you'll get kicked for it. This includes "now playing" scripts, large amounts of
158 158
   irrelevant text such as lorem ipsum, and unfunny non sequiturs.</li>
159 159
 
160
-<li>Impersonating other members &mdash; particularly staff members &mdash; will not go unpunished. Please remember that
160
+<li>Impersonating other members, particularly staff members, will not go unpunished. Please remember that
161 161
   the Slack channels are publicly accessible.</li>
162 162
 
163 163
 <li>Please use the threaded conversations feature in Slack and avoid replying to threads with new messages or

+ 18
- 1
classes/torrentsearch.class.php View File

@@ -71,7 +71,7 @@ class TorrentSearch
71 71
     'searchstr' => 1,
72 72
     'series' => 1, # Location
73 73
     'studio' => 1, # Department/Lab
74
-    'location' => 1,
74
+    'location' => 1, # Combined ↑
75 75
     'subber' => 1,
76 76
     'subbing' => 1,
77 77
     'taglist' => 1
@@ -698,6 +698,22 @@ class TorrentSearch
698 698
      * @return bool True if it's a real hit
699 699
      */
700 700
     private function filter_torrent_internal($Torrent)
701
+    {
702
+        if (isset($this->UsedTorrentAttrs['freetorrent'])) {
703
+            $FilterValue = $this->UsedTorrentAttrs['freetorrent'];
704
+            if ($FilterValue === 3 && $Torrent['FreeTorrent'] === 0) {
705
+                // Either FL or NL is ok
706
+                return false;
707
+            } elseif ($FilterValue !== 3 && $FilterValue !== (int)$Torrent['FreeTorrent']) {
708
+                return false;
709
+            }
710
+        }
711
+        return true;
712
+    }
713
+}
714
+
715
+/* Not integers
716
+    private function filter_torrent_internal($Torrent)
701 717
     {
702 718
         if (isset($this->UsedTorrentAttrs['freetorrent'])) {
703 719
             $FilterValue = $this->UsedTorrentAttrs['freetorrent'];
@@ -711,3 +727,4 @@ class TorrentSearch
711 727
         return true;
712 728
     }
713 729
 }
730
+*/

+ 1
- 1
sections/requests/requests.php View File

@@ -560,7 +560,7 @@ View::show_header($Title, 'requests');
560 560
           <a href="user.php?id=<?=$FillerInfo['ID']?>"><?=$FillerInfo['Username']?></a>
561 561
 <?php      }
562 562
             } else { ?>
563
-        &mdash;
563
+        &ndash;
564 564
 <?php    } ?>
565 565
       </td>
566 566
       <td>

+ 43
- 36
sections/store/badge.php View File

@@ -1,4 +1,5 @@
1
-<?
1
+<?php
2
+
2 3
 $UserID = $LoggedUser['ID'];
3 4
 $BadgeID = $_GET['badge'];
4 5
 
@@ -6,72 +7,78 @@ $ShopBadgeIDs = [100, 101, 102, 103, 104, 105, 106, 107];
6 7
 $Prices = [100 => 5000, 101 => 10000, 102 => 25000, 103 => 50000, 104 => 100000, 105 => 250000, 106 => 500000, 107 => 1000000];
7 8
 
8 9
 if (!$BadgeID) {
9
-  $Err = 'No badge specified.';
10
+    $Err = 'No badge specified';
10 11
 } elseif (!in_array($BadgeID, $ShopBadgeIDs)) {
11
-  $Err = 'Invalid badge ID.';
12
+    $Err = 'Invalid badge ID';
12 13
 } elseif (Badges::has_badge($UserID, $BadgeID)) {
13
-  $Err = 'You already have this badge.';
14
-} elseif ($BadgeID != $ShopBadgeIDs[0] && !Badges::has_badge($UserID, $ShopBadgeIDs[array_search($BadgeID, $ShopBadgeIDs)-1])) {
15
-  $Err = 'You haven\'t purchased the badges before this one!';
14
+    $Err = 'You already have this badge';
15
+} elseif ($BadgeID !== $ShopBadgeIDs[0] && !Badges::has_badge($UserID, $ShopBadgeIDs[array_search($BadgeID, $ShopBadgeIDs)-1])) {
16
+    $Err = "You haven't purchased the badges before this one!";
16 17
 }
17 18
 
18
-if (isset($_GET['confirm']) && $_GET['confirm'] == 1) {
19
-  if (!isset($Err)) {
20
-    $DB->query("
19
+if (isset($_GET['confirm']) && $_GET['confirm'] === 1) {
20
+    if (!isset($Err)) {
21
+        $DB->query("
21 22
       SELECT BonusPoints
22 23
       FROM users_main
23 24
       WHERE ID = $UserID");
24
-    if ($DB->has_results()) {
25
-      list($BP) =  $DB->next_record();
26
-      $BP = (int)$BP;
25
+        if ($DB->has_results()) {
26
+            list($BP) =  $DB->next_record();
27
+            $BP = (int)$BP;
27 28
 
28
-      if ($BP >= $Prices[$BadgeID]) {
29
-        if (!Badges::award_badge($UserID, $BadgeID)) {
30
-          $Err = 'Could not award badge, unknown error occurred.';
31
-        } else {
32
-          $DB->query("
29
+            if ($BP >= $Prices[$BadgeID]) {
30
+                if (!Badges::award_badge($UserID, $BadgeID)) {
31
+                    $Err = 'Could not award badge, unknown error occurred.';
32
+                } else {
33
+                    $DB->query("
33 34
             UPDATE users_main
34 35
             SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ."
35 36
             WHERE ID = $UserID");
36 37
 
37
-          $DB->query("
38
+                    $DB->query("
38 39
             UPDATE users_info
39 40
             SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment)
40 41
             WHERE UserID = $UserID");
41 42
 
42
-          $Cache->delete_value("user_info_heavy_$UserID");
43
+                    $Cache->delete_value("user_info_heavy_$UserID");
44
+                }
45
+            } else {
46
+                $Err = 'Not enough '.BONUS_POINTS.'.';
47
+            }
43 48
         }
44
-      } else {
45
-        $Err = 'Not enough '.BONUS_POINTS.'.';
46
-      }
47 49
     }
48
-  }
49 50
 
50
-  View::show_header('Store'); ?>
51
+    View::show_header('Store'); ?>
51 52
 <div class='thin'>
52
-  <h2 id='general'>Purchase <?=isset($Err)?'Failed':'Successful'?></h2>
53
+  <h2 id='general'>Purchase <?=isset($Err)?'Failed':'Successful'?>
54
+  </h2>
53 55
   <div class='box pad' style='padding: 10px 10px 10px 20px;'>
54
-    <p><?=isset($Err)?'Error: '.$Err:'You have purchased a badge'?></p>
56
+    <p><?=isset($Err)?'Error: '.$Err:'You have purchased a badge'?>
57
+    </p>
55 58
     <p><a href='/store.php'>Back to Store</a></p>
56 59
   </div>
57 60
 </div>
58
-<? } else {
59
-  View::show_header('Store'); ?>
61
+<?php
62
+} else {
63
+        View::show_header('Store'); ?>
60 64
 <div class='thin'>
61 65
   <h2 id='general'>Purchase Badge?</h2>
62 66
   <div class='box pad' style='padding: 10px 10px 10px 20px;'>
63
-    <p>Badge cost: <?=number_format($Prices[$BadgeID])?> <?=BONUS_POINTS?></p>
64
-    <? if (isset($Err)) { ?>
65
-    <p>Error: <?=$Err?></p>
66
-    <? } else { ?>
67
+    <p>Badge cost: <?=number_format($Prices[$BadgeID])?> <?=BONUS_POINTS?>
68
+    </p>
69
+    <?php if (isset($Err)) { ?>
70
+    <p>Error: <?=$Err?>
71
+    </p>
72
+    <?php } else { ?>
67 73
     <form action="store.php">
68 74
       <input type="hidden" name="item" value="badge">
69 75
       <input type="hidden" name="badge" value="<?=$BadgeID?>">
70 76
       <input type="hidden" name="confirm" value="1">
71 77
       <input type="submit" value="Purchase">
72
-    <? } ?>
73
-    <p><a href='/store.php'>Back to Store</a></p>
78
+      <?php } ?>
79
+      <p><a href='/store.php'>Back to Store</a></p>
74 80
   </div>
75 81
 </div>
76
-<? }
77
-View::show_footer(); ?>
82
+<?php
83
+    }
84
+View::show_footer();

+ 76
- 78
sections/store/freeleechpool.php View File

@@ -1,49 +1,48 @@
1
-<?
2
-if (isset($_POST['donation'])) {
1
+<?php
3 2
 
4
-  $Donation = $_POST['donation'];
5
-  if (!is_numeric($Donation) || $Donation < 1) {
6
-    error('Invalid donation');
7
-  }
3
+if (isset($_POST['donation'])) {
4
+    $Donation = $_POST['donation'];
5
+    if (!is_numeric($Donation) || $Donation < 1) {
6
+        error('Invalid donation');
7
+    }
8 8
 
9
-  $UserID = $LoggedUser['ID'];
9
+    $UserID = $LoggedUser['ID'];
10 10
 
11
-  $DB->query("
11
+    $DB->query("
12 12
     SELECT BonusPoints
13 13
     FROM users_main
14 14
     WHERE ID = $UserID");
15
-  if ($DB->has_results()) {
16
-    list($Points) = $DB->next_record();
15
+    if ($DB->has_results()) {
16
+        list($Points) = $DB->next_record();
17 17
 
18
-    if ($Points >= $Donation) {
18
+        if ($Points >= $Donation) {
19
+            $PoolTipped = false;
19 20
 
20
-      $PoolTipped = false;
21
-
22
-      $DB->query("
21
+            $DB->query("
23 22
         UPDATE users_main
24 23
         SET BonusPoints = BonusPoints - $Donation
25 24
         WHERE ID = $UserID");
26
-      $DB->query("
25
+            $DB->query("
27 26
         UPDATE misc
28 27
         SET First = First + $Donation
29 28
         WHERE Name = 'FreeleechPool'");
30
-      $Cache->delete_value('user_info_heavy_'.$UserID);
29
+            $Cache->delete_value('user_info_heavy_'.$UserID);
31 30
 
32
-      // Check to see if we're now over the target pool size
33
-      $DB->query("
31
+            // Check to see if we're now over the target pool size
32
+            $DB->query("
34 33
         SELECT First, Second
35 34
         FROM misc
36 35
         WHERE Name = 'FreeleechPool'");
37
-      if ($DB->has_results()) {
38
-        list($Pool, $Target) = $DB->next_record();
36
+            if ($DB->has_results()) {
37
+                list($Pool, $Target) = $DB->next_record();
39 38
 
40
-        if ($Pool > $Target) {
41
-          $PoolTipped = true;
42
-          $NumTorrents = rand(2, 6);
43
-          $Torrents = [];
44
-          for ($i = 0; $i < $NumTorrents; $i++) {
45
-            $TorrentSize = intval($Pool * (($i==$NumTorrents-1)?1:(rand(10,80)/100)) * 100000);
46
-            $DB->query("
39
+                if ($Pool > $Target) {
40
+                    $PoolTipped = true;
41
+                    $NumTorrents = rand(2, 6);
42
+                    $Torrents = [];
43
+                    for ($i = 0; $i < $NumTorrents; $i++) {
44
+                        $TorrentSize = intval($Pool * (($i===$NumTorrents-1)?1:(rand(10, 80)/100)) * 100000); # todo
45
+                        $DB->query("
47 46
               SELECT ID, Size
48 47
               FROM torrents
49 48
               WHERE Size < $TorrentSize
@@ -52,74 +51,73 @@ if (isset($_POST['donation'])) {
52 51
                 AND FreeLeechType = '0'
53 52
               ORDER BY Seeders ASC, Size DESC
54 53
               LIMIT 1");
55
-            if ($DB->has_results()) {
56
-              list($TorrentID, $Size) = $DB->next_record();
57
-              $DB->query("
54
+                        if ($DB->has_results()) {
55
+                            list($TorrentID, $Size) = $DB->next_record();
56
+                            $DB->query("
58 57
                 INSERT INTO shop_freeleeches
59 58
                 (TorrentID, ExpiryTime)
60 59
                 VALUES($TorrentID, NOW() + INTERVAL 2 DAY)");
61
-              Torrents::freeleech_torrents($TorrentID, 1, 3);
62
-              $Pool -= $TorrentSize/100000;
63
-            } else {
64
-              // Failed to find a torrent. Maybe try again with a new value, maybe move on
65
-              if (rand(1,5) > 1) { $i--; }
66
-            }
67
-          }
60
+                            Torrents::freeleech_torrents($TorrentID, 1, 3);
61
+                            $Pool -= $TorrentSize/100000;
62
+                        } else {
63
+                            // Failed to find a torrent. Maybe try again with a new value, maybe move on
64
+                            if (rand(1, 5) > 1) {
65
+                                $i--;
66
+                            }
67
+                        }
68
+                    }
68 69
 
69
-          $Target = rand(10000, 100000);
70
-          $DB->query("
70
+                    $Target = rand(10000, 100000);
71
+                    $DB->query("
71 72
             UPDATE misc
72 73
             SET First = 0,
73 74
                 Second = $Target
74 75
             WHERE Name = 'FreeleechPool'");
76
+                }
77
+            }
78
+            $Cache->delete_value('shop_freeleech_list');
79
+        } else {
80
+            error("Not enough points to donate");
75 81
         }
76
-      }
77
-      $Cache->delete_value('shop_freeleech_list');
78
-    } else {
79
-      error("Not enough points to donate");
80 82
     }
81
-  }
82 83
 
83
-  View::show_header('Store'); ?>
84
-  <div class="thin">
85
-    <h2 id="general">Donation Successful</h2>
86
-    <div class="box pad" style="padding: 10px 10px 10px 20px;">
87
-      <p>You donated <?=number_format($Donation)?> <?=BONUS_POINTS?> to the Freeleech Pool</p>
88
-<? if ($PoolTipped) { ?>
89
-      <p>Your donation triggered a freeleech!</p>
90
-<? } ?>
91
-      <p><a href="/store.php">Back to Store</a></p>
92
-    </div>
84
+    View::show_header('Store'); ?>
85
+<div class="thin">
86
+  <h2 id="general">Donation Successful</h2>
87
+  <div class="box pad" style="padding: 10px 10px 10px 20px;">
88
+    <p>You donated <?=number_format($Donation)?> <?=BONUS_POINTS?> to the Freeleech Pool</p>
89
+    <?php if ($PoolTipped) { ?>
90
+    <p>Your donation triggered a freeleech!</p>
91
+    <?php } ?>
92
+    <p><a href="/store.php">Back to Store</a></p>
93 93
   </div>
94
-  <? View::show_footer();
95
-
94
+</div>
95
+<?php View::show_footer();
96 96
 } else {
97
-
98
-  $DB->query("
97
+    $DB->query("
99 98
     SELECT First
100 99
     FROM misc
101 100
     WHERE Name = 'FreeleechPool'");
102
-  if ($DB->has_results()) {
103
-    list($Pool) = $DB->next_record();
104
-  } else {
105
-    $Pool = 0;
106
-  }
101
+    if ($DB->has_results()) {
102
+        list($Pool) = $DB->next_record();
103
+    } else {
104
+        $Pool = 0;
105
+    }
107 106
 
108
-  View::show_header('Store'); ?>
109
-  <div class="thin">
110
-    <div class="box pad" style="padding: 10px 10px 10px 20px; text-align: center;">
111
-      <form action="store.php" method="POST">
112
-        <input type="hidden" name="item" value="freeleechpool">
113
-        <strong>
107
+    View::show_header('Store'); ?>
108
+<div class="thin">
109
+  <div class="box pad" style="padding: 10px 10px 10px 20px; text-align: center;">
110
+    <form action="store.php" method="POST">
111
+      <input type="hidden" name="item" value="freeleechpool">
112
+      <strong>
114 113
         There are currently <?=number_format($Pool)?> <?=BONUS_POINTS?> in the Freeleech Pool
115
-        </strong>
116
-        <br><br>
117
-        <input type="text" name="donation" value="">
118
-        <input type="submit" value="Donate">
119
-      </form>
120
-      <p><a href="/store.php">Back to Store</a></p>
121
-    </div>
114
+      </strong>
115
+      <br><br>
116
+      <input type="text" name="donation" value="">
117
+      <input type="submit" value="Donate">
118
+    </form>
119
+    <p><a href="/store.php">Back to Store</a></p>
122 120
   </div>
123
-  <? View::show_footer();
121
+</div>
122
+<?php View::show_footer();
124 123
 }
125
-?>

+ 68
- 61
sections/store/promotion.php View File

@@ -1,4 +1,7 @@
1
-<?
1
+<?php
2
+
3
+# todo: I like the idea of store-based promotions expanded to other factors,
4
+# e.g., under an HnR threshold or minimum account age
2 5
 $UserID = $LoggedUser['ID'];
3 6
 $GiB = 1024*1024*1024;
4 7
 
@@ -13,6 +16,7 @@ $Classes = array(
13 16
     'MinRatio'    => 0.7, // minimum ratio
14 17
     'TorUnique'   => false // do the uploads have to be unique groups?
15 18
   ),
19
+
16 20
   POWER => array(
17 21
     'Name'        => 'Well Endowed',
18 22
     'Price'       => 10000,
@@ -23,6 +27,7 @@ $Classes = array(
23 27
     'MinRatio'    => 1.1,
24 28
     'TorUnique'   => false
25 29
   ),
30
+
26 31
   ELITE => array(
27 32
     'Name'        => 'Bombshell',
28 33
     'Price'       => 30000,
@@ -33,6 +38,7 @@ $Classes = array(
33 38
     'MinRatio'    => 1.2,
34 39
     'TorUnique'   => false
35 40
   ),
41
+
36 42
   TORRENT_MASTER => array(
37 43
     'Name'        => 'Top Heavy',
38 44
     'Price'       => 60000,
@@ -43,6 +49,7 @@ $Classes = array(
43 49
     'MinRatio'    => 1.3,
44 50
     'TorUnique'   => false
45 51
   ),
52
+  
46 53
   POWER_TM => array(
47 54
     'Name'        => 'Titty Monster',
48 55
     'Price'       => 100000,
@@ -65,9 +72,9 @@ $DB->query("
65 72
   WHERE users_main.ID = $UserID");
66 73
 
67 74
 if ($DB->has_results()) {
68
-  list($PermID, $BP, $Warned, $Upload, $Download, $Ratio, $Enabled, $Uploads, $Groups) = $DB->next_record();
75
+    list($PermID, $BP, $Warned, $Upload, $Download, $Ratio, $Enabled, $Uploads, $Groups) = $DB->next_record();
69 76
 
70
-  switch ($PermID) {
77
+    switch ($PermID) {
71 78
     case USER:
72 79
       $To = MEMBER;
73 80
       break;
@@ -87,15 +94,14 @@ if ($DB->has_results()) {
87 94
       $To = -1;
88 95
   }
89 96
 
90
-  if ($To == -1) {
91
-    $Err[] = "Your user class is not eligible for promotions";
92
-  } elseif ($Enabled != 1) {
93
-    $Err[] = "This account is disabled, how did you get here?";
94
-  } else {
95
-
96
-    if ($Classes[$To]['NonSmall'] > 0) {
97
-      //
98
-      $DB->query("
97
+    if ($To == -1) {
98
+        $Err[] = "Your user class is not eligible for promotions";
99
+    } elseif ($Enabled != 1) {
100
+        $Err[] = "This account is disabled, how did you get here?";
101
+    } else {
102
+        if ($Classes[$To]['NonSmall'] > 0) {
103
+            //
104
+            $DB->query("
99 105
         SELECT COUNT(torrents.ID)
100 106
         FROM torrents
101 107
           JOIN torrents_group ON torrents.GroupID = torrents_group.ID
@@ -103,80 +109,81 @@ if ($DB->has_results()) {
103 109
           OR (torrents_group.CategoryID = 3 AND torrents_group.Pages >= 50))
104 110
           AND torrents.UserID = $UserID");
105 111
 
106
-      if ($DB->has_results()) {
107
-        list($NonSmall) = $DB->next_record();
112
+            if ($DB->has_results()) {
113
+                list($NonSmall) = $DB->next_record();
108 114
 
109
-        if ($NonSmall < $Classes[$To]['NonSmall']) {
110
-          $Err[] = "You do not have enough large uploads.";
115
+                if ($NonSmall < $Classes[$To]['NonSmall']) {
116
+                    $Err[] = "You do not have enough large uploads.";
117
+                }
118
+            } else {
119
+                $Err[] = "You do not have enough large uploads.";
120
+            }
111 121
         }
112
-      } else {
113
-        $Err[] = "You do not have enough large uploads.";
114
-      }
115
-
116
-    }
117 122
 
118
-    if ($Warned) {
119
-      $Err[] = "You cannot be promoted while warned";
120
-    }
123
+        if ($Warned) {
124
+            $Err[] = "You cannot be promoted while warned";
125
+        }
121 126
 
122
-    if ($LoggedUser['DisablePromotion']) {
123
-      $Err[] = "You have been banned from purchasing promotions";
124
-    }
127
+        if ($LoggedUser['DisablePromotion']) {
128
+            $Err[] = "You have been banned from purchasing promotions";
129
+        }
125 130
 
126
-    if ($BP < $Classes[$To]['Price']) {
127
-      $Err[] = "Not enough points";
128
-    }
131
+        if ($BP < $Classes[$To]['Price']) {
132
+            $Err[] = "Not enough points";
133
+        }
129 134
 
130
-    if ($Ratio < $Classes[$To]['MinRatio']) {
131
-      $Err[] = "Your ratio is too low to be promoted. The minimum ratio required for this promotion is ".$Classes[$To]['MinRatio'].".";
132
-    }
135
+        if ($Ratio < $Classes[$To]['MinRatio']) {
136
+            $Err[] = "Your ratio is too low to be promoted. The minimum ratio required for this promotion is ".$Classes[$To]['MinRatio'].".";
137
+        }
133 138
 
134
-    if ($Upload < $Classes[$To]['MinUpload']*$GiB) {
135
-      if ($Classes[$To]['MinUpload'] >= 1024) {
136
-        $Amount = $Classes[$To]['MinUpload']/1024;
137
-        $Unit = 'TiB';
138
-      } else {
139
-        $Amount = $Classes[$To]['MinUpload'];
140
-        $Unit = 'GiB';
141
-      }
142
-      $Err[] = "You have not uploaded enough to be promoted. The minimum uploaded amount for this promotion is ".$Amount."".$Unit.".";
143
-    }
139
+        if ($Upload < $Classes[$To]['MinUpload']*$GiB) {
140
+            if ($Classes[$To]['MinUpload'] >= 1024) {
141
+                $Amount = $Classes[$To]['MinUpload']/1024;
142
+                $Unit = 'TiB';
143
+            } else {
144
+                $Amount = $Classes[$To]['MinUpload'];
145
+                $Unit = 'GiB';
146
+            }
147
+            $Err[] = "You have not uploaded enough to be promoted. The minimum uploaded amount for this promotion is ".$Amount."".$Unit.".";
148
+        }
144 149
 
145
-    if ($Download < $Classes[$To]['MinDownload']*$GiB) {
146
-      $Err[] = "You have not downloaded enough to be promoted. The minimum downloaded amount for this promotion is ".$Classes[$To]['MinDownload']."GiB.";
147
-    }
150
+        if ($Download < $Classes[$To]['MinDownload']*$GiB) {
151
+            $Err[] = "You have not downloaded enough to be promoted. The minimum downloaded amount for this promotion is ".$Classes[$To]['MinDownload']."GiB.";
152
+        }
148 153
 
149
-    if ($Uploads < $Classes[$To]['MinUploads']) {
150
-      $Err[] = "You have not uploaded enough torrents to be promoted. The minimum number of uploaded torrents for this promotion is ".$Classes[$To]['MinUploads'].".";
151
-    }
154
+        if ($Uploads < $Classes[$To]['MinUploads']) {
155
+            $Err[] = "You have not uploaded enough torrents to be promoted. The minimum number of uploaded torrents for this promotion is ".$Classes[$To]['MinUploads'].".";
156
+        }
152 157
 
153
-    if ($Classes[$To]['UniqueTor'] && $Groups < $Classes[$To]['MinUploads']) {
154
-      $Err[] = "You have not uploaded to enough unique torrent groups to be promoted. The minimum number of unique groups for this promotion is ".$Classes[$To]['MinUploads'].".";
155
-    }
158
+        if ($Classes[$To]['UniqueTor'] && $Groups < $Classes[$To]['MinUploads']) {
159
+            $Err[] = "You have not uploaded to enough unique torrent groups to be promoted. The minimum number of unique groups for this promotion is ".$Classes[$To]['MinUploads'].".";
160
+        }
156 161
 
157
-    if (!isset($Err)) {
158
-      $DB->query("
162
+        if (!isset($Err)) {
163
+            $DB->query("
159 164
         UPDATE users_main
160 165
         SET
161 166
           BonusPoints = BonusPoints - ".$Classes[$To]['Price'].",
162 167
           PermissionID = $To
163 168
         WHERE ID = $UserID");
164
-      $DB->query("
169
+            $DB->query("
165 170
         UPDATE users_info
166 171
         SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($To)." via store purchase\n\n', AdminComment)
167 172
         WHERE UserID = $UserID");
168
-      $Cache->delete_value("user_info_$UserID");
169
-      $Cache->delete_value("user_info_heavy_$UserID");
173
+            $Cache->delete_value("user_info_$UserID");
174
+            $Cache->delete_value("user_info_heavy_$UserID");
175
+        }
170 176
     }
171
-  }
172 177
 }
173 178
 
174 179
 View::show_header('Store'); ?>
175 180
 <div class="thin">
176
-  <h2 id="general">Purchase <?=isset($Err)?"Failed":"Successful"?></h2>
181
+  <h2 id="general">Purchase <?=isset($Err)?"Failed":"Successful"?>
182
+  </h2>
177 183
   <div class="box pad" style="padding: 10px 10px 10px 20px;">
178
-    <p><?=isset($Err)?"Error: ".implode("<br />Error: ", $Err):"You have been promoted to ".$Classes[$To]['Name']."!"?></p>
184
+    <p><?=isset($Err)?"Error: ".implode("<br />Error: ", $Err):"You have been promoted to ".$Classes[$To]['Name']."!"?>
185
+    </p>
179 186
     <p><a href="/store.php">Back to Store</a></p>
180 187
   </div>
181 188
 </div>
182
-<? View::show_footer(); ?>
189
+<?php View::show_footer();

+ 17
- 14
sections/store/token.php View File

@@ -1,4 +1,5 @@
1
-<?
1
+<?php
2
+
2 3
 $Purchase = "1 freeleech token";
3 4
 $UserID = $LoggedUser['ID'];
4 5
 
@@ -7,32 +8,34 @@ $DB->query("
7 8
   FROM users_main
8 9
   WHERE ID = $UserID");
9 10
 if ($DB->has_results()) {
10
-  list($Points) = $DB->next_record();
11
+    list($Points) = $DB->next_record();
11 12
 
12
-  if ($Points >= 10000) {
13
-    $DB->query("
13
+    if ($Points >= 10000) {
14
+        $DB->query("
14 15
       UPDATE users_main
15 16
       SET BonusPoints = BonusPoints - 10000,
16 17
           FLTokens    = FLTokens + 1
17 18
       WHERE ID = $UserID");
18
-    $DB->query("
19
+        $DB->query("
19 20
       UPDATE users_info
20 21
       SET AdminComment = CONCAT('".sqltime()." - Purchased a freeleech token from the store\n\n', AdminComment)
21 22
       WHERE UserID = $UserID");
22
-    $Cache->delete_value('user_info_heavy_'.$UserID);
23
-    $Worked = true;
24
-  } else {
25
-    $Worked = false;
26
-    $ErrMessage = "Not enough ".BONUS_POINTS.".";
27
-  }
23
+        $Cache->delete_value('user_info_heavy_'.$UserID);
24
+        $Worked = true;
25
+    } else {
26
+        $Worked = false;
27
+        $ErrMessage = "Not enough ".BONUS_POINTS.".";
28
+    }
28 29
 }
29 30
 
30 31
 View::show_header('Store'); ?>
31 32
 <div class="thin">
32
-  <h2 id="general">Purchase <?print $Worked?"Successful":"Failed"?></h2>
33
+  <h2 id="general">Purchase <?print $Worked?"Successful":"Failed"?>
34
+  </h2>
33 35
   <div class="box pad" style="padding: 10px 10px 10px 20px;">
34
-    <p><?print $Worked?("You purchased ".$Purchase):("Error: ".$ErrMessage)?></p>
36
+    <p><?print $Worked?("You purchased ".$Purchase):("Error: ".$ErrMessage)?>
37
+    </p>
35 38
     <p><a href="/store.php">Back to Store</a></p>
36 39
   </div>
37 40
 </div>
38
-<? View::show_footer(); ?>
41
+<?php View::show_footer();

+ 6
- 8
sections/torrents/browse.php View File

@@ -708,7 +708,6 @@ die();
708 708
 
709 709
       # Similar to the logic down the page, and on
710 710
       # torrents.class.php and sections/artist/artist.php
711
-      # todo: Find out exactly whhere this displays (it's not the search results)
712 711
       if ($GroupResults && (count($Torrents) > 1 && isset($GroupedCategories[$CategoryID - 1]))) {
713 712
           // These torrents are in a group
714 713
           $CoverArt = $GroupInfo['WikiImage'];
@@ -859,11 +858,9 @@ die();
859 858
           class="tooltip" title="Report">RP</a> ]
860 859
       </span>
861 860
           <a
862
-          href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>"
863
-          class="torrent_label tl_reported tooltip search_link">
864
-            <strong>[Details]</strong>
865
-            <?=Torrents::torrent_info($Data)?>
866
-          </a>
861
+          href="torrents.php?id=<?=$GroupID?>&amp;torrentid=<?=$TorrentID?>#torrent<?=$TorrentID?>"
862
+          class="torrent_label tl_reported tooltip search_link"><strong>Details</strong></a>
863
+          / <?=Torrents::torrent_info($Data)?>
867 864
           <?php if ($Reported) { ?>
868 865
             / <strong
869 866
               class="torrent_label tl_reported tooltip search_link important_text"
@@ -1005,8 +1002,9 @@ die();
1005 1002
         </div>
1006 1003
         <?=$DisplayName?>
1007 1004
         <br />
1008
-        <div style="display: inline;" class="torrent_info"><?=$ExtraInfo?><?php if ($Reported) { ?> / <strong
1009
-            class="torrent_label tl_reported tooltip"
1005
+        <div style="display: inline;" class="torrent_info"><?=$ExtraInfo?><?php if ($Reported) { ?>
1006
+        / <strong
1007
+            class="torrent_label tl_reported tooltip important_text"
1010 1008
             title="Type: <?=ucfirst($Reports[0]['Type'])?><br>Comment: <?=htmlentities(htmlentities($Reports[0]['UserComment']))?>">Reported</strong><?php } ?>
1011 1009
         </div>
1012 1010
         <div class="tags"><?=$TorrentTags->format("torrents.php?$Action&amp;taglist=")?>

+ 34
- 34
sections/torrents/details.php View File

@@ -525,28 +525,28 @@ foreach ($TorrentList as $Torrent) {
525 525
 
526 526
   // Similar to Torrents::torrent_info()
527 527
     if ($Media) {
528
-        $ExtraInfo.=display_str($Media);
529
-        $AddExtra=" / ";
528
+        $ExtraInfo .= display_str($Media);
529
+        $AddExtra = " / ";
530 530
     }
531 531
 
532 532
     if ($Container) {
533
-        $ExtraInfo.=$AddExtra.display_str($Container);
534
-        $AddExtra=' / ';
533
+        $ExtraInfo .= $AddExtra . display_str($Container);
534
+        $AddExtra = ' / ';
535 535
     }
536 536
 
537 537
     if ($Archive) {
538
-        $ExtraInfo .= $AddExtra.display_str($Archive);
539
-        $AddExtra=' / ';
538
+        $ExtraInfo .= $AddExtra . display_str($Archive);
539
+        $AddExtra = ' / ';
540 540
     }
541 541
 
542 542
     if ($Codec) {
543
-        $ExtraInfo.=$AddExtra.display_str($Codec);
544
-        $AddExtra=' / ';
543
+        $ExtraInfo .= $AddExtra . display_str($Codec);
544
+        $AddExtra = ' / ';
545 545
     }
546 546
 
547 547
     if ($Resolution) {
548
-        $ExtraInfo.=$AddExtra.display_str($Resolution);
549
-        $AddExtra=' / ';
548
+        $ExtraInfo .= $AddExtra . display_str($Resolution);
549
+        $AddExtra = ' / ';
550 550
     }
551 551
 
552 552
     /*
@@ -579,41 +579,41 @@ foreach ($TorrentList as $Torrent) {
579 579
     */
580 580
 
581 581
     if ($Censored) {
582
-        $ExtraInfo .= $AddExtra.display_str('Aligned');
583
-        $AddExtra=' / ';
582
+        $ExtraInfo .= $AddExtra . display_str('Aligned');
583
+        $AddExtra = ' / ';
584 584
     } else {
585
-        $ExtraInfo .= $AddExtra.display_str('Not Aligned');
586
-        $AddExtra=' / ';
585
+        $ExtraInfo .= $AddExtra . display_str('Not Aligned');
586
+        $AddExtra = ' / ';
587 587
     }
588 588
 
589 589
     if (!$ExtraInfo) {
590 590
         $ExtraInfo = $GroupName;
591
-        $AddExtra=' / ';
591
+        $AddExtra = ' / ';
592 592
     }
593 593
 
594 594
     if ($IsLeeching) {
595
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Leeching', 'important_text');
595
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Leeching', 'important_text');
596 596
         $AddExtra=' / ';
597 597
     } elseif ($IsSeeding) {
598
-        $ExtraInfo.=$AddExtra . Format::torrent_label('Seeding', 'important_text_alt');
599
-        $AddExtra=' / ';
598
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Seeding', 'important_text_alt');
599
+        $AddExtra = ' / ';
600 600
     } elseif ($IsSnatched) {
601
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Snatched!', 'bold');
602
-        $AddExtra=' / ';
601
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Snatched!', 'bold');
602
+        $AddExtra = ' / ';
603 603
     }
604 604
 
605 605
     if ($FreeTorrent === '1') {
606
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Freeleech!', 'important_text_alt');
606
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Freeleech!', 'important_text_alt');
607 607
         $AddExtra=' / ';
608 608
     }
609 609
 
610 610
     if ($FreeTorrent === '2') {
611
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Neutral Leech!', 'bold');
612
-        $AddExtra=' / ';
611
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Neutral Leech!', 'bold');
612
+        $AddExtra = ' / ';
613 613
     }
614 614
 
615 615
     // Freleechizer
616
-    if ($FreeLeechType == '3') {
616
+    if ($FreeLeechType === '3') {
617 617
         $DB->query("
618 618
       SELECT UNIX_TIMESTAMP(ExpiryTime)
619 619
       FROM shop_freeleeches
@@ -625,30 +625,30 @@ foreach ($TorrentList as $Torrent) {
625 625
     }
626 626
 
627 627
     if ($PersonalFL) {
628
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Personal Freeleech!', 'important_text_alt');
629
-        $AddExtra=' / ';
628
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Personal Freeleech!', 'important_text_alt');
629
+        $AddExtra = ' / ';
630 630
     }
631 631
 
632 632
     if ($Reported) {
633 633
         $HtmlReportType = ucfirst($Reports[0]['Type']);
634 634
         $HtmlReportComment = htmlentities(htmlentities($Reports[0]['UserComment']));
635
-        $ExtraInfo.=$AddExtra. "<strong class='torrent_label tl_reported tooltip' title='Type: $HtmlReportType<br>Comment: HtmlReportComment'>".Format::torrent_label('Reported', 'important_text')."</strong>";
636
-        $AddExtra=' / ';
635
+        $ExtraInfo .= $AddExtra . "<strong class='torrent_label tl_reported tooltip' title='Type: $HtmlReportType<br>Comment: $HtmlReportComment'>".Format::torrent_label('Reported', 'important_text')."</strong>";
636
+        $AddExtra = ' / ';
637 637
     }
638 638
 
639 639
     if (!empty($BadTags)) {
640
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Tags', 'important_text');
641
-        $AddExtra=' / ';
640
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Tags', 'important_text');
641
+        $AddExtra = ' / ';
642 642
     }
643 643
 
644 644
     if (!empty($BadFolders)) {
645
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Bad Folders', 'important_text');
646
-        $AddExtra=' / ';
645
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Bad Folders', 'important_text');
646
+        $AddExtra = ' / ';
647 647
     }
648 648
 
649 649
     if (!empty($BadFiles)) {
650
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Bad File Names', 'important_text');
651
-        $AddExtra=' / ';
650
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Bad File Names', 'important_text');
651
+        $AddExtra = ' / ';
652 652
     }
653 653
 
654 654
     $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];

+ 2
- 0
sections/torrents/takeedit.php View File

@@ -231,6 +231,7 @@ switch ($Type) {
231 231
     }
232 232
     */
233 233
 
234
+    /* Broken 2020-03-10
234 235
     $Validate->SetFields(
235 236
         'media',
236 237
         '1',
@@ -238,6 +239,7 @@ switch ($Type) {
238 239
         'Not a valid media',
239 240
         array('inarray' => $Media)
240 241
     );
242
+    */
241 243
 
242 244
     /*
243 245
     $Validate->SetFields(

+ 3
- 3
sections/upload/upload_handle.php View File

@@ -232,10 +232,10 @@ default:
232 232
         # torrents_group.Studio
233 233
         $Validate->SetFields(
234 234
             'studio',
235
-            '0',
235
+            '1',
236 236
             'string',
237
-            'Department/Lab must be between 0 and 100 characters.',
238
-            array('maxlength' => 100, 'minlength' => 0)
237
+            'Department/Lab must be between 10 and 100 characters.',
238
+            array('maxlength' => 100, 'minlength' => 10)
239 239
         );
240 240
 
241 241
         # torrents_group.Series

Loading…
Cancel
Save