From 02cc825841dd60300aebfed23c59c39d222b4374 Mon Sep 17 00:00:00 2001 From: niu tech Date: Tue, 16 Jan 2024 23:57:41 +0100 Subject: [PATCH] Refactor backend --- .gitignore | 4 - .htaccess | 66 ---- README.md | 8 +- assets/upgrade | 1 - backend/config.php.dist | 14 - backend/controllers/browser.php | 114 ------- backend/controllers/feature.php | 55 ---- backend/controllers/fingerprint.php | 23 -- backend/controllers/latest.php | 14 - backend/controllers/results.php | 261 ---------------- backend/controllers/saved.php | 20 -- backend/controllers/search.php | 12 - backend/controllers/timeline.php | 50 --- backend/index.php | 303 ------------------- backend/libraries/database.php | 11 - backend/libraries/template.php | 93 ------ backend/libraries/tools.php | 81 ----- backend/models/browsers.php | 42 --- backend/models/fingerprint.php | 159 ---------- backend/models/raw.php | 165 ---------- backend/models/results.php | 338 --------------------- backend/other/database.sql | 146 --------- backend/templates/browser.html | 276 ----------------- backend/templates/feature.html | 178 ----------- backend/templates/fingerprint.html | 210 ------------- backend/templates/latest.html | 176 ----------- backend/templates/results-other.html | 270 ----------------- backend/templates/results.html | 434 --------------------------- backend/templates/saved.html | 203 ------------- backend/templates/search.html | 251 ---------------- backend/templates/timeline.html | 133 -------- composer.json | 5 - index.html | 12 +- results/latest.html | 2 +- results/search.html | 2 +- s/index.html | 5 +- scripts/base.js | 39 +-- scripts/reporting.js | 8 +- 38 files changed, 11 insertions(+), 4173 deletions(-) delete mode 100644 .gitignore delete mode 100644 .htaccess delete mode 100644 assets/upgrade delete mode 100644 backend/config.php.dist delete mode 100644 backend/controllers/browser.php delete mode 100644 backend/controllers/feature.php delete mode 100644 backend/controllers/fingerprint.php delete mode 100644 backend/controllers/latest.php delete mode 100644 backend/controllers/results.php delete mode 100644 backend/controllers/saved.php delete mode 100644 backend/controllers/search.php delete mode 100644 backend/controllers/timeline.php delete mode 100644 backend/index.php delete mode 100644 backend/libraries/database.php delete mode 100644 backend/libraries/template.php delete mode 100644 backend/libraries/tools.php delete mode 100644 backend/models/browsers.php delete mode 100644 backend/models/fingerprint.php delete mode 100644 backend/models/raw.php delete mode 100644 backend/models/results.php delete mode 100644 backend/other/database.sql delete mode 100644 backend/templates/browser.html delete mode 100644 backend/templates/feature.html delete mode 100644 backend/templates/fingerprint.html delete mode 100644 backend/templates/latest.html delete mode 100644 backend/templates/results-other.html delete mode 100644 backend/templates/results.html delete mode 100644 backend/templates/saved.html delete mode 100644 backend/templates/search.html delete mode 100644 backend/templates/timeline.html delete mode 100644 composer.json diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3a72a52d..00000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -backend/config.php -composer.lock -vendor/ -.DS_Store diff --git a/.htaccess b/.htaccess deleted file mode 100644 index 6ced5309..00000000 --- a/.htaccess +++ /dev/null @@ -1,66 +0,0 @@ -AddOutputFilterByType DEFLATE text/html -AddOutputFilterByType DEFLATE text/css -AddOutputFilterByType DEFLATE text/javascript - -RewriteEngine on -RewriteCond %{HTTP_HOST} ^www\.html5test\.com$ -RewriteRule ^ http://html5test.com%{REQUEST_URI} [L,R=301] - -RewriteRule ^compare.html$ /compare/browser/index.html [R] -RewriteRule ^results.html$ /results/desktop.html [R] -RewriteRule ^results-mobile.html$ /results/mobile.html [R] -RewriteRule ^results-tablets.html$ /results/tablet.html [R] -RewriteRule ^results-tv.html$ /results/television.html [R] - -RewriteRule ^api/(.+)$ /backend/index.php?method=$1&%{QUERY_STRING} -RewriteRule ^s/(.+).html$ /backend/controllers/saved.php?id=$1 -RewriteRule ^compare/browser/index.html$ /backend/controllers/browser.php?%{QUERY_STRING} -RewriteRule ^compare/browser/(.+).html$ /backend/controllers/browser.php?show=$1&%{QUERY_STRING} -RewriteRule ^compare/feature/index.html$ /backend/controllers/feature.php?%{QUERY_STRING} -RewriteRule ^compare/feature/(.+).html$ /backend/controllers/feature.php?show=$1&%{QUERY_STRING} -RewriteRule ^results/desktop.html$ /backend/controllers/results.php?type=desktop -RewriteRule ^results/mobile.html$ /backend/controllers/results.php?type=mobile -RewriteRule ^results/tablet.html$ /backend/controllers/results.php?type=tablet -RewriteRule ^results/gaming.html$ /backend/controllers/results.php?type=gaming -RewriteRule ^results/television.html$ /backend/controllers/results.php?type=television -RewriteRule ^results/other.html$ /backend/controllers/results.php?type=other -RewriteRule ^results/latest.html$ /backend/controllers/latest.php -RewriteRule ^results/search.html$ /backend/controllers/search.php -RewriteRule ^results/related/(.+).html$ /backend/controllers/fingerprint.php?id=$1 -RewriteRule ^results/(.+)/timeline/(.+).html$ /backend/controllers/timeline.php?id=$2&type=$1 -RewriteRule ^results/timeline/(.+).html$ /backend/controllers/timeline.php?id=$1&type=mobile - -RewriteRule ^favicon(.*)$ /images/icons/favicon$1 -RewriteRule ^apple-touch-icon(.*)$ /images/icons/apple-touch-icon$1 -RewriteRule ^mstile-(.*)$ /images/icons/mstile-$1 -RewriteRule ^browserconfig.xml /images/icons/browserconfig.xml - -RewriteRule ^scripts/useragents http://api.whichbrowser.net/warning.js - - - - - Header set Access-Control-Allow-Origin "*" - - - - - - Header set Access-Control-Allow-Origin "*" - - - - - - Header set Access-Control-Allow-Origin "*" - - - - -SetEnvIf User-Agent .*Bada.* BROKEN_CSP - - - - Header set Content-Security-Policy "default-src 'unsafe-inline' data: *; frame-src *; options inline-script;" env=!BROKEN_CSP - - diff --git a/README.md b/README.md index 68cf8712..6d79abe6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ - + ### Updated domain: [html5test.co](https://html5test.co) @@ -19,9 +19,3 @@ Please be aware that although the HTML5 specification is now an official recomme specifications that are being tested are still in development and could change before receiving an official status. In the future new tests will be added for new specifications and existing tests will be updated when the specifications change. - - -**Thanks to:** - -      - diff --git a/assets/upgrade b/assets/upgrade deleted file mode 100644 index a0aba931..00000000 --- a/assets/upgrade +++ /dev/null @@ -1 +0,0 @@ -OK \ No newline at end of file diff --git a/backend/config.php.dist b/backend/config.php.dist deleted file mode 100644 index bc0a2a2d..00000000 --- a/backend/config.php.dist +++ /dev/null @@ -1,14 +0,0 @@ - false, - - 'release' => 9, - - 'database' => [ - 'server' => 'localhost', - 'username' => '******'; - 'password' => '******'; - 'database' => 'html5test' - ] - ]; \ No newline at end of file diff --git a/backend/controllers/browser.php b/backend/controllers/browser.php deleted file mode 100644 index 55c7987f..00000000 --- a/backend/controllers/browser.php +++ /dev/null @@ -1,114 +0,0 @@ -set('results', Browsers::getAll($GLOBALS['configuration']['release'])); - - if (isset($_REQUEST['show'])) { - $show = explode('/', $_REQUEST['show']); - - if (isset($show[0])) { - if ($show[0] == 'mybrowser') { - $tpl->set('one', ''); - } - - else if (preg_match("/^[a-f0-9]{16,16}$/", $show[0])) { - if ($row = Results::getByUniqueId($show[0])) { - $tpl->set('one', json_encode($row)); - } - } - - else { - if ($row = Results::getByBrowser($show[0], $GLOBALS['configuration']['release'])) { - $tpl->set('one', json_encode($row)); - } - } - } - - if (isset($show[1])) { - if ($show[1] == 'mybrowser') { - $tpl->set('two', ''); - } - - else if (preg_match("/^[a-f0-9]{16,16}$/", $show[1])) { - if ($row = Results::getByUniqueId($show[1])) { - $tpl->set('two', json_encode($row)); - } - } - - else { - if ($row = Results::getByBrowser($show[1], $GLOBALS['configuration']['release'])) { - $tpl->set('two', json_encode($row)); - } - } - } - - if (isset($show[2])) { - if ($show[2] == 'mybrowser') { - $tpl->set('three', ''); - } - - else if (preg_match("/^[a-f0-9]{16,16}$/", $show[2])) { - if ($row = Results::getByUniqueId($show[2])) { - $tpl->set('three', json_encode($row)); - } - } - - else { - if ($row = Results::getByBrowser($show[2], $GLOBALS['configuration']['release'])) { - $tpl->set('three', json_encode($row)); - } - } - } - - if (isset($show[3])) { - if ($show[3] == 'mybrowser') { - $tpl->set('four', ''); - } - - else if (preg_match("/^[a-f0-9]{16,16}$/", $show[3])) { - if ($row = Results::getByUniqueId($show[3])) { - $tpl->set('four', json_encode($row)); - } - } - - else { - if ($row = Results::getByBrowser($show[3], $GLOBALS['configuration']['release'])) { - $tpl->set('four', json_encode($row)); - } - } - } - - if (isset($show[4])) { - if ($show[4] == 'mybrowser') { - $tpl->set('five', ''); - } - - else if (preg_match("/^[a-f0-9]{16,16}$/", $show[4])) { - if ($row = Results::getByUniqueId($show[4])) { - $tpl->set('five', json_encode($row)); - } - } - - else { - if ($row = Results::getByBrowser($show[4], $GLOBALS['configuration']['release'])) { - $tpl->set('five', json_encode($row)); - } - } - } - } - - - echo $tpl->fetch(); - - - - - diff --git a/backend/controllers/feature.php b/backend/controllers/feature.php deleted file mode 100644 index 02805cc0..00000000 --- a/backend/controllers/feature.php +++ /dev/null @@ -1,55 +0,0 @@ -set('results', Browsers::getAll($GLOBALS['configuration']['release'])); - - if (isset($_REQUEST['show'])) { - $show = explode('/', $_REQUEST['show']); - - if (isset($show[0])) { - $tpl->set('one', json_encode(array( - 'key' => $show[0], - 'supported' => implode(',', Results::getByFeature($show[0], $GLOBALS['configuration']['release'])) - ))); - } - - if (isset($show[1])) { - $tpl->set('two', json_encode(array( - 'key' => $show[1], - 'supported' => implode(',', Results::getByFeature($show[1], $GLOBALS['configuration']['release'])) - ))); - } - - if (isset($show[2])) { - $tpl->set('three', json_encode(array( - 'key' => $show[2], - 'supported' => implode(',', Results::getByFeature($show[2], $GLOBALS['configuration']['release'])) - ))); - } - - if (isset($show[3])) { - $tpl->set('four', json_encode(array( - 'key' => $show[3], - 'supported' => implode(',', Results::getByFeature($show[3], $GLOBALS['configuration']['release'])) - ))); - } - - if (isset($show[4])) { - $tpl->set('five', json_encode(array( - 'key' => $show[4], - 'supported' => implode(',', Results::getByFeature($show[4], $GLOBALS['configuration']['release'])) - ))); - } - } - - echo $tpl->fetch(); \ No newline at end of file diff --git a/backend/controllers/fingerprint.php b/backend/controllers/fingerprint.php deleted file mode 100644 index aaeea61f..00000000 --- a/backend/controllers/fingerprint.php +++ /dev/null @@ -1,23 +0,0 @@ -set('fingerprint', $row); - } - - if ($row = Results::getByFingerprint($_REQUEST['id'])) { - $tpl->set('results', $row); - } - } - - echo $tpl->fetch(); diff --git a/backend/controllers/latest.php b/backend/controllers/latest.php deleted file mode 100644 index 8e9beb55..00000000 --- a/backend/controllers/latest.php +++ /dev/null @@ -1,14 +0,0 @@ -set('results', Raw::getAll()); - - - echo $tpl->fetch(); \ No newline at end of file diff --git a/backend/controllers/results.php b/backend/controllers/results.php deleted file mode 100644 index 4b65cd0f..00000000 --- a/backend/controllers/results.php +++ /dev/null @@ -1,261 +0,0 @@ -set('type', $type); - - - $consoles = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('gaming-console',v.type) - ORDER BY - score DESC - "); - - while ($row = $result->fetch_object()) { - $consoles[] = $row; - } - - $tpl->set('consoles', $consoles); - - $portables = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('gaming-portable',v.type) - ORDER BY - score DESC - "); - - while ($row = $result->fetch_object()) { - $portables[] = $row; - } - - $tpl->set('portables', $portables); - - $smarttvs = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('television-smart',v.type) - ORDER BY - score DESC - "); - - while ($row = $result->fetch_object()) { - $smarttvs[$row->status][] = $row; - } - - $tpl->set('smarttvs', $smarttvs); - - $settopboxes = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('television-box',v.type) - ORDER BY - score DESC - "); - - while ($row = $result->fetch_object()) { - $settopboxes[] = $row; - } - - $tpl->set('settopboxes', $settopboxes); - - $ereaders = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('ereader',v.type) - ORDER BY - score DESC - "); - - while ($row = $result->fetch_object()) { - $ereaders[] = $row; - } - - $tpl->set('ereaders', $ereaders); - - - echo $tpl->fetch(); - } - - else { - $tpl = new Template('../templates/results.html'); - $tpl->set('type', $type); - - - $main = array(); - $names = array(); - - $result = $db->query(" - SELECT - v.status, IFNULL(pp.nickname,pp.name) as name, IFNULL(p.nickname,p.name) as alternative, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, f.score - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN data_platforms AS pp ON (pp.platform = IFNULL(p.related,p.platform)) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - pp.order > 0 AND - v.visible = 1 AND - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('" . $type . "',v.type) - ORDER BY - pp.order DESC, IFNULL(p.related,p.platform), v.status = 'upcoming' DESC, v.status = 'current' DESC, v.status = 'legacy' DESC, !ISNULL(v.releasedate), v.releasedate DESC - "); - - $count = 0; - - $previousPlatform = ''; - $previousId = ''; - - while ($row = $result->fetch_object()) { - $names[$row->name] = array($row->name, $row->id); - - if (!isset($main[$row->name])) { - $main[$row->name] = array(null, null); - } - - if ($row->status == 'upcoming') { - $main[$row->name][0] = $row; - } - - if ($row->status == 'current') { - $main[$row->name][1] = $row; - } - - if ($row->status == 'legacy' && count($main[$row->name]) < 8) { - if ($row->id == $previousId && $row->platform != $previousPlatform) { - $main[$row->name][] = $row->alternative; - } - - $main[$row->name][] = $row; - } - - $previousPlatform = $row->platform; - $previousId = $row->id; - - $count = max($count, count($main[$row->name])); - } - - $tpl->set('main', $main); - $tpl->set('mainRows', $count); - $tpl->set('mainColumns', $names); - - - - $results = array(); - - $result = $db->query(" - SELECT - v.status, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('" . $type . "',v.type) - ORDER BY - score DESC, platform ASC, version DESC - "); - - while ($row = $result->fetch_object()) { - $results[$row->status][] = $row; - } - - - $tpl->set('results', $results); - - - - $sets = array(); - - $result = $db->query(" - SELECT - p.order, pp.name AS grouped, v.platform, IFNULL(p.related,p.platform) AS id, IFNULL(v.version,'') AS version, v.nickname, v.details, IF(ISNULL(v.releasedate),DATE(NOW()),v.releasedate) AS `releasedate`, v.status, f.score - FROM - data_versions AS v - LEFT JOIN data_platforms AS p ON (v.platform = p.platform) - LEFT JOIN data_platforms AS pp ON (pp.platform = IFNULL(p.related,p.platform)) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - (!ISNULL(v.releasedate) OR v.status = 'upcoming') AND - s.release = '" . $GLOBALS['configuration']['release'] . "' AND - FIND_IN_SET('" . $type . "',p.type) AND - !ISNULL(f.score) - ORDER BY - pp.name, `releasedate` - "); - - while ($row = $result->fetch_object()) { - $sets[$row->grouped]['name'] = $row->grouped; - $sets[$row->grouped]['data'][] = $row; - } - - $tpl->set('sets', $sets); - - echo $tpl->fetch(); - } \ No newline at end of file diff --git a/backend/controllers/saved.php b/backend/controllers/saved.php deleted file mode 100644 index 18c09d35..00000000 --- a/backend/controllers/saved.php +++ /dev/null @@ -1,20 +0,0 @@ -set('release', intval($GLOBALS['configuration']['release'])); - - if (isset($_REQUEST['id'])) { - - if ($row = Results::getByUniqueId($_REQUEST['id'])) { - $tpl->set('one', json_encode($row)); - $tpl->set('legacy', intval($row->release) != intval($GLOBALS['configuration']['release'])); - $tpl->set('release', intval($row->release)); - } - } - - echo $tpl->fetch(); diff --git a/backend/controllers/search.php b/backend/controllers/search.php deleted file mode 100644 index 0aacd545..00000000 --- a/backend/controllers/search.php +++ /dev/null @@ -1,12 +0,0 @@ -fetch(); \ No newline at end of file diff --git a/backend/controllers/timeline.php b/backend/controllers/timeline.php deleted file mode 100644 index 166d3dc4..00000000 --- a/backend/controllers/timeline.php +++ /dev/null @@ -1,50 +0,0 @@ -query(" - SELECT - * - FROM - data_platforms - WHERE - (platform = '" . $db->escape_string($_REQUEST['id']) . "' OR related = '" . $db->escape_string($_REQUEST['id']) . "') AND - FIND_IN_SET('" . $db->escape_string($_REQUEST['type']) . "',type) - ORDER BY - related IS NULL DESC, `order` - "); - - $names = []; - $name = ''; - - while ($row = $result->fetch_object()) { - $names[] = $row->name; - } - - $last = array_pop($names); - - if (count($names)) { - $name = implode(', ', $names) . ' and ' . $last; - } else { - $name = $last; - } - - $tpl->set('name', $name); - - if ($timeline = Results::getTimeline($_REQUEST['id'], $_REQUEST['type'], $GLOBALS['configuration']['release'])) { - $tpl->set('timeline', $timeline); - } - } - - echo $tpl->fetch(); diff --git a/backend/index.php b/backend/index.php deleted file mode 100644 index d4992d5f..00000000 --- a/backend/index.php +++ /dev/null @@ -1,303 +0,0 @@ -query('SELECT DISTINCT identifier FROM results WHERE `release` = "' . $GLOBALS['configuration']['release'] . '" AND source = "' . $db->escape_string($_REQUEST['source']) . '"'); - while ($row = $result->fetch_object()) { - $data[] = $row->identifier; - } - - echo json_encode($data); - break; - - case 'getTask': - $task = Uuid::uuid4(); - $source = $_REQUEST['source']; - $identifier = $_REQUEST['identifier']; - - $url = (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://') . - $_SERVER['HTTP_HOST'] . - '/index.html' . - '?task=' . $task . - '&source=' . rawurlencode($source) . - '&identifier=' . rawurlencode($identifier); - - echo json_encode(array('task' => $task, 'url' => $url)); - break; - - case 'hasTask': - $db = Factory::Database(); - $result = $db->query('SELECT * FROM results WHERE task = "' . $db->escape_string($_REQUEST['task']) . '"'); - - if ($result->num_rows) { - if ($row = $result->fetch_object()) { - $url = (!empty($_SERVER['HTTPS']) ? 'https://' : 'http://') . - $_SERVER['HTTP_HOST'] . - '/s/' . - $row->uniqueid . - '.html'; - - echo json_encode(array( - 'source' => $row->source, - 'identifier' => $row->identifier, - 'score' => intval($row->score), - 'fingerprint' => $row->fingerprint, - 'url' => $url, - )); - } - } else { - echo 'false'; - } - break; - - case 'exportResults': - echo json_encode(Results::export($GLOBALS['configuration']['release'])); - break; - - case 'myResults': - echo json_encode(Raw::getMine()); - break; - - case 'allResults': - echo json_encode(Raw::getAll()); - break; - - case 'searchResults': - echo json_encode(Raw::search($_REQUEST['query'])); - break; - - case 'loadFeature': - echo json_encode(array( - 'key' => $_REQUEST['key'], - 'supported' => implode(',', Results::getByFeature($_REQUEST['key'], $GLOBALS['configuration']['release'])) - )); - - break; - - case 'loadBrowser': - if (substr($_REQUEST['id'], 0, 7) == 'custom:') { - if ($data = Results::getByUniqueId(substr($_REQUEST['id'], 7))) { - echo json_encode($data); - } - - } else { - if ($data = Results::getByBrowser($_REQUEST['id'], $GLOBALS['configuration']['release'])) { - echo json_encode($data); - } - } - - break; - - case 'submit': - $payload = json_decode($_REQUEST['payload']); - $headers = getallheaders(); - - $filteredHeaders = ''; - - foreach($headers as $key => $value) { - if (!in_array(strtolower($key), array( - 'accept', 'host', 'connection', 'dnt', 'user-agent', 'accept-encoding', 'accept-language', - 'accept-charset', 'referer', 'cookie', 'content-type', 'content-length', 'content-transfer-encoding', - 'origin', 'pragma', 'cache-control', 'via', 'clientip', 'x-bluecoat-via', 'x-piper-id', - 'x-forwarded-for', 'x-teacup', 'x-saucer', 'isajaxrequest', 'keep-alive', 'max-forwards', - 'xroxy-connection', 'client-ip', 'cookie2', 'x-via', 'x-imforwards', 'http-client-id', - 'x-proxy-id', 'z-forwarded-for', 'expect', 'x-ip-address', 'x-rbt-optimized-by', 'qpr-loop', - 'cuda_cliip', 'x-source-id', 'x-clickoncesupport' - ))) { - $filteredHeaders .= $key . ": " . $value . "\n"; - } - } - - if (!$GLOBALS['configuration']['readonly'] && intval($payload->release) >= 5) { - $useragentHeader = $_SERVER['HTTP_USER_AGENT']; - $useragentId = preg_replace("/(; ?)[a-z][a-z](?:-[a-zA-Z][a-zA-Z])?([;)])/", '$1xx$2', $useragentHeader); - - $db = Factory::Database(); - - $db->query(' - INSERT INTO - results - SET - `release` = "' . $db->escape_string($payload->release) . '", - `timestamp` = NOW(), - `ip` = "' . $db->escape_string(get_ip_address()) . '", - `protocol` = "' . $db->escape_string($payload->protocol) . '", - `source` = ' . (is_null($payload->source) ? 'NULL' : '"' . $db->escape_string($payload->source) . '"') . ', - `identifier` = ' . (is_null($payload->identifier) ? 'NULL' : '"' . $db->escape_string($payload->identifier) . '"') . ', - `task` = ' . (is_null($payload->task) ? 'NULL' : '"' . $db->escape_string($payload->task) . '"') . ', - `uniqueid` = "' . $db->escape_string($payload->uniqueid) . '", - `score` = "' . $db->escape_string($payload->score) . '", - `maximum` = "' . $db->escape_string($payload->maximum) . '", - `fingerprint` = "' . $db->escape_string(md5($payload->results.$payload->points)) . '", - `camouflage` = "' . $db->escape_string($payload->camouflage) . '", - `features` = "' . $db->escape_string($payload->features) . '", - `browserName` = "' . $db->escape_string($payload->browserName) . '", - `browserChannel` = "' . $db->escape_string($payload->browserChannel) . '", - `browserVersion` = "' . $db->escape_string($payload->browserVersion) . '", - `browserVersionType` = "' . $db->escape_string($payload->browserVersionType) . '", - `browserVersionMajor` = "' . intval($payload->browserVersionMajor) . '", - `browserVersionMinor` = "' . intval($payload->browserVersionMinor) . '", - `browserVersionOriginal` = "' . $db->escape_string($payload->browserVersionOriginal) . '", - `browserMode` = "' . $db->escape_string($payload->browserMode) . '", - `engineName` = "' . $db->escape_string($payload->engineName) . '", - `engineVersion` = "' . $db->escape_string($payload->engineVersion) . '", - `osName` = "' . $db->escape_string($payload->osName) . '", - `osFamily` = "' . $db->escape_string($payload->osFamily) . '", - `osVersion` = "' . $db->escape_string($payload->osVersion) . '", - `deviceManufacturer` = "' . $db->escape_string($payload->deviceManufacturer) . '", - `deviceModel` = "' . $db->escape_string($payload->deviceModel) . '", - `deviceSeries` = "' . $db->escape_string($payload->deviceSeries) . '", - `deviceWidth` = "' . $db->escape_string($payload->deviceWidth) . '", - `deviceHeight` = "' . $db->escape_string($payload->deviceHeight) . '", - `deviceType` = "' . $db->escape_string($payload->deviceType) . '", - `useragent` = "' . $db->escape_string($payload->useragent) . '", - `useragentHeader` = "' . $db->escape_string($useragentHeader) . '", - `useragentId` = "' . $db->escape_string(md5($useragentId)) . '", - `humanReadable` = "' . $db->escape_string($payload->humanReadable) . '", - `headers` = "' . $db->escape_string($filteredHeaders) . '", - `status` = 0 - '); - - echo $db->error; - - $db->query(' - REPLACE INTO - indices - SET - `release` = "' . $db->escape_string($payload->release) . '", - `fingerprint` = "' . $db->escape_string(md5($payload->results.$payload->points)) . '", - `score` = "' . $db->escape_string($payload->score) . '", - `humanReadable` = "' . $db->escape_string($payload->humanReadable) . '", - `browserName` = "' . $db->escape_string($payload->browserName) . '", - `browserVersion` = "' . $db->escape_string($payload->browserVersion) . '", - `engineName` = "' . $db->escape_string($payload->engineName) . '", - `engineVersion` = "' . $db->escape_string($payload->engineVersion) . '", - `osName` = "' . $db->escape_string($payload->osName) . '", - `osFamily` = "' . $db->escape_string($payload->osFamily) . '", - `osVersion` = "' . $db->escape_string($payload->osVersion) . '", - `deviceManufacturer` = "' . $db->escape_string($payload->deviceManufacturer) . '", - `deviceModel` = "' . $db->escape_string($payload->deviceModel) . '", - `deviceSeries` = "' . $db->escape_string($payload->deviceSeries) . '", - `deviceType` = "' . $db->escape_string($payload->deviceType) . '", - `timestamp` = NOW(), - `uniqueid` = "' . $db->escape_string($payload->uniqueid) . '" - '); - - $db->query(' - INSERT INTO - fingerprints - SET - `release` = "' . $db->escape_string($payload->release) . '", - `fingerprint` = "' . $db->escape_string(md5($payload->results.$payload->points)) . '", - `score` = "' . $db->escape_string($payload->score) . '", - `maximum` = "' . $db->escape_string($payload->maximum) . '", - `results` = "' . $db->escape_string($payload->results) . '", - `points` = "' . $db->escape_string($payload->points) . '" - '); - } - - break; - - case 'feedback': - $payload = json_decode($_REQUEST['payload']); - - if (!$GLOBALS['configuration']['readonly']) { - $db = Factory::Database(); - - $db->query(' - UPDATE - results - SET - status = -1, - comments = "' . $db->escape_string($payload->value) . '" - WHERE - uniqueid = "' . $db->escape_string($payload->uniqueid) . '" - '); - } - - break; - - case 'save': - $payload = json_decode($_REQUEST['payload']); - - if (!$GLOBALS['configuration']['readonly']) { - $db = Factory::Database(); - - $db->query(' - UPDATE - results - SET - used = used + 1, - lastUsed = NOW() - WHERE - uniqueid = "' . $db->escape_string($payload->uniqueid) . '" - '); - } - - break; - - case 'confirm': - $payload = json_decode($_REQUEST['payload']); - - if (!$GLOBALS['configuration']['readonly']) { - $db = Factory::Database(); - - $db->query(' - UPDATE - results - SET - status = 1 - WHERE - uniqueid = "' . $db->escape_string($payload->uniqueid) . '" - '); - } - - break; - - case 'report': - $payload = json_decode($_REQUEST['payload']); - - if (!$GLOBALS['configuration']['readonly']) { - $db = Factory::Database(); - - $db->query(' - UPDATE - results - SET - status = -1 - WHERE - uniqueid = "' . $db->escape_string($payload->uniqueid) . '" - '); - } - - break; - } diff --git a/backend/libraries/database.php b/backend/libraries/database.php deleted file mode 100644 index 13effe02..00000000 --- a/backend/libraries/database.php +++ /dev/null @@ -1,11 +0,0 @@ -set_charset ('utf8'); - return $db; - } - } \ No newline at end of file diff --git a/backend/libraries/template.php b/backend/libraries/template.php deleted file mode 100644 index 11d899fb..00000000 --- a/backend/libraries/template.php +++ /dev/null @@ -1,93 +0,0 @@ -file = $file; - } - - /** - * Set a template variable. - */ - function set($name, $value) { - $this->value[$name] = is_object($value) && @function_exists(array($value, 'Template')) ? $value->fetch() : $value; - } - - function append($name, $value) { - if (isset($this->append[$name])) - $this->append[$name] .= is_object($value) && @function_exists(array($value, 'Template')) ? $value->fetch() : $value; - else - $this->append[$name] = is_object($value) && @function_exists(array($value, 'Template')) ? $value->fetch() : $value; - } - - function prepend($name, $value) { - if (isset($this->prepend[$name])) - $this->prepend[$name] .= is_object($value) && @function_exists(array($value, 'Template')) ? $value->fetch() : $value; - else - $this->prepend[$name] = is_object($value) && @function_exists(array($value, 'Template')) ? $value->fetch() : $value; - } - - function filter($function) { - $this->filters[] = $function; - } - - function get($name) { - return $this->value[$name]; - } - - /** - * Open, parse, and return the template file. - * - * @param $file string the template file name - */ - function fetch($file = null) { - if(!$file) $file = $this->file; - - if (is_array($this->prepend)) { - while(list($k,) = each($this->prepend)) { - if (isset($this->value[$k])) - $this->value[$k] = $this->prepend[$k] . $this->value[$k]; - else - $this->value[$k] = $this->prepend[$k]; - } - } - - if (is_array($this->append)) { - while(list($k,) = each($this->append)) { - if (isset($this->value[$k])) - $this->value[$k] = $this->value[$k] . $this->append[$k]; - else - $this->value[$k] = $this->append[$k]; - } - } - - if (is_array($this->value)) { - extract($this->value); - } - // Extract the vars to local namespace - - ob_start(); // Start output buffering - include($file); // Include the file - $contents = ob_get_contents(); // Get the contents of the buffer - ob_end_clean(); // End buffering and discard - - // Execute any registered filters... - if (is_array($this->filters)) { - while(list(,$f) = each($this->filters)) { - $contents = call_user_func($f, $contents, $this); - } - } - - return $contents; // Return the contents - } -} \ No newline at end of file diff --git a/backend/libraries/tools.php b/backend/libraries/tools.php deleted file mode 100644 index a564e5f0..00000000 --- a/backend/libraries/tools.php +++ /dev/null @@ -1,81 +0,0 @@ -= 0) && (($no = $dif / $lngh[$v]) <= 1); $v--); - if ($v < 0) - $v = 0; - $_tm = $cur_tm - ($dif % $lngh[$v]); - - $no = ($rcs ? floor($no) : round($no)); // if last denomination, round - - if ($no != 1) - $pds[$v] .= 's'; - $x = $no . ' ' . $pds[$v]; - - if (($rcs > 0) && ($v >= 1)) - $x .= ' ' . $this->time_ago($_tm, $rcs - 1); - - return $x; - } - - - function get_ip_address() { - $ip = $_SERVER['REMOTE_ADDR']; - - $headers = apache_request_headers(); - if (isset($headers['X-Forwarded-For'])) $ip = $headers['X-Forwarded-For']; - if (isset($headers['Proxy-Client-IP'])) $ip = $headers['Proxy-Client-IP']; - if (isset($headers['X-Client-IP'])) $ip = $headers['X-Client-IP']; - if (isset($headers['Client-IP'])) $ip = $headers['Client-IP']; - - return $ip; - } - - function opt_explode($echar, $str) { - $newstrarr = []; - - if (strlen($echar) != 1 || strlen($str) == 0) { - return 0; - } - - $str = trim($str); - - $idx=0; - $arr=0; - - while($idx < strlen($str)) { - if($str[$idx] == '"') { - // quoted field - $idx++; - while ($idx < strlen($str)) { - // look for ending quote - if($str[$idx] == '"') { - $idx++; - $arr++; - break; - } - $newstrarr[$arr] = $newstrarr[$arr] . $str[$idx]; - $idx++; - } - } elseif ($str[$idx] == $echar) { - // normal delimiter, advance element - $arr++; - } else { - // must be normal char, tack onto current element - if (isset($newstrarr[$arr])) { - $newstrarr[$arr] = $newstrarr[$arr] . $str[$idx]; - } else { - $newstrarr[$arr] = $str[$idx]; - } - } - $idx++; - } - - return $newstrarr; - } \ No newline at end of file diff --git a/backend/models/browsers.php b/backend/models/browsers.php deleted file mode 100644 index 7f15c4a9..00000000 --- a/backend/models/browsers.php +++ /dev/null @@ -1,42 +0,0 @@ -query(" - SELECT - v.platform, IFNULL(v.version,'') AS version, v.nickname, v.details, v.visible, IFNULL(p.related,p.platform) AS id, f.score - FROM - data_platforms AS p - LEFT JOIN data_versions AS v ON (p.platform = v.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - FIND_IN_SET('" . $type . "',v.type) AND - s.release = '" . $release . "' AND - f.points != '' - ORDER BY - v.platform, v.status='experimental', v.status='upcoming', ISNULL(v.releasedate), v.releasedate, v.version - "); - - while ($row = $result->fetch_object()) { - $row->uid = $type . '-' . $row->platform . '-' . $row->version; - $row->type = $type; - $row->visible = $row->visible == '1'; - - $results[] = $row; - } - } - - return $results; - } - - - } \ No newline at end of file diff --git a/backend/models/fingerprint.php b/backend/models/fingerprint.php deleted file mode 100644 index f7657851..00000000 --- a/backend/models/fingerprint.php +++ /dev/null @@ -1,159 +0,0 @@ - 20) { - $data['status'] = 'none'; - unset($data['items']); - } - - if ($data['status'] == 'fixed' || $data['status'] == 'list') { - $items = array(); - - reset ($data['items']); - while (list($k,$v) = each($data['items'])) { - $items[] = array('name' => $k, 'value' => $v['value'], 'percentage' => $v['percentage']); - } - - $data['items'] = $items; - - usort($data['items'], function ($a, $b) { - if ($a['value'] == $b['value']) { - return 0; - } - return ($a['value'] > $b['value']) ? -1 : 1; - }); - } - - return $data; - } - - - static function getById($id) { - $results = array( - 'results' => array(), - 'browserName' => array('items' => array(), 'status' => 'list'), - 'browserVersion' => array('items' => array(), 'status' => 'list'), - 'osName' => array('items' => array(), 'status' => 'list'), - 'osVersion' => array('items' => array(), 'status' => 'list'), - 'deviceManufacturer' => array('items' => array(), 'status' => 'list'), - 'deviceModel' => array('items' => array(), 'status' => 'list') - ); - - $db = Factory::Database(); - - $result = $db->query(" - SELECT - * - FROM - results - WHERE - fingerprint = '" . $db->escape_string($id) . "' - ORDER BY - humanReadable - "); - - while ($row = $result->fetch_object()) { - $results['results'][] = (object) array( - 'id' => $row->uniqueid, - 'name' => $row->humanReadable, - 'ago' => time_ago(strtotime($row->timestamp)) - ); - - if (!isset($results['browserName']['items'][trim($row->browserName)])) { - $results['browserName']['items'][trim($row->browserName)] = array('value' => 0); - } - - $results['browserName']['items'][trim($row->browserName)]['value']++; - - - if (!isset($results['browserVersion']['items'][trim($row->browserName . ' ' . $row->browserVersion)])) { - $results['browserVersion']['items'][trim($row->browserName . ' ' . $row->browserVersion)] = array('value' => 0); - } - - $results['browserVersion']['items'][trim($row->browserName . ' ' . $row->browserVersion)]['value']++; - - - if (!isset($results['osName']['items'][trim($row->osName)])) { - $results['osName']['items'][trim($row->osName)] = array('value' => 0); - } - - $results['osName']['items'][trim($row->osName)]['value']++; - - - if (!isset($results['osVersion']['items'][trim($row->osName . ' ' . $row->osVersion)])) { - $results['osVersion']['items'][trim($row->osName . ' ' . $row->osVersion)] = array('value' => 0); - } - - $results['osVersion']['items'][trim($row->osName . ' ' . $row->osVersion)]['value']++; - - - if (!isset($results['deviceManufacturer']['items'][trim($row->deviceManufacturer)])) { - $results['deviceManufacturer']['items'][trim($row->deviceManufacturer)] = array('value' => 0); - } - - $results['deviceManufacturer']['items'][trim($row->deviceManufacturer)]['value']++; - - - if (!isset($results['deviceModel']['items'][trim($row->deviceManufacturer . ' ' . $row->deviceModel)])) { - $results['deviceModel']['items'][trim($row->deviceManufacturer . ' ' . $row->deviceModel)] = array('value' => 0); - } - - $results['deviceModel']['items'][trim($row->deviceManufacturer . ' ' . $row->deviceModel)]['value']++; - } - - - $results['browserName'] = Fingerprint::process($results['browserName']); - $results['browserVersion'] = Fingerprint::process($results['browserVersion']); - $results['osName'] = Fingerprint::process($results['osName']); - $results['osVersion'] = Fingerprint::process($results['osVersion']); - $results['deviceManufacturer'] = Fingerprint::process($results['deviceManufacturer']); - $results['deviceModel'] = Fingerprint::process($results['deviceModel']); - - if ($results['deviceManufacturer']['status'] == 'fixed' && $results['deviceManufacturer']['value'] == '') { - $results['deviceManufacturer']['status'] = 'none'; - unset($results['deviceManufacturer']['value']); - } - - if ($results['deviceModel']['status'] == 'fixed' && $results['deviceModel']['value'] == '') { - $results['deviceModel']['status'] = 'none'; - unset($results['deviceModel']['value']); - } - - return $results; - } - } \ No newline at end of file diff --git a/backend/models/raw.php b/backend/models/raw.php deleted file mode 100644 index 117c8dfc..00000000 --- a/backend/models/raw.php +++ /dev/null @@ -1,165 +0,0 @@ - 1) { - if ($components[0] == 'score') { - $comparison = $negative ? '!=' : '='; - - if (substr($components[1], -1) == '+') { - $comparison = $negative ? '<=' : '>'; - $components[1] = substr($components[1], 0, -1); - } - - if (substr($components[1], -1) == '-') { - $comparison = $negative ? '>=' : '<'; - $components[1] = substr($components[1], 0, -1); - } - - $where[] = 'score ' . $comparison . ' ' . intval($components[1]); - } - - if (in_array($components[0], array('browserVersion', 'engineVersion', 'osVersion', 'browserName', 'engineName', 'osName', 'deviceManufacturer', 'deviceType', 'deviceModel'))) { - if ($components[1] == "") { - $where[] = $components[0] . ($negative ? ' !=' : ' =') . ' ""'; - } else { - $where[] = $components[0] . ($negative ? ' NOT' : '') . ' LIKE "' . $db->escape_string($components[1]) . '%"'; - } - } - - if (in_array($components[0], array('useragent'))) { - if ($components[1] == "") { - $where[] = $components[0] . ($negative ? ' !=' : ' =') . ' ""'; - } else { - $where[] = $components[0] . ($negative ? ' NOT' : '') . ' LIKE "%' . $db->escape_string($components[1]) . '%"'; - } - } - } - - else { - $where[] = ($negative ? '!' : '') . 'MATCH(humanReadable) AGAINST ("\"' . $db->escape_string($components[0]) . '\"")'; - } - } - - - - $result = $db->query(' - INSERT INTO - queries - SET - query = "' . $db->escape_string($query) . '", - compiledQuery = "' . $db->escape_string(implode(' AND ', $where)) . '" - '); - - $id = $db->insert_id; - $start = time(); - - - $results = array(); - - $result = $db->query(' - SELECT - timestamp, uniqueid, score, humanReadable - FROM - indices - WHERE - ' . implode(' AND ', $where) . ' - ORDER BY - timestamp DESC - LIMIT 100 - '); - - while ($row = $result->fetch_object()) { - $results[] = (object) array( - 'uniqueid' => $row->uniqueid, - 'score' => intval($row->score), - 'humanReadable' => $row->humanReadable, - 'ago' => time_ago(strtotime($row->timestamp)) - ); - } - - - $db->query(' - UPDATE - queries - SET - elapsedTime = ' . (time() - $start) . ' - WHERE - id = ' . $db->escape_string($id) . ' - '); - - - return $results; - } - - static function getAll() { - $db = Factory::Database(); - - $results = array(); - - $result = $db->query(' - SELECT - timestamp, uniqueid, score, humanReadable - FROM - results - ORDER BY - timestamp DESC - LIMIT 100 - '); - - while ($row = $result->fetch_object()) { - $results[] = (object) array( - 'uniqueid' => $row->uniqueid, - 'score' => intval($row->score), - 'humanReadable' => $row->humanReadable, - 'ago' => time_ago(strtotime($row->timestamp)) - ); - } - - return $results; - } - - static function getMine() { - $db = Factory::Database(); - - $results = array(); - - $result = $db->query(' - SELECT - timestamp, uniqueid, score, humanReadable - FROM - results - WHERE - ip = "' . $db->escape_string(get_ip_address()) . '" - ORDER BY - timestamp DESC - LIMIT 100 - '); - - while ($row = $result->fetch_object()) { - $results[] = (object) array( - 'uniqueid' => $row->uniqueid, - 'score' => intval($row->score), - 'humanReadable' => $row->humanReadable, - 'ago' => time_ago(strtotime($row->timestamp)) - ); - } - - return $results; - } - } \ No newline at end of file diff --git a/backend/models/results.php b/backend/models/results.php deleted file mode 100644 index f7c35574..00000000 --- a/backend/models/results.php +++ /dev/null @@ -1,338 +0,0 @@ -query(" - SELECT - v.platform, IFNULL(v.version,'') AS version, v.nickname, v.releasedate, v.status, f.score, f.results - FROM - data_platforms AS p - LEFT JOIN data_versions AS v ON (p.platform = v.platform) - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (s.fingerprint = f.fingerprint) - WHERE - (p.platform = '" . $db->escape_string($id) . "' OR p.related = '" . $db->escape_string($id) . "') AND - FIND_IN_SET('" . $db->escape_string($type) . "',p.type) AND - FIND_IN_SET('" . $db->escape_string($type) . "',v.type) AND - v.status != 'experimental' AND - s.release = '" . $release . "' - ORDER BY - IF(v.status='upcoming',1,0) DESC, v.releasedate DESC, p.related, v.version DESC - "); - - while ($row = $result->fetch_object()) { - $results[] = $row; - } - - for ($i = 0; $i < count($results) - 1; $i++) { - $results[$i]->changes = Results::getDiff($results[$i]->results, $results[$i + 1]->results); - } - - for ($i = 0; $i < count($results); $i++) { - unset($results[$i]->results); - } - - return $results; - } - - static function getArray($string) { - $result = array(); - - $array = explode(',', $string); - - for ($i = 0; $i < count($array); $i++) { - $item = explode('=', $array[$i]); - $result[$item[0]] = $item[1]; - } - - return $result; - } - - static function getDiff($current, $previous) { - $current = Results::getArray($current); - $previous = Results::getArray($previous); - - $changes = array(); - - foreach ($previous AS $p => $value) { - if (preg_match("/\.codecs\./", $p)) continue; - - if ($previous[$p] == 33) $previous[$p] = 1; - if ($current[$p] == 33) $current[$p] = 1; - - if ($previous[$p] != $current[$p]) { - $changes[] = (object) array( - 'id' => $p, - 'from' => $previous[$p], - 'to' => $current[$p] - ); - } - } - - return $changes; - } - - - static function getByFeature($id, $release) { - $db = Factory::Database(); - - $results = array(); - - $result = $db->query(" - SELECT - IFNULL(SUBSTRING_INDEX(SUBSTRING_INDEX(f.results,'" . $db->escape_string($id) . "=',-1),',',1),0) as supported, - v.platform, IFNULL(v.version,'') AS version - FROM - data_versions AS v - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $release . "' - "); - - while ($row = $result->fetch_object()) { - $results[] = $row->platform . '-' . $row->version . '=' . $row->supported; - } - - return $results; - } - - static function getByBrowser($browser, $release) { - $db = Factory::Database(); - - $browser = explode('-', $browser); - - if (count($browser) > 1) { - list($browserPlatform, $browserVersion) = $browser; - - $result = $db->query(" - SELECT - v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $release . "' AND - v.platform = '" . $db->escape_string($browserPlatform) . "' AND - v.version = '" . $db->escape_string($browserVersion) . "' - "); - - if ($row = $result->fetch_object()) { - return $row; - } - - return; - } - else { - $browserPlatform = $browser[0]; - } - - $result = $db->query(" - SELECT - v.platform, IFNULL(v.version,'') AS version, v.nickname, f.score, f.points, f.results - FROM - data_versions AS v - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $release . "' AND - v.platform = '" . $db->escape_string($browserPlatform) . "' AND - v.version IS NULL - ORDER BY - v.releasedate DESC - "); - - if ($row = $result->fetch_object()) { - return $row; - } - } - - - - static function getByUniqueId($id) { - $db = Factory::Database(); - - $result = $db->query(" - SELECT - r.release, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint - FROM - results AS r - LEFT JOIN fingerprints AS f ON (r.fingerprint = f.fingerprint) - WHERE - r.uniqueid ='" . $db->escape_string($id) . "' - "); - - if ($row = $result->fetch_object()) { - - // Update use counter - $db->query(' - UPDATE - results - SET - used = used + 1, - lastUsed = NOW() - WHERE - uniqueid = "' . $db->escape_string($id) . '" - '); - - return $row; - } - - - /* Quick hack to make older ids work again */ - - $result = $db->query(" - SELECT - r.version as `release`, r.uniqueid AS id, 'Unique id' AS nickname, f.score, f.maximum, f.points, f.results, humanReadable, useragentHeader AS useragent, deviceWidth, deviceHeight, f.fingerprint - FROM - html5test5.results AS r - LEFT JOIN html5test5.fingerprints AS f ON (r.fingerprint = f.fingerprint) - WHERE - r.uniqueid ='" . $db->escape_string($id) . "' - "); - - if ($row = $result->fetch_object()) { - - // Update use counter - $db->query(' - UPDATE - html5test5.results - SET - used = used + 1, - lastUsed = NOW() - WHERE - uniqueid = "' . $db->escape_string($id) . '" - '); - - return $row; - } - } - - - static function getByFingerprint($id) { - $db = Factory::Database(); - - $res = $db->query(" - SELECT - score, maximum, points, results - FROM - fingerprints - WHERE - fingerprint ='" . $db->escape_string($id) . "' - "); - - if ($row = $res->fetch_object()) { - return $row; - } - } - - - static function export($release) { - $db = Factory::Database(); - - $browsers = array(); - - $res = $db->query(" - SELECT - * - FROM - data_platforms - ORDER BY - name - "); - - echo mysql_error(); - - while ($row = $res->fetch_object()) { - $browser = (object) array( - 'name' => $row->name, - 'kind' => $row->kind, - 'versions' => array() - ); - - $vres = $db->query(" - SELECT - * - FROM - data_versions - WHERE - platform = '" . addslashes($row->id) . "' - ORDER BY - version - "); - - while ($vrow = $vres->fetch_object()) { - $version = (object) array( - 'id' => is_null($vrow->version) ? $vrow->platform : $vrow->platform . '-' . $vrow->version, - 'version' => $vrow->version, - 'nickname' => $vrow->nickname, - 'release' => $vrow->release - ); - - $browser->versions[] = $version; - } - - $browsers[] = $browser; - } - - - $results = array(); - - $res = $db->query(" - SELECT - v.platform, IFNULL(v.version,'') AS version, f.results - FROM - data_versions AS v - LEFT JOIN scores AS s ON (v.platform = s.platform AND (v.version = s.version OR (v.version IS NULL AND s.version IS NULL))) - LEFT JOIN fingerprints AS f ON (f.fingerprint = s.fingerprint) - WHERE - s.release = '" . $release . "' - ORDER BY - v.platform, v.version - "); - - while ($row = $res->fetch_object()) { - $r = explode(',', $row->results); - - for ($i = 0; $i < count($r); $i++) { - list($key, $value) = explode('=', $r[$i]); - - if (!isset($results[$key])) { - $results[$key] = array(); - } - - $platform = $row->version == '' ? $row->platform : $row->platform . '-' . $row->version; - $value = intval($value); - - if ($value & 1) { - switch(true) { - case !! ($value & 2): $results[$key][$platform] = 'yes:old'; - case !! ($value & 4): $results[$key][$platform] = 'yes:buggy'; - case !! ($value & 8): $results[$key][$platform] = 'yes:prefix'; - default: $results[$key][$platform] = 'yes'; - } - } - else { - switch(true) { - case !! ($value & 16): $results[$key][$platform] = 'no:blocked'; - default: $results[$key][$platform] = 'no'; - } - } - } - } - - - return array( - 'browsers' => $browsers, - 'results' => $results - ); - } - } \ No newline at end of file diff --git a/backend/other/database.sql b/backend/other/database.sql deleted file mode 100644 index c5bcf030..00000000 --- a/backend/other/database.sql +++ /dev/null @@ -1,146 +0,0 @@ -CREATE TABLE `browserCompanies` ( - `id` varchar(24) DEFAULT NULL, - `name` varchar(128) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `browserDevices` ( - `id` char(24) DEFAULT NULL, - `name` varchar(128) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `browserFamilies` ( - `id` char(24) DEFAULT NULL, - `name` varchar(128) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `browserPlatforms` ( - `id` char(24) DEFAULT NULL, - `name` varchar(128) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `browserVariants` ( - `id` char(24) NOT NULL DEFAULT '', - `name` varchar(128) DEFAULT NULL, - `nickname` varchar(128) DEFAULT NULL, - `company` varchar(128) DEFAULT NULL, - `importance` int(2) DEFAULT '0', - `kind` varchar(128) DEFAULT NULL, - `type` varchar(128) DEFAULT NULL, - `family` char(24) DEFAULT NULL, - `platforms` varchar(128) DEFAULT NULL, - `devices` varchar(128) DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; - -CREATE TABLE `browserVersions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `variant` varchar(32) DEFAULT NULL, - `version` varchar(32) DEFAULT NULL, - `grouped` varchar(128) DEFAULT NULL, - `nickname` varchar(128) DEFAULT NULL, - `details` varchar(128) DEFAULT NULL, - `description` varchar(256) DEFAULT NULL, - `release` date DEFAULT NULL, - `type` varchar(32) DEFAULT NULL, - `status` varchar(16) DEFAULT NULL, - `listed` int(11) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `variant_version_type` (`variant`,`version`,`type`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=260 DEFAULT CHARSET=utf8; - -CREATE TABLE `fingerprints` ( - `fingerprint` char(32) NOT NULL DEFAULT '', - `version` tinyint(3) NOT NULL DEFAULT '0', - `score` smallint(3) NOT NULL DEFAULT '0', - `maximum` smallint(3) NOT NULL DEFAULT '0', - `points` varchar(512) NOT NULL DEFAULT '', - `results` varchar(10240) NOT NULL DEFAULT '', - PRIMARY KEY (`fingerprint`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `indices` ( - `fingerprint` char(32) NOT NULL DEFAULT '', - `score` int(11) NOT NULL, - `humanReadable` char(128) NOT NULL DEFAULT '', - `browserName` char(64) NOT NULL, - `browserVersion` char(20) NOT NULL, - `engineName` char(60) NOT NULL, - `engineVersion` char(20) NOT NULL, - `osName` char(64) NOT NULL, - `osVersion` char(20) NOT NULL, - `deviceManufacturer` char(60) NOT NULL, - `deviceModel` char(64) NOT NULL, - `deviceType` char(16) NOT NULL, - `timestamp` datetime NOT NULL, - `uniqueid` char(20) NOT NULL, - PRIMARY KEY (`fingerprint`,`humanReadable`), - KEY `timestamp` (`timestamp`) USING BTREE, - KEY `browser` (`browserName`,`browserVersion`) USING BTREE, - KEY `os` (`osName`,`osVersion`) USING BTREE, - KEY `engine` (`engineName`,`engineVersion`) USING BTREE, - KEY `device` (`deviceManufacturer`,`deviceModel`) USING BTREE, - KEY `deviceModel` (`deviceModel`) USING BTREE, - FULLTEXT KEY `humanReadable` (`humanReadable`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `results` ( - `version` varchar(8) CHARACTER SET latin1 NOT NULL, - `revision` int(11) NOT NULL DEFAULT '0', - `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - `ip` varchar(16) CHARACTER SET latin1 NOT NULL, - `protocol` varchar(8) CHARACTER SET latin1 NOT NULL, - `uniqueid` varchar(20) CHARACTER SET latin1 NOT NULL, - `score` int(11) NOT NULL, - `maximum` int(11) NOT NULL DEFAULT '0', - `browserName` varchar(64) CHARACTER SET latin1 NOT NULL, - `browserChannel` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '', - `browserVersion` varchar(20) CHARACTER SET latin1 NOT NULL, - `browserVersionType` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '', - `browserVersionMajor` varchar(8) CHARACTER SET latin1 NOT NULL DEFAULT '' COMMENT ' ', - `browserVersionMinor` varchar(8) CHARACTER SET latin1 NOT NULL DEFAULT '', - `browserVersionOriginal` varchar(20) CHARACTER SET latin1 NOT NULL DEFAULT '', - `browserMode` varchar(8) CHARACTER SET latin1 NOT NULL, - `engineName` varchar(60) CHARACTER SET latin1 NOT NULL, - `engineVersion` varchar(20) CHARACTER SET latin1 NOT NULL, - `osName` varchar(64) CHARACTER SET latin1 NOT NULL, - `osVersion` varchar(20) CHARACTER SET latin1 NOT NULL, - `deviceManufacturer` varchar(60) CHARACTER SET latin1 NOT NULL, - `deviceModel` varchar(64) CHARACTER SET latin1 NOT NULL, - `deviceWidth` int(11) NOT NULL DEFAULT '0', - `deviceHeight` int(11) NOT NULL DEFAULT '0', - `deviceType` varchar(16) CHARACTER SET latin1 NOT NULL DEFAULT '', - `deviceIdentified` int(11) NOT NULL DEFAULT '0', - `useragent` text CHARACTER SET latin1 NOT NULL, - `useragentHeader` text NOT NULL, - `useragentId` char(32) NOT NULL DEFAULT '', - `humanReadable` varchar(128) CHARACTER SET latin1 DEFAULT NULL, - `status` int(11) NOT NULL DEFAULT '0', - `camouflage` int(11) DEFAULT NULL, - `features` varchar(64) NOT NULL DEFAULT '', - `headers` text NOT NULL, - `fingerprint` varchar(32) NOT NULL DEFAULT '', - `points` text, - `results` text, - PRIMARY KEY (`uniqueid`), - UNIQUE KEY `uniqueid` (`uniqueid`), - KEY `timestamp` (`timestamp`) USING BTREE, - KEY `useragent` (`useragent`(20)) USING BTREE, - KEY `version` (`version`,`revision`) USING BTREE, - KEY `fingerprint` (`fingerprint`) USING BTREE, - KEY `useragentHeader` (`useragentHeader`(20)) USING BTREE, - KEY `useragentId` (`useragentId`) USING BTREE, - KEY `osName` (`osName`) USING BTREE, - KEY `osVersion` (`osVersion`) USING BTREE, - KEY `browserName` (`browserName`) USING BTREE, - KEY `deviceManufacturerModel` (`deviceManufacturer`,`deviceModel`) USING BTREE, - KEY `deviceModel` (`deviceModel`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -CREATE TABLE `scores` ( - `variant` varchar(32) DEFAULT NULL, - `version` varchar(32) DEFAULT NULL, - `release` decimal(5,2) DEFAULT '0.00', - `fingerprint` char(32) DEFAULT NULL, - UNIQUE KEY `variant_version_release` (`variant`,`version`,`release`) USING BTREE, - KEY `fingerprint` (`fingerprint`) USING BTREE -) ENGINE=InnoDB DEFAULT CHARSET=utf8; \ No newline at end of file diff --git a/backend/templates/browser.html b/backend/templates/browser.html deleted file mode 100644 index cf09722d..00000000 --- a/backend/templates/browser.html +++ /dev/null @@ -1,276 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
-
-
-
-
-
-
-
- -
- -

About these scores

-
- The data above is compiled from automatically submitted test results. It is possible your results - may differ slightly due to external factors such as settings and which operating system is used. - If you believe the data above is incorrect, or if you think we are missing an important browser - or device, please open a bug report at Github. -
-
- - -
- - -
-
- - - - - diff --git a/backend/templates/feature.html b/backend/templates/feature.html deleted file mode 100644 index 59b4ef07..00000000 --- a/backend/templates/feature.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
-
-
-
-
-
-
-
- -
- -

About these scores

-
- The data above is compiled from automatically submitted test results. It is possible your results - may differ slightly due to external factors such as settings and which operating system is used. - If you believe the data above is incorrect, or if you think we are missing an important browser - or device, please open a bug report at Github. -
-
- - -
- - -
-
- - - - - diff --git a/backend/templates/fingerprint.html b/backend/templates/fingerprint.html deleted file mode 100644 index 5490b8ee..00000000 --- a/backend/templates/fingerprint.html +++ /dev/null @@ -1,210 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
-
-

This browser scored score; ?> out of maximum; ?> points

-
-
-
- -
-
-
- -

Related

- -
-
-

Test results

- - - - - - - - - - - - - -
Browser
name; ?>
-
-
- -
-
- - -

Browsers

- -
- - - - - - - - - - - - - - - - - - -
VersionCountPercentage
%
-
- - - - -

Operating Systems

- -
- - - - - - - - - - - - - - - - - - -
VersionCountPercentage
%
-
- - - - -

Devices

- -
- - - - - - - - - - - - - - - - - - -
ModelCountPercentage
%
-
- -
-
- -
- -

- Please note that all data shown above are unconfirmed test results. They could be fake or - belong to a different browser than the one listed. -

-
-
-
- - -
-
- - - - - diff --git a/backend/templates/latest.html b/backend/templates/latest.html deleted file mode 100644 index 1738f87b..00000000 --- a/backend/templates/latest.html +++ /dev/null @@ -1,176 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
-
- -

Latest results

- -
- - - - - - - - - - - - - - - - - - -
ScoreBrowserWhen
score; ?>humanReadable; ?>ago; ?> ago
-

- Please note that all data shown above are unconfirmed test results. They could be fake or - belong to a different browser than the one listed. -

- -
- - -
-
- - -
-
- - - - - diff --git a/backend/templates/results-other.html b/backend/templates/results-other.html deleted file mode 100644 index a1dc8318..00000000 --- a/backend/templates/results-other.html +++ /dev/null @@ -1,270 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
- -
-

Gaming

- -
- -
-

Consoles

- - - - - - - - - - - - - - - - - -
ScoreDevice
score; ?> - nickname; ?> - details; ?>
-
- -
- -
- -
-

Portable

- - - - - - - - - - - - - - - - - -
ScoreDevice
score; ?> - nickname; ?> - details; ?>
-
- -
-
- -
- -
-

Television

- -
- -

Smart TVs

-
- - - - - - - - - - - - - - - - - -
ScoreDevice
score; ?> - nickname; ?> - details; ?>
-
- -
- -
- -
-

Set-top boxes

- - - - - - - - - - - - - - - - - -
ScoreDevice
score; ?> - nickname; ?> - details; ?>
-
- -
-
- -
- -
-

E-readers

- -
- -
-

E-paper readers

- - - - - - - - - - - - - - - - - -
ScoreDevice
score; ?> - nickname; ?> - details; ?>
-
- -
- -
-
-
- -
- -

About these scores

-
- The data above is compiled from automatically submitted test results. It is possible your results - may differ slightly due to external factors such as settings and which operating system is used. - If you believe the data above is incorrect, or if you think we are missing an important browser - or device, please open a bug report at Github. -
-
-
- - -
-
- - - - - diff --git a/backend/templates/results.html b/backend/templates/results.html deleted file mode 100644 index 38f79e97..00000000 --- a/backend/templates/results.html +++ /dev/null @@ -1,434 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
- - -
-

Overview

-
- - - - - - - - - - - - - - - - - - - - -
 
'> - - '>' . $d[$r]->version . ' ' . $d[$r]->score . ''; - } - - if (is_string($d[$r])) { - echo "" . $d[$r] . ""; - } - } - ?>
-
-
- -
- - - -
-

Scores

- -
- -
- -
-

Current

- - - - - - - - - - - '> - - - - - - -
ScoreBrowser
score; ?> - nickname; ?> - details; ?>
-
- - - -
-

Upcoming

- - - - - - - - - - - '> - - - - - - -
ScoreBrowser
score; ?> - nickname; ?> - details; ?>
-
- - - -
-

Experimental

- - - - - - - - - - - '> - - - - - - -
ScoreBrowser
score; ?> - nickname; ?> - details; ?>
-
-
- -
- -
-

Older

- - - - - - - - - - - '> - - - - - - -
ScoreBrowser
score; ?> - nickname; ?> - details; ?>
-
- -
-
- - - - - -
- -
-
-

Timeline

- -
- -
- - -
-
- - -
- -

About these scores

-
- The data above is compiled from automatically submitted test results. It is possible your results - may differ slightly due to external factors such as settings and which operating system is used. - If you believe the data above is incorrect, or if you think we are missing an important browser - or device, please open a bug report at Github. -
-
-
- - -
-
- - - - - diff --git a/backend/templates/saved.html b/backend/templates/saved.html deleted file mode 100644 index fd3901c0..00000000 --- a/backend/templates/saved.html +++ /dev/null @@ -1,203 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- - -
-
- The following results were created in an older version of the test suite. If you test the same browser - on the current site, it may get a different score and different results. -
-
- - - -
-
-
-
- - -
-
- - - - - diff --git a/backend/templates/search.html b/backend/templates/search.html deleted file mode 100644 index 3783b221..00000000 --- a/backend/templates/search.html +++ /dev/null @@ -1,251 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
- - -
-
-
- -
-
-
- - - -
- - - -
- -

Examples

-
-
-
deviceType:mobile osName:Windows
-
All mobile devices running Windows
- -
deviceManufacturer:Samsung -osName:Android
-
All non-Android devices created by Samsung
- -
osName:Android osVersion:4.4
-
All devices running Android 4.4
- -
browserName:Chrome osName:"Mac OS X"
-
Chrome running on OS X
- -
deviceModel:iPhone
-
All iPhones
- -
engineName:Gecko -browserName:Firefox
-
All Gecko based browser except for Firefox
- -
score:500+
-
All results with a score higher than or equal to 500
- -
-
-
- - -
-
- - - - - diff --git a/backend/templates/timeline.html b/backend/templates/timeline.html deleted file mode 100644 index cebaf23a..00000000 --- a/backend/templates/timeline.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - HTML5test - How well does your browser support HTML5? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

HTML5test how well does your browser support HTML5?

- -
- -
-
-
-
- - -

Timeline for

-
- - -
-
score; ?>
-

version : ''); ?>.html'>nickname; ?> »

- status != 'upcoming'): ?> - releasedate)): ?> -

Release date: releasedate)); ?>

- -

Release date: unknown

- - -

Not yet released

- -
- - changes) && count($item->changes)): ?> -
- - - -
- - -
- These results are collected from many thousands of visitors using all kinds of devices. - Excluded from this timeline are changes in video and audio codecs, because they are often - dependant on operating system and device hardware. -
-
-
- - -
-
- - - - - diff --git a/composer.json b/composer.json deleted file mode 100644 index 0427180a..00000000 --- a/composer.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "require": { - "ramsey/uuid": "^3.4" - } -} diff --git a/index.html b/index.html index 433b8c55..6d0fae7d 100644 --- a/index.html +++ b/index.html @@ -159,17 +159,7 @@

Help us improve HTML5 test by donating

new Test(function(r) { var m = new Metadata(tests); var c = new Calculate(r, m.data); - - submitResults(r, c); - - upgradeConnection( - function() { - location.protocol = 'https:'; - }, - function() { - showResults(r, c, m); - } - ); + showResults(r, c, m); }, showError); }); diff --git a/results/latest.html b/results/latest.html index 4a4f8133..32de4727 100644 --- a/results/latest.html +++ b/results/latest.html @@ -97,7 +97,7 @@

Latest results

httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST', 'https://html5test.com/api/' + type + 'Results', true); + httpRequest.open('POST', API_BASE + '/' + type + 'Results', true); httpRequest.onreadystatechange = process; httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send(); diff --git a/results/search.html b/results/search.html index 13d84d31..d30f40dc 100644 --- a/results/search.html +++ b/results/search.html @@ -137,7 +137,7 @@

HTML5test how well does your browser suppo httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST', 'https://html5test.com/api/searchResults', true); + httpRequest.open('POST', API_BASE + '/searchResults', true); httpRequest.onreadystatechange = process; httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send("query=" + encodeURIComponent(query)); diff --git a/s/index.html b/s/index.html index 2a68ad73..f26a9262 100644 --- a/s/index.html +++ b/s/index.html @@ -79,7 +79,7 @@

HTML5test how well does your browser suppo httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST','https://html5test.com/api/loadBrowser', true); + httpRequest.open('POST', API_BASE + '/loadBrowser', true); httpRequest.onreadystatechange = process; httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send('id=' + encodeURIComponent('custom:' + id)); @@ -89,9 +89,6 @@

HTML5test how well does your browser suppo function process() { if (httpRequest.readyState == 4 && httpRequest.responseText != '') { var data = JSON.parse(httpRequest.responseText); - if (data.results.indexOf('#') == 0) { - data.results = decompress(data.results.substring(1)); - } update(data); } } diff --git a/scripts/base.js b/scripts/base.js index d5c0a803..08c10526 100644 --- a/scripts/base.js +++ b/scripts/base.js @@ -1,3 +1,5 @@ +var API_BASE = 'https://html5test.eu5.net/api' + /* Polyfills */ if (!Function.prototype.bind) { @@ -57,10 +59,6 @@ if (!Function.prototype.bind) { /* Utility functions */ -function compress(c) { var b = z = {}, f = c.split(""), d = [], a = f[0], g = 256; for (b = 1; b < f.length; b++)c = f[b], null != z[a + c] ? a += c : (d.push(1 < a.length ? z[a] : a.charCodeAt(0)), z[a + c] = g, g++, a = c); d.push(1 < a.length ? z[a] : a.charCodeAt(0)); for (b = 0; b < d.length; b++)d[b] = String.fromCharCode(d[b]); return d.join("") } - -function decompress(b) { var a = e = {}, d = b.split(""), c = f = d[0], g = [c], h = o = 256; for (b = 1; b < d.length; b++)a = d[b].charCodeAt(0), a = h > a ? d[b] : e[a] ? e[a] : f + c, g.push(a), c = a.charAt(0), e[o] = f + c, o++, f = a; return g.join("") } - function loadWhichBrowser(cb) { var callback = cb; @@ -109,7 +107,7 @@ function submit(method, payload) { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST', 'https://html5test.com/api/' + method, true); + httpRequest.open('POST', API_BASE + '/' + method, true); httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send('payload=' + encodeURIComponent(payload)); } @@ -130,35 +128,6 @@ function decodeParameters() { return params; } -function upgradeConnection(success, failure) { - if (location.protocol == "http:") { - var httpRequest; - - if (window.XMLHttpRequest) { - httpRequest = new XMLHttpRequest(); - } else if (window.ActiveXObject) { - httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); - } - - httpRequest.onreadystatechange = function () { - if (httpRequest.readyState == 4) { - if (httpRequest.status >= 200 && httpRequest.status < 400) { - success(); - } else { - failure(); - } - } - } - - httpRequest.open('GET', 'https://html5test.com/assets/upgrade', true); - httpRequest.send(); - - return; - } - - failure(); -} - function submitResults(r, c) { var parameters = decodeParameters(); var identifier = typeof parameters.identifier != 'undefined' ? parameters.identifier : ''; @@ -200,7 +169,7 @@ function submitResults(r, c) { '"useragent": "' + navigator.userAgent + '",' + '"humanReadable": "' + Browsers.toString() + '",' + '"points": "' + c.points + '",' + - '"results": "#' + escapeSlashes(compress(r.results)) + '"' + + '"results": "#' + escapeSlashes(r.results) + '"' + '}'; submit('submit', payload); diff --git a/scripts/reporting.js b/scripts/reporting.js index 185346b0..a578ea31 100644 --- a/scripts/reporting.js +++ b/scripts/reporting.js @@ -303,7 +303,7 @@ FeatureTable.prototype = { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST', 'https://html5test.com/api/loadBrowser', true); + httpRequest.open('POST', API_BASE + '/loadBrowser', true); httpRequest.onreadystatechange = process; httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send('id=' + encodeURIComponent(id)); @@ -311,10 +311,6 @@ FeatureTable.prototype = { function process() { if (httpRequest.readyState == 4 && httpRequest.responseText != '') { var data = JSON.parse(httpRequest.responseText); - if (data.results.indexOf('#') == 0) { - data.results = decompress(data.results.substring(1)); - } - var f = that.options.filter; that.filter(''); that.updateColumn(column, data); @@ -1033,7 +1029,7 @@ BrowserTable.prototype = { httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); } - httpRequest.open('POST', 'https://html5test.com/api/loadFeature', true); + httpRequest.open('POST', API_BASE + '/loadFeature', true); httpRequest.onreadystatechange = process; httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); httpRequest.send('key=' + encodeURIComponent(key));