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
 <li>Flooding is irritating and you'll get kicked for it. This includes "now playing" scripts, large amounts of
157
 <li>Flooding is irritating and you'll get kicked for it. This includes "now playing" scripts, large amounts of
158
   irrelevant text such as lorem ipsum, and unfunny non sequiturs.</li>
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
   the Slack channels are publicly accessible.</li>
161
   the Slack channels are publicly accessible.</li>
162
 
162
 
163
 <li>Please use the threaded conversations feature in Slack and avoid replying to threads with new messages or
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
     'searchstr' => 1,
71
     'searchstr' => 1,
72
     'series' => 1, # Location
72
     'series' => 1, # Location
73
     'studio' => 1, # Department/Lab
73
     'studio' => 1, # Department/Lab
74
-    'location' => 1,
74
+    'location' => 1, # Combined ↑
75
     'subber' => 1,
75
     'subber' => 1,
76
     'subbing' => 1,
76
     'subbing' => 1,
77
     'taglist' => 1
77
     'taglist' => 1
698
      * @return bool True if it's a real hit
698
      * @return bool True if it's a real hit
699
      */
699
      */
700
     private function filter_torrent_internal($Torrent)
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
         if (isset($this->UsedTorrentAttrs['freetorrent'])) {
718
         if (isset($this->UsedTorrentAttrs['freetorrent'])) {
703
             $FilterValue = $this->UsedTorrentAttrs['freetorrent'];
719
             $FilterValue = $this->UsedTorrentAttrs['freetorrent'];
711
         return true;
727
         return true;
712
     }
728
     }
713
 }
729
 }
730
+*/

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

560
           <a href="user.php?id=<?=$FillerInfo['ID']?>"><?=$FillerInfo['Username']?></a>
560
           <a href="user.php?id=<?=$FillerInfo['ID']?>"><?=$FillerInfo['Username']?></a>
561
 <?php      }
561
 <?php      }
562
             } else { ?>
562
             } else { ?>
563
-        &mdash;
563
+        &ndash;
564
 <?php    } ?>
564
 <?php    } ?>
565
       </td>
565
       </td>
566
       <td>
566
       <td>

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

1
-<?
1
+<?php
2
+
2
 $UserID = $LoggedUser['ID'];
3
 $UserID = $LoggedUser['ID'];
3
 $BadgeID = $_GET['badge'];
4
 $BadgeID = $_GET['badge'];
4
 
5
 
6
 $Prices = [100 => 5000, 101 => 10000, 102 => 25000, 103 => 50000, 104 => 100000, 105 => 250000, 106 => 500000, 107 => 1000000];
7
 $Prices = [100 => 5000, 101 => 10000, 102 => 25000, 103 => 50000, 104 => 100000, 105 => 250000, 106 => 500000, 107 => 1000000];
7
 
8
 
8
 if (!$BadgeID) {
9
 if (!$BadgeID) {
9
-  $Err = 'No badge specified.';
10
+    $Err = 'No badge specified';
10
 } elseif (!in_array($BadgeID, $ShopBadgeIDs)) {
11
 } elseif (!in_array($BadgeID, $ShopBadgeIDs)) {
11
-  $Err = 'Invalid badge ID.';
12
+    $Err = 'Invalid badge ID';
12
 } elseif (Badges::has_badge($UserID, $BadgeID)) {
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
       SELECT BonusPoints
22
       SELECT BonusPoints
22
       FROM users_main
23
       FROM users_main
23
       WHERE ID = $UserID");
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
             UPDATE users_main
34
             UPDATE users_main
34
             SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ."
35
             SET BonusPoints = BonusPoints - " . $Prices[$BadgeID] ."
35
             WHERE ID = $UserID");
36
             WHERE ID = $UserID");
36
 
37
 
37
-          $DB->query("
38
+                    $DB->query("
38
             UPDATE users_info
39
             UPDATE users_info
39
             SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment)
40
             SET AdminComment = CONCAT('".sqltime()." - Purchased badge $BadgeID from store\n\n', AdminComment)
40
             WHERE UserID = $UserID");
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
 <div class='thin'>
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
   <div class='box pad' style='padding: 10px 10px 10px 20px;'>
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
     <p><a href='/store.php'>Back to Store</a></p>
58
     <p><a href='/store.php'>Back to Store</a></p>
56
   </div>
59
   </div>
57
 </div>
60
 </div>
58
-<? } else {
59
-  View::show_header('Store'); ?>
61
+<?php
62
+} else {
63
+        View::show_header('Store'); ?>
60
 <div class='thin'>
64
 <div class='thin'>
61
   <h2 id='general'>Purchase Badge?</h2>
65
   <h2 id='general'>Purchase Badge?</h2>
62
   <div class='box pad' style='padding: 10px 10px 10px 20px;'>
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
     <form action="store.php">
73
     <form action="store.php">
68
       <input type="hidden" name="item" value="badge">
74
       <input type="hidden" name="item" value="badge">
69
       <input type="hidden" name="badge" value="<?=$BadgeID?>">
75
       <input type="hidden" name="badge" value="<?=$BadgeID?>">
70
       <input type="hidden" name="confirm" value="1">
76
       <input type="hidden" name="confirm" value="1">
71
       <input type="submit" value="Purchase">
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
   </div>
80
   </div>
75
 </div>
81
 </div>
76
-<? }
77
-View::show_footer(); ?>
82
+<?php
83
+    }
84
+View::show_footer();

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

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
     SELECT BonusPoints
12
     SELECT BonusPoints
13
     FROM users_main
13
     FROM users_main
14
     WHERE ID = $UserID");
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
         UPDATE users_main
22
         UPDATE users_main
24
         SET BonusPoints = BonusPoints - $Donation
23
         SET BonusPoints = BonusPoints - $Donation
25
         WHERE ID = $UserID");
24
         WHERE ID = $UserID");
26
-      $DB->query("
25
+            $DB->query("
27
         UPDATE misc
26
         UPDATE misc
28
         SET First = First + $Donation
27
         SET First = First + $Donation
29
         WHERE Name = 'FreeleechPool'");
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
         SELECT First, Second
33
         SELECT First, Second
35
         FROM misc
34
         FROM misc
36
         WHERE Name = 'FreeleechPool'");
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
               SELECT ID, Size
46
               SELECT ID, Size
48
               FROM torrents
47
               FROM torrents
49
               WHERE Size < $TorrentSize
48
               WHERE Size < $TorrentSize
52
                 AND FreeLeechType = '0'
51
                 AND FreeLeechType = '0'
53
               ORDER BY Seeders ASC, Size DESC
52
               ORDER BY Seeders ASC, Size DESC
54
               LIMIT 1");
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
                 INSERT INTO shop_freeleeches
57
                 INSERT INTO shop_freeleeches
59
                 (TorrentID, ExpiryTime)
58
                 (TorrentID, ExpiryTime)
60
                 VALUES($TorrentID, NOW() + INTERVAL 2 DAY)");
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
             UPDATE misc
72
             UPDATE misc
72
             SET First = 0,
73
             SET First = 0,
73
                 Second = $Target
74
                 Second = $Target
74
             WHERE Name = 'FreeleechPool'");
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
   </div>
93
   </div>
94
-  <? View::show_footer();
95
-
94
+</div>
95
+<?php View::show_footer();
96
 } else {
96
 } else {
97
-
98
-  $DB->query("
97
+    $DB->query("
99
     SELECT First
98
     SELECT First
100
     FROM misc
99
     FROM misc
101
     WHERE Name = 'FreeleechPool'");
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
         There are currently <?=number_format($Pool)?> <?=BONUS_POINTS?> in the Freeleech Pool
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
   </div>
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
-<?
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
 $UserID = $LoggedUser['ID'];
5
 $UserID = $LoggedUser['ID'];
3
 $GiB = 1024*1024*1024;
6
 $GiB = 1024*1024*1024;
4
 
7
 
13
     'MinRatio'    => 0.7, // minimum ratio
16
     'MinRatio'    => 0.7, // minimum ratio
14
     'TorUnique'   => false // do the uploads have to be unique groups?
17
     'TorUnique'   => false // do the uploads have to be unique groups?
15
   ),
18
   ),
19
+
16
   POWER => array(
20
   POWER => array(
17
     'Name'        => 'Well Endowed',
21
     'Name'        => 'Well Endowed',
18
     'Price'       => 10000,
22
     'Price'       => 10000,
23
     'MinRatio'    => 1.1,
27
     'MinRatio'    => 1.1,
24
     'TorUnique'   => false
28
     'TorUnique'   => false
25
   ),
29
   ),
30
+
26
   ELITE => array(
31
   ELITE => array(
27
     'Name'        => 'Bombshell',
32
     'Name'        => 'Bombshell',
28
     'Price'       => 30000,
33
     'Price'       => 30000,
33
     'MinRatio'    => 1.2,
38
     'MinRatio'    => 1.2,
34
     'TorUnique'   => false
39
     'TorUnique'   => false
35
   ),
40
   ),
41
+
36
   TORRENT_MASTER => array(
42
   TORRENT_MASTER => array(
37
     'Name'        => 'Top Heavy',
43
     'Name'        => 'Top Heavy',
38
     'Price'       => 60000,
44
     'Price'       => 60000,
43
     'MinRatio'    => 1.3,
49
     'MinRatio'    => 1.3,
44
     'TorUnique'   => false
50
     'TorUnique'   => false
45
   ),
51
   ),
52
+  
46
   POWER_TM => array(
53
   POWER_TM => array(
47
     'Name'        => 'Titty Monster',
54
     'Name'        => 'Titty Monster',
48
     'Price'       => 100000,
55
     'Price'       => 100000,
65
   WHERE users_main.ID = $UserID");
72
   WHERE users_main.ID = $UserID");
66
 
73
 
67
 if ($DB->has_results()) {
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
     case USER:
78
     case USER:
72
       $To = MEMBER;
79
       $To = MEMBER;
73
       break;
80
       break;
87
       $To = -1;
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
         SELECT COUNT(torrents.ID)
105
         SELECT COUNT(torrents.ID)
100
         FROM torrents
106
         FROM torrents
101
           JOIN torrents_group ON torrents.GroupID = torrents_group.ID
107
           JOIN torrents_group ON torrents.GroupID = torrents_group.ID
103
           OR (torrents_group.CategoryID = 3 AND torrents_group.Pages >= 50))
109
           OR (torrents_group.CategoryID = 3 AND torrents_group.Pages >= 50))
104
           AND torrents.UserID = $UserID");
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
         UPDATE users_main
164
         UPDATE users_main
160
         SET
165
         SET
161
           BonusPoints = BonusPoints - ".$Classes[$To]['Price'].",
166
           BonusPoints = BonusPoints - ".$Classes[$To]['Price'].",
162
           PermissionID = $To
167
           PermissionID = $To
163
         WHERE ID = $UserID");
168
         WHERE ID = $UserID");
164
-      $DB->query("
169
+            $DB->query("
165
         UPDATE users_info
170
         UPDATE users_info
166
         SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($To)." via store purchase\n\n', AdminComment)
171
         SET AdminComment = CONCAT('".sqltime()." - Class changed to ".Users::make_class_string($To)." via store purchase\n\n', AdminComment)
167
         WHERE UserID = $UserID");
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
 View::show_header('Store'); ?>
179
 View::show_header('Store'); ?>
175
 <div class="thin">
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
   <div class="box pad" style="padding: 10px 10px 10px 20px;">
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
     <p><a href="/store.php">Back to Store</a></p>
186
     <p><a href="/store.php">Back to Store</a></p>
180
   </div>
187
   </div>
181
 </div>
188
 </div>
182
-<? View::show_footer(); ?>
189
+<?php View::show_footer();

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

1
-<?
1
+<?php
2
+
2
 $Purchase = "1 freeleech token";
3
 $Purchase = "1 freeleech token";
3
 $UserID = $LoggedUser['ID'];
4
 $UserID = $LoggedUser['ID'];
4
 
5
 
7
   FROM users_main
8
   FROM users_main
8
   WHERE ID = $UserID");
9
   WHERE ID = $UserID");
9
 if ($DB->has_results()) {
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
       UPDATE users_main
15
       UPDATE users_main
15
       SET BonusPoints = BonusPoints - 10000,
16
       SET BonusPoints = BonusPoints - 10000,
16
           FLTokens    = FLTokens + 1
17
           FLTokens    = FLTokens + 1
17
       WHERE ID = $UserID");
18
       WHERE ID = $UserID");
18
-    $DB->query("
19
+        $DB->query("
19
       UPDATE users_info
20
       UPDATE users_info
20
       SET AdminComment = CONCAT('".sqltime()." - Purchased a freeleech token from the store\n\n', AdminComment)
21
       SET AdminComment = CONCAT('".sqltime()." - Purchased a freeleech token from the store\n\n', AdminComment)
21
       WHERE UserID = $UserID");
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
 View::show_header('Store'); ?>
31
 View::show_header('Store'); ?>
31
 <div class="thin">
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
   <div class="box pad" style="padding: 10px 10px 10px 20px;">
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
     <p><a href="/store.php">Back to Store</a></p>
38
     <p><a href="/store.php">Back to Store</a></p>
36
   </div>
39
   </div>
37
 </div>
40
 </div>
38
-<? View::show_footer(); ?>
41
+<?php View::show_footer();

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

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

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

525
 
525
 
526
   // Similar to Torrents::torrent_info()
526
   // Similar to Torrents::torrent_info()
527
     if ($Media) {
527
     if ($Media) {
528
-        $ExtraInfo.=display_str($Media);
529
-        $AddExtra=" / ";
528
+        $ExtraInfo .= display_str($Media);
529
+        $AddExtra = " / ";
530
     }
530
     }
531
 
531
 
532
     if ($Container) {
532
     if ($Container) {
533
-        $ExtraInfo.=$AddExtra.display_str($Container);
534
-        $AddExtra=' / ';
533
+        $ExtraInfo .= $AddExtra . display_str($Container);
534
+        $AddExtra = ' / ';
535
     }
535
     }
536
 
536
 
537
     if ($Archive) {
537
     if ($Archive) {
538
-        $ExtraInfo .= $AddExtra.display_str($Archive);
539
-        $AddExtra=' / ';
538
+        $ExtraInfo .= $AddExtra . display_str($Archive);
539
+        $AddExtra = ' / ';
540
     }
540
     }
541
 
541
 
542
     if ($Codec) {
542
     if ($Codec) {
543
-        $ExtraInfo.=$AddExtra.display_str($Codec);
544
-        $AddExtra=' / ';
543
+        $ExtraInfo .= $AddExtra . display_str($Codec);
544
+        $AddExtra = ' / ';
545
     }
545
     }
546
 
546
 
547
     if ($Resolution) {
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
     */
579
     */
580
 
580
 
581
     if ($Censored) {
581
     if ($Censored) {
582
-        $ExtraInfo .= $AddExtra.display_str('Aligned');
583
-        $AddExtra=' / ';
582
+        $ExtraInfo .= $AddExtra . display_str('Aligned');
583
+        $AddExtra = ' / ';
584
     } else {
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
     if (!$ExtraInfo) {
589
     if (!$ExtraInfo) {
590
         $ExtraInfo = $GroupName;
590
         $ExtraInfo = $GroupName;
591
-        $AddExtra=' / ';
591
+        $AddExtra = ' / ';
592
     }
592
     }
593
 
593
 
594
     if ($IsLeeching) {
594
     if ($IsLeeching) {
595
-        $ExtraInfo.=$AddExtra. Format::torrent_label('Leeching', 'important_text');
595
+        $ExtraInfo .= $AddExtra . Format::torrent_label('Leeching', 'important_text');
596
         $AddExtra=' / ';
596
         $AddExtra=' / ';
597
     } elseif ($IsSeeding) {
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
     } elseif ($IsSnatched) {
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
     if ($FreeTorrent === '1') {
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
         $AddExtra=' / ';
607
         $AddExtra=' / ';
608
     }
608
     }
609
 
609
 
610
     if ($FreeTorrent === '2') {
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
     // Freleechizer
615
     // Freleechizer
616
-    if ($FreeLeechType == '3') {
616
+    if ($FreeLeechType === '3') {
617
         $DB->query("
617
         $DB->query("
618
       SELECT UNIX_TIMESTAMP(ExpiryTime)
618
       SELECT UNIX_TIMESTAMP(ExpiryTime)
619
       FROM shop_freeleeches
619
       FROM shop_freeleeches
625
     }
625
     }
626
 
626
 
627
     if ($PersonalFL) {
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
     if ($Reported) {
632
     if ($Reported) {
633
         $HtmlReportType = ucfirst($Reports[0]['Type']);
633
         $HtmlReportType = ucfirst($Reports[0]['Type']);
634
         $HtmlReportComment = htmlentities(htmlentities($Reports[0]['UserComment']));
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
     if (!empty($BadTags)) {
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
     if (!empty($BadFolders)) {
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
     if (!empty($BadFiles)) {
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
     $TorrentDL = "torrents.php?action=download&amp;id=".$TorrentID."&amp;authkey=".$LoggedUser['AuthKey']."&amp;torrent_pass=".$LoggedUser['torrent_pass'];
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
     }
231
     }
232
     */
232
     */
233
 
233
 
234
+    /* Broken 2020-03-10
234
     $Validate->SetFields(
235
     $Validate->SetFields(
235
         'media',
236
         'media',
236
         '1',
237
         '1',
238
         'Not a valid media',
239
         'Not a valid media',
239
         array('inarray' => $Media)
240
         array('inarray' => $Media)
240
     );
241
     );
242
+    */
241
 
243
 
242
     /*
244
     /*
243
     $Validate->SetFields(
245
     $Validate->SetFields(

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

232
         # torrents_group.Studio
232
         # torrents_group.Studio
233
         $Validate->SetFields(
233
         $Validate->SetFields(
234
             'studio',
234
             'studio',
235
-            '0',
235
+            '1',
236
             'string',
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
         # torrents_group.Series
241
         # torrents_group.Series

Loading…
Cancel
Save