@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | // Get the closing user's Email signature and append it to the Email. |
38 | 38 | if (User::getCurrent()->getEmailSig() != "") { |
39 | 39 | $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8"); |
40 | - mail($target, "RE: [ACC #$id] English Wikipedia Account Request", $template->getText() . "\n\n" . $emailsig, $headers); |
|
40 | + mail($target, "RE: [ACC #$id] English Wikipedia Account Request", $template->getText()."\n\n".$emailsig, $headers); |
|
41 | 41 | } |
42 | 42 | else { |
43 | 43 | mail($target, "RE: [ACC #$id] English Wikipedia Account Request", $template->getText(), $headers); |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | } |
107 | 107 | else { |
108 | 108 | // This is the login form, not the request form. We need protection here. |
109 | - $path = 'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]; |
|
110 | - header("Location: " . $path); |
|
109 | + $path = 'https://'.$_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; |
|
110 | + header("Location: ".$path); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | |
204 | 204 | function displayPreview($wikicode) |
205 | 205 | { |
206 | - $parseresult = unserialize(file_get_contents('http://en.wikipedia.org/w/api.php?action=parse&format=php&text=' . urlencode($wikicode))); |
|
206 | + $parseresult = unserialize(file_get_contents('http://en.wikipedia.org/w/api.php?action=parse&format=php&text='.urlencode($wikicode))); |
|
207 | 207 | $out = "<br />\n<h3>Preview</h3>\n<div style=\"border: 2px dashed rgb(26, 79, 133);\">\n<div style=\"margin: 20px;\">"; |
208 | 208 | $out .= $parseresult['parse']['text']['*']; |
209 | 209 | $out .= '</div></div>'; |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | */ |
294 | 294 | function welcomerbotRenderSig($creator, $sig) |
295 | 295 | { |
296 | - $signature = html_entity_decode($sig) . ' ~~~~~'; |
|
297 | - if (!preg_match("/((\[\[[ ]*(w:)?[ ]*(en:)?)|(\{\{subst:))[ ]*User[ ]*:[ ]*" . $creator . "[ ]*(\]\]|\||\}\}|\/)/i", $signature)) { |
|
296 | + $signature = html_entity_decode($sig).' ~~~~~'; |
|
297 | + if (!preg_match("/((\[\[[ ]*(w:)?[ ]*(en:)?)|(\{\{subst:))[ ]*User[ ]*:[ ]*".$creator."[ ]*(\]\]|\||\}\}|\/)/i", $signature)) { |
|
298 | 298 | $signature = "--[[User:$creator|$creator]] ([[User talk:$creator|talk]]) ~~~~~"; |
299 | 299 | } |
300 | 300 | return $signature; |
@@ -332,25 +332,25 @@ discard block |
||
332 | 332 | $pluralise = false; |
333 | 333 | } |
334 | 334 | elseif ($secs > 10 && $secs < $minuteCut) { |
335 | - $output = round($secs / $second) . " second"; |
|
335 | + $output = round($secs / $second)." second"; |
|
336 | 336 | } |
337 | 337 | elseif ($secs >= $minuteCut && $secs < $hourCut) { |
338 | - $output = round($secs / $minute) . " minute"; |
|
338 | + $output = round($secs / $minute)." minute"; |
|
339 | 339 | } |
340 | 340 | elseif ($secs >= $hourCut && $secs < $dayCut) { |
341 | - $output = round($secs / $hour) . " hour"; |
|
341 | + $output = round($secs / $hour)." hour"; |
|
342 | 342 | } |
343 | 343 | elseif ($secs >= $dayCut && $secs < $weekCut) { |
344 | - $output = round($secs / $day) . " day"; |
|
344 | + $output = round($secs / $day)." day"; |
|
345 | 345 | } |
346 | 346 | elseif ($secs >= $weekCut && $secs < $month) { |
347 | - $output = round($secs / $week) . " week"; |
|
347 | + $output = round($secs / $week)." week"; |
|
348 | 348 | } |
349 | 349 | elseif ($secs >= $month && $secs < $year) { |
350 | - $output = round($secs / $month) . " month"; |
|
350 | + $output = round($secs / $month)." month"; |
|
351 | 351 | } |
352 | 352 | elseif ($secs >= $year && $secs < $year * 10) { |
353 | - $output = round($secs / $year) . " year"; |
|
353 | + $output = round($secs / $year)." year"; |
|
354 | 354 | } |
355 | 355 | else { |
356 | 356 | $output = "a long time ago"; |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | if ($pluralise) { |
361 | - $output = (substr($output, 0, 2) <> "1 ") ? $output . "s ago" : $output . " ago"; |
|
361 | + $output = (substr($output, 0, 2) <> "1 ") ? $output."s ago" : $output." ago"; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | return $output; |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | { |
405 | 405 | $userList = ""; |
406 | 406 | foreach ($users as $v) { |
407 | - $userList .= "\"" . htmlentities($v) . "\", "; |
|
407 | + $userList .= "\"".htmlentities($v)."\", "; |
|
408 | 408 | } |
409 | - $userList = "[" . rtrim($userList, ", ") . "]"; |
|
409 | + $userList = "[".rtrim($userList, ", ")."]"; |
|
410 | 410 | $tailscript = <<<JS |
411 | 411 | $('.username-typeahead').typeahead({ |
412 | 412 | source: {$userList} |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | /** Initialises the PHP Session */ |
30 | 30 | function initialiseSession() { |
31 | - session_start(); |
|
31 | + session_start(); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | "requests" => $requests, |
161 | 161 | "total" => $totalRequests, |
162 | 162 | "api" => $v['api'], |
163 | - "type" => $type); |
|
163 | + "type" => $type); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | global $smarty; |
@@ -27,7 +27,8 @@ |
||
27 | 27 | $session = new session(); |
28 | 28 | |
29 | 29 | /** Initialises the PHP Session */ |
30 | -function initialiseSession() { |
|
30 | +function initialiseSession() |
|
31 | +{ |
|
31 | 32 | session_start(); |
32 | 33 | } |
33 | 34 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $viewableDataStatement->bindValue(":email", $request->getEmail()); |
66 | 66 | $viewableDataStatement->bindValue(":reserved", User::getCurrent()->getId()); |
67 | 67 | $viewableDataStatement->bindValue(":trustedIp", $request->getTrustedIp()); |
68 | - $viewableDataStatement->bindValue(":trustedProxy", '%' . $request->getTrustedIp() . '%'); |
|
68 | + $viewableDataStatement->bindValue(":trustedProxy", '%'.$request->getTrustedIp().'%'); |
|
69 | 69 | |
70 | 70 | $viewableDataStatement->execute(); |
71 | 71 | |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | #endregion |
78 | 78 | |
79 | 79 | if ($request->getStatus() == "Closed") { |
80 | - $hash = md5($request->getId() . $request->getEmail() . $request->getTrustedIp() . microtime()); //If the request is closed, change the hash based on microseconds similar to the checksums. |
|
80 | + $hash = md5($request->getId().$request->getEmail().$request->getTrustedIp().microtime()); //If the request is closed, change the hash based on microseconds similar to the checksums. |
|
81 | 81 | $smarty->assign("isclosed", true); |
82 | 82 | } |
83 | 83 | else { |
84 | - $hash = md5($request->getId() . $request->getEmail() . $request->getTrustedIp()); |
|
84 | + $hash = md5($request->getId().$request->getEmail().$request->getTrustedIp()); |
|
85 | 85 | $smarty->assign("isclosed", false); |
86 | 86 | } |
87 | 87 | $smarty->assign("hash", $hash); |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | $userListData = $userListResult->fetchAll(PDO::FETCH_COLUMN); |
258 | 258 | $userListProcessedData = array(); |
259 | 259 | foreach ($userListData as $userListItem) { |
260 | - $userListProcessedData[] = "\"" . htmlentities($userListItem) . "\""; |
|
260 | + $userListProcessedData[] = "\"".htmlentities($userListItem)."\""; |
|
261 | 261 | } |
262 | 262 | |
263 | - $userList = '[' . implode(",", $userListProcessedData) . ']'; |
|
263 | + $userList = '['.implode(",", $userListProcessedData).']'; |
|
264 | 264 | $smarty->assign("jsuserlist", $userList); |
265 | 265 | // end: assign to user |
266 | 266 |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | { |
25 | 25 | global $toolUserAgent; |
26 | 26 | |
27 | - $endpoint = $this->baseUrlInternal . '/initiate&format=json&oauth_callback=oob'; |
|
27 | + $endpoint = $this->baseUrlInternal.'/initiate&format=json&oauth_callback=oob'; |
|
28 | 28 | |
29 | 29 | $c = new OAuthConsumer($this->consumerToken, $this->consumerSecret); |
30 | 30 | $parsed = parse_url($endpoint); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $data = curl_exec($ch); |
44 | 44 | |
45 | 45 | if (!$data) { |
46 | - throw new Exception('Curl error: ' . curl_error($ch)); |
|
46 | + throw new Exception('Curl error: '.curl_error($ch)); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | $token = json_decode($data); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | global $toolUserAgent; |
66 | 66 | |
67 | - $endpoint = $this->baseUrlInternal . '/token&format=json'; |
|
67 | + $endpoint = $this->baseUrlInternal.'/token&format=json'; |
|
68 | 68 | |
69 | 69 | $c = new OAuthConsumer($this->consumerToken, $this->consumerSecret); |
70 | 70 | $rc = new OAuthConsumer($requestToken, $requestSecret); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $data = curl_exec($ch); |
89 | 89 | |
90 | 90 | if (!$data) { |
91 | - throw new Exception('Curl error: ' . curl_error($ch)); |
|
91 | + throw new Exception('Curl error: '.curl_error($ch)); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | $token = json_decode($data); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | $ch = curl_init(); |
122 | 122 | if ($method == "GET") { |
123 | - curl_setopt($ch, CURLOPT_URL, $mediawikiWebServiceEndpoint . "?" . http_build_query($apiParams)); |
|
123 | + curl_setopt($ch, CURLOPT_URL, $mediawikiWebServiceEndpoint."?".http_build_query($apiParams)); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($method == "POST") { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | $data = curl_exec($ch); |
139 | 139 | |
140 | 140 | if (!$data) { |
141 | - throw new Exception('Curl error: ' . curl_error($ch)); |
|
141 | + throw new Exception('Curl error: '.curl_error($ch)); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return json_decode($data); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | global $toolUserAgent; |
151 | 151 | |
152 | - $endpoint = $this->baseUrlInternal . '/identify&format=json'; |
|
152 | + $endpoint = $this->baseUrlInternal.'/identify&format=json'; |
|
153 | 153 | |
154 | 154 | $c = new OAuthConsumer($this->consumerToken, $this->consumerSecret); |
155 | 155 | $rc = new OAuthToken($accessToken, $accessSecret); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $data = curl_exec($ch); |
173 | 173 | |
174 | 174 | if (!$data) { |
175 | - throw new Exception('Curl error: ' . curl_error($ch)); |
|
175 | + throw new Exception('Curl error: '.curl_error($ch)); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | $decodedData = json_decode($data); |
@@ -12,8 +12,7 @@ |
||
12 | 12 | if(!isset($_GET['tool']) |
13 | 13 | || !isset($toolList[$_GET['tool']]) |
14 | 14 | || !isset($_GET['data']) |
15 | -) |
|
16 | -{ |
|
15 | +) { |
|
17 | 16 | header("HTTP/1.1 403 Forbidden"); |
18 | 17 | return; |
19 | 18 | } |
@@ -8,8 +8,8 @@ |
||
8 | 8 | 'honeypot' => 'https://www.projecthoneypot.org/ip_%DATA%', |
9 | 9 | 'stopforumspam' => 'https://www.stopforumspam.com/ipcheck/%DATA%', |
10 | 10 | 'google' => 'https://www.google.com/search?q=%DATA%', |
11 | - 'rangefinder' => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%', |
|
12 | - 'ipcheck' => 'https://tools.wmflabs.org/ipcheck/index.php?ip=%DATA%' |
|
11 | + 'rangefinder' => 'https://tools.wmflabs.org/rangeblockfinder/?ip=%DATA%', |
|
12 | + 'ipcheck' => 'https://tools.wmflabs.org/ipcheck/index.php?ip=%DATA%' |
|
13 | 13 | ); |
14 | 14 | |
15 | 15 | if(!isset($_GET['tool']) |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | 'ipcheck' => 'https://tools.wmflabs.org/ipcheck/index.php?ip=%DATA%' |
13 | 13 | ); |
14 | 14 | |
15 | -if(!isset($_GET['tool']) |
|
15 | +if (!isset($_GET['tool']) |
|
16 | 16 | || !isset($toolList[$_GET['tool']]) |
17 | 17 | || !isset($_GET['data']) |
18 | 18 | ) |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | if (isset($_GET['round2'])) { |
25 | - echo '<script>window.location.href=' . json_encode(str_replace("%DATA%", urlencode($_GET['data']), $toolList[$_GET['tool']])) . '</script>'; |
|
25 | + echo '<script>window.location.href='.json_encode(str_replace("%DATA%", urlencode($_GET['data']), $toolList[$_GET['tool']])).'</script>'; |
|
26 | 26 | } |
27 | 27 | else { |
28 | - header("Location: " . $_SERVER["REQUEST_URI"] . "&round2=true"); |
|
28 | + header("Location: ".$_SERVER["REQUEST_URI"]."&round2=true"); |
|
29 | 29 | } |
@@ -2036,41 +2036,41 @@ |
||
2036 | 2036 | }); |
2037 | 2037 | } |
2038 | 2038 | elseif ($action == "listall") { |
2039 | - global $availableRequestStates, $enableEmailConfirm; |
|
2039 | + global $availableRequestStates, $enableEmailConfirm; |
|
2040 | 2040 | |
2041 | 2041 | if (isset($_GET['status']) && isset($availableRequestStates[$_GET['status']])) { |
2042 | 2042 | $type = $_GET['status']; // safe, we've verified it's sane in the above if statement. |
2043 | 2043 | |
2044 | - $database = gGetDb(); |
|
2044 | + $database = gGetDb(); |
|
2045 | 2045 | |
2046 | - if ($enableEmailConfirm == 1) { |
|
2047 | - $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
2048 | - } else { |
|
2049 | - $query = "SELECT * FROM request WHERE status = :type;"; |
|
2050 | - } |
|
2046 | + if ($enableEmailConfirm == 1) { |
|
2047 | + $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
|
2048 | + } else { |
|
2049 | + $query = "SELECT * FROM request WHERE status = :type;"; |
|
2050 | + } |
|
2051 | 2051 | |
2052 | - $statement = $database->prepare($query); |
|
2052 | + $statement = $database->prepare($query); |
|
2053 | 2053 | |
2054 | - $statement->bindValue(":type", $type); |
|
2055 | - $statement->execute(); |
|
2054 | + $statement->bindValue(":type", $type); |
|
2055 | + $statement->execute(); |
|
2056 | 2056 | |
2057 | - $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
2058 | - foreach ($requests as $req) { |
|
2059 | - /** @var Request $req */ |
|
2060 | - $req->setDatabase($database); |
|
2061 | - } |
|
2057 | + $requests = $statement->fetchAll(PDO::FETCH_CLASS, "Request"); |
|
2058 | + foreach ($requests as $req) { |
|
2059 | + /** @var Request $req */ |
|
2060 | + $req->setDatabase($database); |
|
2061 | + } |
|
2062 | 2062 | |
2063 | - global $smarty; |
|
2064 | - $smarty->assign("requests", $requests); |
|
2065 | - $smarty->assign("showStatus", false); |
|
2066 | - $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
2067 | - echo $html; |
|
2068 | - } else { |
|
2069 | - echo defaultpage(); |
|
2070 | - } |
|
2063 | + global $smarty; |
|
2064 | + $smarty->assign("requests", $requests); |
|
2065 | + $smarty->assign("showStatus", false); |
|
2066 | + $html = $smarty->fetch("mainpage/requesttable.tpl"); |
|
2067 | + echo $html; |
|
2068 | + } else { |
|
2069 | + echo defaultpage(); |
|
2070 | + } |
|
2071 | 2071 | |
2072 | - BootstrapSkin::displayInternalFooter(); |
|
2073 | - die(); |
|
2072 | + BootstrapSkin::displayInternalFooter(); |
|
2073 | + die(); |
|
2074 | 2074 | } |
2075 | 2075 | # If the action specified does not exist, goto the default page. |
2076 | 2076 | else { |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $user = User::getByUsername($_POST['username'], gGetDb()); |
350 | 350 | |
351 | 351 | if ($user == false || !$user->authenticate($_POST['password'])) { |
352 | - header("Location: $baseurl/acc.php?error=authfail&tplUsername=" . urlencode($_POST['username'])); |
|
352 | + header("Location: $baseurl/acc.php?error=authfail&tplUsername=".urlencode($_POST['username'])); |
|
353 | 353 | die(); |
354 | 354 | } |
355 | 355 | |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | Logger::unbanned($database, $ban, $_POST['unbanreason']); |
903 | 903 | }); |
904 | 904 | |
905 | - BootstrapSkin::displayAlertBox("Unbanned " . $ban->getTarget(), "alert-info", "", false, false); |
|
905 | + BootstrapSkin::displayAlertBox("Unbanned ".$ban->getTarget(), "alert-info", "", false, false); |
|
906 | 906 | BootstrapSkin::displayInternalFooter(); |
907 | 907 | Notification::unbanned($ban, $_POST['unbanreason']); |
908 | 908 | die(); |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | if ($request->getStatus() == $_GET['target']) { |
1036 | 1036 | SessionAlert::error( |
1037 | - "Cannot set status, target already deferred to " . htmlentities($_GET['target']), |
|
1037 | + "Cannot set status, target already deferred to ".htmlentities($_GET['target']), |
|
1038 | 1038 | "Error"); |
1039 | 1039 | header("Location: acc.php?action=zoom&id={$request->getId()}"); |
1040 | 1040 | die(); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | if ($request->getEmailSent() == "1" && !isset($_GET['override']) && $gem != 0) { |
1151 | 1151 | $alertContent = "<p>This request has already been closed in a manner that has generated an e-mail to the user, Proceed?</p><br />"; |
1152 | 1152 | $alertContent .= "<div class=\"row-fluid\">"; |
1153 | - $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?sum=" . $_GET['sum'] . "&action=done&id=" . $_GET['id'] . "&override=yes&email=" . $_GET['email'] . "\">Yes</a>"; |
|
1153 | + $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?sum=".$_GET['sum']."&action=done&id=".$_GET['id']."&override=yes&email=".$_GET['email']."\">Yes</a>"; |
|
1154 | 1154 | $alertContent .= "<a class=\"btn btn-danger span3\" href=\"$baseurl/acc.php\">No</a>"; |
1155 | 1155 | $alertContent .= "</div>"; |
1156 | 1156 | |
@@ -1161,9 +1161,9 @@ discard block |
||
1161 | 1161 | |
1162 | 1162 | // check the request is not reserved by someone else |
1163 | 1163 | if ($request->getReserved() != 0 && !isset($_GET['reserveoverride']) && $request->getReserved() != User::getCurrent()->getId()) { |
1164 | - $alertContent = "<p>This request is currently marked as being handled by " . $request->getReservedObject()->getUsername() . ", Proceed?</p><br />"; |
|
1164 | + $alertContent = "<p>This request is currently marked as being handled by ".$request->getReservedObject()->getUsername().", Proceed?</p><br />"; |
|
1165 | 1165 | $alertContent .= "<div class=\"row-fluid\">"; |
1166 | - $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?" . $_SERVER["QUERY_STRING"] . "&reserveoverride=yes\">Yes</a>"; |
|
1166 | + $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?".$_SERVER["QUERY_STRING"]."&reserveoverride=yes\">Yes</a>"; |
|
1167 | 1167 | $alertContent .= "<a class=\"btn btn-danger span3\" href=\"$baseurl/acc.php\">No</a>"; |
1168 | 1168 | $alertContent .= "</div>"; |
1169 | 1169 | |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | } |
1180 | 1180 | |
1181 | 1181 | // Checks whether the username is already in use on Wikipedia. |
1182 | - $userexist = file_get_contents("http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=" . urlencode($request->getName()) . "&format=php"); |
|
1182 | + $userexist = file_get_contents("http://en.wikipedia.org/w/api.php?action=query&list=users&ususers=".urlencode($request->getName())."&format=php"); |
|
1183 | 1183 | $ue = unserialize($userexist); |
1184 | 1184 | if (!isset ($ue['query']['users']['0']['missing'])) { |
1185 | 1185 | $exists = true; |
@@ -1200,7 +1200,7 @@ discard block |
||
1200 | 1200 | if ($isForCreated && !$exists && !isset($_GET['createoverride'])) { |
1201 | 1201 | $alertContent = "<p>You have chosen to mark this request as \"created\", but the account does not exist on the English Wikipedia, proceed?</p><br />"; |
1202 | 1202 | $alertContent .= "<div class=\"row-fluid\">"; |
1203 | - $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?" . $_SERVER["QUERY_STRING"] . "&createoverride=yes\">Yes</a>"; |
|
1203 | + $alertContent .= "<a class=\"btn btn-success offset3 span3\" href=\"$baseurl/acc.php?".$_SERVER["QUERY_STRING"]."&createoverride=yes\">Yes</a>"; |
|
1204 | 1204 | $alertContent .= "<a class=\"btn btn-danger span3\" href=\"$baseurl/acc.php\">No</a>"; |
1205 | 1205 | $alertContent .= "</div>"; |
1206 | 1206 | |
@@ -1245,26 +1245,26 @@ discard block |
||
1245 | 1245 | die(); |
1246 | 1246 | } |
1247 | 1247 | |
1248 | - $headers = 'From: [email protected]' . "\r\n"; |
|
1248 | + $headers = 'From: [email protected]'."\r\n"; |
|
1249 | 1249 | |
1250 | 1250 | // CC mailing list option |
1251 | 1251 | if (User::getCurrent()->isAdmin() || User::getCurrent()->isCheckuser()) { |
1252 | 1252 | // these people get the choice |
1253 | 1253 | if (isset($_POST['ccmailist']) && $_POST['ccmailist'] == "on") { |
1254 | - $headers .= 'Cc: [email protected]' . "\r\n"; |
|
1254 | + $headers .= 'Cc: [email protected]'."\r\n"; |
|
1255 | 1255 | } |
1256 | 1256 | } else { |
1257 | 1257 | // these people do not. |
1258 | - $headers .= 'Cc: [email protected]' . "\r\n"; |
|
1258 | + $headers .= 'Cc: [email protected]'."\r\n"; |
|
1259 | 1259 | } |
1260 | 1260 | |
1261 | - $headers .= 'X-ACC-Request: ' . $request->getId() . "\r\n"; |
|
1262 | - $headers .= 'X-ACC-UserID: ' . User::getCurrent()->getId() . "\r\n"; |
|
1261 | + $headers .= 'X-ACC-Request: '.$request->getId()."\r\n"; |
|
1262 | + $headers .= 'X-ACC-UserID: '.User::getCurrent()->getId()."\r\n"; |
|
1263 | 1263 | |
1264 | 1264 | // Get the closing user's Email signature and append it to the Email. |
1265 | 1265 | if (User::getCurrent()->getEmailSig() != "") { |
1266 | 1266 | $emailsig = html_entity_decode(User::getCurrent()->getEmailSig(), ENT_QUOTES, "UTF-8"); |
1267 | - mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'] . "\n\n" . $emailsig, $headers); |
|
1267 | + mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody']."\n\n".$emailsig, $headers); |
|
1268 | 1268 | } |
1269 | 1269 | else { |
1270 | 1270 | mail($request->getEmail(), "RE: [ACC #{$request->getId()}] English Wikipedia Account Request", $_POST['msgbody'], $headers); |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | |
1290 | 1290 | Notification::requestClosed($request, $crea); |
1291 | 1291 | BootstrapSkin::displayAlertBox( |
1292 | - "Request " . $request->getId() . " (" . htmlentities($request->getName(), ENT_COMPAT, 'UTF-8') . ") marked as '" . htmlentities($crea, ENT_COMPAT, 'UTF-8') . "'.", |
|
1292 | + "Request ".$request->getId()." (".htmlentities($request->getName(), ENT_COMPAT, 'UTF-8').") marked as '".htmlentities($crea, ENT_COMPAT, 'UTF-8')."'.", |
|
1293 | 1293 | "alert-success"); |
1294 | 1294 | } |
1295 | 1295 | else if ($_POST['action'] == "mail") { |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | Notification::requestClosed($request, $crea); |
1358 | - BootstrapSkin::displayAlertBox("Request " . $request->getId() . " (" . htmlentities($request->getName(), ENT_COMPAT, 'UTF-8') . ") marked as '" . htmlentities($crea, ENT_COMPAT, 'UTF-8') . "'.", "alert-success"); |
|
1358 | + BootstrapSkin::displayAlertBox("Request ".$request->getId()." (".htmlentities($request->getName(), ENT_COMPAT, 'UTF-8').") marked as '".htmlentities($crea, ENT_COMPAT, 'UTF-8')."'.", "alert-success"); |
|
1359 | 1359 | |
1360 | 1360 | $towhom = $request->getEmail(); |
1361 | 1361 | if ($gem != "0") { |
@@ -1524,7 +1524,7 @@ discard block |
||
1524 | 1524 | if (!isset($_GET['confclosed'])) { |
1525 | 1525 | if ($request->getStatus() == "Closed") { |
1526 | 1526 | // FIXME: bootstrappify properly |
1527 | - throw new TransactionException('This request is currently closed. Are you sure you wish to reserve it?<br /><ul><li><a href="' . $_SERVER["REQUEST_URI"] . '&confclosed=yes">Yes, reserve this closed request</a></li><li><a href="' . $baseurl . '/acc.php">No, return to main request interface</a></li></ul>', "Request closed", "alert-info"); |
|
1527 | + throw new TransactionException('This request is currently closed. Are you sure you wish to reserve it?<br /><ul><li><a href="'.$_SERVER["REQUEST_URI"].'&confclosed=yes">Yes, reserve this closed request</a></li><li><a href="'.$baseurl.'/acc.php">No, return to main request interface</a></li></ul>', "Request closed", "alert-info"); |
|
1528 | 1528 | } |
1529 | 1529 | } |
1530 | 1530 | |
@@ -1595,7 +1595,7 @@ discard block |
||
1595 | 1595 | } |
1596 | 1596 | } |
1597 | 1597 | else { |
1598 | - echo "You cannot break " . htmlentities($reservedUser->getUsername()) . "'s reservation"; |
|
1598 | + echo "You cannot break ".htmlentities($reservedUser->getUsername())."'s reservation"; |
|
1599 | 1599 | } |
1600 | 1600 | } |
1601 | 1601 | else { |
@@ -1695,7 +1695,7 @@ discard block |
||
1695 | 1695 | } |
1696 | 1696 | |
1697 | 1697 | if (!isset($_POST['comment']) || $_POST['comment'] == "") { |
1698 | - header("Location: acc.php?action=zoom&id=" . $request->getId()); |
|
1698 | + header("Location: acc.php?action=zoom&id=".$request->getId()); |
|
1699 | 1699 | die(); |
1700 | 1700 | } |
1701 | 1701 | |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | |
1729 | 1729 | Notification::commentCreated($comment); |
1730 | 1730 | |
1731 | - header("Location: acc.php?action=zoom&id=" . $request->getId()); |
|
1731 | + header("Location: acc.php?action=zoom&id=".$request->getId()); |
|
1732 | 1732 | } |
1733 | 1733 | elseif ($action == "changepassword") { |
1734 | 1734 | if ((!isset($_POST['oldpassword'])) || $_POST['oldpassword'] == "") { |
@@ -1806,7 +1806,7 @@ discard block |
||
1806 | 1806 | Notification::commentEdited($comment); |
1807 | 1807 | |
1808 | 1808 | SessionAlert::success("Comment has been saved successfully"); |
1809 | - header("Location: $baseurl/acc.php?action=zoom&id=" . $comment->getRequest()); |
|
1809 | + header("Location: $baseurl/acc.php?action=zoom&id=".$comment->getRequest()); |
|
1810 | 1810 | }); |
1811 | 1811 | |
1812 | 1812 | die(); |
@@ -152,8 +152,7 @@ discard block |
||
152 | 152 | |
153 | 153 | $database = gGetDb(); |
154 | 154 | |
155 | - $database->transactionally(function() use ($database, $useOauthSignup) |
|
156 | - { |
|
155 | + $database->transactionally(function() use ($database, $useOauthSignup) { |
|
157 | 156 | |
158 | 157 | $newUser = new User(); |
159 | 158 | $newUser->setDatabase($database); |
@@ -481,8 +480,7 @@ discard block |
||
481 | 480 | |
482 | 481 | $database = gGetDb(); |
483 | 482 | |
484 | - $database->transactionally(function() use ($database) |
|
485 | - { |
|
483 | + $database->transactionally(function() use ($database) { |
|
486 | 484 | global $smarty; |
487 | 485 | |
488 | 486 | $message = InterfaceMessage::getById($_GET['edit'], $database); |
@@ -570,8 +568,7 @@ discard block |
||
570 | 568 | |
571 | 569 | $database = gGetDb(); |
572 | 570 | |
573 | - $database->transactionally(function() use ($database, $baseurl) |
|
574 | - { |
|
571 | + $database->transactionally(function() use ($database, $baseurl) { |
|
575 | 572 | $template = new WelcomeTemplate(); |
576 | 573 | $template->setDatabase($database); |
577 | 574 | $template->setUserCode($_POST['usercode']); |
@@ -656,8 +653,7 @@ discard block |
||
656 | 653 | die(); |
657 | 654 | } |
658 | 655 | |
659 | - $database->transactionally(function() use($database, $template) |
|
660 | - { |
|
656 | + $database->transactionally(function() use($database, $template) { |
|
661 | 657 | $tid = $template->getId(); |
662 | 658 | |
663 | 659 | $database |
@@ -693,8 +689,7 @@ discard block |
||
693 | 689 | } |
694 | 690 | |
695 | 691 | if (isset($_POST['submit'])) { |
696 | - $database->transactionally(function() use($database, $template) |
|
697 | - { |
|
692 | + $database->transactionally(function() use($database, $template) { |
|
698 | 693 | $template->setUserCode($_POST['usercode']); |
699 | 694 | $template->setBotCode($_POST['botcode']); |
700 | 695 | $template->save(); |
@@ -825,8 +820,7 @@ discard block |
||
825 | 820 | |
826 | 821 | $currentUsername = User::getCurrent()->getUsername(); |
827 | 822 | |
828 | - $database->transactionally(function() use ($database, $ban, $duration, $currentUsername) |
|
829 | - { |
|
823 | + $database->transactionally(function() use ($database, $ban, $duration, $currentUsername) { |
|
830 | 824 | $ban->setDatabase($database); |
831 | 825 | $ban->setActive(1); |
832 | 826 | $ban->setType($_POST['type']); |
@@ -891,8 +885,7 @@ discard block |
||
891 | 885 | else { |
892 | 886 | $database = gGetDb(); |
893 | 887 | |
894 | - $database->transactionally(function() use ($database, $ban) |
|
895 | - { |
|
888 | + $database->transactionally(function() use ($database, $ban) { |
|
896 | 889 | $ban->setActive(0); |
897 | 890 | $ban->save(); |
898 | 891 | |
@@ -1041,8 +1034,7 @@ discard block |
||
1041 | 1034 | } |
1042 | 1035 | |
1043 | 1036 | $database = gGetDb(); |
1044 | - $database->transactionally(function() use ($database, $request) |
|
1045 | - { |
|
1037 | + $database->transactionally(function() use ($database, $request) { |
|
1046 | 1038 | global $availableRequestStates; |
1047 | 1039 | |
1048 | 1040 | $request->setReserved(0); |
@@ -1192,7 +1184,8 @@ discard block |
||
1192 | 1184 | $emailTemplate = EmailTemplate::getById($gem, gGetDb()); |
1193 | 1185 | if ($emailTemplate instanceof EmailTemplate) { |
1194 | 1186 | $isForCreated = $emailTemplate->getDefaultAction() === EmailTemplate::CREATED; |
1195 | - } else { |
|
1187 | + } |
|
1188 | + else { |
|
1196 | 1189 | $isForCreated = false; |
1197 | 1190 | } |
1198 | 1191 | |
@@ -1253,7 +1246,8 @@ discard block |
||
1253 | 1246 | if (isset($_POST['ccmailist']) && $_POST['ccmailist'] == "on") { |
1254 | 1247 | $headers .= 'Cc: [email protected]' . "\r\n"; |
1255 | 1248 | } |
1256 | - } else { |
|
1249 | + } |
|
1250 | + else { |
|
1257 | 1251 | // these people do not. |
1258 | 1252 | $headers .= 'Cc: [email protected]' . "\r\n"; |
1259 | 1253 | } |
@@ -1469,8 +1463,7 @@ discard block |
||
1469 | 1463 | elseif ($action == "reserve") { |
1470 | 1464 | $database = gGetDb(); |
1471 | 1465 | |
1472 | - $database->transactionally(function() use ($database) |
|
1473 | - { |
|
1466 | + $database->transactionally(function() use ($database) { |
|
1474 | 1467 | $request = Request::getById($_GET['resid'], $database); |
1475 | 1468 | |
1476 | 1469 | if ($request == false) { |
@@ -1573,8 +1566,7 @@ discard block |
||
1573 | 1566 | if ($reservedUser->getId() != User::getCurrent()->getId()) { |
1574 | 1567 | if (User::getCurrent()->isAdmin()) { |
1575 | 1568 | if (isset($_GET['confirm']) && $_GET['confirm'] == 1) { |
1576 | - $database->transactionally(function() use($database, $request) |
|
1577 | - { |
|
1569 | + $database->transactionally(function() use($database, $request) { |
|
1578 | 1570 | $request->setReserved(0); |
1579 | 1571 | $request->save(); |
1580 | 1572 | |
@@ -1599,8 +1591,7 @@ discard block |
||
1599 | 1591 | } |
1600 | 1592 | } |
1601 | 1593 | else { |
1602 | - $database->transactionally(function() use ($database, $request) |
|
1603 | - { |
|
1594 | + $database->transactionally(function() use ($database, $request) { |
|
1604 | 1595 | $request->setReserved(0); |
1605 | 1596 | $request->save(); |
1606 | 1597 | |
@@ -1793,8 +1784,7 @@ discard block |
||
1793 | 1784 | |
1794 | 1785 | if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
1795 | 1786 | $database = gGetDb(); |
1796 | - $database->transactionally(function() use ($database, $comment, $baseurl) |
|
1797 | - { |
|
1787 | + $database->transactionally(function() use ($database, $comment, $baseurl) { |
|
1798 | 1788 | |
1799 | 1789 | $comment->setComment($_POST['newcomment']); |
1800 | 1790 | $comment->setVisibility($_POST['visibility']); |
@@ -1842,8 +1832,7 @@ discard block |
||
1842 | 1832 | die(); |
1843 | 1833 | } |
1844 | 1834 | |
1845 | - $database->transactionally(function() use ($database, $user, $requestObject, $curuser) |
|
1846 | - { |
|
1835 | + $database->transactionally(function() use ($database, $user, $requestObject, $curuser) { |
|
1847 | 1836 | $updateStatement = $database->prepare("UPDATE request SET reserved = :userid WHERE id = :request;"); |
1848 | 1837 | $updateStatement->bindValue(":userid", $user->getId()); |
1849 | 1838 | $updateStatement->bindValue(":request", $requestObject->getId()); |
@@ -1871,8 +1860,7 @@ discard block |
||
1871 | 1860 | } |
1872 | 1861 | if (isset($_POST['submit'])) { |
1873 | 1862 | $database = gGetDb(); |
1874 | - $database->transactionally(function() use ($database) |
|
1875 | - { |
|
1863 | + $database->transactionally(function() use ($database) { |
|
1876 | 1864 | global $baseurl; |
1877 | 1865 | |
1878 | 1866 | $emailTemplate = new EmailTemplate(); |
@@ -1950,8 +1938,7 @@ discard block |
||
1950 | 1938 | die(); |
1951 | 1939 | } |
1952 | 1940 | |
1953 | - $database->transactionally(function() use ($database, $emailTemplate) |
|
1954 | - { |
|
1941 | + $database->transactionally(function() use ($database, $emailTemplate) { |
|
1955 | 1942 | $emailTemplate->save(); |
1956 | 1943 | |
1957 | 1944 | Logger::editedEmail($database, $emailTemplate); |
@@ -2016,8 +2003,7 @@ discard block |
||
2016 | 2003 | } |
2017 | 2004 | elseif ($action == "oauthattach") { |
2018 | 2005 | $database = gGetDb(); |
2019 | - $database->transactionally(function() use ($database) |
|
2020 | - { |
|
2006 | + $database->transactionally(function() use ($database) { |
|
2021 | 2007 | try { |
2022 | 2008 | global $oauthConsumerToken, $oauthSecretToken, $oauthBaseUrl, $oauthBaseUrlInternal; |
2023 | 2009 | |
@@ -2052,7 +2038,8 @@ discard block |
||
2052 | 2038 | |
2053 | 2039 | if ($enableEmailConfirm == 1) { |
2054 | 2040 | $query = "SELECT * FROM request WHERE status = :type AND emailconfirm = 'Confirmed';"; |
2055 | - } else { |
|
2041 | + } |
|
2042 | + else { |
|
2056 | 2043 | $query = "SELECT * FROM request WHERE status = :type;"; |
2057 | 2044 | } |
2058 | 2045 | |
@@ -2072,7 +2059,8 @@ discard block |
||
2072 | 2059 | $smarty->assign("showStatus", false); |
2073 | 2060 | $html = $smarty->fetch("mainpage/requesttable.tpl"); |
2074 | 2061 | echo $html; |
2075 | - } else { |
|
2062 | + } |
|
2063 | + else { |
|
2076 | 2064 | echo defaultpage(); |
2077 | 2065 | } |
2078 | 2066 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | die(); |
83 | 83 | } |
84 | 84 | |
85 | - $qterm = '%' . $term . '%'; |
|
85 | + $qterm = '%'.$term.'%'; |
|
86 | 86 | |
87 | 87 | $statement = gGetDb()->prepare("SELECT * FROM request WHERE email LIKE :term;"); |
88 | 88 | $statement->bindValue(":term", $qterm); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $smarty->display("search/searchresult.tpl"); |
101 | 101 | } |
102 | 102 | elseif ($_GET['type'] == 'IP') { |
103 | - $qterm = '%' . $term . '%'; |
|
103 | + $qterm = '%'.$term.'%'; |
|
104 | 104 | |
105 | 105 | $statement = gGetDb()->prepare("SELECT * FROM request WHERE email <> '[email protected]' and ip <> '127.0.0.1' and ip LIKE :term or forwardedip LIKE :term2;"); |
106 | 106 | $statement->bindValue(":term", $qterm); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $smarty->display("search/searchresult.tpl"); |
120 | 120 | } |
121 | 121 | elseif ($_GET['type'] == 'Request') { |
122 | - $qterm = '%' . $term . '%'; |
|
122 | + $qterm = '%'.$term.'%'; |
|
123 | 123 | |
124 | 124 | $statement = gGetDb()->prepare("SELECT * FROM request WHERE name LIKE :term;"); |
125 | 125 | $statement->bindValue(":term", $qterm); |
@@ -63,12 +63,12 @@ |
||
63 | 63 | $database->commit(); |
64 | 64 | echo ". Committed txn.\n"; |
65 | 65 | } catch (Exception $ex) { |
66 | - echo ". Encountered exception: " . $ex->getMessage(). "\n"; |
|
66 | + echo ". Encountered exception: ".$ex->getMessage()."\n"; |
|
67 | 67 | $database->rollBack(); |
68 | 68 | echo ". Rolled back txn\n"; |
69 | 69 | throw $ex; |
70 | 70 | } finally { |
71 | - if($database->hasActiveTransaction()){ |
|
71 | + if ($database->hasActiveTransaction()) { |
|
72 | 72 | $database->rollBack(); |
73 | 73 | echo ". Rolled back txn\n"; |
74 | 74 | } |
@@ -62,13 +62,15 @@ |
||
62 | 62 | echo ". IP location fetch complete.\n"; |
63 | 63 | $database->commit(); |
64 | 64 | echo ". Committed txn.\n"; |
65 | - } catch (Exception $ex) { |
|
65 | + } |
|
66 | + catch (Exception $ex) { |
|
66 | 67 | echo ". Encountered exception: " . $ex->getMessage(). "\n"; |
67 | 68 | $database->rollBack(); |
68 | 69 | echo ". Rolled back txn\n"; |
69 | 70 | throw $ex; |
70 | - } finally { |
|
71 | - if($database->hasActiveTransaction()){ |
|
71 | + } |
|
72 | + finally { |
|
73 | + if($database->hasActiveTransaction()) { |
|
72 | 74 | $database->rollBack(); |
73 | 75 | echo ". Rolled back txn\n"; |
74 | 76 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if (isset($_SERVER['REQUEST_METHOD'])) { |
4 | - die(); |
|
4 | + die(); |
|
5 | 5 | } // Web clients die. |
6 | 6 | |
7 | 7 | ini_set('display_errors', 1); |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | $locationProvider = new IpLocationProvider($database, $locationProviderApiKey); |
18 | 18 | |
19 | 19 | while (true) { |
20 | - echo "Beginning txn\n"; |
|
21 | - $database->beginTransaction(); |
|
20 | + echo "Beginning txn\n"; |
|
21 | + $database->beginTransaction(); |
|
22 | 22 | |
23 | - try { |
|
24 | - echo ". Fetching data...\n"; |
|
23 | + try { |
|
24 | + echo ". Fetching data...\n"; |
|
25 | 25 | |
26 | - // fetch a bunch of un-geolocated IPs from the database. |
|
27 | - // note we have to parse the forwardedip field in the database so we can test against the geolocation table. |
|
28 | - // This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available. |
|
29 | - // Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an IN() |
|
30 | - // clause dynamically, sending that back to the database to check if there are geolocation entries, then repeating |
|
31 | - // until we have 10 to process - and the fact that we'd have to potentially retrieve all IPs from the database |
|
32 | - // before we find any at all. This way keeps all of that legwork in the database, at the cost of a more complex |
|
33 | - // query. |
|
34 | - $statement = $database->query(<<<SQL |
|
26 | + // fetch a bunch of un-geolocated IPs from the database. |
|
27 | + // note we have to parse the forwardedip field in the database so we can test against the geolocation table. |
|
28 | + // This guarantees we get ten unlocated IPs back, unless there actually aren't 10 available. |
|
29 | + // Alternatives include downloading a small set of forwarded IPs, splitting it in PHP, constructing an IN() |
|
30 | + // clause dynamically, sending that back to the database to check if there are geolocation entries, then repeating |
|
31 | + // until we have 10 to process - and the fact that we'd have to potentially retrieve all IPs from the database |
|
32 | + // before we find any at all. This way keeps all of that legwork in the database, at the cost of a more complex |
|
33 | + // query. |
|
34 | + $statement = $database->query(<<<SQL |
|
35 | 35 | SELECT p.prox |
36 | 36 | FROM ( |
37 | 37 | SELECT trim(substring_index(substring_index(r.forwardedip, ',', n.n), ',', -1)) prox |
@@ -48,38 +48,38 @@ discard block |
||
48 | 48 | WHERE NOT EXISTS (SELECT 1 FROM geolocation g WHERE g.address = p.prox FOR UPDATE) |
49 | 49 | LIMIT 10; |
50 | 50 | SQL |
51 | - ); |
|
51 | + ); |
|
52 | 52 | |
53 | - $missingIps = $statement->fetchAll(PDO::FETCH_COLUMN); |
|
53 | + $missingIps = $statement->fetchAll(PDO::FETCH_COLUMN); |
|
54 | 54 | |
55 | - $count = count($missingIps); |
|
56 | - if ($count === 0) { |
|
57 | - echo ". Found nothing to do.\n"; |
|
58 | - break; |
|
59 | - } |
|
55 | + $count = count($missingIps); |
|
56 | + if ($count === 0) { |
|
57 | + echo ". Found nothing to do.\n"; |
|
58 | + break; |
|
59 | + } |
|
60 | 60 | |
61 | - echo ". Picked {$count} IP addresses\n"; |
|
61 | + echo ". Picked {$count} IP addresses\n"; |
|
62 | 62 | |
63 | - foreach ($missingIps as $ip) { |
|
64 | - echo ". . Getting location for {$ip}...\n"; |
|
65 | - $data = json_encode($locationProvider->getIpLocation($ip)); |
|
66 | - echo ". . . {$data}\n"; |
|
67 | - } |
|
63 | + foreach ($missingIps as $ip) { |
|
64 | + echo ". . Getting location for {$ip}...\n"; |
|
65 | + $data = json_encode($locationProvider->getIpLocation($ip)); |
|
66 | + echo ". . . {$data}\n"; |
|
67 | + } |
|
68 | 68 | |
69 | - echo ". IP location fetch complete.\n"; |
|
70 | - $database->commit(); |
|
71 | - echo ". Committed txn.\n"; |
|
72 | - } catch (Exception $ex) { |
|
73 | - echo ". Encountered exception: " . $ex->getMessage(). "\n"; |
|
74 | - $database->rollBack(); |
|
75 | - echo ". Rolled back txn\n"; |
|
76 | - throw $ex; |
|
77 | - } finally { |
|
78 | - if($database->hasActiveTransaction()){ |
|
79 | - $database->rollBack(); |
|
80 | - echo ". Rolled back txn\n"; |
|
81 | - } |
|
82 | - } |
|
69 | + echo ". IP location fetch complete.\n"; |
|
70 | + $database->commit(); |
|
71 | + echo ". Committed txn.\n"; |
|
72 | + } catch (Exception $ex) { |
|
73 | + echo ". Encountered exception: " . $ex->getMessage(). "\n"; |
|
74 | + $database->rollBack(); |
|
75 | + echo ". Rolled back txn\n"; |
|
76 | + throw $ex; |
|
77 | + } finally { |
|
78 | + if($database->hasActiveTransaction()){ |
|
79 | + $database->rollBack(); |
|
80 | + echo ". Rolled back txn\n"; |
|
81 | + } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | echo "Done.\n"; |
@@ -10,8 +10,7 @@ |
||
10 | 10 | |
11 | 11 | $db = gGetDb( ); |
12 | 12 | |
13 | -$db->transactionally(function() use ($db) |
|
14 | -{ |
|
13 | +$db->transactionally(function() use ($db) { |
|
15 | 14 | global $cDataClearIp, $cDataClearEmail, $dataclear_interval, $enableEmailConfirm; |
16 | 15 | |
17 | 16 | $query = $db->prepare("UPDATE request SET ip = :ip, forwardedip = null, email = :mail, useragent = '' WHERE date < DATE_SUB(curdate(), INTERVAL $dataclear_interval) AND status = 'Closed';"); |
@@ -20,7 +20,7 @@ |
||
20 | 20 | public static function getByAddress($address, PdoDatabase $database, $forUpdate = false) |
21 | 21 | { |
22 | 22 | $lockMode = $forUpdate ? ' FOR UPDATE' : ''; |
23 | - $sql = "SELECT * FROM geolocation WHERE address = :id LIMIT 1" . $lockMode; |
|
23 | + $sql = "SELECT * FROM geolocation WHERE address = :id LIMIT 1".$lockMode; |
|
24 | 24 | |
25 | 25 | $statement = $database->prepare($sql); |
26 | 26 | $statement->bindValue(":id", $address); |