Browse Source

Some null coalescing

spaghetti 9 years ago
parent
commit
4e73f89ede
3 changed files with 493 additions and 498 deletions
  1. 167
    168
      classes/time.class.php
  2. 50
    50
      sections/error/index.php
  3. 276
    280
      sections/userhistory/email_history2.php

+ 167
- 168
classes/time.class.php View File

@@ -1,19 +1,19 @@
1 1
 <?
2 2
 if (!extension_loaded('date')) {
3
-	error('Date extension not loaded.');
3
+  error('Date extension not loaded.');
4 4
 }
5 5
 
6 6
 function time_ago($TimeStamp) {
7
-	if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
8
-		if ($TimeStamp == '0000-00-00 00:00:00') {
9
-			return false;
10
-		}
11
-		$TimeStamp = strtotime($TimeStamp);
12
-	}
13
-	if ($TimeStamp == 0) {
14
-		return false;
15
-	}
16
-	return time() - $TimeStamp;
7
+  if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
8
+    if ($TimeStamp == '0000-00-00 00:00:00') {
9
+      return false;
10
+    }
11
+    $TimeStamp = strtotime($TimeStamp);
12
+  }
13
+  if ($TimeStamp == 0) {
14
+    return false;
15
+  }
16
+  return time() - $TimeStamp;
17 17
 }
18 18
 
19 19
 /*
@@ -21,185 +21,184 @@ function time_ago($TimeStamp) {
21 21
  * difference in text (e.g. "16 hours and 28 minutes", "1 day, 18 hours").
22 22
  */
23 23
 function time_diff($TimeStamp, $Levels = 2, $Span = true, $Lowercase = false) {
24
-	if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
25
-		if ($TimeStamp == '0000-00-00 00:00:00') {
26
-			return 'Never';
27
-		}
28
-		$TimeStamp = strtotime($TimeStamp);
29
-	}
30
-	if ($TimeStamp == 0) {
31
-		return 'Never';
32
-	}
33
-	$Time = time() - $TimeStamp;
34
-
35
-	// If the time is negative, then it expires in the future.
36
-	if ($Time < 0) {
37
-		$Time = -$Time;
38
-		$HideAgo = true;
39
-	}
40
-
41
-	$Years = floor($Time / 31556926); // seconds in one year
42
-	$Remain = $Time - $Years * 31556926;
43
-
44
-	$Months = floor($Remain / 2629744); // seconds in one month
45
-	$Remain = $Remain - $Months * 2629744;
46
-
47
-	$Weeks = floor($Remain / 604800); // seconds in one week
48
-	$Remain = $Remain - $Weeks * 604800;
49
-
50
-	$Days = floor($Remain / 86400); // seconds in one day
51
-	$Remain = $Remain - $Days * 86400;
52
-
53
-	$Hours=floor($Remain / 3600); // seconds in one hour
54
-	$Remain = $Remain - $Hours * 3600;
55
-
56
-	$Minutes = floor($Remain / 60); // seconds in one minute
57
-	$Remain = $Remain - $Minutes * 60;
58
-
59
-	$Seconds = $Remain;
60
-
61
-	$Return = '';
62
-
63
-	if ($Years > 0 && $Levels > 0) {
64
-		if ($Years > 1) {
65
-			$Return .= "$Years years";
66
-		} else {
67
-			$Return .= "$Years year";
68
-		}
69
-		$Levels--;
70
-	}
71
-
72
-	if ($Months > 0 && $Levels > 0) {
73
-		if ($Return != '') {
74
-			$Return .= ', ';
75
-		}
76
-		if ($Months > 1) {
77
-			$Return .= "$Months months";
78
-		} else {
79
-			$Return .= "$Months month";
80
-		}
81
-		$Levels--;
82
-	}
83
-
84
-	if ($Weeks > 0 && $Levels > 0) {
85
-		if ($Return != '') {
86
-			$Return .= ', ';
87
-		}
88
-		if ($Weeks > 1) {
89
-			$Return .= "$Weeks weeks";
90
-		} else {
91
-			$Return .= "$Weeks week";
92
-		}
93
-		$Levels--;
94
-	}
95
-
96
-	if ($Days > 0 && $Levels > 0) {
97
-		if ($Return != '') {
98
-			$Return .= ', ';
99
-		}
100
-		if ($Days > 1) {
101
-			$Return .= "$Days days";
102
-		} else {
103
-			$Return .= "$Days day";
104
-		}
105
-		$Levels--;
106
-	}
107
-
108
-	if ($Hours > 0 && $Levels > 0) {
109
-		if ($Return != '') {
110
-			$Return .= ', ';
111
-		}
112
-		if ($Hours > 1) {
113
-			$Return .= "$Hours hours";
114
-		} else {
115
-			$Return .= "$Hours hour";
116
-		}
117
-		$Levels--;
118
-	}
119
-
120
-	if ($Minutes > 0 && $Levels > 0) {
121
-		if ($Return != '') {
122
-			$Return .= ' and ';
123
-		}
124
-		if ($Minutes > 1) {
125
-			$Return .= "$Minutes mins";
126
-		} else {
127
-			$Return .= "$Minutes min";
128
-		}
129
-		$Levels--;
130
-	}
131
-
132
-	if ($Return == '') {
133
-		$Return = 'Just now';
134
-	} elseif (!isset($HideAgo)) {
135
-		$Return .= ' ago';
136
-	}
137
-
138
-	if ($Lowercase) {
139
-		$Return = strtolower($Return);
140
-	}
141
-
142
-	if ($Span) {
143
-		return '<span class="time tooltip" title="'.date('M d Y, H:i', $TimeStamp).'">'.$Return.'</span>';
144
-	} else {
145
-		return $Return;
146
-	}
24
+  if (!is_number($TimeStamp)) { // Assume that $TimeStamp is SQL timestamp
25
+    if ($TimeStamp == '0000-00-00 00:00:00') {
26
+      return 'Never';
27
+    }
28
+    $TimeStamp = strtotime($TimeStamp);
29
+  }
30
+  if ($TimeStamp == 0) {
31
+    return 'Never';
32
+  }
33
+  $Time = time() - $TimeStamp;
34
+
35
+  // If the time is negative, then it expires in the future.
36
+  if ($Time < 0) {
37
+    $Time = -$Time;
38
+    $HideAgo = true;
39
+  }
40
+
41
+  $Years = floor($Time / 31556926); // seconds in one year
42
+  $Remain = $Time - $Years * 31556926;
43
+
44
+  $Months = floor($Remain / 2629744); // seconds in one month
45
+  $Remain = $Remain - $Months * 2629744;
46
+
47
+  $Weeks = floor($Remain / 604800); // seconds in one week
48
+  $Remain = $Remain - $Weeks * 604800;
49
+
50
+  $Days = floor($Remain / 86400); // seconds in one day
51
+  $Remain = $Remain - $Days * 86400;
52
+
53
+  $Hours=floor($Remain / 3600); // seconds in one hour
54
+  $Remain = $Remain - $Hours * 3600;
55
+
56
+  $Minutes = floor($Remain / 60); // seconds in one minute
57
+  $Remain = $Remain - $Minutes * 60;
58
+
59
+  $Seconds = $Remain;
60
+
61
+  $Return = '';
62
+
63
+  if ($Years > 0 && $Levels > 0) {
64
+    if ($Years > 1) {
65
+      $Return .= "$Years years";
66
+    } else {
67
+      $Return .= "$Years year";
68
+    }
69
+    $Levels--;
70
+  }
71
+
72
+  if ($Months > 0 && $Levels > 0) {
73
+    if ($Return != '') {
74
+      $Return .= ', ';
75
+    }
76
+    if ($Months > 1) {
77
+      $Return .= "$Months months";
78
+    } else {
79
+      $Return .= "$Months month";
80
+    }
81
+    $Levels--;
82
+  }
83
+
84
+  if ($Weeks > 0 && $Levels > 0) {
85
+    if ($Return != '') {
86
+      $Return .= ', ';
87
+    }
88
+    if ($Weeks > 1) {
89
+      $Return .= "$Weeks weeks";
90
+    } else {
91
+      $Return .= "$Weeks week";
92
+    }
93
+    $Levels--;
94
+  }
95
+
96
+  if ($Days > 0 && $Levels > 0) {
97
+    if ($Return != '') {
98
+      $Return .= ', ';
99
+    }
100
+    if ($Days > 1) {
101
+      $Return .= "$Days days";
102
+    } else {
103
+      $Return .= "$Days day";
104
+    }
105
+    $Levels--;
106
+  }
107
+
108
+  if ($Hours > 0 && $Levels > 0) {
109
+    if ($Return != '') {
110
+      $Return .= ', ';
111
+    }
112
+    if ($Hours > 1) {
113
+      $Return .= "$Hours hours";
114
+    } else {
115
+      $Return .= "$Hours hour";
116
+    }
117
+    $Levels--;
118
+  }
119
+
120
+  if ($Minutes > 0 && $Levels > 0) {
121
+    if ($Return != '') {
122
+      $Return .= ' and ';
123
+    }
124
+    if ($Minutes > 1) {
125
+      $Return .= "$Minutes mins";
126
+    } else {
127
+      $Return .= "$Minutes min";
128
+    }
129
+    $Levels--;
130
+  }
131
+
132
+  if ($Return == '') {
133
+    $Return = 'Just now';
134
+  } elseif (!isset($HideAgo)) {
135
+    $Return .= ' ago';
136
+  }
137
+
138
+  if ($Lowercase) {
139
+    $Return = strtolower($Return);
140
+  }
141
+
142
+  if ($Span) {
143
+    return '<span class="time tooltip" title="'.date('M d Y, H:i', $TimeStamp).'">'.$Return.'</span>';
144
+  } else {
145
+    return $Return;
146
+  }
147 147
 }
148 148
 
149 149
 /* SQL utility functions */
150 150
 
151 151
 function time_plus($Offset) {
152
-	return date('Y-m-d H:i:s', time() + $Offset);
152
+  return date('Y-m-d H:i:s', time() + $Offset);
153 153
 }
154 154
 
155 155
 function time_minus($Offset, $Fuzzy = false) {
156
-	if ($Fuzzy) {
157
-		return date('Y-m-d 00:00:00', time() - $Offset);
158
-	} else {
159
-		return date('Y-m-d H:i:s', time() - $Offset);
160
-	}
156
+  if ($Fuzzy) {
157
+    return date('Y-m-d 00:00:00', time() - $Offset);
158
+  } else {
159
+    return date('Y-m-d H:i:s', time() - $Offset);
160
+  }
161 161
 }
162 162
 
163
-function sqltime($timestamp = false) {
164
-	if ($timestamp === false) {
165
-		$timestamp = time();
166
-	}
167
-	return date('Y-m-d H:i:s', $timestamp);
163
+// This is never used anywhere with $timestamp set
164
+// TODO: Why don't we just use NOW() in the sql queries?
165
+function sqltime($timestamp = NULL) {
166
+  return date('Y-m-d H:i:s', ($timestamp ?? time()));
168 167
 }
169 168
 
170 169
 function validDate($DateString) {
171
-	$DateTime = explode(' ', $DateString);
172
-	if (count($DateTime) != 2) {
173
-		return false;
174
-	}
175
-	list($Date, $Time) = $DateTime;
176
-	$SplitTime = explode(':', $Time);
177
-	if (count($SplitTime) != 3) {
178
-		return false;
179
-	}
180
-	list($H, $M, $S) = $SplitTime;
181
-	if ($H != 0 && !(is_number($H) && $H < 24 && $H >= 0)) { return false; }
182
-	if ($M != 0 && !(is_number($M) && $M < 60 && $M >= 0)) { return false; }
183
-	if ($S != 0 && !(is_number($S) && $S < 60 && $S >= 0)) { return false; }
184
-	$SplitDate = explode('-', $Date);
185
-	if (count($SplitDate) != 3) {
186
-		return false;
187
-	}
188
-	list($Y, $M, $D) = $SplitDate;
189
-	return checkDate($M, $D, $Y);
170
+  $DateTime = explode(' ', $DateString);
171
+  if (count($DateTime) != 2) {
172
+    return false;
173
+  }
174
+  list($Date, $Time) = $DateTime;
175
+  $SplitTime = explode(':', $Time);
176
+  if (count($SplitTime) != 3) {
177
+    return false;
178
+  }
179
+  list($H, $M, $S) = $SplitTime;
180
+  if ($H != 0 && !(is_number($H) && $H < 24 && $H >= 0)) { return false; }
181
+  if ($M != 0 && !(is_number($M) && $M < 60 && $M >= 0)) { return false; }
182
+  if ($S != 0 && !(is_number($S) && $S < 60 && $S >= 0)) { return false; }
183
+  $SplitDate = explode('-', $Date);
184
+  if (count($SplitDate) != 3) {
185
+    return false;
186
+  }
187
+  list($Y, $M, $D) = $SplitDate;
188
+  return checkDate($M, $D, $Y);
190 189
 }
191 190
 
192 191
 function is_valid_date($Date) {
193
-	return is_valid_datetime($Date, 'Y-m-d');
192
+  return is_valid_datetime($Date, 'Y-m-d');
194 193
 }
195 194
 
196 195
 function is_valid_time($Time) {
197
-	return is_valid_datetime($Time, 'H:i');
196
+  return is_valid_datetime($Time, 'H:i');
198 197
 }
199 198
 
200 199
 function is_valid_datetime($DateTime, $Format = 'Y-m-d H:i') {
201
-	$FormattedDateTime = DateTime::createFromFormat($Format, $DateTime);
202
-	return $FormattedDateTime && $FormattedDateTime->format($Format) == $DateTime;
200
+  $FormattedDateTime = DateTime::createFromFormat($Format, $DateTime);
201
+  return $FormattedDateTime && $FormattedDateTime->format($Format) == $DateTime;
203 202
 }
204 203
 
205 204
 ?>

+ 50
- 50
sections/error/index.php View File

@@ -1,65 +1,65 @@
1 1
 <?
2 2
 
3 3
 function notify ($Channel, $Message) {
4
-	global $LoggedUser;
5
-	send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? site_url()."user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SITE_DOMAIN."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
4
+  global $LoggedUser;
5
+  send_irc("PRIVMSG ".$Channel." :".$Message." error by ".(!empty($LoggedUser['ID']) ? site_url()."user.php?id=".$LoggedUser['ID'] ." (".$LoggedUser['Username'].")" : $_SERVER['REMOTE_ADDR']." (".Tools::geoip($_SERVER['REMOTE_ADDR']).")")." accessing https://".SITE_DOMAIN."".$_SERVER['REQUEST_URI'].(!empty($_SERVER['HTTP_REFERER'])? " from ".$_SERVER['HTTP_REFERER'] : ''));
6 6
 }
7 7
 
8 8
 $Errors = array('403','404','413','504');
9 9
 
10 10
 if (!empty($_GET['e']) && in_array($_GET['e'],$Errors)) {
11
-	// Web server error i.e. http://sitename/madeupdocument.php
12
-	include($_GET['e'].'.php');
11
+  // Web server error i.e. http://sitename/madeupdocument.php
12
+  include($_GET['e'].'.php');
13 13
 } else {
14
-	// Gazelle error (Comes from the error() function)
15
-	switch (isset($Error) ? $Error : NAN) {
14
+  // Gazelle error (Comes from the error() function)
15
+  switch ($Error ?? NAN) {
16 16
 
17
-		case '403':
18
-			$Title = "Error 403";
19
-			$Description = "You just tried to go to a page that you don't have enough permission to view.";
20
-			notify(STATUS_CHAN,'403');
21
-			break;
22
-		case '404':
23
-			$Title = "Error 404";
24
-			$Description = "You just tried to go to a page that doesn't exist.";
25
-			break;
26
-		case '0':
27
-			$Title = "Invalid Input";
28
-			$Description = "Something was wrong with the input provided with your request, and the server is refusing to fulfill it.";
29
-			notify(STATUS_CHAN,'PHP-0');
30
-			break;
31
-		case '-1':
32
-			$Title = "Invalid request";
33
-			$Description = "Something was wrong with your request, and the server is refusing to fulfill it.";
34
-			break;
35
-		default:
36
-			if (!empty($Error)) {
37
-				$Title = 'Error';
38
-				$Description = $Error;
39
-			} else {
40
-				$Title = "Unexpected Error";
41
-				$Description = "You have encountered an unexpected error.";
42
-			}
43
-	}
17
+    case '403':
18
+      $Title = "Error 403";
19
+      $Description = "You just tried to go to a page that you don't have enough permission to view.";
20
+      notify(STATUS_CHAN,'403');
21
+      break;
22
+    case '404':
23
+      $Title = "Error 404";
24
+      $Description = "You just tried to go to a page that doesn't exist.";
25
+      break;
26
+    case '0':
27
+      $Title = "Invalid Input";
28
+      $Description = "Something was wrong with the input provided with your request, and the server is refusing to fulfill it.";
29
+      notify(STATUS_CHAN,'PHP-0');
30
+      break;
31
+    case '-1':
32
+      $Title = "Invalid request";
33
+      $Description = "Something was wrong with your request, and the server is refusing to fulfill it.";
34
+      break;
35
+    default:
36
+      if (!empty($Error)) {
37
+        $Title = 'Error';
38
+        $Description = $Error;
39
+      } else {
40
+        $Title = "Unexpected Error";
41
+        $Description = "You have encountered an unexpected error.";
42
+      }
43
+  }
44 44
 
45
-	if (isset($Log)) {
46
-		$Description .= ' <a href="log.php?search='.$Log.'">Search Log</a>';
47
-	}
45
+  if (isset($Log)) {
46
+    $Description .= ' <a href="log.php?search='.$Log.'">Search Log</a>';
47
+  }
48 48
 
49
-	if (empty($NoHTML) && (!isset($Error) || $Error != -1)) {
50
-		View::show_header($Title);
49
+  if (empty($NoHTML) && (!isset($Error) || $Error != -1)) {
50
+    View::show_header($Title);
51 51
 ?>
52
-	<div class="thin">
53
-		<div class="header">
54
-			<h2><?=$Title?></h2>
55
-		</div>
56
-		<div class="box pad">
57
-			<p><?=$Description?></p>
58
-		</div>
59
-	</div>
52
+  <div class="thin">
53
+    <div class="header">
54
+      <h2><?=$Title?></h2>
55
+    </div>
56
+    <div class="box pad">
57
+      <p><?=$Description?></p>
58
+    </div>
59
+  </div>
60 60
 <?
61
-		View::show_footer();
62
-	} else {
63
-		echo $Description;
64
-	}
61
+    View::show_footer();
62
+  } else {
63
+    echo $Description;
64
+  }
65 65
 }

+ 276
- 280
sections/userhistory/email_history2.php View File

@@ -12,74 +12,76 @@ user.
12 12
 
13 13
 $UserID = $_GET['userid'];
14 14
 if (!is_number($UserID)) {
15
-	error(404);
15
+  error(404);
16 16
 }
17 17
 
18 18
 $DB->query("
19
-	SELECT
20
-		ui.JoinDate,
21
-		p.Level AS Class
22
-	FROM users_main AS um
23
-		JOIN users_info AS ui ON um.ID = ui.UserID
24
-		JOIN permissions AS p ON p.ID = um.PermissionID
25
-	WHERE um.ID = $UserID");
19
+  SELECT
20
+    ui.JoinDate,
21
+    p.Level AS Class
22
+  FROM users_main AS um
23
+    JOIN users_info AS ui ON um.ID = ui.UserID
24
+    JOIN permissions AS p ON p.ID = um.PermissionID
25
+  WHERE um.ID = $UserID");
26 26
 list($Joined, $Class) = $DB->next_record();
27 27
 
28 28
 if (!check_perms('users_view_email', $Class)) {
29
-	error(403);
29
+  error(403);
30 30
 }
31 31
 
32
-$UsersOnly = $_GET['usersonly'];
32
+// TODO: Is this even used?
33
+$UsersOnly = $_GET['usersonly'] ?? false;
33 34
 
34 35
 $DB->query("
35
-	SELECT Username
36
-	FROM users_main
37
-	WHERE ID = $UserID");
36
+  SELECT Username
37
+  FROM users_main
38
+  WHERE ID = $UserID");
38 39
 list($Username) = $DB->next_record();
39 40
 View::show_header("Email history for $Username");
40 41
 
41 42
 // Get current email (and matches)
42 43
 $DB->query("
43
-	SELECT
44
-		m.Email,
45
-		'".sqltime()."' AS Time,
46
-		m.IP,
47
-		GROUP_CONCAT(h.UserID SEPARATOR '|') AS UserIDs,
48
-		GROUP_CONCAT(h.Time SEPARATOR '|') AS UserSetTimes,
49
-		GROUP_CONCAT(h.IP SEPARATOR '|') AS UserIPs,
50
-		GROUP_CONCAT(m2.Username SEPARATOR '|') AS Usernames,
51
-		GROUP_CONCAT(m2.Enabled SEPARATOR '|') AS UsersEnabled,
52
-		GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
53
-		GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
54
-	FROM users_main AS m
55
-		LEFT JOIN users_history_emails AS h ON h.Email = m.Email
56
-				AND h.UserID != m.ID
57
-		LEFT JOIN users_main AS m2 ON m2.ID = h.UserID
58
-		LEFT JOIN users_info AS i ON i.UserID = h.UserID
59
-	WHERE m.ID = '$UserID'"
44
+  SELECT
45
+    m.Email,
46
+    '".sqltime()."' AS Time,
47
+    m.IP,
48
+    GROUP_CONCAT(h.UserID SEPARATOR '|') AS UserIDs,
49
+    GROUP_CONCAT(h.Time SEPARATOR '|') AS UserSetTimes,
50
+    GROUP_CONCAT(h.IP SEPARATOR '|') AS UserIPs,
51
+    GROUP_CONCAT(m2.Username SEPARATOR '|') AS Usernames,
52
+    GROUP_CONCAT(m2.Enabled SEPARATOR '|') AS UsersEnabled,
53
+    GROUP_CONCAT(i.Donor SEPARATOR '|') AS UsersDonor,
54
+    GROUP_CONCAT(i.Warned SEPARATOR '|') AS UsersWarned
55
+  FROM users_main AS m
56
+    LEFT JOIN users_history_emails AS h ON h.Email = m.Email
57
+        AND h.UserID != m.ID
58
+    LEFT JOIN users_main AS m2 ON m2.ID = h.UserID
59
+    LEFT JOIN users_info AS i ON i.UserID = h.UserID
60
+  WHERE m.ID = '$UserID'"
60 61
 );
61
-$CurrentEmail = array_shift($DB->to_array());
62
+//$CurrentEmail = array_shift($DB->to_array());
63
+$CurrentEmail = ($DB->to_array())[0]; // Only variables should be passed by reference
62 64
 
63 65
 // Get historic emails (and matches)
64 66
 $DB->query("
65
-	SELECT
66
-		h2.Email,
67
-		h2.Time,
68
-		h2.IP,
69
-		h3.UserID AS UserIDs,
70
-		h3.Time AS UserSetTimes,
71
-		h3.IP AS UserIPs,
72
-		m3.Username AS Usernames,
73
-		m3.Enabled AS UsersEnabled,
74
-		i2.Donor AS UsersDonor,
75
-		i2.Warned AS UsersWarned
76
-	FROM users_history_emails AS h2
77
-		LEFT JOIN users_history_emails AS h3 ON h3.Email = h2.Email
78
-				AND h3.UserID != h2.UserID
79
-		LEFT JOIN users_main AS m3 ON m3.ID = h3.UserID
80
-		LEFT JOIN users_info AS i2 ON i2.UserID = h3.UserID
81
-	WHERE h2.UserID = '$UserID'
82
-	ORDER BY Time DESC"
67
+  SELECT
68
+    h2.Email,
69
+    h2.Time,
70
+    h2.IP,
71
+    h3.UserID AS UserIDs,
72
+    h3.Time AS UserSetTimes,
73
+    h3.IP AS UserIPs,
74
+    m3.Username AS Usernames,
75
+    m3.Enabled AS UsersEnabled,
76
+    i2.Donor AS UsersDonor,
77
+    i2.Warned AS UsersWarned
78
+  FROM users_history_emails AS h2
79
+    LEFT JOIN users_history_emails AS h3 ON h3.Email = h2.Email
80
+        AND h3.UserID != h2.UserID
81
+    LEFT JOIN users_main AS m3 ON m3.ID = h3.UserID
82
+    LEFT JOIN users_info AS i2 ON i2.UserID = h3.UserID
83
+  WHERE h2.UserID = '$UserID'
84
+  ORDER BY Time DESC"
83 85
 );
84 86
 $History = $DB->to_array();
85 87
 
@@ -91,292 +93,286 @@ $Current['IP'] = $History[(count($History) - 1)]['IP'];
91 93
 
92 94
 // Matches for current email
93 95
 if ($CurrentEmail['Usernames'] != '') {
94
-	$UserIDs = explode('|', $CurrentEmail['UserIDs']);
95
-	$Usernames = explode('|', $CurrentEmail['Usernames']);
96
-	$UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
97
-	$UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
98
-	$UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
99
-	$UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
100
-	$UserIPs = explode('|', $CurrentEmail['UserIPs']);
96
+  $UserIDs = explode('|', $CurrentEmail['UserIDs']);
97
+  $Usernames = explode('|', $CurrentEmail['Usernames']);
98
+  $UsersEnabled = explode('|', $CurrentEmail['UsersEnabled']);
99
+  $UsersDonor = explode('|', $CurrentEmail['UsersDonor']);
100
+  $UsersWarned = explode('|', $CurrentEmail['UsersWarned']);
101
+  $UserSetTimes = explode('|', $CurrentEmail['UserSetTimes']);
102
+  $UserIPs = explode('|', $CurrentEmail['UserIPs']);
101 103
 
102
-	foreach ($UserIDs as $Key => $Val) {
103
-		$CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
104
-		$CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
105
-		$CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
106
-	}
104
+  foreach ($UserIDs as $Key => $Val) {
105
+    $CurrentMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val, true, true, true);
106
+    $CurrentMatches[$Key]['IP'] = $UserIPs[$Key];
107
+    $CurrentMatches[$Key]['EndTime'] = $UserSetTimes[$Key];
108
+  }
107 109
 }
108 110
 
109 111
 // Email history records
110 112
 if (count($History) === 1) {
111
-	$Invite['Email'] = $History[0]['Email'];
112
-	$Invite['EndTime'] = $Joined;
113
-	$Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
114
-	$Invite['IP'] = $History[0]['IP'];
115
-	if ($Current['StartTime'] == '0000-00-00 00:00:00') {
116
-		$Current['StartTime'] = $Joined;
117
-	}
113
+  $Invite['Email'] = $History[0]['Email'];
114
+  $Invite['EndTime'] = $Joined;
115
+  $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
116
+  $Invite['IP'] = $History[0]['IP'];
117
+  if ($Current['StartTime'] == '0000-00-00 00:00:00') {
118
+    $Current['StartTime'] = $Joined;
119
+  }
118 120
 } else {
119
-	foreach ($History as $Key => $Val) {
120
-		if ($History[$Key + 1]['Time'] == '0000-00-00 00:00:00' && $Val['Time'] != '0000-00-00 00:00:00') {
121
-			// Invited email
122
-			$Invite['Email'] = $Val['Email'];
123
-			$Invite['EndTime'] = $Joined;
124
-			$Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
125
-			$Invite['IP'] = $Val['IP'];
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') {
123
+      // Invited email
124
+      $Invite['Email'] = $Val['Email'];
125
+      $Invite['EndTime'] = $Joined;
126
+      $Invite['AccountAge'] = date(time() + time() - strtotime($Joined)); // Same as EndTime but without ' ago'
127
+      $Invite['IP'] = $Val['IP'];
126 128
 
127
-		} elseif ($History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time'] != '0000-00-00 00:00:00') {
128
-			// Old email
129
-			$i = 1;
130
-			while ($Val['Email'] == $History[$Key + $i]['Email']) {
131
-				$i++;
132
-			}
133
-			$Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time'] != '0000-00-00 00:00:00') ? $History[$Key + $i]['Time'] : $Joined;
134
-			$Old[$Key]['EndTime'] = $Val['Time'];
135
-			$Old[$Key]['IP'] = $Val['IP'];
136
-			$Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
137
-			$Old[$Key]['Email'] = $Val['Email'];
129
+    } elseif (isset($History[$Key - 1]) && $History[$Key - 1]['Email'] != $Val['Email'] && $Val['Time'] != '0000-00-00 00:00:00') {
130
+      // Old email
131
+      $i = 1;
132
+      while ($Val['Email'] == $History[$Key + $i]['Email']) {
133
+        $i++;
134
+      }
135
+      $Old[$Key]['StartTime'] = (isset($History[$Key + $i]) && $History[$Key + $i]['Time'] != '0000-00-00 00:00:00') ? $History[$Key + $i]['Time'] : $Joined;
136
+      $Old[$Key]['EndTime'] = $Val['Time'];
137
+      $Old[$Key]['IP'] = $Val['IP'];
138
+      $Old[$Key]['ElapsedTime'] = date(time() + strtotime($Old[$Key]['EndTime']) - strtotime($Old[$Key]['StartTime']));
139
+      $Old[$Key]['Email'] = $Val['Email'];
140
+    }
138 141
 
139
-		} else {
140
-			// Shouldn't have to be here but I'll leave it anyway
141
-			$Other[$Key]['StartTime'] = (isset($History[$Key + $i])) ? $History[$Key + $i]['Time'] : $Joined;
142
-			$Other[$Key]['EndTime'] = $Val['Time'];
143
-			$Other[$Key]['IP'] = $Val['IP'];
144
-			$Other[$Key]['ElapsedTime'] = date(time() + strtotime($Other[$Key]['EndTime']) - strtotime($Other[$Key]['StartTime']));
145
-			$Other[$Key]['Email'] = $Val['Email'];
146
-		}
147
-
148
-		if ($Val['Usernames'] != '') {
149
-			// Match with old email
150
-			$OldMatches[$Key]['Email'] = $Val['Email'];
151
-			$OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val['UserIDs'], true, true, true);
152
-			$OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
153
-			$OldMatches[$Key]['IP'] = $Val['UserIPs'];
154
-		}
155
-	}
142
+    if ($Val['Usernames'] != '') {
143
+      // Match with old email
144
+      $OldMatches[$Key]['Email'] = $Val['Email'];
145
+      $OldMatches[$Key]['Username'] = '&nbsp;&nbsp;&#187;&nbsp;'.Users::format_username($Val['UserIDs'], true, true, true);
146
+      $OldMatches[$Key]['EndTime'] = $Val['UserSetTimes'];
147
+      $OldMatches[$Key]['IP'] = $Val['UserIPs'];
148
+    }
149
+  }
156 150
 }
157 151
 
158 152
 // Clean up arrays
159
-if ($Old) {
160
-	$Old = array_reverse(array_reverse($Old));
161
-	$LastOld = count($Old) - 1;
162
-	if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
163
-		// Make sure the timeline is intact (invite email was used as email for the account in the beginning)
164
-		$Old[$LastOld + 1]['Email'] = $Invite['Email'];
165
-		$Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
166
-		$Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
167
-		$Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime'] ) - strtotime($Old[$LastOld + 1]['StartTime']));
168
-		$Old[$LastOld + 1]['IP'] = $Invite['IP'];
169
-	}
153
+if ($Old ?? false) {
154
+  $Old = array_reverse(array_reverse($Old));
155
+  $LastOld = count($Old) - 1;
156
+  if ($Old[$LastOld]['StartTime'] != $Invite['EndTime']) {
157
+    // Make sure the timeline is intact (invite email was used as email for the account in the beginning)
158
+    $Old[$LastOld + 1]['Email'] = $Invite['Email'];
159
+    $Old[$LastOld + 1]['StartTime'] = $Invite['EndTime'];
160
+    $Old[$LastOld + 1]['EndTime'] = $Old[$LastOld]['StartTime'];
161
+    $Old[$LastOld + 1]['ElapsedTime'] = date(time() + strtotime($Old[$LastOld + 1]['EndTime'] ) - strtotime($Old[$LastOld + 1]['StartTime']));
162
+    $Old[$LastOld + 1]['IP'] = $Invite['IP'];
163
+  }
170 164
 }
171 165
 
172 166
 // Start page with current email
173 167
 ?>
174 168
 <div class="thin">
175
-	<div class="header">
176
-		<h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
177
-		<div class="linkbox center">
178
-			<a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">Old email history</a>
179
-		</div>
180
-	</div>
181
-	<br />
182
-	<table width="100%">
183
-		<tr class="colhead">
184
-			<td>Current email</td>
185
-			<td>Start</td>
186
-			<td>End</td>
187
-			<td>Current IP <a href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>" class="brackets">H</a></td>
188
-			<td>Set from IP</td>
189
-		</tr>
169
+  <div class="header">
170
+    <h2>Email history for <a href="user.php?id=<?=$UserID ?>"><?=$Username ?></a></h2>
171
+    <div class="linkbox center">
172
+      <a href="userhistory.php?action=email&amp;userid=<?=$UserID?>" class="brackets">Old email history</a>
173
+    </div>
174
+  </div>
175
+  <br />
176
+  <table width="100%">
177
+    <tr class="colhead">
178
+      <td>Current email</td>
179
+      <td>Start</td>
180
+      <td>End</td>
181
+      <td>Current IP <a href="userhistory.php?action=ips&amp;userid=<?=$UserID ?>" class="brackets">H</a></td>
182
+      <td>Set from IP</td>
183
+    </tr>
190 184
 <? 
191 185
 $Current['Email'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Current['Email']) : '[Encrypted]';
192 186
 $Current['CurrentIP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Current['CurrentIP']) : '[Encrypted]';
193 187
 $Current['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Current['IP']) : '[Encrypted]';
194 188
 ?>
195
-		<tr class="row">
196
-			<td><?=display_str($Current['Email'])?></td>
197
-			<td><?=time_diff($Current['StartTime'])?></td>
198
-			<td></td>
199
-			<td>
200
-				<?=display_str($Current['CurrentIP'])?>
201
-				(<?=Tools::get_country_code_by_ajax($Current['CurrentIP'])?>)
202
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search">S</a>
203
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
204
-				<br />
205
-				<?=Tools::get_host_by_ajax($Current['CurrentIP'])?>
206
-			</td>
207
-			<td>
208
-				<?=display_str($Current['IP'])?>
209
-				(<?=Tools::get_country_code_by_ajax($Current['IP'])?>)
210
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search">S</a>
211
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
212
-				<br />
213
-				<?=Tools::get_host_by_ajax($Current['IP'])?>
214
-			</td>
215
-		</tr>
189
+    <tr class="row">
190
+      <td><?=display_str($Current['Email'])?></td>
191
+      <td><?=time_diff($Current['StartTime'])?></td>
192
+      <td></td>
193
+      <td>
194
+        <?=display_str($Current['CurrentIP'])?>
195
+        (<?=Tools::get_country_code_by_ajax($Current['CurrentIP'])?>)
196
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search">S</a>
197
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['CurrentIP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
198
+        <br />
199
+        <?=Tools::get_host_by_ajax($Current['CurrentIP'])?>
200
+      </td>
201
+      <td>
202
+        <?=display_str($Current['IP'])?>
203
+        (<?=Tools::get_country_code_by_ajax($Current['IP'])?>)
204
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search">S</a>
205
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Current['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
206
+        <br />
207
+        <?=Tools::get_host_by_ajax($Current['IP'])?>
208
+      </td>
209
+    </tr>
216 210
 <?
217
-if ($CurrentMatches) {
218
-	// Match on the current email
219
-	foreach ($CurrentMatches as $Match) {
211
+if ($CurrentMatches ?? false) {
212
+  // Match on the current email
213
+  foreach ($CurrentMatches as $Match) {
220 214
     $Match['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Match['IP']) : '[Encrypted]';
221 215
 ?>
222
-		<tr class="row">
223
-			<td><?=$Match['Username']?></td>
224
-			<td></td>
225
-			<td><?=time_diff($Match['EndTime'])?></td>
226
-			<td></td>
227
-			<td>
228
-				<?=display_str($Match['IP'])?>
229
-				(<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
230
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
231
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
232
-				<br />
233
-				<?=Tools::get_host_by_ajax($Match['IP'])?>
234
-			</td>
235
-		</tr>
216
+    <tr class="row">
217
+      <td><?=$Match['Username']?></td>
218
+      <td></td>
219
+      <td><?=time_diff($Match['EndTime'])?></td>
220
+      <td></td>
221
+      <td>
222
+        <?=display_str($Match['IP'])?>
223
+        (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
224
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
225
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
226
+        <br />
227
+        <?=Tools::get_host_by_ajax($Match['IP'])?>
228
+      </td>
229
+    </tr>
236 230
 <?
237
-	}
231
+  }
238 232
 }
239 233
 // Old emails
240
-if ($Old) {
234
+if ($Old ?? false) {
241 235
 ?>
242
-		<tr class="colhead">
243
-			<td>Old emails</td>
244
-			<td>Start</td>
245
-			<td>End</td>
246
-			<td>Elapsed</td>
247
-			<td>Set from IP</td>
248
-		</tr>
236
+    <tr class="colhead">
237
+      <td>Old emails</td>
238
+      <td>Start</td>
239
+      <td>End</td>
240
+      <td>Elapsed</td>
241
+      <td>Set from IP</td>
242
+    </tr>
249 243
 <?
250
-	$j = 0;
251
-	// Old email
252
-	foreach ($Old as $Record) {
253
-		++$j;
244
+  $j = 0;
245
+  // Old email
246
+  foreach ($Old as $Record) {
247
+    ++$j;
254 248
 
255
-		// Matches on old email
256
-		ob_start();
257
-		$i = 0;
258
-		foreach ($OldMatches as $Match) {
259
-			if ($Match['Email'] == $Record['Email']) {
260
-				++$i;
261
-				// Email matches
262
-?>
263
-		<tr class="row hidden" id="matches_<?=$j?>">
264
-			<td><?=$Match['Username']?></td>
265
-			<td></td>
266
-			<td><?=time_diff($Match['EndTime'])?></td>
267
-			<td></td>
268
-			<td>
269
-				<?=display_str($Match['IP'])?>
270
-				(<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
271
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
272
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
273
-				<br />
274
-				<?=Tools::get_host_by_ajax($Match['IP'])?>
275
-			</td>
276
-		</tr>
277
-<?
278
-			}
279
-		}
249
+    // Matches on old email
250
+    ob_start();
251
+    $i = 0;
252
+    if ($OldMatches ?? false) {
253
+      foreach ($OldMatches as $Match) {
254
+        if ($Match['Email'] == $Record['Email']) {
255
+          ++$i;
256
+          // Email matches
257
+  ?>
258
+      <tr class="row hidden" id="matches_<?=$j?>">
259
+        <td><?=$Match['Username']?></td>
260
+        <td></td>
261
+        <td><?=time_diff($Match['EndTime'])?></td>
262
+        <td></td>
263
+        <td>
264
+          <?=display_str($Match['IP'])?>
265
+          (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
266
+          <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
267
+          <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
268
+          <br />
269
+          <?=Tools::get_host_by_ajax($Match['IP'])?>
270
+        </td>
271
+      </tr>
272
+  <?
273
+        }
274
+      }
275
+    }
280 276
 
281
-		// Save matches to variable
282
-		$MatchCount = $i;
283
-		$Matches = ob_get_contents();
284
-		ob_end_clean();
277
+    // Save matches to variable
278
+    $MatchCount = $i;
279
+    $Matches = ob_get_contents();
280
+    ob_end_clean();
285 281
 
286 282
     $Record['Email'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Record['Email']) : '[Encrypted]';
287 283
     $Record['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Record['IP']) : '[Encrypted]';
288 284
 ?>
289
-		<tr class="row">
290
-			<td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_'.$j.'\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
291
-			<td><?=time_diff($Record['StartTime'])?></td>
292
-			<td><?=time_diff($Record['EndTime'])?></td>
293
-			<td><?=time_diff($Record['ElapsedTime'])?></td>
294
-			<td>
295
-				<?=display_str($Record['IP'])?>
296
-				(<?=Tools::get_country_code_by_ajax($Record['IP'])?>)
297
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search">S</a>
298
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
299
-				<br />
300
-				<?=Tools::get_host_by_ajax($Record['IP'])?>
301
-			</td>
302
-		</tr>
285
+    <tr class="row">
286
+      <td><?=display_str($Record['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_'.$j.'\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
287
+      <td><?=time_diff($Record['StartTime'])?></td>
288
+      <td><?=time_diff($Record['EndTime'])?></td>
289
+      <td><?=time_diff($Record['ElapsedTime'])?></td>
290
+      <td>
291
+        <?=display_str($Record['IP'])?>
292
+        (<?=Tools::get_country_code_by_ajax($Record['IP'])?>)
293
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search">S</a>
294
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Record['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
295
+        <br />
296
+        <?=Tools::get_host_by_ajax($Record['IP'])?>
297
+      </td>
298
+    </tr>
303 299
 <?
304
-		if ($MatchCount > 0) {
305
-			if (isset($Matches)) {
306
-				echo $Matches;
307
-				unset($Matches);
308
-				unset($MatchCount);
309
-			}
310
-		}
311
-	}
300
+    if ($MatchCount > 0) {
301
+      if (isset($Matches)) {
302
+        echo $Matches;
303
+        unset($Matches);
304
+        unset($MatchCount);
305
+      }
306
+    }
307
+  }
312 308
 }
313 309
 // Invite email (always there)
314 310
 ?>
315
-		<tr class="colhead">
316
-			<td>Invite email</td>
317
-			<td>Start</td>
318
-			<td>End</td>
319
-			<td>Age of account</td>
320
-			<td>Registration IP address</td>
321
-		</tr>
311
+    <tr class="colhead">
312
+      <td>Invite email</td>
313
+      <td>Start</td>
314
+      <td>End</td>
315
+      <td>Age of account</td>
316
+      <td>Registration IP address</td>
317
+    </tr>
322 318
 <?
323 319
 // Matches on invite email
324
-if ($OldMatches) {
325
-	$i = 0;
326
-	ob_start();
327
-	foreach ($OldMatches as $Match) {
328
-		if ($Match['Email'] == $Invite['Email']) {
329
-			++$i;
330
-			// Match email is the same as the invite email
320
+$i = 0;
321
+ob_start();
322
+if ($OldMatches ?? false) {
323
+  foreach ($OldMatches as $Match) {
324
+    if ($Match['Email'] == $Invite['Email']) {
325
+      ++$i;
326
+      // Match email is the same as the invite email
331 327
       
332 328
       $Match['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Match['IP']) : '[Encrypted]';
333 329
 ?>
334
-		<tr class="row hidden" id="matches_invite">
335
-			<td><?=$Match['Username']?></td>
336
-			<td></td>
337
-			<td><?=time_diff($Match['EndTime'])?></td>
338
-			<td></td>
339
-			<td>
340
-				<?=display_str($Match['IP'])?>
341
-				(<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
342
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
343
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
344
-				<br />
345
-				<?=Tools::get_host_by_ajax($Match['IP'])?>
346
-			</td>
347
-		</tr>
330
+    <tr class="row hidden" id="matches_invite">
331
+      <td><?=$Match['Username']?></td>
332
+      <td></td>
333
+      <td><?=time_diff($Match['EndTime'])?></td>
334
+      <td></td>
335
+      <td>
336
+        <?=display_str($Match['IP'])?>
337
+        (<?=Tools::get_country_code_by_ajax($Match['IP'])?>)
338
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search">S</a>
339
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Match['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
340
+        <br />
341
+        <?=Tools::get_host_by_ajax($Match['IP'])?>
342
+      </td>
343
+    </tr>
348 344
 <?
349
-		}
350
-	}
351
-	$MatchCount = $i;
352
-	$Matches = ob_get_contents();
353
-	ob_end_clean();
345
+    }
346
+  }
354 347
 }
348
+$MatchCount = $i;
349
+$Matches = ob_get_contents();
350
+ob_end_clean();
355 351
 
356 352
 $Invite['Email'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Invite['Email']) : '[Encrypted]';
357 353
 $Invite['IP'] = apc_exists('DBKEY') ? DBCrypt::decrypt($Invite['IP']) : '[Encrypted]';
358 354
 ?>
359
-		<tr class="row">
360
-			<td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_invite\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
361
-			<td>Never</td>
362
-			<td><?=time_diff($Invite['EndTime'])?></td>
363
-			<td><?=time_diff($Invite['AccountAge'])?></td>
364
-			<td>
365
-				<?=display_str($Invite['IP'])?>
366
-				(<?=Tools::get_country_code_by_ajax($Invite['IP'])?>)
367
-				<a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search">S</a>
368
-				<a href="http://whatismyipaddress.com/ip/<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
369
-				<br />
370
-				<?=Tools::get_host_by_ajax($Invite['IP'])?>
371
-			</td>
372
-		</tr>
355
+    <tr class="row">
356
+      <td><?=display_str($Invite['Email'])?><?=(($MatchCount > 0) ? ' <a href="#" onclick="$(\'#matches_invite\').gtoggle(); return false;">('.$MatchCount.')</a>' : '')?></td>
357
+      <td>Never</td>
358
+      <td><?=time_diff($Invite['EndTime'])?></td>
359
+      <td><?=time_diff($Invite['AccountAge'])?></td>
360
+      <td>
361
+        <?=display_str($Invite['IP'])?>
362
+        (<?=Tools::get_country_code_by_ajax($Invite['IP'])?>)
363
+        <a href="user.php?action=search&amp;ip_history=on&amp;ip=<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search">S</a>
364
+        <a href="http://whatismyipaddress.com/ip/<?=display_str($Invite['IP'])?>" class="brackets tooltip" title="Search WIMIA.com">WI</a>
365
+        <br />
366
+        <?=Tools::get_host_by_ajax($Invite['IP'])?>
367
+      </td>
368
+    </tr>
373 369
 <?
374 370
 
375 371
 if ($Matches) {
376
-	echo $Matches;
372
+  echo $Matches;
377 373
 }
378 374
 
379 375
 ?>
380
-	</table>
376
+  </table>
381 377
 </div>
382 378
 <? View::show_footer(); ?>

Loading…
Cancel
Save