Browse Source

Badge changes and additions

spaghetti 8 years ago
parent
commit
60dfdf1de6

+ 11
- 0
classes/config.template View File

@@ -213,6 +213,17 @@ define('AUTOMATED_BADGE_IDS', [
213 213
     '1024' => 36,
214 214
     '2048' => 37,
215 215
     '4096' => 38
216
+  ],
217
+  'Posts' => [
218
+    '25'    => 60,
219
+    '50'    => 61,
220
+    '100'   => 62,
221
+    '250'   => 63,
222
+    '500'   => 64,
223
+    '1000'  => 65,
224
+    '2500'  => 66,
225
+    '5000'  => 67,
226
+    '10000' => 68
216 227
   ]
217 228
 ]);
218 229
 ?>

+ 10
- 9
classes/rules.class.php View File

@@ -25,6 +25,7 @@ class Rules {
25 25
       <li>Attempting to find a bug in the site code is absolutely fine. Misusing that knowledge is not, but we actively encourage users to try to find bugs and report them so they can be fixed. The discovery of significant bugs may result in a reward at the discretion of the staff. Do not be an asshole and try to flood the tracker or something and then come to us saying "lol I found bug gib reward"</li>
26 26
       <li>We're a community. Working together is what makes this place what it is. There are well over a thousand new torrents uploaded every day (pfffff) and, sadly, the staff are only a little psychic. If you come across something that violates a rule, report it, and help us better organize the site for you.</li>
27 27
       <li>We respect the wishes of other BitTorrent trackers that we agree with here, as we wish for them to do the same. Please refrain from posting full names or links to sites that do not want to be mentioned.</li>
28
+      <li>Don't reveal the criteria for hidden badges or we'll ban you, or yell at you, or maybe just ruin your stats and remove all your nips. But we'll probably ban you.</li>
28 29
     </ol>
29 30
 <?
30 31
   }
@@ -59,16 +60,16 @@ class Rules {
59 60
 
60 61
       <li><strong>Certain tags are <strong class="important_text">required</strong> for appropriate uploads:</strong>"<strong class="important_text_alt">lolicon</strong>", "<strong class="important_text_alt">shotacon</strong>", "<strong class="important_text_alt">toddlercon</strong>". Failure to use these tags may result in punishment.</li>
61 62
 
62
-			<li><strong>Use tag namespaces when appropriate.</strong> Oppaitime allows for tag namespaces to aid with searching. For example, you may want to use the tags "<strong class="important_text_alt">masturbation:male</strong>" or "<strong class="important_text_alt">masturbation:female</strong>" instead of just "<strong class="important_text">masturbation</strong>". They can be used to make search queries more specific. Searching for "<strong class="important_texti_alt">masturbation</strong>" will show all torrents tagged with "<strong class="important_text_alt">masturbation</strong>", "<strong class="important_text_alt">masturbation:male</strong>", or "<strong class="important_text_alt">masturbation:female</strong>". However, searching for "<strong class="important_text_alt">masturbation:female</strong>" will ONLY show torrents with that tag. Tags with namespaces will appear differently depending on the namespace used, which include:
63
-				<ul>
64
-					<li><strong>:parody<strong> - Used to denote a parodied work: <strong class="tag_parody">touhou</strong>, <strong class="tag_parody">kantai.collection</strong></li>
65
-					<li><strong>:character</strong> - Used to denote a character in a parodied work: <strong class="tag_character">iori.minase</strong>, <strong class="tag_character">hakurei.reimu</strong></li>
66
-					<li><strong>:male</strong> - Used to denote that the tag refers to a male character: <strong class="tag_male">masturbation</strong>, <strong class="tag_male">teacher</strong></li>
67
-					<li><strong>:female</strong> - Used to denote that the tag refers to a female character: <strong class="tag_female">masturbation</strong>, <strong class="tag_female">shaved</strong></li>
68
-				</ul>
63
+      <li><strong>Use tag namespaces when appropriate.</strong> Oppaitime allows for tag namespaces to aid with searching. For example, you may want to use the tags "<strong class="important_text_alt">masturbation:male</strong>" or "<strong class="important_text_alt">masturbation:female</strong>" instead of just "<strong class="important_text">masturbation</strong>". They can be used to make search queries more specific. Searching for "<strong class="important_texti_alt">masturbation</strong>" will show all torrents tagged with "<strong class="important_text_alt">masturbation</strong>", "<strong class="important_text_alt">masturbation:male</strong>", or "<strong class="important_text_alt">masturbation:female</strong>". However, searching for "<strong class="important_text_alt">masturbation:female</strong>" will ONLY show torrents with that tag. Tags with namespaces will appear differently depending on the namespace used, which include:
64
+        <ul>
65
+          <li><strong>:parody<strong> - Used to denote a parodied work: <strong class="tag_parody">touhou</strong>, <strong class="tag_parody">kantai.collection</strong></li>
66
+          <li><strong>:character</strong> - Used to denote a character in a parodied work: <strong class="tag_character">iori.minase</strong>, <strong class="tag_character">hakurei.reimu</strong></li>
67
+          <li><strong>:male</strong> - Used to denote that the tag refers to a male character: <strong class="tag_male">masturbation</strong>, <strong class="tag_male">teacher</strong></li>
68
+          <li><strong>:female</strong> - Used to denote that the tag refers to a female character: <strong class="tag_female">masturbation</strong>, <strong class="tag_female">shaved</strong></li>
69
+        </ul>
69 70
 
70
-				Note: gender namespaces should <strong class="important_text">NOT</strong> be used for tags where the gender is implied, such as "<strong class="important_text_alt">lolicon</strong>" or "<strong class="important_text_alt">shotacon</strong>".
71
-			</li>
71
+        Note: gender namespaces should <strong class="important_text">NOT</strong> be used for tags where the gender is implied, such as "<strong class="important_text_alt">lolicon</strong>" or "<strong class="important_text_alt">shotacon</strong>".
72
+      </li>
72 73
 
73 74
       <li><strong>All uploads require a minimum of 5 tags.</strong></li>
74 75
 

+ 9
- 9
sections/forums/take_new_thread.php View File

@@ -119,17 +119,17 @@ if (isset($_POST['subscribe'])) {
119 119
 
120 120
 //Award a badge if necessary
121 121
 $DB->query("
122
-	SELECT COUNT(ID)
123
-	FROM forums_posts
124
-	WHERE AuthorID = '$LoggedUser[ID]'");
122
+  SELECT COUNT(ID)
123
+  FROM forums_posts
124
+  WHERE AuthorID = '$LoggedUser[ID]'");
125 125
 list($UserPosts) = $DB->next_record(MYSQLI_NUM, false);
126 126
 foreach (AUTOMATED_BADGE_IDS['Posts'] AS $Count => $Badge) {
127
-	if ((int) $UserPosts > $Count) {
128
-		$Success = Badges::award_badge($LoggedUser['ID'], $Badge);
129
-		if ($Success) {
130
-			Misc::send_pm($LoggedUser['ID'], 0, 'You have received a badge!', "You have received a badge for making ".$Count." forum posts.\n\nIt can be enabled from your user settings.");
131
-		}
132
-	}
127
+  if ((int) $UserPosts >= $Count) {
128
+    $Success = Badges::award_badge($LoggedUser['ID'], $Badge);
129
+    if ($Success) {
130
+      Misc::send_pm($LoggedUser['ID'], 0, 'You have received a badge!', "You have received a badge for making ".$Count." forum posts.\n\nIt can be enabled from your user settings.");
131
+    }
132
+  }
133 133
 }
134 134
 
135 135
 if (!$NoPoll) { // god, I hate double negatives...

+ 14
- 14
sections/forums/take_reply.php View File

@@ -263,20 +263,20 @@ if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID'] && ((!check_perms('site
263 263
   //Increment this now to make sure we redirect to the correct page
264 264
   $ThreadInfo['Posts']++;
265 265
 
266
-	//Award a badge if necessary
267
-	$DB->query("
268
-		SELECT COUNT(ID)
269
-		FROM forums_posts
270
-		WHERE AuthorID = '$LoggedUser[ID]'");
271
-	list($UserPosts) = $DB->next_record(MYSQLI_NUM, false);
272
-	foreach (AUTOMATED_BADGE_IDS['Posts'] AS $Count => $Badge) {
273
-		if ((int) $UserPosts > $Count) {
274
-			$Success = Badges::award_badge($LoggedUser['ID'], $Badge);
275
-			if ($Success) {
276
-				Misc::send_pm($LoggedUser['ID'], 0, 'You have received a badge!', "You have received a badge for making ".$Count." forum posts.\n\nIt can be enabled from your user settings.");
277
-			}
278
-		}
279
-	}
266
+  //Award a badge if necessary
267
+  $DB->query("
268
+    SELECT COUNT(ID)
269
+    FROM forums_posts
270
+    WHERE AuthorID = '$LoggedUser[ID]'");
271
+  list($UserPosts) = $DB->next_record(MYSQLI_NUM, false);
272
+  foreach (AUTOMATED_BADGE_IDS['Posts'] AS $Count => $Badge) {
273
+    if ((int) $UserPosts >= $Count) {
274
+      $Success = Badges::award_badge($LoggedUser['ID'], $Badge);
275
+      if ($Success) {
276
+        Misc::send_pm($LoggedUser['ID'], 0, 'You have received a badge!', "You have received a badge for making ".$Count." forum posts.\n\nIt can be enabled from your user settings.");
277
+      }
278
+    }
279
+  }
280 280
 }
281 281
 
282 282
 Subscriptions::flush_subscriptions('forums', $TopicID);

+ 26
- 8
sections/schedule/hourly/badges.php View File

@@ -16,10 +16,9 @@ foreach (AUTOMATED_BADGE_IDS['DL'] as $DL=>$Badge) {
16 16
   if ($DB->has_results()) {
17 17
     $IDs = $DB->collect('ID');
18 18
     foreach ($IDs as $ID) {
19
-      $DB->query("
20
-        INSERT INTO users_badges
21
-        VALUES ($ID, $Badge, 0)");
22
-      Misc::send_pm($ID, 0, 'You have received a badge!', "You have received a badge for downloading ".$DL."GiB of data.\n\nIt can be enabled from your user settings.");
19
+      if (Badges::award_badge($ID, $Badge)) {
20
+        Misc::send_pm($ID, 0, 'You have received a badge!', "You have received a badge for downloading ".$DL."GiB of data.\n\nIt can be enabled from your user settings.");
21
+      }
23 22
     }
24 23
     $ModifiedIDs = array_merge($ModifiedIDs, $IDs);
25 24
   }
@@ -36,10 +35,29 @@ foreach (AUTOMATED_BADGE_IDS['UL'] as $UL=>$Badge) {
36 35
   if ($DB->has_results()) {
37 36
     $IDs = $DB->collect('ID');
38 37
     foreach ($IDs as $ID) {
39
-      $DB->query("
40
-        INSERT INTO users_badges
41
-        VALUES ($ID, $Badge, 0)");
42
-      Misc::send_pm($ID, 0, 'You have received a badge!', "You have received a badge for uploading ".$UL."GiB of data.\n\nIt can be enabled from your user settings.");
38
+      if (Badges::award_badge($ID, $Badge)) {
39
+        Misc::send_pm($ID, 0, 'You have received a badge!', "You have received a badge for uploading ".$UL."GiB of data.\n\nIt can be enabled from your user settings.");
40
+      }
41
+    }
42
+    $ModifiedIDs = array_merge($ModifiedIDs, $IDs);
43
+  }
44
+}
45
+
46
+// Tag Badges
47
+foreach (AUTOMATED_BADGE_IDS['Tags'] as $Tag=>$Badge) {
48
+  $DB->query("
49
+    SELECT DISTINCT x.uid
50
+    FROM xbt_snatched AS x
51
+    JOIN torrents AS t ON t.ID = x.fid
52
+    JOIN torrents_group AS tg ON t.GroupID = tg.ID
53
+    WHERE tg.TagList LIKE '%" . $Tag . "%'");
54
+
55
+  if ($DB->has_results()) {
56
+    $IDs = $DB->collect('uid');
57
+    foreach ($IDs as $ID) {
58
+      if (Badges::award_badge($ID, $Badge)) {
59
+        Misc::send_pm($ID, 0, 'You have recieved a badge!', "You have received a badge for mysterious reasons.\n\nIt can be enabled from your user settings.");
60
+      }
43 61
     }
44 62
     $ModifiedIDs = array_merge($ModifiedIDs, $IDs);
45 63
   }

BIN
static/common/badges/amethyst.png View File


BIN
static/common/badges/bronze_trophy.png View File


BIN
static/common/badges/dango.png View File


BIN
static/common/badges/diaper.png View File


BIN
static/common/badges/gold_trophy.png View File


BIN
static/common/badges/mochi.png View File


BIN
static/common/badges/nigiri.png View File


BIN
static/common/badges/nikuman.png View File


BIN
static/common/badges/norimaki.png View File


BIN
static/common/badges/onigiri.png View File


BIN
static/common/badges/peridot.png View File


BIN
static/common/badges/quartz.png View File


BIN
static/common/badges/ramen.png View File


BIN
static/common/badges/rice_bowl.png View File


BIN
static/common/badges/ruby.png View File


BIN
static/common/badges/sapphire.png View File


BIN
static/common/badges/silver_trophy.png View File


BIN
static/common/badges/takoyaki.png View File


BIN
static/common/badges/topaz.png View File


Loading…
Cancel
Save