Browse Source

Merge branch 'master' of ngxez/Gazelle into master

spaghetti 8 years ago
parent
commit
f23d350216
40 changed files with 169 additions and 162 deletions
  1. 1
    1
      classes/misc.class.php
  2. 1
    1
      classes/script_start.php
  3. 2
    2
      classes/time.class.php
  4. 1
    1
      classes/tools.class.php
  5. 3
    3
      classes/users.class.php
  6. 1
    1
      classes/zip.class.php
  7. 77
    77
      gazelle.sql
  8. 1
    1
      sections/ajax/forum/forum.php
  9. 1
    1
      sections/ajax/forum/thread.php
  10. 1
    1
      sections/ajax/request.php
  11. 1
    1
      sections/ajax/tcomments.php
  12. 2
    2
      sections/ajax/user.php
  13. 1
    1
      sections/ajax/usersearch.php
  14. 1
    1
      sections/forums/poll_mod.php
  15. 2
    2
      sections/forums/take_new_thread.php
  16. 1
    1
      sections/forums/take_reply.php
  17. 2
    2
      sections/forums/thread.php
  18. 9
    2
      sections/index/private.php
  19. 2
    2
      sections/login/index.php
  20. 2
    2
      sections/register/index.php
  21. 1
    1
      sections/requests/take_unfill.php
  22. 2
    2
      sections/schedule/daily/disable_inactive_users.php
  23. 2
    2
      sections/schedule/daily/disable_unconfirmed_users.php
  24. 8
    8
      sections/schedule/daily/ratio_watch.php
  25. 1
    1
      sections/schedule/hourly/class_promotion.php
  26. 1
    1
      sections/schedule/hourly/disable_leech.php
  27. 2
    2
      sections/schedule/hourly/expire_warnings.php
  28. 1
    1
      sections/schedule/hourly/hide_old_requests.php
  29. 1
    1
      sections/store/promotion.php
  30. 2
    2
      sections/tools/data/upscale_pool.php
  31. 4
    4
      sections/tools/data/user_flow.php
  32. 2
    2
      sections/torrents/details.php
  33. 3
    3
      sections/torrents/functions.php
  34. 1
    1
      sections/torrents/reseed.php
  35. 2
    2
      sections/user/advancedsearch.php
  36. 2
    2
      sections/user/take_edit.php
  37. 9
    9
      sections/user/takemoderate.php
  38. 7
    7
      sections/user/user.php
  39. 2
    2
      sections/userhistory/email_history.php
  40. 4
    4
      sections/userhistory/email_history2.php

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

@@ -279,7 +279,7 @@ class Misc {
279 279
       'AddedTime' => sqltime(),
280 280
       'Body' => $PostBody,
281 281
       'EditedUserID' => 0,
282
-      'EditedTime' => '0000-00-00 00:00:00',
282
+      'EditedTime' => NULL,
283 283
       'Username' => ''
284 284
       );
285 285
     G::$Cache->insert('', $Post);

+ 1
- 1
classes/script_start.php View File

@@ -158,7 +158,7 @@ if (isset($_COOKIE['session']) && isset($_COOKIE['userid'])) {
158 158
 
159 159
   // $LoggedUser['RatioWatch'] as a bool to disable things for users on Ratio Watch
160 160
   $LoggedUser['RatioWatch'] = (
161
-    $LoggedUser['RatioWatchEnds'] != '0000-00-00 00:00:00'
161
+    $LoggedUser['RatioWatchEnds'] != NULL
162 162
     && time() < strtotime($LoggedUser['RatioWatchEnds'])
163 163
     && ($LoggedUser['BytesDownloaded'] * $LoggedUser['RequiredRatio']) > $LoggedUser['BytesUploaded']
164 164
   );

+ 2
- 2
classes/time.class.php View File

@@ -5,7 +5,7 @@ if (!extension_loaded('date')) {
5 5
 
6 6
 function time_ago($TimeStamp) {
7 7
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
8
-    if ($TimeStamp == '0000-00-00 00:00:00') {
8
+    if ($TimeStamp == NULL) {
9 9
       return false;
10 10
     }
11 11
     $TimeStamp = strtotime($TimeStamp);
@@ -22,7 +22,7 @@ function time_ago($TimeStamp) {
22 22
  */
23 23
 function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
24 24
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
25
-    if ($TimeStamp == '0000-00-00 00:00:00') {
25
+    if ($TimeStamp == NULL) {
26 26
       return 'Never';
27 27
     }
28 28
     $TimeStamp = strtotime($TimeStamp);

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

@@ -235,7 +235,7 @@ class Tools {
235 235
       SELECT Warned
236 236
       FROM users_info
237 237
       WHERE UserID = $UserID
238
-        AND Warned != '0000-00-00 00:00:00'");
238
+        AND Warned != NULL");
239 239
     if (G::$DB->has_results()) {
240 240
       //User was already warned, appending new warning to old.
241 241
       list($OldDate) = G::$DB->next_record();

+ 3
- 3
classes/users.class.php View File

@@ -84,7 +84,7 @@ class Users {
84 84
             'Paranoia' => array(),
85 85
             'Artist' => false,
86 86
             'Donor' => false,
87
-            'Warned' => '0000-00-00 00:00:00',
87
+            'Warned' => NULL,
88 88
             'Avatar' => '',
89 89
             'Enabled' => 0,
90 90
             'Title' => '',
@@ -122,7 +122,7 @@ class Users {
122 122
       G::$DB->set_query_id($OldQueryID);
123 123
     }
124 124
     if (strtotime($UserInfo['Warned']) < time()) {
125
-      $UserInfo['Warned'] = '0000-00-00 00:00:00';
125
+      $UserInfo['Warned'] = NULL;
126 126
       G::$Cache->cache_value("user_info_$UserID", $UserInfo, 2592000);
127 127
     }
128 128
 
@@ -419,7 +419,7 @@ class Users {
419 419
       $Str .= Badges::display_badges(Badges::get_displayed_badges($UserID), true);
420 420
     }
421 421
 
422
-    $Str .= ($IsWarned && $UserInfo['Warned'] != '0000-00-00 00:00:00') ? '<a href="wiki.php?action=article&amp;id=218"'
422
+    $Str .= ($IsWarned && $UserInfo['Warned'] != NULL) ? '<a href="wiki.php?action=article&amp;id=218"'
423 423
           . '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
424 424
           . (G::$LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d H:i', strtotime($UserInfo['Warned'])) : '')
425 425
           . '" class="tooltip" /></a>' : '';

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

@@ -80,7 +80,7 @@ if (!extension_loaded('zlib')) {
80 80
 //Handles timestamps
81 81
 function dostime($TimeStamp = 0) {
82 82
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
83
-    if ($TimeStamp == '0000-00-00 00:00:00') {
83
+    if ($TimeStamp == NULL) {
84 84
       return 'Never';
85 85
     }
86 86
     $TimeStamp = strtotime($TimeStamp);

+ 77
- 77
gazelle.sql View File

@@ -17,7 +17,7 @@ CREATE TABLE `api_users` (
17 17
   `AppID` int(10) NOT NULL,
18 18
   `Token` char(32) NOT NULL,
19 19
   `State` enum('0','1','2') NOT NULL DEFAULT '0',
20
-  `Time` datetime NOT NULL,
20
+  `Time` datetime,
21 21
   `Access` text,
22 22
   PRIMARY KEY (`UserID`,`AppID`),
23 23
   KEY `UserID` (`UserID`)
@@ -107,7 +107,7 @@ CREATE TABLE `blog` (
107 107
   `UserID` int(10) unsigned NOT NULL,
108 108
   `Title` varchar(255) NOT NULL,
109 109
   `Body` text,
110
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
110
+  `Time` datetime,
111 111
   `ThreadID` int(10) unsigned DEFAULT NULL,
112 112
   `Important` tinyint(4) NOT NULL DEFAULT '0',
113 113
   PRIMARY KEY (`ID`),
@@ -118,7 +118,7 @@ CREATE TABLE `blog` (
118 118
 CREATE TABLE `bookmarks_artists` (
119 119
   `UserID` int(10) NOT NULL,
120 120
   `ArtistID` int(10) NOT NULL,
121
-  `Time` datetime NOT NULL,
121
+  `Time` datetime,
122 122
   KEY `UserID` (`UserID`),
123 123
   KEY `ArtistID` (`ArtistID`)
124 124
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -126,7 +126,7 @@ CREATE TABLE `bookmarks_artists` (
126 126
 CREATE TABLE `bookmarks_collages` (
127 127
   `UserID` int(10) NOT NULL,
128 128
   `CollageID` int(10) NOT NULL,
129
-  `Time` datetime NOT NULL,
129
+  `Time` datetime,
130 130
   KEY `UserID` (`UserID`),
131 131
   KEY `CollageID` (`CollageID`)
132 132
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -134,7 +134,7 @@ CREATE TABLE `bookmarks_collages` (
134 134
 CREATE TABLE `bookmarks_requests` (
135 135
   `UserID` int(10) NOT NULL,
136 136
   `RequestID` int(10) NOT NULL,
137
-  `Time` datetime NOT NULL,
137
+  `Time` datetime,
138 138
   KEY `UserID` (`UserID`),
139 139
   KEY `RequestID` (`RequestID`)
140 140
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -142,7 +142,7 @@ CREATE TABLE `bookmarks_requests` (
142 142
 CREATE TABLE `bookmarks_torrents` (
143 143
   `UserID` int(10) NOT NULL,
144 144
   `GroupID` int(10) NOT NULL,
145
-  `Time` datetime NOT NULL,
145
+  `Time` datetime,
146 146
   `Sort` int(11) NOT NULL DEFAULT '0',
147 147
   UNIQUE KEY `groups_users` (`GroupID`,`UserID`),
148 148
   KEY `UserID` (`UserID`),
@@ -164,7 +164,7 @@ CREATE TABLE `calendar` (
164 164
 
165 165
 CREATE TABLE `changelog` (
166 166
   `ID` int(11) NOT NULL AUTO_INCREMENT,
167
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
167
+  `Time` datetime,
168 168
   `Message` text,
169 169
   `Author` varchar(30) NOT NULL,
170 170
   PRIMARY KEY (`ID`)
@@ -184,7 +184,7 @@ CREATE TABLE `collages` (
184 184
   `MaxGroupsPerUser` int(10) NOT NULL DEFAULT '0',
185 185
   `Featured` tinyint(4) NOT NULL DEFAULT '0',
186 186
   `Subscribers` int(10) DEFAULT '0',
187
-  `updated` datetime NOT NULL,
187
+  `updated` datetime,
188 188
   PRIMARY KEY (`ID`),
189 189
   UNIQUE KEY `Name` (`Name`),
190 190
   KEY `UserID` (`UserID`),
@@ -196,7 +196,7 @@ CREATE TABLE `collages_artists` (
196 196
   `ArtistID` int(10) NOT NULL,
197 197
   `UserID` int(10) NOT NULL,
198 198
   `Sort` int(10) NOT NULL DEFAULT '0',
199
-  `AddedOn` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
199
+  `AddedOn` datetime,
200 200
   PRIMARY KEY (`CollageID`,`ArtistID`),
201 201
   KEY `UserID` (`UserID`),
202 202
   KEY `Sort` (`Sort`)
@@ -207,7 +207,7 @@ CREATE TABLE `collages_torrents` (
207 207
   `GroupID` int(10) NOT NULL,
208 208
   `UserID` int(10) NOT NULL,
209 209
   `Sort` int(10) NOT NULL DEFAULT '0',
210
-  `AddedOn` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
210
+  `AddedOn` datetime,
211 211
   PRIMARY KEY (`CollageID`,`GroupID`),
212 212
   KEY `UserID` (`UserID`),
213 213
   KEY `Sort` (`Sort`)
@@ -218,7 +218,7 @@ CREATE TABLE `comments` (
218 218
   `Page` enum('artist','collages','requests','torrents') NOT NULL,
219 219
   `PageID` int(10) NOT NULL,
220 220
   `AuthorID` int(10) NOT NULL,
221
-  `AddedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
221
+  `AddedTime` datetime,
222 222
   `Body` mediumtext,
223 223
   `EditedUserID` int(10) DEFAULT NULL,
224 224
   `EditedTime` datetime DEFAULT NULL,
@@ -270,7 +270,7 @@ CREATE TABLE `do_not_upload` (
270 270
   `Name` varchar(255) NOT NULL,
271 271
   `Comment` varchar(255) NOT NULL,
272 272
   `UserID` int(10) NOT NULL,
273
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
273
+  `Time` datetime,
274 274
   `Sequence` mediumint(8) NOT NULL,
275 275
   PRIMARY KEY (`ID`),
276 276
   KEY `Time` (`Time`)
@@ -280,7 +280,7 @@ CREATE TABLE `donations` (
280 280
   `UserID` int(10) NOT NULL,
281 281
   `Amount` decimal(6,2) NOT NULL,
282 282
   `Email` varchar(255) NOT NULL,
283
-  `Time` datetime NOT NULL,
283
+  `Time` datetime,
284 284
   `Currency` varchar(5) NOT NULL DEFAULT 'USD',
285 285
   `Source` varchar(30) NOT NULL DEFAULT '',
286 286
   `Reason` mediumtext,
@@ -342,7 +342,7 @@ CREATE TABLE `email_blacklist` (
342 342
   `ID` int(10) NOT NULL AUTO_INCREMENT,
343 343
   `UserID` int(10) NOT NULL,
344 344
   `Email` varchar(255) NOT NULL,
345
-  `Time` datetime NOT NULL,
345
+  `Time` datetime,
346 346
   `Comment` text,
347 347
   PRIMARY KEY (`ID`)
348 348
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -351,7 +351,7 @@ CREATE TABLE `email_delete_requests` (
351 351
   `UserID` int(10) unsigned NOT NULL,
352 352
   `Email` varchar(255) NOT NULL,
353 353
   `Reason` text,
354
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
354
+  `Time` datetime,
355 355
   PRIMARY KEY (`UserID`,`Email`)
356 356
 ) ENGINE=InnoDB CHARSET=utf8;
357 357
 
@@ -359,16 +359,16 @@ CREATE TABLE `featured_albums` (
359 359
   `GroupID` int(10) NOT NULL DEFAULT '0',
360 360
   `ThreadID` int(10) NOT NULL DEFAULT '0',
361 361
   `Title` varchar(35) NOT NULL DEFAULT '',
362
-  `Started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
363
-  `Ended` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
362
+  `Started` datetime,
363
+  `Ended` datetime
364 364
 ) ENGINE=InnoDB CHARSET=utf8;
365 365
 
366 366
 CREATE TABLE `featured_merch` (
367 367
   `ProductID` int(10) NOT NULL DEFAULT '0',
368 368
   `Title` varchar(35) NOT NULL DEFAULT '',
369 369
   `Image` varchar(255) NOT NULL DEFAULT '',
370
-  `Started` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
371
-  `Ended` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
370
+  `Started` datetime,
371
+  `Ended` datetime,
372 372
   `ArtistID` int(10) unsigned DEFAULT '0'
373 373
 ) ENGINE=InnoDB CHARSET=utf8;
374 374
 
@@ -386,7 +386,7 @@ CREATE TABLE `forums` (
386 386
   `LastPostID` int(10) NOT NULL DEFAULT '0',
387 387
   `LastPostAuthorID` int(10) NOT NULL DEFAULT '0',
388 388
   `LastPostTopicID` int(10) NOT NULL DEFAULT '0',
389
-  `LastPostTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
389
+  `LastPostTime` datetime,
390 390
   `AutoLock` enum('0','1') DEFAULT '1',
391 391
   `AutoLockWeeks` int(3) unsigned NOT NULL DEFAULT '4',
392 392
   PRIMARY KEY (`ID`),
@@ -414,7 +414,7 @@ CREATE TABLE `forums_polls` (
414 414
   `TopicID` int(10) unsigned NOT NULL,
415 415
   `Question` varchar(255) NOT NULL,
416 416
   `Answers` text,
417
-  `Featured` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
417
+  `Featured` datetime,
418 418
   `Closed` enum('0','1') NOT NULL DEFAULT '0',
419 419
   PRIMARY KEY (`TopicID`)
420 420
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -430,7 +430,7 @@ CREATE TABLE `forums_posts` (
430 430
   `ID` int(10) NOT NULL AUTO_INCREMENT,
431 431
   `TopicID` int(10) NOT NULL,
432 432
   `AuthorID` int(10) NOT NULL,
433
-  `AddedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
433
+  `AddedTime` datetime,
434 434
   `Body` mediumtext,
435 435
   `EditedUserID` int(10) DEFAULT NULL,
436 436
   `EditedTime` datetime DEFAULT NULL,
@@ -448,7 +448,7 @@ CREATE TABLE `forums_topic_notes` (
448 448
   `ID` int(10) NOT NULL AUTO_INCREMENT,
449 449
   `TopicID` int(10) NOT NULL,
450 450
   `AuthorID` int(10) NOT NULL,
451
-  `AddedTime` datetime NOT NULL,
451
+  `AddedTime` datetime,
452 452
   `Body` mediumtext,
453 453
   PRIMARY KEY (`ID`),
454 454
   KEY `TopicID` (`TopicID`),
@@ -464,11 +464,11 @@ CREATE TABLE `forums_topics` (
464 464
   `ForumID` int(3) NOT NULL,
465 465
   `NumPosts` int(10) NOT NULL DEFAULT '0',
466 466
   `LastPostID` int(10) NOT NULL,
467
-  `LastPostTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
467
+  `LastPostTime` datetime,
468 468
   `LastPostAuthorID` int(10) NOT NULL,
469 469
   `StickyPostID` int(10) NOT NULL DEFAULT '0',
470 470
   `Ranking` tinyint(2) DEFAULT '0',
471
-  `CreatedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
471
+  `CreatedTime` datetime,
472 472
   PRIMARY KEY (`ID`),
473 473
   KEY `AuthorID` (`AuthorID`),
474 474
   KEY `ForumID` (`ForumID`),
@@ -507,7 +507,7 @@ CREATE TABLE `group_log` (
507 507
   `TorrentID` int(10) NOT NULL,
508 508
   `UserID` int(10) NOT NULL DEFAULT '0',
509 509
   `Info` mediumtext,
510
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
510
+  `Time` datetime,
511 511
   `Hidden` tinyint(4) NOT NULL DEFAULT '0',
512 512
   PRIMARY KEY (`ID`),
513 513
   KEY `GroupID` (`GroupID`),
@@ -532,7 +532,7 @@ CREATE TABLE `invites` (
532 532
   `InviterID` int(10) NOT NULL DEFAULT '0',
533 533
   `InviteKey` char(32) NOT NULL,
534 534
   `Email` varchar(255) NOT NULL,
535
-  `Expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
535
+  `Expires` datetime,
536 536
   `Reason` varchar(255) NOT NULL DEFAULT '',
537 537
   PRIMARY KEY (`InviteKey`),
538 538
   KEY `Expires` (`Expires`),
@@ -580,7 +580,7 @@ CREATE TABLE `locked_accounts` (
580 580
 CREATE TABLE `log` (
581 581
   `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
582 582
   `Message` varchar(400) NOT NULL,
583
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
583
+  `Time` datetime,
584 584
   PRIMARY KEY (`ID`),
585 585
   KEY `Time` (`Time`)
586 586
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -597,7 +597,7 @@ CREATE TABLE `news` (
597 597
   `UserID` int(10) unsigned NOT NULL,
598 598
   `Title` varchar(255) NOT NULL,
599 599
   `Body` text,
600
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
600
+  `Time` datetime,
601 601
   PRIMARY KEY (`ID`),
602 602
   KEY `UserID` (`UserID`),
603 603
   KEY `Time` (`Time`)
@@ -605,8 +605,8 @@ CREATE TABLE `news` (
605 605
 
606 606
 CREATE TABLE `ocelot_query_times` (
607 607
   `buffer` enum('users','torrents','snatches','peers') NOT NULL,
608
-  `starttime` datetime NOT NULL,
609
-  `ocelotinstance` datetime NOT NULL,
608
+  `starttime` datetime,
609
+  `ocelotinstance` datetime,
610 610
   `querylength` int(11) NOT NULL,
611 611
   `timespent` int(11) NOT NULL,
612 612
   UNIQUE KEY `starttime` (`starttime`)
@@ -637,8 +637,8 @@ CREATE TABLE `pm_conversations_users` (
637 637
   `ConvID` int(12) NOT NULL DEFAULT '0',
638 638
   `InInbox` enum('1','0') NOT NULL,
639 639
   `InSentbox` enum('1','0') NOT NULL,
640
-  `SentDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
641
-  `ReceivedDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
640
+  `SentDate` datetime,
641
+  `ReceivedDate` datetime,
642 642
   `UnRead` enum('1','0') NOT NULL DEFAULT '1',
643 643
   `Sticky` enum('1','0') NOT NULL DEFAULT '0',
644 644
   `ForwardedTo` int(12) NOT NULL DEFAULT '0',
@@ -656,7 +656,7 @@ CREATE TABLE `pm_conversations_users` (
656 656
 CREATE TABLE `pm_messages` (
657 657
   `ID` int(12) NOT NULL AUTO_INCREMENT,
658 658
   `ConvID` int(12) NOT NULL DEFAULT '0',
659
-  `SentDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
659
+  `SentDate` datetime,
660 660
   `SenderID` int(10) NOT NULL DEFAULT '0',
661 661
   `Body` text,
662 662
   PRIMARY KEY (`ID`),
@@ -677,8 +677,8 @@ CREATE TABLE `reports` (
677 677
   `Comment` text,
678 678
   `ResolverID` int(10) unsigned NOT NULL DEFAULT '0',
679 679
   `Status` enum('New','InProgress','Resolved') DEFAULT 'New',
680
-  `ResolvedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
681
-  `ReportedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
680
+  `ResolvedTime` datetime,
681
+  `ReportedTime` datetime,
682 682
   `Reason` text,
683 683
   `ClaimerID` int(10) unsigned NOT NULL DEFAULT '0',
684 684
   `Notes` text,
@@ -693,7 +693,7 @@ CREATE TABLE `reports_email_blacklist` (
693 693
   `ID` int(10) NOT NULL AUTO_INCREMENT,
694 694
   `Type` tinyint(4) NOT NULL DEFAULT '0',
695 695
   `UserID` int(10) NOT NULL,
696
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
696
+  `Time` datetime,
697 697
   `Checked` tinyint(4) NOT NULL DEFAULT '0',
698 698
   `ResolverID` int(10) DEFAULT '0',
699 699
   `Email` varchar(255) NOT NULL DEFAULT '',
@@ -710,8 +710,8 @@ CREATE TABLE `reportsv2` (
710 710
   `UserComment` text,
711 711
   `ResolverID` int(10) unsigned NOT NULL DEFAULT '0',
712 712
   `Status` enum('New','InProgress','Resolved') DEFAULT 'New',
713
-  `ReportedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
714
-  `LastChangeTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
713
+  `ReportedTime` datetime,
714
+  `LastChangeTime` datetime,
715 715
   `ModComment` text,
716 716
   `Track` text,
717 717
   `Image` text,
@@ -729,7 +729,7 @@ CREATE TABLE `reportsv2` (
729 729
 CREATE TABLE `requests` (
730 730
   `ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
731 731
   `UserID` int(10) unsigned NOT NULL DEFAULT '0',
732
-  `TimeAdded` datetime NOT NULL,
732
+  `TimeAdded` datetime,
733 733
   `LastVote` datetime DEFAULT NULL,
734 734
   `CategoryID` int(3) NOT NULL,
735 735
   `Title` varchar(255) DEFAULT NULL,
@@ -740,7 +740,7 @@ CREATE TABLE `requests` (
740 740
   `DLsiteID` varchar(50) DEFAULT NULL,
741 741
   `FillerID` int(10) unsigned NOT NULL DEFAULT '0',
742 742
   `TorrentID` int(10) unsigned NOT NULL DEFAULT '0',
743
-  `TimeFilled` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
743
+  `TimeFilled` datetime,
744 744
   `Visible` binary(1) NOT NULL DEFAULT '1',
745 745
   `GroupID` int(10) DEFAULT NULL,
746 746
   PRIMARY KEY (`ID`),
@@ -787,7 +787,7 @@ CREATE TABLE `schedule` (
787 787
 
788 788
 CREATE TABLE `shop_freeleeches` (
789 789
   `TorrentID` int(10) NOT NULL,
790
-  `ExpiryTime` datetime NOT NULL,
790
+  `ExpiryTime` datetime,
791 791
   PRIMARY KEY (`TorrentID`),
792 792
   KEY `ExpiryTime` (`ExpiryTime`)
793 793
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -990,7 +990,7 @@ CREATE TABLE `staff_answers` (
990 990
   `QuestionID` int(10) NOT NULL,
991 991
   `UserID` int(10) NOT NULL,
992 992
   `Answer` mediumtext,
993
-  `Date` datetime NOT NULL,
993
+  `Date` datetime,
994 994
   PRIMARY KEY (`QuestionID`,`UserID`),
995 995
   KEY `UserID` (`UserID`)
996 996
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1000,7 +1000,7 @@ CREATE TABLE `staff_blog` (
1000 1000
   `UserID` int(10) unsigned NOT NULL,
1001 1001
   `Title` varchar(255) NOT NULL,
1002 1002
   `Body` text,
1003
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1003
+  `Time` datetime,
1004 1004
   PRIMARY KEY (`ID`),
1005 1005
   KEY `UserID` (`UserID`),
1006 1006
   KEY `Time` (`Time`)
@@ -1008,7 +1008,7 @@ CREATE TABLE `staff_blog` (
1008 1008
 
1009 1009
 CREATE TABLE `staff_blog_visits` (
1010 1010
   `UserID` int(10) unsigned NOT NULL,
1011
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1011
+  `Time` datetime,
1012 1012
   UNIQUE KEY `UserID` (`UserID`),
1013 1013
   CONSTRAINT `staff_blog_visits_ibfk_1` FOREIGN KEY (`UserID`) REFERENCES `users_main` (`ID`) ON DELETE CASCADE
1014 1014
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1091,7 +1091,7 @@ CREATE TABLE `tags` (
1091 1091
 
1092 1092
 CREATE TABLE `top10_history` (
1093 1093
   `ID` int(10) NOT NULL AUTO_INCREMENT,
1094
-  `Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1094
+  `Date` datetime,
1095 1095
   `Type` enum('Daily','Weekly') DEFAULT NULL,
1096 1096
   PRIMARY KEY (`ID`)
1097 1097
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1128,15 +1128,15 @@ CREATE TABLE `torrents` (
1128 1128
   `Size` bigint(12) NOT NULL,
1129 1129
   `Leechers` int(6) NOT NULL DEFAULT '0',
1130 1130
   `Seeders` int(6) NOT NULL DEFAULT '0',
1131
-  `last_action` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1131
+  `last_action` datetime,
1132 1132
   `FreeTorrent` enum('0','1','2') NOT NULL DEFAULT '0',
1133 1133
   `FreeLeechType` enum('0','1','2','3','4') NOT NULL DEFAULT '0',
1134
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1134
+  `Time` datetime,
1135 1135
   `Description` text,
1136 1136
   `MediaInfo` text,
1137 1137
   `Snatched` int(10) unsigned NOT NULL DEFAULT '0',
1138 1138
   `balance` bigint(20) NOT NULL DEFAULT '0',
1139
-  `LastReseedRequest` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1139
+  `LastReseedRequest` datetime,
1140 1140
   `Subber` varchar(300) NOT NULL DEFAULT '',
1141 1141
   `Archive` varchar(3) NOT NULL DEFAULT '',
1142 1142
   PRIMARY KEY (`ID`),
@@ -1172,20 +1172,20 @@ CREATE TABLE `torrents_artists` (
1172 1172
 CREATE TABLE `torrents_bad_files` (
1173 1173
   `TorrentID` int(11) NOT NULL DEFAULT '0',
1174 1174
   `UserID` int(11) NOT NULL DEFAULT '0',
1175
-  `TimeAdded` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
1175
+  `TimeAdded` datetime
1176 1176
 ) ENGINE=InnoDB CHARSET=utf8;
1177 1177
 
1178 1178
 CREATE TABLE `torrents_bad_folders` (
1179 1179
   `TorrentID` int(11) NOT NULL,
1180 1180
   `UserID` int(11) NOT NULL,
1181
-  `TimeAdded` datetime NOT NULL,
1181
+  `TimeAdded` datetime,
1182 1182
   PRIMARY KEY (`TorrentID`)
1183 1183
 ) ENGINE=InnoDB CHARSET=utf8;
1184 1184
 
1185 1185
 CREATE TABLE `torrents_bad_tags` (
1186 1186
   `TorrentID` int(10) NOT NULL DEFAULT '0',
1187 1187
   `UserID` int(10) NOT NULL DEFAULT '0',
1188
-  `TimeAdded` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1188
+  `TimeAdded` datetime,
1189 1189
   KEY `TimeAdded` (`TimeAdded`)
1190 1190
 ) ENGINE=InnoDB CHARSET=utf8;
1191 1191
 
@@ -1201,7 +1201,7 @@ CREATE TABLE `torrents_group` (
1201 1201
   `CatalogueNumber` varchar(80) NOT NULL DEFAULT '',
1202 1202
   `Pages` smallint(5) unsigned DEFAULT NULL,
1203 1203
   `TagList` varchar(500) NOT NULL,
1204
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1204
+  `Time` datetime,
1205 1205
   `RevisionID` int(12) DEFAULT NULL,
1206 1206
   `WikiBody` text,
1207 1207
   `WikiImage` varchar(255) NOT NULL,
@@ -1254,7 +1254,7 @@ CREATE TABLE `torrents_peerlists_compare` (
1254 1254
 CREATE TABLE `torrents_recommended` (
1255 1255
   `GroupID` int(10) NOT NULL,
1256 1256
   `UserID` int(10) NOT NULL,
1257
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1257
+  `Time` datetime,
1258 1258
   PRIMARY KEY (`GroupID`),
1259 1259
   KEY `Time` (`Time`)
1260 1260
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1263,7 +1263,7 @@ CREATE TABLE `torrents_screenshots` (
1263 1263
   `ID` int(10) NOT NULL AUTO_INCREMENT,
1264 1264
   `GroupID` int(10) NOT NULL,
1265 1265
   `UserID` int(10) NOT NULL,
1266
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1266
+  `Time` datetime,
1267 1267
   `Image` varchar(255) NOT NULL,
1268 1268
   PRIMARY KEY (`ID`,`GroupID`,`Image`)
1269 1269
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1304,7 +1304,7 @@ CREATE TABLE `user_questions` (
1304 1304
   `ID` int(10) NOT NULL AUTO_INCREMENT,
1305 1305
   `Question` mediumtext,
1306 1306
   `UserID` int(10) NOT NULL,
1307
-  `Date` datetime NOT NULL,
1307
+  `Date` datetime,
1308 1308
   PRIMARY KEY (`ID`),
1309 1309
   KEY `Date` (`Date`)
1310 1310
 ) ENGINE=InnoDB CHARSET=utf8;
@@ -1352,7 +1352,7 @@ CREATE TABLE `users_donor_ranks` (
1352 1352
 CREATE TABLE `users_downloads` (
1353 1353
   `UserID` int(10) NOT NULL,
1354 1354
   `TorrentID` int(1) NOT NULL,
1355
-  `Time` datetime NOT NULL,
1355
+  `Time` datetime,
1356 1356
   PRIMARY KEY (`UserID`,`TorrentID`,`Time`),
1357 1357
   KEY `TorrentID` (`TorrentID`),
1358 1358
   KEY `UserID` (`UserID`)
@@ -1380,7 +1380,7 @@ CREATE TABLE `users_enable_requests` (
1380 1380
   `Email` varchar(255) NOT NULL,
1381 1381
   `IP` varchar(255) NOT NULL DEFAULT 'mIbUEUEmV93bF6C5i6cITAlcw3H7TKcaPzZZIMIZQNQ=',
1382 1382
   `UserAgent` text,
1383
-  `Timestamp` datetime NOT NULL,
1383
+  `Timestamp` datetime,
1384 1384
   `HandledTimestamp` datetime DEFAULT NULL,
1385 1385
   `Token` char(32) DEFAULT NULL,
1386 1386
   `CheckedBy` int(10) unsigned DEFAULT NULL,
@@ -1395,7 +1395,7 @@ CREATE TABLE `users_enable_requests` (
1395 1395
 CREATE TABLE `users_freeleeches` (
1396 1396
   `UserID` int(10) NOT NULL,
1397 1397
   `TorrentID` int(10) NOT NULL,
1398
-  `Time` datetime NOT NULL,
1398
+  `Time` datetime,
1399 1399
   `Expired` tinyint(1) NOT NULL DEFAULT '0',
1400 1400
   `Downloaded` bigint(20) NOT NULL DEFAULT '0',
1401 1401
   `Uses` int(10) NOT NULL DEFAULT '1',
@@ -1420,7 +1420,7 @@ CREATE TABLE `users_history_emails` (
1420 1420
 CREATE TABLE `users_history_ips` (
1421 1421
   `UserID` int(10) NOT NULL,
1422 1422
   `IP` varchar(90) NOT NULL DEFAULT '0.0.0.0',
1423
-  `StartTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1423
+  `StartTime` datetime,
1424 1424
   `EndTime` datetime DEFAULT NULL,
1425 1425
   PRIMARY KEY (`UserID`,`IP`,`StartTime`),
1426 1426
   KEY `UserID` (`UserID`),
@@ -1449,22 +1449,22 @@ CREATE TABLE `users_info` (
1449 1449
   `StyleID` int(10) unsigned NOT NULL,
1450 1450
   `StyleURL` varchar(255) DEFAULT NULL,
1451 1451
   `Info` text,
1452
-  `Avatar` varchar(255) NOT NULL,
1452
+  `Avatar` varchar(255),
1453 1453
   `AdminComment` text,
1454 1454
   `SiteOptions` text,
1455 1455
   `ViewAvatars` enum('0','1') NOT NULL DEFAULT '1',
1456 1456
   `Donor` enum('0','1') NOT NULL DEFAULT '0',
1457 1457
   `Artist` enum('0','1') NOT NULL DEFAULT '0',
1458 1458
   `DownloadAlt` enum('0','1') NOT NULL DEFAULT '0',
1459
-  `Warned` datetime NOT NULL,
1460
-  `SupportFor` varchar(255) NOT NULL,
1459
+  `Warned` datetime,
1460
+  `SupportFor` varchar(255),
1461 1461
   `TorrentGrouping` enum('0','1','2') NOT NULL COMMENT '0=Open,1=Closed,2=Off',
1462 1462
   `ShowTags` enum('0','1') NOT NULL DEFAULT '1',
1463 1463
   `NotifyOnQuote` enum('0','1','2') NOT NULL DEFAULT '0',
1464
-  `AuthKey` varchar(32) NOT NULL,
1465
-  `ResetKey` varchar(32) NOT NULL,
1466
-  `ResetExpires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1467
-  `JoinDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1464
+  `AuthKey` varchar(32) NOT NULL DEFAULT '',
1465
+  `ResetKey` varchar(32) NOT NULL DEFAULT '',
1466
+  `ResetExpires` datetime,
1467
+  `JoinDate` datetime,
1468 1468
   `Inviter` int(10) DEFAULT NULL,
1469 1469
   `BitcoinAddress` varchar(34) DEFAULT NULL,
1470 1470
   `WarnedTimes` int(2) NOT NULL DEFAULT '0',
@@ -1480,10 +1480,10 @@ CREATE TABLE `users_info` (
1480 1480
   `DisablePoints` enum('0','1') NOT NULL DEFAULT '0',
1481 1481
   `DisablePromotion` enum('0','1') NOT NULL DEFAULT '0',
1482 1482
   `DisableRequests` enum('0','1') NOT NULL DEFAULT '0',
1483
-  `RatioWatchEnds` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1483
+  `RatioWatchEnds` datetime,
1484 1484
   `RatioWatchDownload` bigint(20) unsigned NOT NULL DEFAULT '0',
1485 1485
   `RatioWatchTimes` tinyint(1) unsigned NOT NULL DEFAULT '0',
1486
-  `BanDate` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1486
+  `BanDate` datetime,
1487 1487
   `BanReason` enum('0','1','2','3','4') NOT NULL DEFAULT '0',
1488 1488
   `CatchupTime` datetime DEFAULT NULL,
1489 1489
   `LastReadNews` int(10) NOT NULL DEFAULT '0',
@@ -1492,7 +1492,7 @@ CREATE TABLE `users_info` (
1492 1492
   `PermittedForums` varchar(150) NOT NULL DEFAULT '',
1493 1493
   `UnseededAlerts` enum('0','1') NOT NULL DEFAULT '0',
1494 1494
   `LastReadBlog` int(10) NOT NULL DEFAULT '0',
1495
-  `InfoTitle` varchar(255) NOT NULL,
1495
+  `InfoTitle` varchar(255) NOT NULL DEFAULT '',
1496 1496
   UNIQUE KEY `UserID` (`UserID`),
1497 1497
   KEY `SupportFor` (`SupportFor`),
1498 1498
   KEY `DisableInvites` (`DisableInvites`),
@@ -1520,8 +1520,8 @@ CREATE TABLE `users_main` (
1520 1520
   `Email` varchar(255) NOT NULL,
1521 1521
   `PassHash` varchar(60) NOT NULL,
1522 1522
   `IRCKey` char(32) DEFAULT NULL,
1523
-  `LastLogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1524
-  `LastAccess` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1523
+  `LastLogin` datetime,
1524
+  `LastAccess` datetime,
1525 1525
   `IP` varchar(90) NOT NULL DEFAULT '0.0.0.0',
1526 1526
   `Class` tinyint(2) NOT NULL DEFAULT '5',
1527 1527
   `Uploaded` bigint(20) unsigned NOT NULL DEFAULT '0',
@@ -1608,7 +1608,7 @@ CREATE TABLE `users_notify_quoted` (
1608 1608
   `PageID` int(10) NOT NULL,
1609 1609
   `PostID` int(10) NOT NULL,
1610 1610
   `UnRead` tinyint(1) NOT NULL DEFAULT '1',
1611
-  `Date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1611
+  `Date` datetime,
1612 1612
   PRIMARY KEY (`UserID`,`Page`,`PostID`)
1613 1613
 ) ENGINE=InnoDB CHARSET=utf8;
1614 1614
 
@@ -1655,7 +1655,7 @@ CREATE TABLE `users_sessions` (
1655 1655
   `Browser` varchar(40) DEFAULT NULL,
1656 1656
   `OperatingSystem` varchar(13) DEFAULT NULL,
1657 1657
   `IP` varchar(90) NOT NULL,
1658
-  `LastUpdate` datetime NOT NULL,
1658
+  `LastUpdate` datetime,
1659 1659
   `Active` tinyint(4) NOT NULL DEFAULT '1',
1660 1660
   `FullUA` text,
1661 1661
   PRIMARY KEY (`UserID`,`SessionID`),
@@ -1751,7 +1751,7 @@ CREATE TABLE `wiki_artists` (
1751 1751
   `Body` text,
1752 1752
   `UserID` int(10) NOT NULL DEFAULT '0',
1753 1753
   `Summary` varchar(100) DEFAULT NULL,
1754
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1754
+  `Time` datetime,
1755 1755
   `Image` varchar(255) DEFAULT NULL,
1756 1756
   PRIMARY KEY (`RevisionID`),
1757 1757
   KEY `PageID` (`PageID`),
@@ -1775,7 +1775,7 @@ CREATE TABLE `wiki_torrents` (
1775 1775
   `Body` text,
1776 1776
   `UserID` int(10) NOT NULL DEFAULT '0',
1777 1777
   `Summary` varchar(100) DEFAULT NULL,
1778
-  `Time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
1778
+  `Time` datetime,
1779 1779
   `Image` varchar(255) DEFAULT NULL,
1780 1780
   PRIMARY KEY (`RevisionID`),
1781 1781
   KEY `PageID` (`PageID`),
@@ -1840,7 +1840,7 @@ INSERT INTO wiki_aliases (Alias, UserID, ArticleID) VALUES ('wiki', 1, 1);
1840 1840
 
1841 1841
 INSERT INTO wiki_revisions (ID, Revision, Title, Body, Date, Author) VALUES (1, 1, 'Wiki', 'Welcome to your new wiki! Hope this works.', NOW(), 1);
1842 1842
 
1843
-INSERT INTO forums (ID, CategoryID, Sort, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, NumTopics, NumPosts, LastPostID, LastPostAuthorID, LastPostTopicID, LastPostTime) VALUES (1, 1, 20, 'Your Site', 'Totally rad forum', 100, 100, 100, 0, 0, 0, 0, 0, '0000-00-00 00:00:00'), (2, 5, 30, 'Chat', 'Expect this to fill up with spam', 100, 100, 100, 0, 0, 0, 0, 0, '0000-00-00 00:00:00'), (3, 10, 40, 'Help!', 'I fell down and I cant get up', 100, 100, 100, 0, 0, 0, 0, 0, '0000-00-00 00:00:00'), (4, 20, 100, 'Trash', 'Every thread ends up here eventually', 100, 500, 500, 0, 0, 0, 0, 0, '0000-00-00 00:00:00');
1843
+INSERT INTO forums (ID, CategoryID, Sort, Name, Description, MinClassRead, MinClassWrite, MinClassCreate, NumTopics, NumPosts, LastPostID, LastPostAuthorID, LastPostTopicID, LastPostTime) VALUES (1, 1, 20, 'Your Site', 'Totally rad forum', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (2, 5, 30, 'Chat', 'Expect this to fill up with spam', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (3, 10, 40, 'Help!', 'I fell down and I cant get up', 100, 100, 100, 0, 0, 0, 0, 0, NULL), (4, 20, 100, 'Trash', 'Every thread ends up here eventually', 100, 500, 500, 0, 0, 0, 0, 0, NULL);
1844 1844
 
1845 1845
 INSERT INTO tags (ID, Name, TagType, Uses, UserID) VALUES (1, 'foo', 'genre', 0, 1),(2, 'bar', 'genre', 0, 1),(3, 'baz', 'genre', 0, 1);
1846 1846
 

+ 1
- 1
sections/ajax/forum/forum.php View File

@@ -140,7 +140,7 @@ if (count($Forum) === 0) {
140 140
     $UserInfo = Users::user_info($LastAuthorID);
141 141
     $LastAuthorName = $UserInfo['Username'];
142 142
     // Bug fix for no last time available
143
-    if ($LastTime == '0000-00-00 00:00:00') {
143
+    if ($LastTime == NULL) {
144 144
       $LastTime = '';
145 145
     }
146 146
 

+ 1
- 1
sections/ajax/forum/thread.php View File

@@ -261,7 +261,7 @@ foreach ($Thread as $Key => $Post) {
261 261
       'paranoia' => $Paranoia,
262 262
       'artist' => $Artist === '1',
263 263
       'donor' => $Donor === '1',
264
-      'warned' => $Warned !== '0000-00-00 00:00:00',
264
+      'warned' => $Warned !== NULL,
265 265
       'avatar' => $Avatar,
266 266
       'enabled' => $Enabled === '2' ? false : true,
267 267
       'userTitle' => $UserTitle

+ 1
- 1
sections/ajax/request.php View File

@@ -67,7 +67,7 @@ foreach ($Thread as $Key => $Post) {
67 67
     'authorId'        => (int)$AuthorID,
68 68
     'name'            => $Username,
69 69
     'donor'           => ($Donor == 1),
70
-    'warned'          => ($Warned != '0000-00-00 00:00:00'),
70
+    'warned'          => ($Warned != NULL),
71 71
     'enabled'         => ($Enabled == 2 ? false : true),
72 72
     'class'           => Users::make_class_string($PermissionID),
73 73
     'addedTime'       => $AddedTime,

+ 1
- 1
sections/ajax/tcomments.php View File

@@ -23,7 +23,7 @@ foreach ($Thread as $Key => $Post) {
23 23
       'authorName' => $Username,
24 24
       'artist' => $Artist == 1,
25 25
       'donor' => $Donor == 1,
26
-      'warned' => ($Warned != '0000-00-00 00:00:00'),
26
+      'warned' => ($Warned != NULL),
27 27
       'avatar' => $Avatar,
28 28
       'enabled' => ($Enabled == 2 ? false : true),
29 29
       'userTitle' => $UserTitle

+ 2
- 2
sections/ajax/user.php View File

@@ -308,7 +308,7 @@ if ($ParanoiaLevel == 0) {
308 308
 }
309 309
 
310 310
 //Bugfix for no access time available
311
-if ($LastAccess == '0000-00-00 00:00:00') {
311
+if ($LastAccess == NULL) {
312 312
   $LastAccess = '';
313 313
 }
314 314
 
@@ -342,7 +342,7 @@ json_print("success", array(
342 342
     'paranoia'      => (int)$ParanoiaLevel,
343 343
     'paranoiaText'  => $ParanoiaLevelText,
344 344
     'donor'         => ($Donor == 1),
345
-    'warned'        => ($Warned != '0000-00-00 00:00:00'),
345
+    'warned'        => ($Warned != NULL),
346 346
     'enabled'       => ($Enabled == '1' || $Enabled == '0' || !$Enabled),
347 347
     'passkey'       => $torrent_pass
348 348
   ),

+ 1
- 1
sections/ajax/usersearch.php View File

@@ -44,7 +44,7 @@ foreach ($Results as $Result) {
44 44
     'userId' => (int)$UserID,
45 45
     'username' => $Username,
46 46
     'donor' => $Donor == 1,
47
-    'warned' => ($Warned != '0000-00-00 00:00:00'),
47
+    'warned' => ($Warned != NULL),
48 48
     'enabled' => ($Enabled == 2 ? false : true),
49 49
     'class' => Users::make_class_string($PermissionID),
50 50
     'avatar' => $Avatar

+ 1
- 1
sections/forums/poll_mod.php View File

@@ -39,7 +39,7 @@ if (!list($Question,$Answers,$Votes,$Featured,$Closed) = $Cache->get_value('poll
39 39
 }
40 40
 
41 41
 if (isset($_POST['feature'])) {
42
-  if (!$Featured || $Featured == '0000-00-00 00:00:00') {
42
+  if (!$Featured || $Featured == NULL) {
43 43
     $Featured = sqltime();
44 44
     $Cache->cache_value('polls_featured',$TopicID,0);
45 45
     $DB->query('

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

@@ -138,7 +138,7 @@ if (!$NoPoll) { // god, I hate double negatives...
138 138
       (TopicID, Question, Answers)
139 139
     VALUES
140 140
       ('$TopicID', '".db_string($Question)."', '".db_string(serialize($Answers))."')");
141
-  $Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, '0000-00-00 00:00:00', '0'), 0);
141
+  $Cache->cache_value("polls_$TopicID", array($Question, $Answers, $Votes, NULL, '0'), 0);
142 142
 
143 143
   if ($ForumID == STAFF_FORUM) {
144 144
     send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" ".site_url()."forums.php?action=viewthread&threadid=$TopicID");
@@ -203,7 +203,7 @@ $Post = array(
203 203
   'AddedTime' => sqltime(),
204 204
   'Body' => $Body,
205 205
   'EditedUserID' => 0,
206
-  'EditedTime' => '0000-00-00 00:00:00'
206
+  'EditedTime' => NULL
207 207
   );
208 208
 $Cache->insert('', $Post);
209 209
 $Cache->commit_transaction(0);

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

@@ -250,7 +250,7 @@ if ($ThreadInfo['LastPostAuthorID'] == $LoggedUser['ID'] && ((!check_perms('site
250 250
     'AddedTime'=>$SQLTime,
251 251
     'Body'=>$Body,
252 252
     'EditedUserID'=>0,
253
-    'EditedTime'=>'0000-00-00 00:00:00',
253
+    'EditedTime'=>NULL,
254 254
     'Username'=>$LoggedUser['Username'] //TODO: Remove, it's never used?
255 255
     ));
256 256
   $Cache->commit_transaction(0);

+ 2
- 2
sections/forums/thread.php View File

@@ -260,7 +260,7 @@ if ($ThreadInfo['NoPoll'] == 0) {
260 260
 
261 261
 ?>
262 262
   <div class="box thin clear">
263
-    <div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?><? if ($Featured && $Featured !== '0000-00-00 00:00:00') { echo ' [Featured]'; } ?></strong> <a href="#" onclick="$('#threadpoll').gtoggle(); log_hit(); return false;" class="brackets">View</a></div>
263
+    <div class="head colhead_dark"><strong>Poll<? if ($Closed) { echo ' [Closed]'; } ?><? if ($Featured && $Featured !== NULL) { echo ' [Featured]'; } ?></strong> <a href="#" onclick="$('#threadpoll').gtoggle(); log_hit(); return false;" class="brackets">View</a></div>
264 264
     <div class="pad<? if (/*$LastRead !== null || */$ThreadInfo['IsLocked']) { echo ' hidden'; } ?>" id="threadpoll">
265 265
       <p><strong><?=display_str($Question)?></strong></p>
266 266
 <?  if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !Forums::check_forumperm($ForumID)) { ?>
@@ -383,7 +383,7 @@ if ($ThreadInfo['NoPoll'] == 0) {
383 383
       </div>
384 384
 <?  }
385 385
   if (check_perms('forums_polls_moderate') && !$RevealVoters) {
386
-    if (!$Featured || $Featured == '0000-00-00 00:00:00') {
386
+    if (!$Featured || $Featured == NULL) {
387 387
 ?>
388 388
       <form class="manage_form" name="poll" action="forums.php" method="post">
389 389
         <input type="hidden" name="action" value="poll_mod" />

+ 9
- 2
sections/index/private.php View File

@@ -18,7 +18,7 @@ if (!$News = $Cache->get_value('news')) {
18 18
   $Cache->cache_value('news_latest_title', $News[0][1], 0);
19 19
 }
20 20
 
21
-if ($LoggedUser['LastReadNews'] != $News[0][0]) {
21
+if ($LoggedUser['LastReadNews'] != $News[0][0] && count($News[0][0]) > 0) {
22 22
   $Cache->begin_transaction("user_info_heavy_$UserID");
23 23
   $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
24 24
   $Cache->commit_transaction(0);
@@ -276,8 +276,15 @@ if (($RequestStats = $Cache->get_value('stats_requests')) === false) {
276 276
   list($RequestCount, $FilledCount) = $RequestStats;
277 277
 }
278 278
 
279
+// do not divide by zero
280
+if ($RequestCount > 0) {
281
+  $RequestsFilledPercent = $FilledCount / $RequestCount * 100;
282
+} else {
283
+  $RequestsFilledPercent = 0;
284
+}
285
+
279 286
 ?>
280
-        <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($FilledCount / $RequestCount * 100, 2)?>% filled)</li>
287
+        <li>Requests: <?=number_format($RequestCount)?> (<?=number_format($RequestsFilledPercent, 2)?>% filled)</li>
281 288
 <?
282 289
 
283 290
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {

+ 2
- 2
sections/login/index.php View File

@@ -68,7 +68,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
68 68
               m.PassHash = '".db_string(Users::make_sec_hash($_REQUEST['password']))."',
69 69
               i.ResetKey = '',
70 70
               m.LastLogin = NOW(),
71
-              i.ResetExpires = '0000-00-00 00:00:00'
71
+              i.ResetExpires = NULL
72 72
             WHERE m.ID = '$UserID'
73 73
               AND i.UserID = m.ID");
74 74
           $DB->query("
@@ -94,7 +94,7 @@ if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'recover') {
94 94
         $DB->query("
95 95
           UPDATE users_info
96 96
           SET ResetKey = '',
97
-            ResetExpires = '0000-00-00 00:00:00'
97
+            ResetExpires = NULL
98 98
           WHERE UserID = '$UserID'");
99 99
         $_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
100 100
       }

+ 2
- 2
sections/register/index.php View File

@@ -162,7 +162,7 @@ if (!empty($_REQUEST['confirm'])) {
162 162
         INSERT INTO users_history_emails
163 163
           (UserID, Email, Time, IP)
164 164
         VALUES
165
-          ('$UserID', '".DBCrypt::encrypt($_REQUEST['email'])."', '0000-00-00 00:00:00', '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
165
+          ('$UserID', '".DBCrypt::encrypt($_REQUEST['email'])."', NULL, '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
166 166
 
167 167
       if ($_REQUEST['email'] != $InviteEmail) {
168 168
         $DB->query("
@@ -176,7 +176,7 @@ if (!empty($_REQUEST['confirm'])) {
176 176
 
177 177
       // Manage invite trees, delete invite
178 178
 
179
-      if ($InviterID !== null) {
179
+      if ($InviterID !== null && $InviterID !== 0) {
180 180
         $DB->query("
181 181
           SELECT TreePosition, TreeID, TreeLevel
182 182
           FROM invite_tree

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

@@ -39,7 +39,7 @@ $DB->query("
39 39
   UPDATE requests
40 40
   SET TorrentID = 0,
41 41
     FillerID = 0,
42
-    TimeFilled = '0000-00-00 00:00:00',
42
+    TimeFilled = NULL,
43 43
     Visible = 1
44 44
   WHERE ID = $RequestID");
45 45
 

+ 2
- 2
sections/schedule/daily/disable_inactive_users.php View File

@@ -11,7 +11,7 @@ if (apc_exists('DBKEY')) {
11 11
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
12 12
       AND um.LastAccess < '".time_minus(3600 * 24 * 110, true)."'
13 13
       AND um.LastAccess > '".time_minus(3600 * 24 * 111, true)."'
14
-      AND um.LastAccess != '0000-00-00 00:00:00'
14
+      AND um.LastAccess != NULL
15 15
       AND ui.Donor = '0'
16 16
       AND um.Enabled != '2'
17 17
       AND ul.UserID IS NULL
@@ -29,7 +29,7 @@ if (apc_exists('DBKEY')) {
29 29
       LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
30 30
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
31 31
       AND um.LastAccess < '".time_minus(3600 * 24 * 30 * 4)."'
32
-      AND um.LastAccess != '0000-00-00 00:00:00'
32
+      AND um.LastAccess != NULL
33 33
       AND ui.Donor = '0'
34 34
       AND um.Enabled != '2'
35 35
       AND ul.UserID IS NULL

+ 2
- 2
sections/schedule/daily/disable_unconfirmed_users.php View File

@@ -6,7 +6,7 @@ $DB->query("
6 6
   SELECT UserID
7 7
   FROM users_info AS ui
8 8
     JOIN users_main AS um ON um.ID = ui.UserID
9
-  WHERE um.LastAccess = '0000-00-00 00:00:00'
9
+  WHERE um.LastAccess = NULL
10 10
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
11 11
     AND um.Enabled != '2'");
12 12
 $UserIDs = $DB->collect('UserID');
@@ -19,7 +19,7 @@ $DB->query("
19 19
     ui.BanDate = '$sqltime',
20 20
     ui.BanReason = '3',
21 21
     ui.AdminComment = CONCAT('$sqltime - Disabled for inactivity (never logged in)\n\n', ui.AdminComment)
22
-  WHERE um.LastAccess = '0000-00-00 00:00:00'
22
+  WHERE um.LastAccess = NULL
23 23
     AND ui.JoinDate < '".time_minus(60 * 60 * 24 * 7)."'
24 24
     AND um.Enabled != '2'");
25 25
 $Cache->decrement('stats_user_count', $DB->affected_rows());

+ 8
- 8
sections/schedule/daily/ratio_watch.php View File

@@ -12,7 +12,7 @@ $UserQuery = $DB->query("
12 12
     FROM users_info AS i
13 13
       JOIN users_main AS m ON m.ID = i.UserID
14 14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
15
-      AND i.RatioWatchEnds != '0000-00-00 00:00:00'
15
+      AND i.RatioWatchEnds != NULL
16 16
       AND m.can_leech = '0'
17 17
       AND m.Enabled = '1'");
18 18
 $OffRatioWatch = $DB->collect('ID');
@@ -20,7 +20,7 @@ if (count($OffRatioWatch) > 0) {
20 20
   $DB->query("
21 21
     UPDATE users_info AS ui
22 22
       JOIN users_main AS um ON um.ID = ui.UserID
23
-    SET ui.RatioWatchEnds = '0000-00-00 00:00:00',
23
+    SET ui.RatioWatchEnds = NULL,
24 24
       ui.RatioWatchDownload = '0',
25 25
       um.can_leech = '1',
26 26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
@@ -29,7 +29,7 @@ if (count($OffRatioWatch) > 0) {
29 29
 
30 30
 foreach ($OffRatioWatch as $UserID) {
31 31
   $Cache->begin_transaction("user_info_heavy_$UserID");
32
-  $Cache->update_row(false, array('RatioWatchEnds' => '0000-00-00 00:00:00', 'RatioWatchDownload' => '0', 'CanLeech' => 1));
32
+  $Cache->update_row(false, array('RatioWatchEnds' => NULL, 'RatioWatchDownload' => '0', 'CanLeech' => 1));
33 33
   $Cache->commit_transaction(0);
34 34
   Misc::send_pm($UserID, 0, 'You have been taken off Ratio Watch', "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=".site_url()."rules.php?p=ratio]here[/url].\n");
35 35
   echo "Ratio watch off: $UserID\n";
@@ -46,14 +46,14 @@ $UserQuery = $DB->query("
46 46
       FROM users_info AS i
47 47
         JOIN users_main AS m ON m.ID = i.UserID
48 48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
49
-        AND i.RatioWatchEnds != '0000-00-00 00:00:00'
49
+        AND i.RatioWatchEnds != NULL
50 50
         AND m.Enabled = '1'");
51 51
 $OffRatioWatch = $DB->collect('ID');
52 52
 if (count($OffRatioWatch) > 0) {
53 53
   $DB->query("
54 54
     UPDATE users_info AS ui
55 55
       JOIN users_main AS um ON um.ID = ui.UserID
56
-    SET ui.RatioWatchEnds = '0000-00-00 00:00:00',
56
+    SET ui.RatioWatchEnds = NULL,
57 57
       ui.RatioWatchDownload = '0',
58 58
       um.can_leech = '1'
59 59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
@@ -61,7 +61,7 @@ if (count($OffRatioWatch) > 0) {
61 61
 
62 62
 foreach ($OffRatioWatch as $UserID) {
63 63
   $Cache->begin_transaction("user_info_heavy_$UserID");
64
-  $Cache->update_row(false, array('RatioWatchEnds' => '0000-00-00 00:00:00', 'RatioWatchDownload' => '0', 'CanLeech' => 1));
64
+  $Cache->update_row(false, array('RatioWatchEnds' => NULL, 'RatioWatchDownload' => '0', 'CanLeech' => 1));
65 65
   $Cache->commit_transaction(0);
66 66
   Misc::send_pm($UserID, 0, "You have been taken off Ratio Watch", "Congratulations! Feel free to begin downloading again.\n To ensure that you do not get put on ratio watch again, please read the rules located [url=".site_url()."rules.php?p=ratio]here[/url].\n");
67 67
   echo "Ratio watch off: $UserID\n";
@@ -79,7 +79,7 @@ $DB->query("
79 79
   FROM users_info AS i
80 80
     JOIN users_main AS m ON m.ID = i.UserID
81 81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
82
-    AND i.RatioWatchEnds = '0000-00-00 00:00:00'
82
+    AND i.RatioWatchEnds = NULL
83 83
     AND m.Enabled = '1'
84 84
     AND m.can_leech = '1'");
85 85
 $OnRatioWatch = $DB->collect('ID');
@@ -114,7 +114,7 @@ $UserQuery = $DB->query("
114 114
     SELECT ID, torrent_pass
115 115
     FROM users_info AS i
116 116
       JOIN users_main AS m ON m.ID = i.UserID
117
-    WHERE i.RatioWatchEnds != '0000-00-00 00:00:00'
117
+    WHERE i.RatioWatchEnds != NULL
118 118
       AND i.RatioWatchEnds < '$sqltime'
119 119
       AND m.Enabled = '1'
120 120
       AND m.can_leech != '0'");

+ 1
- 1
sections/schedule/hourly/class_promotion.php View File

@@ -87,7 +87,7 @@ $Criteria[] = array(
87 87
       FROM users_main
88 88
         JOIN users_info ON users_main.ID = users_info.UserID
89 89
       WHERE PermissionID = ".$L['From']."
90
-        AND Warned = '0000-00-00 00:00:00'
90
+        AND Warned = NULL
91 91
         AND Uploaded >= '$L[MinUpload]'
92 92
         AND (Uploaded / Downloaded >= '$L[MinRatio]' OR (Uploaded / Downloaded IS NULL))
93 93
         AND JoinDate < '$L[MaxTime]'

+ 1
- 1
sections/schedule/hourly/disable_leech.php View File

@@ -5,7 +5,7 @@ $DB->query("
5 5
   SELECT ID, torrent_pass
6 6
   FROM users_info AS i
7 7
     JOIN users_main AS m ON m.ID = i.UserID
8
-  WHERE i.RatioWatchEnds != '0000-00-00 00:00:00'
8
+  WHERE i.RatioWatchEnds != NULL
9 9
     AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
10 10
     AND m.Enabled = '1'
11 11
     AND m.can_leech = '1'");

+ 2
- 2
sections/schedule/hourly/expire_warnings.php View File

@@ -7,12 +7,12 @@ $DB->query("
7 7
   WHERE Warned < '$sqltime'");
8 8
 while (list($UserID) = $DB->next_record()) {
9 9
   $Cache->begin_transaction("user_info_$UserID");
10
-  $Cache->update_row(false, array('Warned' => '0000-00-00 00:00:00'));
10
+  $Cache->update_row(false, array('Warned' => NULL));
11 11
   $Cache->commit_transaction(2592000);
12 12
 }
13 13
 
14 14
 $DB->query("
15 15
   UPDATE users_info
16
-  SET Warned = '0000-00-00 00:00:00'
16
+  SET Warned = NULL
17 17
   WHERE Warned < '$sqltime'");
18 18
 ?>

+ 1
- 1
sections/schedule/hourly/hide_old_requests.php View File

@@ -5,5 +5,5 @@ $DB->query("
5 5
   UPDATE requests
6 6
   SET Visible = 0
7 7
   WHERE TimeFilled < (NOW() - INTERVAL 7 DAY)
8
-    AND TimeFilled != '0000-00-00 00:00:00'");
8
+    AND TimeFilled != NULL");
9 9
 ?>

+ 1
- 1
sections/store/promotion.php View File

@@ -115,7 +115,7 @@ if ($DB->has_results()) {
115 115
 
116 116
     }
117 117
 
118
-    if ($Warned != "0000-00-00 00:00:00") {
118
+    if ($Warned != NULL) {
119 119
       $Err[] = "You cannot be promoted while warned";
120 120
     }
121 121
 

+ 2
- 2
sections/tools/data/upscale_pool.php View File

@@ -23,7 +23,7 @@ $RS = $DB->query("
23 23
     m.RequiredRatio
24 24
   FROM users_main AS m
25 25
     LEFT JOIN users_info AS i ON i.UserID = m.ID
26
-  WHERE i.RatioWatchEnds != '0000-00-00 00:00:00'
26
+  WHERE i.RatioWatchEnds != NULL
27 27
     AND m.Enabled = '1'
28 28
   ORDER BY i.RatioWatchEnds ASC
29 29
   LIMIT $Limit");
@@ -32,7 +32,7 @@ list($Results) = $DB->next_record();
32 32
 $DB->query("
33 33
   SELECT COUNT(UserID)
34 34
   FROM users_info
35
-  WHERE BanDate != '0000-00-00 00:00:00'
35
+  WHERE BanDate != NULL
36 36
     AND BanReason = '2'");
37 37
 list($TotalDisabled) = $DB->next_record();
38 38
 $DB->set_query_id($RS);

+ 4
- 4
sections/tools/data/user_flow.php View File

@@ -77,7 +77,7 @@ $RS = $DB->query("
77 77
           DATE_FORMAT(JoinDate, '%Y-%m-%d') AS Date,
78 78
           COUNT(UserID) AS Flow
79 79
         FROM users_info
80
-        WHERE JoinDate != '0000-00-00 00:00:00'
80
+        WHERE JoinDate != NULL
81 81
         GROUP BY Date
82 82
       ) AS j
83 83
       LEFT JOIN (
@@ -85,7 +85,7 @@ $RS = $DB->query("
85 85
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
86 86
           COUNT(UserID) AS Flow
87 87
         FROM users_info
88
-        WHERE BanDate != '0000-00-00 00:00:00'
88
+        WHERE BanDate != NULL
89 89
           AND BanReason = '1'
90 90
         GROUP BY Date
91 91
       ) AS m ON j.Date = m.Date
@@ -94,7 +94,7 @@ $RS = $DB->query("
94 94
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
95 95
           COUNT(UserID) AS Flow
96 96
         FROM users_info
97
-        WHERE BanDate != '0000-00-00 00:00:00'
97
+        WHERE BanDate != NULL
98 98
           AND BanReason = '2'
99 99
         GROUP BY Date
100 100
       ) AS r ON j.Date = r.Date
@@ -103,7 +103,7 @@ $RS = $DB->query("
103 103
           DATE_FORMAT(BanDate, '%Y-%m-%d') AS Date,
104 104
           COUNT(UserID) AS Flow
105 105
         FROM users_info
106
-        WHERE BanDate != '0000-00-00 00:00:00'
106
+        WHERE BanDate != NULL
107 107
           AND BanReason = '3'
108 108
         GROUP BY Date
109 109
       ) AS i ON j.Date = i.Date

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

@@ -571,14 +571,14 @@ foreach ($TorrentList as $Torrent) {
571 571
             <blockquote>
572 572
               Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
573 573
 <?  if ($Seeders == 0) {
574
-    if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
574
+    if ($LastActive != NULL && time() - strtotime($LastActive) >= 1209600) { ?>
575 575
             <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
576 576
 <?    } else { ?>
577 577
             <br />Last active: <?=time_diff($LastActive); ?>
578 578
 <?    }
579 579
   }
580 580
 
581
-  if (($Seeders == 0 && $LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
581
+  if (($Seeders == 0 && $LastActive != NULL && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) || check_perms('users_mod')) { ?>
582 582
             <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>" class="brackets">Request re-seed</a>
583 583
 <?  }
584 584
 

+ 3
- 3
sections/torrents/functions.php View File

@@ -244,7 +244,7 @@ function get_group_requests($GroupID) {
244 244
       SELECT ID
245 245
       FROM requests
246 246
       WHERE GroupID = $GroupID
247
-        AND TimeFilled = '0000-00-00 00:00:00'");
247
+        AND TimeFilled = NULL");
248 248
     $Requests = $DB->collect('ID');
249 249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
250 250
   }
@@ -416,12 +416,12 @@ function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $G
416 416
             <blockquote>
417 417
               Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
418 418
 <?  if ($Seeders == 0) {
419
-    if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 1209600) { ?>
419
+    if ($LastActive != NULL && time() - strtotime($LastActive) >= 1209600) { ?>
420 420
                 <br /><strong>Last active: <?=time_diff($LastActive);?></strong>
421 421
 <?    } else { ?>
422 422
                 <br />Last active: <?=time_diff($LastActive);?>
423 423
 <?    }
424
-    if ($LastActive != '0000-00-00 00:00:00' && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
424
+    if ($LastActive != NULL && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
425 425
                 <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=($TorrentID)?>&amp;groupid=<?=($GroupID)?>" class="brackets">Request re-seed</a>
426 426
 <?    }
427 427
   } ?>

+ 1
- 1
sections/torrents/reseed.php View File

@@ -16,7 +16,7 @@ if (!check_perms('users_mod')) {
16 16
   if (time() - strtotime($LastReseedRequest) < 864000) {
17 17
     error('There was already a re-seed request for this torrent within the past 10 days.');
18 18
   }
19
-  if ($LastActive == '0000-00-00 00:00:00' || time() - strtotime($LastActive) < 345678) {
19
+  if ($LastActive == NULL || time() - strtotime($LastActive) < 345678) {
20 20
     error(403);
21 21
   }
22 22
 }

+ 2
- 2
sections/user/advancedsearch.php View File

@@ -413,9 +413,9 @@ if (count($_GET)) {
413 413
     }
414 414
 
415 415
     if ($_GET['warned'] == 'yes') {
416
-      $Where[] = 'ui1.Warned != \'0000-00-00 00:00:00\'';
416
+      $Where[] = 'ui1.Warned != NULL';
417 417
     } elseif ($_GET['warned'] == 'no') {
418
-      $Where[] = 'ui1.Warned = \'0000-00-00 00:00:00\'';
418
+      $Where[] = 'ui1.Warned = NULL';
419 419
     }
420 420
 
421 421
     if ($_GET['disabled_ip']) {

+ 2
- 2
sections/user/take_edit.php View File

@@ -164,12 +164,12 @@ if ($CurEmail != $_POST['email']) {
164 164
       UPDATE users_history_emails
165 165
       SET Time = '".sqltime()."'
166 166
       WHERE UserID = '$UserID'
167
-        AND Time = '0000-00-00 00:00:00'");
167
+        AND Time = NULL");
168 168
     $DB->query("
169 169
       INSERT INTO users_history_emails
170 170
         (UserID, Email, Time, IP)
171 171
       VALUES
172
-        ('$UserID', '".DBCrypt::encrypt($NewEmail)."', '0000-00-00 00:00:00', '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
172
+        ('$UserID', '".DBCrypt::encrypt($NewEmail)."', NULL, '".DBCrypt::encrypt($_SERVER['REMOTE_ADDR'])."')");
173 173
 
174 174
   } else {
175 175
     error($Err);

+ 9
- 9
sections/user/takemoderate.php View File

@@ -226,7 +226,7 @@ $DB->set_query_id($QueryID);
226 226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
227 227
   $DB->query("
228 228
     UPDATE users_info
229
-    SET RatioWatchEnds = '0000-00-00 00:00:00', RatioWatchDownload = '0', RatioWatchTimes = '0'
229
+    SET RatioWatchEnds = NULL, RatioWatchDownload = '0', RatioWatchTimes = '0'
230 230
     WHERE UserID = '$UserID'");
231 231
   $EditSummary[] = 'RatioWatch history reset';
232 232
 }
@@ -268,13 +268,13 @@ if ($_POST['ResetEmailHistory'] && check_perms('users_edit_reset_keys')) {
268 268
       INSERT INTO users_history_emails
269 269
         (UserID, Email, Time, IP)
270 270
       VALUES
271
-        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', '0000-00-00 00:00:00', '".DBCrypt::encrypt('127.0.0.1')."')");
271
+        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".DBCrypt::encrypt('127.0.0.1')."')");
272 272
   } else {
273 273
     $DB->query("
274 274
       INSERT INTO users_history_emails
275 275
         (UserID, Email, Time, IP)
276 276
       VALUES
277
-        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', '0000-00-00 00:00:00', '".$Cur['IP']."')");
277
+        ('$UserID', '".DBCrypt::encrypt($Username.'@'.SITE_DOMAIN)."', NULL, '".$Cur['IP']."')");
278 278
   }
279 279
   $DB->query("
280 280
     UPDATE users_main
@@ -486,7 +486,7 @@ if (check_perms('users_edit_badges')) {
486 486
   $Cache->delete_value("user_badges_".$UserID);
487 487
 }
488 488
 
489
-if ($Warned == 1 && $Cur['Warned'] == '0000-00-00 00:00:00' && check_perms('users_warn')) {
489
+if ($Warned == 1 && $Cur['Warned'] == NULL && check_perms('users_warn')) {
490 490
   $Weeks = 'week' . ($WarnLength === 1 ? '' : 's');
491 491
   Misc::send_pm($UserID, 0, 'You have received a warning', "You have been [url=".site_url()."wiki.php?action=article&amp;id=218]warned for $WarnLength {$Weeks}[/url] by [user]".$LoggedUser['Username']."[/user]. The reason given was:
492 492
 [quote]{$WarnReason}[/quote]");
@@ -498,10 +498,10 @@ if ($Warned == 1 && $Cur['Warned'] == '0000-00-00 00:00:00' && check_perms('user
498 498
   $EditSummary[] = db_string($Msg);
499 499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
500 500
 
501
-} elseif ($Warned == 0 && $Cur['Warned'] != '0000-00-00 00:00:00' && check_perms('users_warn')) {
502
-  $UpdateSet[] = "Warned = '0000-00-00 00:00:00'";
501
+} elseif ($Warned == 0 && $Cur['Warned'] != NULL && check_perms('users_warn')) {
502
+  $UpdateSet[] = "Warned = NULL";
503 503
   $EditSummary[] = 'warning removed';
504
-  $LightUpdates['Warned'] = '0000-00-00 00:00:00';
504
+  $LightUpdates['Warned'] = NULL;
505 505
 
506 506
 } elseif ($Warned == 1 && $ExtendWarning != '---' && check_perms('users_warn')) {
507 507
   $Weeks = 'week' . ($ExtendWarning === 1 ? '' : 's');
@@ -700,13 +700,13 @@ if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
700 700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
701 701
 
702 702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
703
-      $UpdateSet[] = "i.RatioWatchEnds = '0000-00-00 00:00:00'";
703
+      $UpdateSet[] = "i.RatioWatchEnds = NULL";
704 704
       $CanLeech = 1;
705 705
       $UpdateSet[] = "m.can_leech = '1'";
706 706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";
707 707
     } else {
708 708
       $EnableStr .= ' (Ratio: '.Format::get_ratio_html($Cur['Uploaded'], $Cur['Downloaded'], false).', RR: '.number_format($Cur['RequiredRatio'],2).')';
709
-      if ($Cur['RatioWatchEnds'] != '0000-00-00 00:00:00') {
709
+      if ($Cur['RatioWatchEnds'] != NULL) {
710 710
         $UpdateSet[] = "i.RatioWatchEnds = NOW()";
711 711
         $UpdateSet[] = "i.RatioWatchDownload = m.Downloaded";
712 712
         $CanLeech = 0;

+ 7
- 7
sections/user/user.php View File

@@ -375,7 +375,7 @@ if ($LoggedUser['Class'] >= 200 || $DB->has_results()) { ?>
375 375
         <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
376 376
 <?
377 377
   }
378
-  if (($OwnProfile || check_perms('users_mod')) && $Warned != '0000-00-00 00:00:00') {
378
+  if (($OwnProfile || check_perms('users_mod')) && $Warned != NULL) {
379 379
 ?>
380 380
         <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning expires in: <?=time_diff((date('Y-m-d H:i', strtotime($Warned))))?></li>
381 381
 <?  } ?>
@@ -654,7 +654,7 @@ DonationsView::render_donor_stats($UserID);
654 654
   </div>
655 655
   <div class="main_column">
656 656
 <?
657
-if ($RatioWatchEnds != '0000-00-00 00:00:00'
657
+if ($RatioWatchEnds != NULL
658 658
     && (time() < strtotime($RatioWatchEnds))
659 659
     && ($Downloaded * $RequiredRatio) > $Uploaded
660 660
     ) {
@@ -701,7 +701,7 @@ if (check_paranoia_here('snatched')) {
701 701
         INNER JOIN torrents_group AS g ON t.GroupID = g.ID
702 702
       WHERE s.uid = '$UserID'
703 703
         AND g.WikiImage != ''
704
-      GROUP BY g.ID
704
+      GROUP BY g.ID,s.tstamp
705 705
       ORDER BY s.tstamp DESC
706 706
       LIMIT 5");
707 707
     $RecentSnatches = $DB->to_array();
@@ -749,7 +749,7 @@ if (check_paranoia_here('uploads')) {
749 749
         INNER JOIN torrents AS t ON t.GroupID = g.ID
750 750
       WHERE t.UserID = '$UserID'
751 751
         AND g.WikiImage != ''
752
-      GROUP BY g.ID
752
+      GROUP BY g.ID,t.Time
753 753
       ORDER BY t.Time DESC
754 754
       LIMIT 5");
755 755
     $RecentUploads = $DB->to_array();
@@ -1324,10 +1324,10 @@ if (!$DisablePoints) {
1324 1324
       <tr>
1325 1325
         <td class="label">Warned:</td>
1326 1326
         <td>
1327
-          <input type="checkbox" name="Warned"<? if ($Warned != '0000-00-00 00:00:00') { ?> checked="checked"<? } ?> />
1327
+          <input type="checkbox" name="Warned"<? if ($Warned != NULL) { ?> checked="checked"<? } ?> />
1328 1328
         </td>
1329 1329
       </tr>
1330
-<?    if ($Warned == '0000-00-00 00:00:00') { // user is not warned ?>
1330
+<?    if ($Warned == NULL) { // user is not warned ?>
1331 1331
       <tr>
1332 1332
         <td class="label">Expiration:</td>
1333 1333
         <td>
@@ -1406,7 +1406,7 @@ if (!$DisablePoints) {
1406 1406
       </tr>
1407 1407
 <?  if (check_perms('users_disable_posts') || check_perms('users_disable_any')) {
1408 1408
     $DB->query("
1409
-      SELECT DISTINCT Email, IP
1409
+      SELECT DISTINCT Email, IP, Time
1410 1410
       FROM users_history_emails
1411 1411
       WHERE UserID = $UserID
1412 1412
       ORDER BY Time ASC");

+ 2
- 2
sections/userhistory/email_history.php View File

@@ -60,7 +60,7 @@ if ($UsersOnly == 1) {
60 60
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
61 61
     WHERE h.UserID = '$UserID'
62 62
       AND h2.UserID > 0"
63
-      /*AND Time != '0000-00-00 00:00:00'*/."
63
+      /*AND Time != NULL*/."
64 64
     ORDER BY Time DESC");
65 65
 } else {
66 66
   $DB->query("
@@ -81,7 +81,7 @@ if ($UsersOnly == 1) {
81 81
     FROM users_history_emails AS h
82 82
       LEFT JOIN geoip_country AS c ON INET_ATON(h.IP) BETWEEN c.StartIP AND c.EndIP
83 83
     WHERE UserID = '$UserID' "
84
-      /*AND Time != '0000-00-00 00:00:00'*/."
84
+      /*AND Time != NULL*/."
85 85
     ORDER BY Time DESC");
86 86
 }
87 87
 $History = $DB->to_array();

+ 4
- 4
sections/userhistory/email_history2.php View File

@@ -114,25 +114,25 @@ if (count($History) === 1) {
114 114
   $Invite['EndTime'] = $Joined;
115 115
   $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
116 116
   $Invite['IP'] = $History[0]['IP'];
117
-  if ($Current['StartTime'] == '0000-00-00 00:00:00') {
117
+  if ($Current['StartTime'] == NULL) {
118 118
     $Current['StartTime'] = $Joined;
119 119
   }
120 120
 } else {
121 121
   foreach ($History as $Key => $Val) {
122
-    if (isset($History[$Key + 1]) && $History[$Key + 1]['Time'] == '0000-00-00 00:00:00' && $Val['Time'] != '0000-00-00 00:00:00') {
122
+    if (isset($History[$Key + 1]) && $History[$Key + 1]['Time'] == NULL && $Val['Time'] != NULL) {
123 123
       // Invited email
124 124
       $Invite['Email'] = $Val['Email'];
125 125
       $Invite['EndTime'] = $Joined;
126 126
       $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
127 127
       $Invite['IP'] = $Val['IP'];
128 128
 
129
-    } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time'] != '0000-00-00 00:00:00') {
129
+    } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time'] != NULL) {
130 130
       // Old email
131 131
       $i = 1;
132 132
       while ($Val['Email'] == $History[$Key + $i]['Email']) {
133 133
         $i++;
134 134
       }
135
-      $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time'] != '0000-00-00 00:00:00') ? $History[$Key + $i]['Time'] : $Joined;
135
+      $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time'] != NULL) ? $History[$Key + $i]['Time'] : $Joined;
136 136
       $Old[$Key]['EndTime'] = $Val['Time'];
137 137
       $Old[$Key]['IP'] = $Val['IP'];
138 138
       $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));

Loading…
Cancel
Save