<?php
+/**
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ * This file is part of Nominatim. (https://nominatim.org)
+ *
+ * Copyright (C) 2022 by the Nominatim developer community.
+ * For a full list of authors see the git log.
+ */
namespace Nominatim;
public static function printSQL($sSQL)
{
- echo '<p><tt><font color="#aaa">'.$sSQL.'</font></tt></p>'."\n";
+ echo '<p><tt><b>'.date('c').'</b> <font color="#aaa">'.htmlspecialchars($sSQL, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401).'</font></tt></p>'."\n";
}
private static function outputVar($mVar, $sPreNL)
}
if (is_string($mVar)) {
- echo "'$mVar'";
- return strlen($mVar) + 2;
+ $sOut = "'$mVar'";
+ } else {
+ $sOut = (string)$mVar;
}
- echo (string)$mVar;
- return strlen((string)$mVar);
+ echo htmlspecialchars($sOut, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401);
+ return strlen($sOut);
}
}