Browse Source

Apparently NULL from the database becomes an empty string in PHP, not null

spaghetti 8 years ago
parent
commit
2e7d189568

+ 1
- 1
classes/script_start.php View File

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

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

@@ -4,15 +4,10 @@ if (!extension_loaded('date')) {
4 4
 }
5 5
 
6 6
 function time_ago($TimeStamp) {
7
+  if (!$TimeStamp) { return false; }
7 8
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
8
-    if (is_null($TimeStamp)) {
9
-      return false;
10
-    }
11 9
     $TimeStamp = strtotime($TimeStamp);
12 10
   }
13
-  if ($TimeStamp == 0) {
14
-    return false;
15
-  }
16 11
   return time() - $TimeStamp;
17 12
 }
18 13
 
@@ -21,15 +16,10 @@ function time_ago($TimeStamp) {
21 16
  * difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
22 17
  */
23 18
 function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
19
+  if (!$TimeStamp) { return 'Never'; }
24 20
   if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
25
-    if (is_null($TimeStamp)) {
26
-      return 'Never';
27
-    }
28 21
     $TimeStamp = strtotime($TimeStamp);
29 22
   }
30
-  if ($TimeStamp == 0) {
31
-    return 'Never';
32
-  }
33 23
   $Time = time() - $TimeStamp;
34 24
 
35 25
   // If the time is negative, then it expires in the future.

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

@@ -419,7 +419,7 @@ class Users {
419 419
       $Str .= Badges::display_badges(Badges::get_displayed_badges($UserID), true);
420 420
     }
421 421
 
422
-    $Str .= ($IsWarned && !is_null($UserInfo['Warned'])) ? '<a href="wiki.php?action=article&amp;id=218"'
422
+    $Str .= ($IsWarned && $UserInfo['Warned']) ? '<a href="wiki.php?action=article&amp;id=218"'
423 423
           . '><img src="'.STATIC_SERVER.'common/symbols/warned.png" alt="Warned" title="Warned'
424 424
           . (G::$LoggedUser['ID'] === $UserID ? ' - Expires ' . date('Y-m-d H:i', strtotime($UserInfo['Warned'])) : '')
425 425
           . '" class="tooltip" /></a>' : '';

+ 0
- 16
classes/zip.class.php View File

@@ -76,21 +76,6 @@ http://www.fileformat.info/tool/hexdump.htm - Useful for analyzing ZIP files
76 76
 if (!extension_loaded('zlib')) {
77 77
   error('Zlib Extension not loaded.');
78 78
 }
79
-/*
80
-//Handles timestamps
81
-function dostime($TimeStamp = 0) {
82
-  if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
83
-    if (is_null($TimeStamp)) {
84
-      return 'Never';
85
-    }
86
-    $TimeStamp = strtotime($TimeStamp);
87
-  }
88
-  $Date = (($TimeStamp == 0) ? getdate() : getdate($TimeStamp));
89
-  $Hex = dechex((($Date['year'] - 1980) << 25) | ($Date['mon'] << 21) | ($Date['mday'] << 16) | ($Date['hours'] << 11) | ($Date['minutes'] << 5) | ($Date['seconds'] >> 1));
90
-  eval("\$Return = \"\x$Hex[6]$Hex[7]\x$Hex[4]$Hex[5]\x$Hex[2]$Hex[3]\x$Hex[0]$Hex[1]\";");
91
-  return $Return;
92
-}
93
-*/
94 79
 
95 80
 class Zip {
96 81
   public $ArchiveSize = 0; // Total size
@@ -116,7 +101,6 @@ class Zip {
116 101
     $this->Data .= "\x14\x00"; // Version requirements
117 102
     $this->Data .= "\x00\x08"; // Bit flag - 0x8 = UTF-8 file names
118 103
     $this->Data .= "\x08\x00"; // Compression
119
-    //$this->Data .= dostime($TimeStamp); // Last modified
120 104
     $this->Data .= "\x00\x00\x00\x00";
121 105
     $DataLength = strlen($FileData); // Saved as variable to avoid wasting CPU calculating it multiple times.
122 106
     $CRC32 = crc32($FileData); // Ditto.

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

@@ -140,9 +140,7 @@ if (count($Forum) === 0) {
140 140
     $UserInfo = Users::user_info($LastAuthorID);
141 141
     $LastAuthorName = $UserInfo['Username'];
142 142
     // Bug fix for no last time available
143
-    if (is_null($LastTime)) {
144
-      $LastTime = '';
145
-    }
143
+    if (!$LastTime) { $LastTime = ''; }
146 144
 
147 145
     $JsonTopics[] = array(
148 146
       'topicId' => (int)$TopicID,

+ 21
- 25
sections/ajax/forum/thread.php View File

@@ -247,7 +247,7 @@ foreach ($Thread as $Key => $Post) {
247 247
 
248 248
 
249 249
   $UserInfo = Users::user_info($EditedUserID);
250
-  $JsonPosts[] = array(
250
+  $JsonPosts[] = [
251 251
     'postId' => (int)$PostID,
252 252
     'addedTime' => $AddedTime,
253 253
     'bbBody' => $Body,
@@ -255,37 +255,33 @@ foreach ($Thread as $Key => $Post) {
255 255
     'editedUserId' => (int)$EditedUserID,
256 256
     'editedTime' => $EditedTime,
257 257
     'editedUsername' => $UserInfo['Username'],
258
-    'author' => array(
258
+    'author' => [
259 259
       'authorId' => (int)$AuthorID,
260 260
       'authorName' => $Username,
261 261
       'paranoia' => $Paranoia,
262 262
       'artist' => $Artist === '1',
263 263
       'donor' => $Donor === '1',
264
-      'warned' => !is_null($Warned),
264
+      'warned' => (bool)$Warned,
265 265
       'avatar' => $Avatar,
266 266
       'enabled' => $Enabled === '2' ? false : true,
267 267
       'userTitle' => $UserTitle
268
-    ),
269
-
270
-  );
268
+    ]
269
+  ];
271 270
 }
272 271
 
273
-print
274
-  json_encode(
275
-    array(
276
-      'status' => 'success',
277
-      'response' => array(
278
-        'forumId' => (int)$ForumID,
279
-        'forumName' => $Forums[$ForumID]['Name'],
280
-        'threadId' => (int)$ThreadID,
281
-        'threadTitle' => display_str($ThreadInfo['Title']),
282
-        'subscribed' => in_array($ThreadID, $UserSubscriptions),
283
-        'locked' => $ThreadInfo['IsLocked'] == 1,
284
-        'sticky' => $ThreadInfo['IsSticky'] == 1,
285
-        'currentPage' => (int)$Page,
286
-        'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
287
-        'poll' => empty($JsonPoll) ? null : $JsonPoll,
288
-        'posts' => $JsonPosts
289
-      )
290
-    )
291
-  );
272
+print json_encode([
273
+  'status' => 'success',
274
+  'response' => [
275
+    'forumId' => (int)$ForumID,
276
+    'forumName' => $Forums[$ForumID]['Name'],
277
+    'threadId' => (int)$ThreadID,
278
+    'threadTitle' => display_str($ThreadInfo['Title']),
279
+    'subscribed' => in_array($ThreadID, $UserSubscriptions),
280
+    'locked' => $ThreadInfo['IsLocked'] == 1,
281
+    'sticky' => $ThreadInfo['IsSticky'] == 1,
282
+    'currentPage' => (int)$Page,
283
+    'pages' => ceil($ThreadInfo['Posts'] / $PerPage),
284
+    'poll' => empty($JsonPoll) ? null : $JsonPoll,
285
+    'posts' => $JsonPosts
286
+  ]
287
+]);

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

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

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

@@ -10,7 +10,7 @@ $JsonComments = array();
10 10
 foreach ($Thread as $Key => $Post) {
11 11
   list($PostID, $AuthorID, $AddedTime, $Body, $EditedUserID, $EditedTime, $EditedUsername) = array_values($Post);
12 12
   list($AuthorID, $Username, $PermissionID, $Paranoia, $Artist, $Donor, $Warned, $Avatar, $Enabled, $UserTitle) = array_values(Users::user_info($AuthorID));
13
-  $JsonComments[] = array(
13
+  $JsonComments[] = [
14 14
     'postId' => (int)$PostID,
15 15
     'addedTime' => $AddedTime,
16 16
     'bbBody' => $Body,
@@ -18,21 +18,21 @@ foreach ($Thread as $Key => $Post) {
18 18
     'editedUserId' => (int)$EditedUserID,
19 19
     'editedTime' => $EditedTime,
20 20
     'editedUsername' => $EditedUsername,
21
-    'userinfo' => array(
21
+    'userinfo' => [
22 22
       'authorId' => (int)$AuthorID,
23 23
       'authorName' => $Username,
24 24
       'artist' => $Artist == 1,
25 25
       'donor' => $Donor == 1,
26
-      'warned' => !is_null($Warned),
26
+      'warned' => (bool)$Warned,
27 27
       'avatar' => $Avatar,
28 28
       'enabled' => ($Enabled == 2 ? false : true),
29 29
       'userTitle' => $UserTitle
30
-    )
31
-  );
30
+    ]
31
+  ];
32 32
 }
33 33
 
34
-json_die("success", array(
34
+json_die("success", [
35 35
   'page' => (int)$Page,
36 36
   'pages' => ceil($NumComments / TORRENT_COMMENTS_PER_PAGE),
37 37
   'comments' => $JsonComments
38
-));
38
+]);

+ 12
- 14
sections/ajax/user.php View File

@@ -308,26 +308,24 @@ if ($ParanoiaLevel == 0) {
308 308
 }
309 309
 
310 310
 //Bugfix for no access time available
311
-if (is_null($LastAccess)) {
312
-  $LastAccess = '';
313
-}
311
+if (!$LastAccess) { $LastAccess = ''; }
314 312
 
315 313
 header('Content-Type: text/plain; charset=utf-8');
316 314
 
317
-json_print("success", array(
315
+json_print("success", [
318 316
   'username'    => $Username,
319 317
   'avatar'      => $Avatar,
320 318
   'isFriend'    => (bool)$Friend,
321 319
   'profileText' => Text::full_format($Info),
322
-  'stats'       => array(
320
+  'stats'       => [
323 321
     'joinedDate'    => $JoinDate,
324 322
     'lastAccess'    => $LastAccess,
325 323
     'uploaded'      => (int)$Uploaded,
326 324
     'downloaded'    => (int)$Downloaded,
327 325
     'ratio'         => (float)$Ratio,
328 326
     'requiredRatio' => (float)$RequiredRatio
329
-  ),
330
-  'ranks' => array(
327
+  ],
328
+  'ranks' => [
331 329
     'uploaded'    => (int)$UploadedRank,
332 330
     'downloaded'  => (int)$DownloadedRank,
333 331
     'uploads'     => (int)$UploadsRank,
@@ -336,17 +334,17 @@ json_print("success", array(
336 334
     'posts'       => (int)$PostRank,
337 335
     'artists'     => (int)$ArtistsRank,
338 336
     'overall'     => (int)$OverallRank
339
-  ),
340
-  'personal' => array(
337
+  ],
338
+  'personal' => [
341 339
     'class'         => $ClassLevels[$Class]['Name'],
342 340
     'paranoia'      => (int)$ParanoiaLevel,
343 341
     'paranoiaText'  => $ParanoiaLevelText,
344 342
     'donor'         => ($Donor == 1),
345
-    'warned'        => !is_null($Warned),
343
+    'warned'        => (bool)$Warned,
346 344
     'enabled'       => ($Enabled == '1' || $Enabled == '0' || !$Enabled),
347 345
     'passkey'       => $torrent_pass
348
-  ),
349
-  'community' => array(
346
+  ],
347
+  'community' => [
350 348
     'posts'           => (int)$ForumPosts,
351 349
     'torrentComments' => (int)$NumComments,
352 350
     'artistComments'  => (int)$NumArtistComments,
@@ -365,6 +363,6 @@ json_print("success", array(
365 363
     'snatched'        => (int)$Snatched,
366 364
     'invited'         => (int)$Invited,
367 365
     'artistsAdded'    => (int)$ArtistsAdded
368
-  )
369
-));
366
+  ]
367
+]);
370 368
 ?>

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

@@ -36,23 +36,23 @@ if (isset($_GET['username'])) {
36 36
 
37 37
 }
38 38
 
39
-$JsonUsers = array();
39
+$JsonUsers = [];
40 40
 foreach ($Results as $Result) {
41 41
   list($UserID, $Username, $Enabled, $PermissionID, $Donor, $Warned, $Avatar) = $Result;
42 42
 
43
-  $JsonUsers[] = array(
43
+  $JsonUsers[] = [
44 44
     'userId' => (int)$UserID,
45 45
     'username' => $Username,
46 46
     'donor' => $Donor == 1,
47
-    'warned' => !is_null($Warned),
47
+    'warned' => (bool)$Warned,
48 48
     'enabled' => ($Enabled == 2 ? false : true),
49 49
     'class' => Users::make_class_string($PermissionID),
50 50
     'avatar' => $Avatar
51
-  );
51
+  ];
52 52
 }
53 53
 
54
-json_die("success", array(
54
+json_die("success", [
55 55
   'currentPage' => (int)$Page,
56 56
   'pages' => ceil($NumResults / USERS_PER_PAGE),
57 57
   'results' => $JsonUsers
58
-));
58
+]);

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

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

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

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

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

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

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

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

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

@@ -416,12 +416,12 @@ function build_torrents_table($Cache, $DB, $LoggedUser, $GroupID, $GroupName, $G
416 416
             <blockquote>
417 417
               Uploaded by <?=(Users::format_username($UserID, false, false, false))?> <?=time_diff($TorrentTime);?>
418 418
 <?  if ($Seeders == 0) {
419
-    if (!is_null($LastActive) && time() - strtotime($LastActive) >= 1209600) { ?>
419
+    if ($LastActive && time() - strtotime($LastActive) >= 1209600) { ?>
420 420
                 <br /><strong>Last active: <?=time_diff($LastActive);?></strong>
421 421
 <?    } else { ?>
422 422
                 <br />Last active: <?=time_diff($LastActive);?>
423 423
 <?    }
424
-    if (!is_null($LastActive) && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
424
+    if ($LastActive && time() - strtotime($LastActive) >= 345678 && time() - strtotime($LastReseedRequest) >= 864000) { ?>
425 425
                 <br /><a href="torrents.php?action=reseed&amp;torrentid=<?=($TorrentID)?>&amp;groupid=<?=($GroupID)?>" class="brackets">Request re-seed</a>
426 426
 <?    }
427 427
   } ?>

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

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

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

@@ -486,7 +486,7 @@ if (check_perms('users_edit_badges')) {
486 486
   $Cache->delete_value("user_badges_".$UserID);
487 487
 }
488 488
 
489
-if ($Warned == 1 && is_null($Cur['Warned']) && check_perms('users_warn')) {
489
+if ($Warned == 1 && !$Cur['Warned'] && check_perms('users_warn')) {
490 490
   $Weeks = 'week' . ($WarnLength === 1 ? '' : 's');
491 491
   Misc::send_pm($UserID, 0, 'You have received a warning', "You have been [url=".site_url()."wiki.php?action=article&amp;id=218]warned for $WarnLength {$Weeks}[/url] by [user]".$LoggedUser['Username']."[/user]. The reason given was:
492 492
 [quote]{$WarnReason}[/quote]");
@@ -498,7 +498,7 @@ if ($Warned == 1 && is_null($Cur['Warned']) && check_perms('users_warn')) {
498 498
   $EditSummary[] = db_string($Msg);
499 499
   $LightUpdates['Warned'] = time_plus(3600 * 24 * 7 * $WarnLength);
500 500
 
501
-} elseif ($Warned == 0 && !is_null($Cur['Warned']) && check_perms('users_warn')) {
501
+} elseif ($Warned == 0 && $Cur['Warned'] && check_perms('users_warn')) {
502 502
   $UpdateSet[] = "Warned = NULL";
503 503
   $EditSummary[] = 'warning removed';
504 504
   $LightUpdates['Warned'] = NULL;
@@ -706,7 +706,7 @@ if ($EnableUser != $Cur['Enabled'] && check_perms('users_disable_users')) {
706 706
       $UpdateSet[] = "i.RatioWatchDownload = '0'";
707 707
     } else {
708 708
       $EnableStr .= ' (Ratio: '.Format::get_ratio_html($Cur['Uploaded'], $Cur['Downloaded'], false).', RR: '.number_format($Cur['RequiredRatio'],2).')';
709
-      if (!is_null($Cur['RatioWatchEnds'])) {
709
+      if ($Cur['RatioWatchEnds']) {
710 710
         $UpdateSet[] = "i.RatioWatchEnds = NOW()";
711 711
         $UpdateSet[] = "i.RatioWatchDownload = m.Downloaded";
712 712
         $CanLeech = 0;

+ 5
- 8
sections/user/user.php View File

@@ -375,7 +375,7 @@ if ($LoggedUser['Class'] >= 200 || $DB->has_results()) { ?>
375 375
         <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>><a href="userhistory.php?action=token_history&amp;userid=<?=$UserID?>">Tokens</a>: <?=number_format($FLTokens)?></li>
376 376
 <?
377 377
   }
378
-  if (($OwnProfile || check_perms('users_mod')) && !is_null($Warned)) {
378
+  if (($OwnProfile || check_perms('users_mod')) && $Warned) {
379 379
 ?>
380 380
         <li<?=($Override === 2 ? ' class="paranoia_override"' : '')?>>Warning expires in: <?=time_diff((date('Y-m-d H:i', strtotime($Warned))))?></li>
381 381
 <?  } ?>
@@ -654,10 +654,7 @@ DonationsView::render_donor_stats($UserID);
654 654
   </div>
655 655
   <div class="main_column">
656 656
 <?
657
-if (!is_null($RatioWatchEnds)
658
-    && (time() < strtotime($RatioWatchEnds))
659
-    && ($Downloaded * $RequiredRatio) > $Uploaded
660
-    ) {
657
+if ($RatioWatchEnds && (time() < strtotime($RatioWatchEnds)) && ($Downloaded * $RequiredRatio) > $Uploaded) {
661 658
 ?>
662 659
     <div class="box">
663 660
       <div class="head">Ratio watch</div>
@@ -1324,10 +1321,10 @@ if (!$DisablePoints) {
1324 1321
       <tr>
1325 1322
         <td class="label">Warned:</td>
1326 1323
         <td>
1327
-          <input type="checkbox" name="Warned"<? if (!is_null($Warned)) { ?> checked="checked"<? } ?> />
1324
+          <input type="checkbox" name="Warned"<? if ($Warned) { ?> checked="checked"<? } ?> />
1328 1325
         </td>
1329 1326
       </tr>
1330
-<?    if (is_null($Warned)) { // user is not warned ?>
1327
+<?    if (!$Warned) { ?>
1331 1328
       <tr>
1332 1329
         <td class="label">Expiration:</td>
1333 1330
         <td>
@@ -1340,7 +1337,7 @@ if (!$DisablePoints) {
1340 1337
           </select>
1341 1338
         </td>
1342 1339
       </tr>
1343
-<?    } else { // user is warned ?>
1340
+<?    } else { ?>
1344 1341
       <tr>
1345 1342
         <td class="label">Extension:</td>
1346 1343
         <td>

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

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

Loading…
Cancel
Save