Browse Source

Allow Gazelle to run with mysql strict mode enabled.

ngxez 8 years ago
parent
commit
ad7abee5c2
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
       'AddedTime' => sqltime(),
279
       'AddedTime' => sqltime(),
280
       'Body' => $PostBody,
280
       'Body' => $PostBody,
281
       'EditedUserID' => 0,
281
       'EditedUserID' => 0,
282
-      'EditedTime' => '0000-00-00 00:00:00',
282
+      'EditedTime' => NULL,
283
       'Username' => ''
283
       'Username' => ''
284
       );
284
       );
285
     G::$Cache->insert('', $Post);
285
     G::$Cache->insert('', $Post);

+ 1
- 1
classes/script_start.php View File

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

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

5
 
5
 
6
 function time_ago($TimeStamp) {
6
 function time_ago($TimeStamp) {
7
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
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
       return false;
9
       return false;
10
     }
10
     }
11
     $TimeStamp = strtotime($TimeStamp);
11
     $TimeStamp = strtotime($TimeStamp);
22
  */
22
  */
23
 function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
23
 function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
24
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
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
       return 'Never';
26
       return 'Never';
27
     }
27
     }
28
     $TimeStamp = strtotime($TimeStamp);
28
     $TimeStamp = strtotime($TimeStamp);

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

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

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

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

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

80
 //Handles timestamps
80
 //Handles timestamps
81
 function dostime($TimeStamp = 0) {
81
 function dostime($TimeStamp = 0) {
82
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
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
       return 'Never';
84
       return 'Never';
85
     }
85
     }
86
     $TimeStamp = strtotime($TimeStamp);
86
     $TimeStamp = strtotime($TimeStamp);

+ 77
- 77
gazelle.sql View File

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

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

261
       'paranoia' => $Paranoia,
261
       'paranoia' => $Paranoia,
262
       'artist' => $Artist === '1',
262
       'artist' => $Artist === '1',
263
       'donor' => $Donor === '1',
263
       'donor' => $Donor === '1',
264
-      'warned' => $Warned !== '0000-00-00 00:00:00',
264
+      'warned' => $Warned !== NULL,
265
       'avatar' => $Avatar,
265
       'avatar' => $Avatar,
266
       'enabled' => $Enabled === '2' ? false : true,
266
       'enabled' => $Enabled === '2' ? false : true,
267
       'userTitle' => $UserTitle
267
       'userTitle' => $UserTitle

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

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

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

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

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

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

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

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

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

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

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

138
       (TopicID, Question, Answers)
138
       (TopicID, Question, Answers)
139
     VALUES
139
     VALUES
140
       ('$TopicID', '".db_string($Question)."', '".db_string(serialize($Answers))."')");
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
   if ($ForumID == STAFF_FORUM) {
143
   if ($ForumID == STAFF_FORUM) {
144
     send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" ".site_url()."forums.php?action=viewthread&threadid=$TopicID");
144
     send_irc('PRIVMSG '.ADMIN_CHAN.' :!mod Poll created by '.$LoggedUser['Username'].": \"$Question\" ".site_url()."forums.php?action=viewthread&threadid=$TopicID");
203
   'AddedTime' => sqltime(),
203
   'AddedTime' => sqltime(),
204
   'Body' => $Body,
204
   'Body' => $Body,
205
   'EditedUserID' => 0,
205
   'EditedUserID' => 0,
206
-  'EditedTime' => '0000-00-00 00:00:00'
206
+  'EditedTime' => NULL
207
   );
207
   );
208
 $Cache->insert('', $Post);
208
 $Cache->insert('', $Post);
209
 $Cache->commit_transaction(0);
209
 $Cache->commit_transaction(0);

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

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

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

260
 
260
 
261
 ?>
261
 ?>
262
   <div class="box thin clear">
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
     <div class="pad<? if (/*$LastRead !== null || */$ThreadInfo['IsLocked']) { echo ' hidden'; } ?>" id="threadpoll">
264
     <div class="pad<? if (/*$LastRead !== null || */$ThreadInfo['IsLocked']) { echo ' hidden'; } ?>" id="threadpoll">
265
       <p><strong><?=display_str($Question)?></strong></p>
265
       <p><strong><?=display_str($Question)?></strong></p>
266
 <?  if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !Forums::check_forumperm($ForumID)) { ?>
266
 <?  if ($UserResponse !== null || $Closed || $ThreadInfo['IsLocked'] || !Forums::check_forumperm($ForumID)) { ?>
383
       </div>
383
       </div>
384
 <?  }
384
 <?  }
385
   if (check_perms('forums_polls_moderate') && !$RevealVoters) {
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
       <form class="manage_form" name="poll" action="forums.php" method="post">
388
       <form class="manage_form" name="poll" action="forums.php" method="post">
389
         <input type="hidden" name="action" value="poll_mod" />
389
         <input type="hidden" name="action" value="poll_mod" />

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

18
   $Cache->cache_value('news_latest_title', $News[0][1], 0);
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
   $Cache->begin_transaction("user_info_heavy_$UserID");
22
   $Cache->begin_transaction("user_info_heavy_$UserID");
23
   $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
23
   $Cache->update_row(false, array('LastReadNews' => $News[0][0]));
24
   $Cache->commit_transaction(0);
24
   $Cache->commit_transaction(0);
276
   list($RequestCount, $FilledCount) = $RequestStats;
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
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {
290
 if ($SnatchStats = $Cache->get_value('stats_snatches')) {

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

68
               m.PassHash = '".db_string(Users::make_sec_hash($_REQUEST['password']))."',
68
               m.PassHash = '".db_string(Users::make_sec_hash($_REQUEST['password']))."',
69
               i.ResetKey = '',
69
               i.ResetKey = '',
70
               m.LastLogin = NOW(),
70
               m.LastLogin = NOW(),
71
-              i.ResetExpires = '0000-00-00 00:00:00'
71
+              i.ResetExpires = NULL
72
             WHERE m.ID = '$UserID'
72
             WHERE m.ID = '$UserID'
73
               AND i.UserID = m.ID");
73
               AND i.UserID = m.ID");
74
           $DB->query("
74
           $DB->query("
94
         $DB->query("
94
         $DB->query("
95
           UPDATE users_info
95
           UPDATE users_info
96
           SET ResetKey = '',
96
           SET ResetKey = '',
97
-            ResetExpires = '0000-00-00 00:00:00'
97
+            ResetExpires = NULL
98
           WHERE UserID = '$UserID'");
98
           WHERE UserID = '$UserID'");
99
         $_SESSION['reseterr'] = 'The link you were given has expired.'; // Error message to display on form
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
         INSERT INTO users_history_emails
162
         INSERT INTO users_history_emails
163
           (UserID, Email, Time, IP)
163
           (UserID, Email, Time, IP)
164
         VALUES
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
       if ($_REQUEST['email'] != $InviteEmail) {
167
       if ($_REQUEST['email'] != $InviteEmail) {
168
         $DB->query("
168
         $DB->query("
176
 
176
 
177
       // Manage invite trees, delete invite
177
       // Manage invite trees, delete invite
178
 
178
 
179
-      if ($InviterID !== null) {
179
+      if ($InviterID !== null && $InviterID !== 0) {
180
         $DB->query("
180
         $DB->query("
181
           SELECT TreePosition, TreeID, TreeLevel
181
           SELECT TreePosition, TreeID, TreeLevel
182
           FROM invite_tree
182
           FROM invite_tree

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

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

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

11
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
11
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
12
       AND um.LastAccess < '".time_minus(3600 * 24 * 110, true)."'
12
       AND um.LastAccess < '".time_minus(3600 * 24 * 110, true)."'
13
       AND um.LastAccess > '".time_minus(3600 * 24 * 111, true)."'
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
       AND ui.Donor = '0'
15
       AND ui.Donor = '0'
16
       AND um.Enabled != '2'
16
       AND um.Enabled != '2'
17
       AND ul.UserID IS NULL
17
       AND ul.UserID IS NULL
29
       LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
29
       LEFT JOIN users_levels AS ul ON ul.UserID = um.ID AND ul.PermissionID = '".CELEB."'
30
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
30
     WHERE um.PermissionID IN ('".USER."', '".MEMBER  ."')
31
       AND um.LastAccess < '".time_minus(3600 * 24 * 30 * 4)."'
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
       AND ui.Donor = '0'
33
       AND ui.Donor = '0'
34
       AND um.Enabled != '2'
34
       AND um.Enabled != '2'
35
       AND ul.UserID IS NULL
35
       AND ul.UserID IS NULL

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

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

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

12
     FROM users_info AS i
12
     FROM users_info AS i
13
       JOIN users_main AS m ON m.ID = i.UserID
13
       JOIN users_main AS m ON m.ID = i.UserID
14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
15
-      AND i.RatioWatchEnds != '0000-00-00 00:00:00'
15
+      AND i.RatioWatchEnds != NULL
16
       AND m.can_leech = '0'
16
       AND m.can_leech = '0'
17
       AND m.Enabled = '1'");
17
       AND m.Enabled = '1'");
18
 $OffRatioWatch = $DB->collect('ID');
18
 $OffRatioWatch = $DB->collect('ID');
20
   $DB->query("
20
   $DB->query("
21
     UPDATE users_info AS ui
21
     UPDATE users_info AS ui
22
       JOIN users_main AS um ON um.ID = ui.UserID
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
       ui.RatioWatchDownload = '0',
24
       ui.RatioWatchDownload = '0',
25
       um.can_leech = '1',
25
       um.can_leech = '1',
26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
29
 
29
 
30
 foreach ($OffRatioWatch as $UserID) {
30
 foreach ($OffRatioWatch as $UserID) {
31
   $Cache->begin_transaction("user_info_heavy_$UserID");
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
   $Cache->commit_transaction(0);
33
   $Cache->commit_transaction(0);
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");
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
   echo "Ratio watch off: $UserID\n";
35
   echo "Ratio watch off: $UserID\n";
46
       FROM users_info AS i
46
       FROM users_info AS i
47
         JOIN users_main AS m ON m.ID = i.UserID
47
         JOIN users_main AS m ON m.ID = i.UserID
48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
49
-        AND i.RatioWatchEnds != '0000-00-00 00:00:00'
49
+        AND i.RatioWatchEnds != NULL
50
         AND m.Enabled = '1'");
50
         AND m.Enabled = '1'");
51
 $OffRatioWatch = $DB->collect('ID');
51
 $OffRatioWatch = $DB->collect('ID');
52
 if (count($OffRatioWatch) > 0) {
52
 if (count($OffRatioWatch) > 0) {
53
   $DB->query("
53
   $DB->query("
54
     UPDATE users_info AS ui
54
     UPDATE users_info AS ui
55
       JOIN users_main AS um ON um.ID = ui.UserID
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
       ui.RatioWatchDownload = '0',
57
       ui.RatioWatchDownload = '0',
58
       um.can_leech = '1'
58
       um.can_leech = '1'
59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
61
 
61
 
62
 foreach ($OffRatioWatch as $UserID) {
62
 foreach ($OffRatioWatch as $UserID) {
63
   $Cache->begin_transaction("user_info_heavy_$UserID");
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
   $Cache->commit_transaction(0);
65
   $Cache->commit_transaction(0);
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");
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
   echo "Ratio watch off: $UserID\n";
67
   echo "Ratio watch off: $UserID\n";
79
   FROM users_info AS i
79
   FROM users_info AS i
80
     JOIN users_main AS m ON m.ID = i.UserID
80
     JOIN users_main AS m ON m.ID = i.UserID
81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
82
-    AND i.RatioWatchEnds = '0000-00-00 00:00:00'
82
+    AND i.RatioWatchEnds = NULL
83
     AND m.Enabled = '1'
83
     AND m.Enabled = '1'
84
     AND m.can_leech = '1'");
84
     AND m.can_leech = '1'");
85
 $OnRatioWatch = $DB->collect('ID');
85
 $OnRatioWatch = $DB->collect('ID');
114
     SELECT ID, torrent_pass
114
     SELECT ID, torrent_pass
115
     FROM users_info AS i
115
     FROM users_info AS i
116
       JOIN users_main AS m ON m.ID = i.UserID
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
       AND i.RatioWatchEnds < '$sqltime'
118
       AND i.RatioWatchEnds < '$sqltime'
119
       AND m.Enabled = '1'
119
       AND m.Enabled = '1'
120
       AND m.can_leech != '0'");
120
       AND m.can_leech != '0'");

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

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

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

5
   SELECT ID, torrent_pass
5
   SELECT ID, torrent_pass
6
   FROM users_info AS i
6
   FROM users_info AS i
7
     JOIN users_main AS m ON m.ID = i.UserID
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
     AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
9
     AND i.RatioWatchDownload + 10 * 1024 * 1024 * 1024 < m.Downloaded
10
     AND m.Enabled = '1'
10
     AND m.Enabled = '1'
11
     AND m.can_leech = '1'");
11
     AND m.can_leech = '1'");

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

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

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

5
   UPDATE requests
5
   UPDATE requests
6
   SET Visible = 0
6
   SET Visible = 0
7
   WHERE TimeFilled < (NOW() - INTERVAL 7 DAY)
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
 
115
 
116
     }
116
     }
117
 
117
 
118
-    if ($Warned != "0000-00-00 00:00:00") {
118
+    if ($Warned != NULL) {
119
       $Err[] = "You cannot be promoted while warned";
119
       $Err[] = "You cannot be promoted while warned";
120
     }
120
     }
121
 
121
 

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

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

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

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

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

571
             <blockquote>
571
             <blockquote>
572
               Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
572
               Uploaded by <?=Users::format_username($UserID, false, false, false)?> <?=time_diff($TorrentTime);?>
573
 <?  if ($Seeders == 0) {
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
             <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
575
             <br /><strong>Last active: <?=time_diff($LastActive); ?></strong>
576
 <?    } else { ?>
576
 <?    } else { ?>
577
             <br />Last active: <?=time_diff($LastActive); ?>
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
             <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=$TorrentID?>&amp;groupid=<?=$GroupID?>" class="brackets">Request re-seed</a>
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
       SELECT ID
244
       SELECT ID
245
       FROM requests
245
       FROM requests
246
       WHERE GroupID = $GroupID
246
       WHERE GroupID = $GroupID
247
-        AND TimeFilled = '0000-00-00 00:00:00'");
247
+        AND TimeFilled = NULL");
248
     $Requests = $DB->collect('ID');
248
     $Requests = $DB->collect('ID');
249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
250
   }
250
   }
416
             <blockquote>
416
             <blockquote>
417
               Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
417
               Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
418
 <?  if ($Seeders == 0) {
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
                 <br /><strong>Last active: <?=time_diff($LastActive);?></strong>
420
                 <br /><strong>Last active: <?=time_diff($LastActive);?></strong>
421
 <?    } else { ?>
421
 <?    } else { ?>
422
                 <br />Last active: <?=time_diff($LastActive);?>
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
                 <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=($TorrentID)?>&amp;groupid=<?=($GroupID)?>" class="brackets">Request re-seed</a>
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
   if (time() - strtotime($LastReseedRequest) < 864000) {
16
   if (time() - strtotime($LastReseedRequest) < 864000) {
17
     error('There was already a re-seed request for this torrent within the past 10 days.');
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
     error(403);
20
     error(403);
21
   }
21
   }
22
 }
22
 }

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

413
     }
413
     }
414
 
414
 
415
     if ($_GET['warned'] == 'yes') {
415
     if ($_GET['warned'] == 'yes') {
416
-      $Where[] = 'ui1.Warned != \'0000-00-00 00:00:00\'';
416
+      $Where[] = 'ui1.Warned != NULL';
417
     } elseif ($_GET['warned'] == 'no') {
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
     if ($_GET['disabled_ip']) {
421
     if ($_GET['disabled_ip']) {

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

164
       UPDATE users_history_emails
164
       UPDATE users_history_emails
165
       SET Time = '".sqltime()."'
165
       SET Time = '".sqltime()."'
166
       WHERE UserID = '$UserID'
166
       WHERE UserID = '$UserID'
167
-        AND Time = '0000-00-00 00:00:00'");
167
+        AND Time = NULL");
168
     $DB->query("
168
     $DB->query("
169
       INSERT INTO users_history_emails
169
       INSERT INTO users_history_emails
170
         (UserID, Email, Time, IP)
170
         (UserID, Email, Time, IP)
171
       VALUES
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
   } else {
174
   } else {
175
     error($Err);
175
     error($Err);

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

226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
227
   $DB->query("
227
   $DB->query("
228
     UPDATE users_info
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
     WHERE UserID = '$UserID'");
230
     WHERE UserID = '$UserID'");
231
   $EditSummary[] = 'RatioWatch history reset';
231
   $EditSummary[] = 'RatioWatch history reset';
232
 }
232
 }
268
       INSERT INTO users_history_emails
268
       INSERT INTO users_history_emails
269
         (UserID, Email, Time, IP)
269
         (UserID, Email, Time, IP)
270
       VALUES
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
   } else {
272
   } else {
273
     $DB->query("
273
     $DB->query("
274
       INSERT INTO users_history_emails
274
       INSERT INTO users_history_emails
275
         (UserID, Email, Time, IP)
275
         (UserID, Email, Time, IP)
276
       VALUES
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
   $DB->query("
279
   $DB->query("
280
     UPDATE users_main
280
     UPDATE users_main
486
   $Cache->delete_value("user_badges_".$UserID);
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
   $Weeks = 'week' . ($WarnLength === 1 ? '' : 's');
490
   $Weeks = 'week' . ($WarnLength === 1 ? '' : 's');
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:
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
 [quote]{$WarnReason}[/quote]");
492
 [quote]{$WarnReason}[/quote]");
498
   $EditSummary[] = db_string($Msg);
498
   $EditSummary[] = db_string($Msg);
499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
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
   $EditSummary[] = 'warning removed';
503
   $EditSummary[] = 'warning removed';
504
-  $LightUpdates['Warned'] = '0000-00-00 00:00:00';
504
+  $LightUpdates['Warned'] = NULL;
505
 
505
 
506
 } elseif ($Warned == 1 && $ExtendWarning != '---' && check_perms('users_warn')) {
506
 } elseif ($Warned == 1 && $ExtendWarning != '---' && check_perms('users_warn')) {
507
   $Weeks = 'week' . ($ExtendWarning === 1 ? '' : 's');
507
   $Weeks = 'week' . ($ExtendWarning === 1 ? '' : 's');
700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
701
 
701
 
702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
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
       $CanLeech = 1;
704
       $CanLeech = 1;
705
       $UpdateSet[] = "m.can_leech = '1'";
705
       $UpdateSet[] = "m.can_leech = '1'";
706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";
706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";
707
     } else {
707
     } else {
708
       $EnableStr .= ' (Ratio: '.Format::get_ratio_html($Cur['Uploaded'], $Cur['Downloaded'], false).', RR: '.number_format($Cur['RequiredRatio'],2).')';
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
         $UpdateSet[] = "i.RatioWatchEnds = NOW()";
710
         $UpdateSet[] = "i.RatioWatchEnds = NOW()";
711
         $UpdateSet[] = "i.RatioWatchDownload = m.Downloaded";
711
         $UpdateSet[] = "i.RatioWatchDownload = m.Downloaded";
712
         $CanLeech = 0;
712
         $CanLeech = 0;

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

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

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

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

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

114
   $Invite['EndTime'] = $Joined;
114
   $Invite['EndTime'] = $Joined;
115
   $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
115
   $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
116
   $Invite['IP'] = $History[0]['IP'];
116
   $Invite['IP'] = $History[0]['IP'];
117
-  if ($Current['StartTime'] == '0000-00-00 00:00:00') {
117
+  if ($Current['StartTime'] == NULL) {
118
     $Current['StartTime'] = $Joined;
118
     $Current['StartTime'] = $Joined;
119
   }
119
   }
120
 } else {
120
 } else {
121
   foreach ($History as $Key => $Val) {
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
       // Invited email
123
       // Invited email
124
       $Invite['Email'] = $Val['Email'];
124
       $Invite['Email'] = $Val['Email'];
125
       $Invite['EndTime'] = $Joined;
125
       $Invite['EndTime'] = $Joined;
126
       $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
126
       $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
127
       $Invite['IP'] = $Val['IP'];
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
       // Old email
130
       // Old email
131
       $i = 1;
131
       $i = 1;
132
       while ($Val['Email'] == $History[$Key + $i]['Email']) {
132
       while ($Val['Email'] == $History[$Key + $i]['Email']) {
133
         $i++;
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
       $Old[$Key]['EndTime'] = $Val['Time'];
136
       $Old[$Key]['EndTime'] = $Val['Time'];
137
       $Old[$Key]['IP'] = $Val['IP'];
137
       $Old[$Key]['IP'] = $Val['IP'];
138
       $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
138
       $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));

Loading…
Cancel
Save