|
4 | 4 | // Use of this source code is governed by the Polyform Shield 1.0.0 license that can be |
5 | 5 | // found in the LICENSE.md file. |
6 | 6 | chdir('..'); |
| 7 | +use WebPageTest\Util; |
| 8 | +use WebPageTest\Util\OAuth as CPOauth; |
7 | 9 | include 'common.inc'; |
8 | 10 |
|
9 | 11 | $urls = $_REQUEST['url']; |
10 | 12 | $labels = $_REQUEST['label']; |
11 | 13 | $ids = array(); |
12 | 14 | $ip = $_SERVER['REMOTE_ADDR']; |
13 | | -$key = ''; |
14 | | -$keys_file = __DIR__ . '/../settings/keys.ini'; |
15 | | -if (file_exists(__DIR__ . '/../settings/common/keys.ini')) { |
16 | | - $keys_file = __DIR__ . '/../settings/common/keys.ini'; |
17 | | -} |
18 | | -if (file_exists(__DIR__ . '/../settings/server/keys.ini')) { |
19 | | - $keys_file = __DIR__ . '/../settings/server/keys.ini'; |
20 | | -} |
21 | | -$key = GetServerKey(); |
22 | 15 | $headless = false; |
23 | 16 | if (GetSetting('headless')) { |
24 | 17 | $headless = true; |
|
41 | 34 | foreach ($urls as $index => $url) { |
42 | 35 | $url = trim($url); |
43 | 36 | if (strlen($url)) { |
44 | | - $id = SubmitTest($url, $labels[$index], $key); |
| 37 | + $id = SubmitTest($url, $labels[$index]); |
45 | 38 | if ($id && strlen($id)) { |
46 | 39 | $ids[] = $id; |
47 | 40 | } |
|
88 | 81 | * @param mixed $url |
89 | 82 | * @param mixed $label |
90 | 83 | */ |
91 | | -function SubmitTest($url, $label, $key) |
| 84 | +function SubmitTest($url, $label) |
92 | 85 | { |
93 | 86 | global $uid; |
94 | 87 | global $user; |
@@ -118,14 +111,30 @@ function SubmitTest($url, $label, $key) |
118 | 111 | if ($user) { |
119 | 112 | $testUrl .= '&user=' . urlencode($uid); |
120 | 113 | } |
121 | | - if (strlen($key)) { |
122 | | - $testUrl .= '&k=' . urlencode($key); |
123 | | - } |
124 | 114 | $saml_cookie = GetSetting('saml_cookie', 'samlu'); |
125 | 115 | if (isset($_COOKIE[$saml_cookie])) { |
126 | 116 | $testUrl .= '&samlu=' . urlencode($_COOKIE[$saml_cookie]); |
127 | 117 | } |
128 | 118 |
|
| 119 | + if ($_REQUEST['vo']) { |
| 120 | + $testUrl .= "&vo={$_REQUEST['vo']}"; |
| 121 | + } |
| 122 | + if ($_REQUEST['vd']) { |
| 123 | + $testUrl .= "&vd=".urlencode($_REQUEST['vd']); |
| 124 | + } |
| 125 | + if ($_REQUEST['vh']) { |
| 126 | + $testUrl .= "&vh={$_REQUEST['vh']}"; |
| 127 | + } |
| 128 | + |
| 129 | + $token_name = Util::getCookieName(CPOauth::$cp_access_token_cookie_key); |
| 130 | + $token_value = $_COOKIE[$token_name]; |
| 131 | + if(isset($token_name) && isset($token_value)){ |
| 132 | + $context = stream_context_create(array("http" => array("header" => 'Cookie: '.$token_name.'='.$token_value."\r\n"), "ignore_errors" => true,) ); |
| 133 | + libxml_set_streams_context($context); |
| 134 | + } |
| 135 | + |
| 136 | + ini_set('user_agent', $_SERVER['HTTP_USER_AGENT']); |
| 137 | + |
129 | 138 | // submit the request |
130 | 139 | $result = simplexml_load_file($testUrl, 'SimpleXMLElement', LIBXML_NOERROR); |
131 | 140 | if ($result && $result->data) { |
|
0 commit comments