Skip to content

Commit

Permalink
More minor tweaks and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
reedy committed Sep 21, 2024
1 parent 1152a60 commit 4dce65f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion openflights.js
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ function xmlhttpPost(strURL, id, param) {
gt.gettext(
"'%1' not found in %2 database. Do you want to add it as a new %2 company?"
),
[airline, modeoperators[mode], modeoperators[mode]]
[airline, modeoperators[mode]]
)
)
) {
Expand Down
4 changes: 2 additions & 2 deletions php/alsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
}
$row = $sth->fetch();
if ($row) {
printf('0;' . sprintf(_('An airline using the IATA code %s exists already.'), $iata));
printf('0;' . sprintf(_('An airline using the IATA code %s exists already.'), htmlspecialchars($iata)));
exit;
}
}
Expand All @@ -122,7 +122,7 @@
}
$row = $sth->fetch();
if ($row) {
printf('0;' . sprintf(_('An airline using the ICAO code %s exists already.'), $icao));
printf('0;' . sprintf(_('An airline using the ICAO code %s exists already.'), htmlspecialchars($icao)));
exit;
}
}
Expand Down
4 changes: 3 additions & 1 deletion php/autocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
include_once 'helper.php';
include_once 'db_pdo.php';

// TODO: Why do we do this?
/**
* Trim anything after a period or left paren
*
* TODO: Why do we do this?
*
* @param $query
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion php/git.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public static function getCurrentCommitID() {
$head = trim(file_get_contents(".git/{$matches[1]}"));
}

return $head ? $head : null;
return $head ?: null;
}
}
6 changes: 3 additions & 3 deletions php/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function nth_text($element, $n) {
return nbsp_trim($item->textContent);
}

// Shouldn't be needed in most cases, as we should be checking for the number of pieces we text,
// Shouldn't be necessary in most cases, as we should be checking for the number of pieces we text,
// as some are optional.
// If the item ($n) we were looking for isn't there, just return an empty string.
return '';
Expand Down Expand Up @@ -370,7 +370,7 @@ function die_nicely($msg) {

if ($html['title']->text() != "FlightMemory - FlightData") {
die_nicely(
sprintf(_("Sorry, the file %s does not appear to contain FlightMemory FlightData."), $uploadFile)
sprintf(_("Sorry, the file %s does not appear to contain FlightMemory FlightData."), htmlspecialchars($uploadFile))
);
}

Expand All @@ -393,7 +393,7 @@ function die_nicely($msg) {
break;

default:
die_nicely(sprintf(_("Unknown file type %s"), $fileType));
die_nicely(sprintf(_("Unknown file type %s"), htmlspecialchars($fileType)));
}

if ($action == _("Upload")) {
Expand Down
2 changes: 1 addition & 1 deletion php/map.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include_once 'helper.php';
include_once 'filter.php';

// This applies only when viewing another users flights
// This applies only when viewing another user's flights
$user = $_POST["user"] ?? ($_GET["user"] ?? null);
$trid = $_POST["trid"] ?? ($_GET["trid"] ?? null);

Expand Down
2 changes: 1 addition & 1 deletion php/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
$success = $sth->execute($params);
}
if (!$success) {
die("0;" . sprintf(_("Operation on user %s failed."), $name));
die("0;" . sprintf(_("Operation on user %s failed."), htmlspecialchars($name)));
}

// In all cases, change locale and units to user selection
Expand Down
4 changes: 2 additions & 2 deletions php/trip.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$trid = $_POST["trid"] ?? null;

if ($type != "NEW" && (!$trid || $trid == 0)) {
die('0;Trip ID ' . $trid . ' invalid');
die("0;" . sprintf(_("Trip ID %s invalid."), htmlspecialchars($trid)));
}

$uid = $_SESSION["uid"];
Expand All @@ -21,7 +21,7 @@
*/
function failIfFalse($res, $name) {
if (!$res) {
die('0;Operation on trip ' . $name . ' failed.');
die("0;" . sprintf(_("Operation on trip %s failed."), htmlspecialchars($name)));
}
}

Expand Down

0 comments on commit 4dce65f

Please sign in to comment.