Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceroute home page tweaks addressing #2658 #2661

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
273 changes: 141 additions & 132 deletions www/traceroute.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,186 +24,195 @@
$connectivity = parse_ini_file($connectivity_file, true);
$locations = LoadLocations();
$loc = ParseLocations($locations);
$page_keywords = array('Traceroute','WebPageTest','Website Speed Test','Test');
$page_keywords = array('Traceroute', 'WebPageTest', 'Website Speed Test', 'Test');
$page_description = "Test network path from multiple locations around the world (traceroute).";
?>
<!DOCTYPE html>
<html lang="en-us">
<head>
<title>WebPageTest - Traceroute diagnostic</title>
<?php include('head.inc'); ?>
</head>
<body class="home feature-pro">
<?php
$tab = 'Start Test';
include 'header.inc';
?>

<?php include("home_header.php"); ?>
<head>
<title>WebPageTest - Traceroute diagnostic</title>
<?php include('head.inc'); ?>
</head>

<div class="home_content_contain">
<div class="home_content">
<body class="home feature-pro">
<?php
$tab = 'Start Test';
include 'header.inc';
?>

<?php include("home_header.php"); ?>

<form name="urlEntry" id="urlEntry" action="/runtest.php" method="POST" enctype="multipart/form-data" onsubmit="return ValidateInput(this)">
<div class="home_content_contain">
<div class="home_content">

<input type="hidden" name="type" value="traceroute">
<input type="hidden" name="vo" value="<?php echo htmlspecialchars($owner);?>">
<?php
if (strlen($secret)) {
$hashStr = $secret;
$hashStr .= $_SERVER['HTTP_USER_AGENT'];
$hashStr .= $owner;

$now = gmdate('c');
echo "<input type=\"hidden\" name=\"vd\" value=\"$now\">\n";
$hashStr .= $now;

$hmac = sha1($hashStr);
echo "<input type=\"hidden\" name=\"vh\" value=\"$hmac\">\n";
}
?>

<form name="urlEntry" id="urlEntry" action="/runtest.php" method="POST" enctype="multipart/form-data" onsubmit="return ValidateInput(this)">

<div id="test_box-container" class="home_responsive_test">
<input type="hidden" name="type" value="traceroute">
<input type="hidden" name="vo" value="<?php echo htmlspecialchars($owner); ?>">
<?php
$currNav = "Traceroute";
include("testTypesNav.php");
if (strlen($secret)) {
$hashStr = $secret;
$hashStr .= $_SERVER['HTTP_USER_AGENT'];
$hashStr .= $owner;

$now = gmdate('c');
echo "<input type=\"hidden\" name=\"vd\" value=\"$now\">\n";
$hashStr .= $now;

$hmac = sha1($hashStr);
echo "<input type=\"hidden\" name=\"vh\" value=\"$hmac\">\n";
}
?>


<div id="analytical-review" class="test_box">
<ul class="input_fields home_responsive_test_top">
<li>
<label for="url" class="vis-hidden">Enter URL to test</label>
<input type="text" name="url" id="url" required placeholder="Host Name/IP Address" class="text large" onkeypress="if (event.keyCode == 32) {return false;}">
</li>
<div id="test_box-container" class="home_responsive_test">
<?php
$currNav = "Traceroute";
include("testTypesNav.php");
?>


<li class="test_main_config">
<div id="analytical-review" class="test_box">
<ul class="input_fields home_responsive_test_top">
<li>
<label for="url" class="vis-hidden">Enter URL to test</label>
<input type="text" name="url" id="url" required placeholder="Host Name/IP Address" class="text large" onkeypress="if (event.keyCode == 32) {return false;}">
</li>

<div class="test_presets">

<div class="fieldrow">
<label for="location">Test Location</label>
<select name="where" id="location">
<?php
foreach ($loc['locations'] as &$location) {
$selected = '';
if ($location['checked']) {
$selected = 'selected';
}
<li class="test_main_config">

echo "<option value=\"{$location['name']}\" $selected>{$location['label']}</option>";
}
?>
</select>
<?php if (GetSetting('map')) { ?>
<button id="change-location-btn" type=button onclick="SelectLocation();" title="Select from Map">Select from Map</button>
<?php } ?>
<span class="pending_tests hidden" id="pending_tests"><span id="backlog">0</span> Pending Tests</span>
<span class="cleared"></span>
</div>
<div class="fieldrow">
<label for="browser">Browser</label>
<select name="browser" id="browser">
<?php
foreach ($loc['browsers'] as $key => &$browser) {
$selected = '';
if ($browser['selected']) {
$selected = 'selected';
<div class="test_presets">

<div class="fieldrow">
<label for="location">Test Location</label>
<select name="where" id="location">
<?php
foreach ($loc['locations'] as &$location) {
$selected = '';
if ($location['checked']) {
$selected = 'selected';
}

echo "<option value=\"{$location['name']}\" $selected>{$location['label']}</option>";
}
echo "<option value=\"{$browser['key']}\" $selected>{$browser['label']}</option>\n";
}
?>
</select>
</div>
<div class="hidden">
<select name="location" id="connection">
<?php
foreach ($loc['connections'] as $key => &$connection) {
$selected = '';
if ($connection['selected']) {
$selected = 'selected';
?>
</select>
<?php if (GetSetting('map')) { ?>
<button id="change-location-btn" type=button onclick="SelectLocation();" title="Select from Map">Select from Map</button>
<?php } ?>
<span class="pending_tests hidden" id="pending_tests"><span id="backlog">0</span> Pending Tests</span>
<span class="cleared"></span>
</div>
<div class="hidden">
<select name="location" id="connection">
<?php
foreach ($loc['connections'] as $key => &$connection) {
$selected = '';
if ($connection['selected']) {
$selected = 'selected';
}
echo "<option value=\"{$connection['key']}\" $selected>{$connection['label']}</option>\n";
}
echo "<option value=\"{$connection['key']}\" $selected>{$connection['label']}</option>\n";
?>
</select>
</div>
<div class="fieldrow">
<label for="number_of_tests">
Number of Tests to Run
</label>
<?php
$runs = 3;
if (isset($_COOKIE["runs"])) {
$runs = (int)@$_COOKIE["runs"];
}
if (isset($_REQUEST["runs"])) {
$runs = (int)@$_REQUEST["runs"];
}
if (isset($req_runs)) {
$runs = (int)$req_runs;
}
$max_runs = GetSetting('maxruns', 9);

$runs = max(1, min($runs, $max_runs));
?>
</select>
</div>
<div class="fieldrow">
<label for="number_of_tests">
Number of Tests to Run<br>
<small>Up to <?php echo GetSetting('maxruns', 9); ?></small>
</label>
<input id="number_of_tests" type="number" class="text short" name="runs" value="3">
</div>
<select id="number_of_tests" class="text short" name="runs" value=<?php echo "\"$runs\""; ?> required>
<?php
for ($i = 1; $i <= $max_runs; $i++) {
echo '<option value="' . $i . '"' . ($i === $runs ? ' selected' : '') . '>' . $i . '</option>';
}
?>
</select>
</div>




</div>
<div>
<input type="submit" name="submit" value="Start Test &#8594;" class="start_test">
</div>
</li>
</div>
<div>
<input type="submit" name="submit" value="Start Test &#8594;" class="start_test">
</div>
</li>

</ul>
</ul>
</div>
</div>
</div>

<div id="location-dialog" style="display:none;">
<h3>Select Test Location</h3>
<div id="map">
</div>
<p>
<select id="location2">
<?php
foreach ($loc['locations'] as &$location) {
$selected = '';
if ($location['checked']) {
$selected = 'SELECTED';
<div id="location-dialog" style="display:none;">
<h3>Select Test Location</h3>
<div id="map">
</div>
<p>
<select id="location2">
<?php
foreach ($loc['locations'] as &$location) {
$selected = '';
if ($location['checked']) {
$selected = 'SELECTED';
}

echo "<option value=\"{$location['name']}\" $selected>{$location['label']}</option>";
}

echo "<option value=\"{$location['name']}\" $selected>{$location['label']}</option>";
}
?>
</select>
<input id="location-ok" type=button class="simplemodal-close" value="OK">
</p>
</div>
?>
</select>
<input id="location-ok" type=button class="simplemodal-close" value="OK">
</p>
</div>
</form>

<?php
include(INCLUDES_PATH . '/include/home-subsections.inc');
?>
<?php include('footer.inc'); ?>
</div><!--home_content_contain-->
</div><!--home_content-->
</div>
</div><!--home_content_contain-->
</div><!--home_content-->
</div>

<script>
<script>
<?php
$max_runs = GetSetting('maxruns', 9);
echo "var maxRuns = $max_runs;\n";
echo "var locations = " . json_encode($locations) . ";\n";
echo "var connectivity = " . json_encode($connectivity) . ";\n";
$maps_api_key = GetSetting('maps_api_key');
$max_runs = GetSetting('maxruns', 9);
echo "var maxRuns = $max_runs;\n";
echo "var locations = " . json_encode($locations) . ";\n";
echo "var connectivity = " . json_encode($connectivity) . ";\n";
$maps_api_key = GetSetting('maps_api_key');
if ($maps_api_key) {
echo "var mapsApiKey = '$maps_api_key';";
}
?>
</script>
<script src="<?php echo $GLOBALS['cdnPath']; ?>/assets/js/test.js?v=<?php echo VER_JS_TEST;?>"></script>
</body>
</script>
<script src="<?php echo $GLOBALS['cdnPath']; ?>/assets/js/test.js?v=<?php echo VER_JS_TEST; ?>"></script>
</body>

</html>


<?php
/**
* Load the location information
*
*/
* Load the location information
*
*/
function LoadLocations()
{
global $request_context;
Expand All @@ -226,4 +235,4 @@ function LoadLocations()
return $locations;
}

?>
?>