Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/test/data/dromaeo/store.php

Issue 2499923002: Update dromaeo to upstream a876d5250befbc41e2deab9d10cf6085b511d5ed (Closed)
Patch Set: Modified readme Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <?php 1 <?php
2 /* 2 /*
3 Dromaeo Test Suite 3 Dromaeo Test Suite
4 Copyright (c) 2010 John Resig 4 Copyright (c) 2010 John Resig
5 5
6 Permission is hereby granted, free of charge, to any person 6 Permission is hereby granted, free of charge, to any person
7 obtaining a copy of this software and associated documentation 7 obtaining a copy of this software and associated documentation
8 files (the "Software"), to deal in the Software without 8 files (the "Software"), to deal in the Software without
9 restriction, including without limitation the rights to use, 9 restriction, including without limitation the rights to use,
10 copy, modify, merge, publish, distribute, sublicense, and/or sell 10 copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the 11 copies of the Software, and to permit persons to whom the
12 Software is furnished to do so, subject to the following 12 Software is furnished to do so, subject to the following
13 conditions: 13 conditions:
14 14
15 The above copyright notice and this permission notice shall be 15 The above copyright notice and this permission notice shall be
16 included in all copies or substantial portions of the Software. 16 included in all copies or substantial portions of the Software.
17 17
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 22 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 23 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 24 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25 OTHER DEALINGS IN THE SOFTWARE. 25 OTHER DEALINGS IN THE SOFTWARE.
26 */ 26 */
27 27
28 » $server = 'mysql.dromaeo.com'; 28 $server = 'mysql.dromaeo.com';
29 » $user = 'dromaeo'; 29 $user = 'dromaeo';
30 » $pass = 'dromaeo'; 30 $pass = 'dromaeo';
31 31
32 » require('JSON.php'); 32 require('JSON.php');
33 33
34 » $json = new Services_JSON(); 34 $json = new Services_JSON();
35 $sql = mysql_connect( $server, $user, $pass ); 35 $sql = mysql_connect( $server, $user, $pass );
36 36
37 mysql_select_db( 'dromaeo' ); 37 mysql_select_db( 'dromaeo' );
38 38
39 » $id = str_replace(';', "", $_REQUEST['id']); 39 $id = preg_replace('/[^\d,]/', '', $_REQUEST['id']);
40 40
41 » if ( $id ) { 41 if ( $id ) {
42 » » $sets = array(); 42 » $sets = array();
43 » » $ids = split(",", $id); 43 » $ids = split(",", $id);
44 44
45 » » foreach ($ids as $i) { 45 » foreach ($ids as $i) {
46 » » » $query = mysql_query( "SELECT * FROM runs WHERE id=$i;" ); 46 » » $query = mysql_query( sprintf("SELECT * FROM runs WHERE id=%s;",
47 » » » $data = mysql_fetch_assoc($query); 47 » » » mysql_real_escape_string($i)));
48 » » $data = mysql_fetch_assoc($query);
49
50 » » $query = mysql_query( sprintf("SELECT * FROM results WHERE run_i d=%s;",
51 » » » mysql_real_escape_string($i)));
52 » » $results = array();
48 53
49 » » » $query = mysql_query( "SELECT * FROM results WHERE run_i d=$i;" ); 54 » » while ( $row = mysql_fetch_assoc($query) ) {
50 » » » $results = array(); 55 » » » array_push($results, $row);
51 » »
52 » » » while ( $row = mysql_fetch_assoc($query) ) {
53 » » » » array_push($results, $row);
54 » » » }
55
56 » » » $data['results'] = $results;
57 » » » $data['ip'] = '';
58
59 » » » array_push($sets, $data);
60 } 56 }
61 57
62 » » echo $json->encode($sets); 58 » » $data['results'] = $results;
63 » } else { 59 » » $data['ip'] = '';
64 » » $data = $json->decode(str_replace('\\"', '"', $_REQUEST['data']) );
65 60
66 » » if ( $data ) { 61 » » array_push($sets, $data);
62 » }
63
64 » echo $json->encode($sets);
65 } else {
66 » $data = $json->decode(str_replace('\\"', '"', $_REQUEST['data']));
67
68 » if ( $data ) {
67 mysql_query( sprintf("INSERT into runs VALUES(NULL,'%s','%s',NOW (),'%s');", 69 mysql_query( sprintf("INSERT into runs VALUES(NULL,'%s','%s',NOW (),'%s');",
68 » » » $_SERVER['HTTP_USER_AGENT'], $_SERVER['REMOTE_ADDR'], st r_replace(';', "", $_REQUEST['style'])) ); 70 » » » mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']),
71 » » » mysql_real_escape_string($_SERVER['REMOTE_ADDR']),
72 » » » mysql_real_escape_string(str_replace(';', "", $_REQUEST[ 'style']))
73 » » ));
69 74
70 $id = mysql_insert_id(); 75 $id = mysql_insert_id();
71 76
72 if ( $id ) { 77 if ( $id ) {
73 78
74 » » foreach ($data as $row) { 79 » » » foreach ($data as $row) {
75 » » » mysql_query( sprintf("INSERT into results VALUES(NULL,'% s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');", 80 » » » » mysql_query( sprintf("INSERT into results VALUES (NULL,'%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s');",
76 » » » » $id, $row->collection, $row->version, $row->name , $row->scale, $row->median, $row->min, $row->max, $row->mean, $row->deviation, $row->runs) ); 81 » » » » » $id, $row->collection, $row->version, $r ow->name, $row->scale, $row->median, $row->min, $row->max, $row->mean, $row->dev iation, $row->runs) );
77 » » } 82 » » » }
78 83
79 » » echo $id; 84 » » » echo $id;
80 » » }
81 } 85 }
82 } 86 }
87 }
83 ?> 88 ?>
OLDNEW
« no previous file with comments | « chrome/test/data/dromaeo/patches/webrunner.patch ('k') | chrome/test/data/dromaeo/tests/MANIFEST.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698