diff --git a/www/runtest.php b/www/runtest.php index 85b29f2d8e..29d0c2cf35 100644 --- a/www/runtest.php +++ b/www/runtest.php @@ -63,6 +63,7 @@ $redirect_cache = array(); $error = null; +$errorTitle = null; $xml = false; $usingAPI = false; $usingApi2 = false; @@ -897,7 +898,7 @@ function buildSelfHost($hosts) } -if (!strlen($error) && CheckIp($test) && CheckUrl($test['url']) && CheckRateLimit($test, $error)) { +if (!strlen($error) && CheckIp($test) && CheckUrl($test['url']) && CheckRateLimit($test, $error, $errorTitle)) { $total_runs = Util::getRunCount($test['runs'], $test['fvonly'], $test['lighthouse'], $test['type']); $hasRunsAvailable = !is_null($request_context->getUser()) && $request_context->getUser()->hasEnoughRemainingRuns($total_runs); $isAnon = !is_null($request_context->getUser()) && $request_context->getUser()->isAnon(); @@ -1452,6 +1453,7 @@ function buildSelfHost($hosts) echo $tpl->render('runlimit'); } else { echo $tpl->render('runtest', array( + 'errorTitle' => $errorTitle, 'error' => $error )); } @@ -3498,8 +3500,8 @@ function loggedOutLoginForm() { $ret = << -
  • Login
  • Sign-up
  • +
  • Login
  • HTML; @@ -3510,15 +3512,15 @@ function loggedInPerks() { $msg = << -
  • Access to 13 months of saved tests, making it easier to compare tests and analyze trends.
  • +
  • The ability to save your tests! Access up to 13 months of tests, making it easier to compare tests and analyze results.
  • Ability to contribute to the WebPageTest Forum.
  • -
  • Access to upcoming betas and new features that will enhance your WebPageTest experience.
  • +
  • Access to upcoming betas and new features to enhance your WebPageTest experience.
  • HTML; return $msg; } -function CheckRateLimit($test, &$error) +function CheckRateLimit($test, &$error, &$errorTitle) { global $USER_EMAIL; global $supportsCPAuth; @@ -3551,8 +3553,11 @@ function CheckRateLimit($test, &$error) $cmrl = new RateLimiter($test['ip'], $monthly_limit); $passesMonthly = $cmrl->check($total_runs); + $error = "

    Don't worry! You can keep testing for free once you log in, which will give you access to other excellent features like:

    "; + $errorTitleTemplate = "You've reached the limit for"; + if (!$passesMonthly) { - $error = "

    You've reached the limit for logged-out tests this month, but don't worry! You can keep testing once you log in, which will give you access to other nice features like:

    "; + $errorTitle = "{$errorTitleTemplate} this month"; $error .= << var intervalId = setInterval(function () { @@ -3580,8 +3585,7 @@ function CheckRateLimit($test, &$error) $count += $total_runs; Cache::store($cache_key, $count, 1800); } else { - $apiUrl = Util::getSetting('api_url'); - $error = '

    You\'ve reached the limit for logged-out tests per hour, but don\'t worry! You can keep testing once you log in, which will give you access to other nice features like:

    '; + $errorTitle = "{$errorTitleTemplate} this month"; $error .= << var intervalId = setInterval(function () { @@ -3594,9 +3598,6 @@ function CheckRateLimit($test, &$error) HTML; $error .= loggedInPerks(); - if ($apiUrl) { - $error .= "

    And also, if you need to run tests programmatically you might be interested in the WebPageTest API

    "; - } $error .= loggedOutLoginForm(); $ret = false; } diff --git a/www/templates/errors/runtest.php b/www/templates/errors/runtest.php index a2e8d7b007..7d62dfd1df 100644 --- a/www/templates/errors/runtest.php +++ b/www/templates/errors/runtest.php @@ -1,6 +1,4 @@
    -

    Oops! There was a problem with the test.

    - +

    Oops!

    +