Browse Source

Use IS and IS NOT for newly added sql NULLs

spaghetti 8 years ago
parent
commit
beaf9b254b

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

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

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

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

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

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

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

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

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

@@ -12,7 +12,7 @@ $UserQuery = $DB->query("
12 12
     FROM users_info AS i
13 13
       JOIN users_main AS m ON m.ID = i.UserID
14 14
     WHERE m.Uploaded/m.Downloaded >= m.RequiredRatio
15
-      AND i.RatioWatchEnds != NULL
15
+      AND i.RatioWatchEnds IS NOT NULL
16 16
       AND m.can_leech = '0'
17 17
       AND m.Enabled = '1'");
18 18
 $OffRatioWatch = $DB->collect('ID');
@@ -20,7 +20,7 @@ if (count($OffRatioWatch) > 0) {
20 20
   $DB->query("
21 21
     UPDATE users_info AS ui
22 22
       JOIN users_main AS um ON um.ID = ui.UserID
23
-    SET ui.RatioWatchEnds = NULL,
23
+    SET ui.RatioWatchEnds IS NULL,
24 24
       ui.RatioWatchDownload = '0',
25 25
       um.can_leech = '1',
26 26
       ui.AdminComment = CONCAT('$sqltime - Leeching re-enabled by adequate ratio.\n\n', ui.AdminComment)
@@ -46,14 +46,14 @@ $UserQuery = $DB->query("
46 46
       FROM users_info AS i
47 47
         JOIN users_main AS m ON m.ID = i.UserID
48 48
       WHERE m.Uploaded / m.Downloaded >= m.RequiredRatio
49
-        AND i.RatioWatchEnds != NULL
49
+        AND i.RatioWatchEnds IS NOT NULL
50 50
         AND m.Enabled = '1'");
51 51
 $OffRatioWatch = $DB->collect('ID');
52 52
 if (count($OffRatioWatch) > 0) {
53 53
   $DB->query("
54 54
     UPDATE users_info AS ui
55 55
       JOIN users_main AS um ON um.ID = ui.UserID
56
-    SET ui.RatioWatchEnds = NULL,
56
+    SET ui.RatioWatchEnds IS NULL,
57 57
       ui.RatioWatchDownload = '0',
58 58
       um.can_leech = '1'
59 59
     WHERE ui.UserID IN(".implode(',', $OffRatioWatch).')');
@@ -79,7 +79,7 @@ $DB->query("
79 79
   FROM users_info AS i
80 80
     JOIN users_main AS m ON m.ID = i.UserID
81 81
   WHERE m.Uploaded / m.Downloaded < m.RequiredRatio
82
-    AND i.RatioWatchEnds = NULL
82
+    AND i.RatioWatchEnds IS NULL
83 83
     AND m.Enabled = '1'
84 84
     AND m.can_leech = '1'");
85 85
 $OnRatioWatch = $DB->collect('ID');
@@ -114,7 +114,7 @@ $UserQuery = $DB->query("
114 114
     SELECT ID, torrent_pass
115 115
     FROM users_info AS i
116 116
       JOIN users_main AS m ON m.ID = i.UserID
117
-    WHERE i.RatioWatchEnds != NULL
117
+    WHERE i.RatioWatchEnds IS NOT NULL
118 118
       AND i.RatioWatchEnds < '$sqltime'
119 119
       AND m.Enabled = '1'
120 120
       AND m.can_leech != '0'");

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

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

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

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

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

@@ -13,6 +13,6 @@ while (list($UserID) = $DB->next_record()) {
13 13
 
14 14
 $DB->query("
15 15
   UPDATE users_info
16
-  SET Warned = NULL
16
+  SET Warned IS NULL
17 17
   WHERE Warned < '$sqltime'");
18 18
 ?>

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

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

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

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

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

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

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

@@ -244,7 +244,7 @@ function get_group_requests($GroupID) {
244 244
       SELECT ID
245 245
       FROM requests
246 246
       WHERE GroupID = $GroupID
247
-        AND TimeFilled = NULL");
247
+        AND TimeFilled IS NULL");
248 248
     $Requests = $DB->collect('ID');
249 249
     $Cache->cache_value("requests_group_$GroupID", $Requests, 0);
250 250
   }

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

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

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

@@ -164,7 +164,7 @@ if ($CurEmail != $_POST['email']) {
164 164
       UPDATE users_history_emails
165 165
       SET Time = '".sqltime()."'
166 166
       WHERE UserID = '$UserID'
167
-        AND Time = NULL");
167
+        AND Time IS NULL");
168 168
     $DB->query("
169 169
       INSERT INTO users_history_emails
170 170
         (UserID, Email, Time, IP)

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

@@ -226,7 +226,7 @@ $DB->set_query_id($QueryID);
226 226
 if ($_POST['ResetRatioWatch'] && check_perms('users_edit_reset_keys')) {
227 227
   $DB->query("
228 228
     UPDATE users_info
229
-    SET RatioWatchEnds = NULL, RatioWatchDownload = '0', RatioWatchTimes = '0'
229
+    SET RatioWatchEnds IS NULL, RatioWatchDownload = '0', RatioWatchTimes = '0'
230 230
     WHERE UserID = '$UserID'");
231 231
   $EditSummary[] = 'RatioWatch history reset';
232 232
 }
@@ -499,7 +499,7 @@ if ($Warned == 1 && $Cur['Warned'] == NULL && check_perms('users_warn')) {
499 499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
500 500
 
501 501
 } elseif ($Warned == 0 && $Cur['Warned'] != NULL && check_perms('users_warn')) {
502
-  $UpdateSet[] = "Warned = NULL";
502
+  $UpdateSet[] = "Warned IS NULL";
503 503
   $EditSummary[] = 'warning removed';
504 504
   $LightUpdates['Warned'] = NULL;
505 505
 
@@ -700,7 +700,7 @@ if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
700 700
     Tracker::update_tracker('add_user', array('id' => $UserID, 'passkey' => $Cur['torrent_pass'], 'visible' => $VisibleTrIP));
701 701
 
702 702
     if (($Cur['Downloaded'] == 0) || ($Cur['Uploaded'] / $Cur['Downloaded'] >= $Cur['RequiredRatio'])) {
703
-      $UpdateSet[] = "i.RatioWatchEnds = NULL";
703
+      $UpdateSet[] = "i.RatioWatchEnds IS NULL";
704 704
       $CanLeech = 1;
705 705
       $UpdateSet[] = "m.can_leech = '1'";
706 706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";

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

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

Loading…
Cancel
Save