2 $logfiles = "/home/groups/o/op/openrocket/persistent/logs/access-";
5 // getallheaders method
6 if (!function_exists('getallheaders')) {
7 function getallheaders() {
8 foreach ($_SERVER as $name => $value) {
9 if (substr($name, 0, 5) == 'HTTP_') {
10 $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
18 // Parse + validate headers
26 foreach (getallheaders() as $header => $value) {
27 if (preg_match("/^[a-zA-Z0-9 !$%&()*+,.\\/:=?@_~-]{1,40}$/", $value)) {
28 $h = strtolower($header);
29 if ($h == 'x-openrocket-version') {
31 } else if ($h == 'x-openrocket-id') {
33 } else if ($h == 'x-openrocket-os') {
35 } else if ($h == 'x-openrocket-java') {
37 } else if ($h == 'x-openrocket-country') {
39 } else if ($h == 'x-openrocket-cpus') {
41 } else if ($h == 'x-openrocket-locale') {
48 if ((strlen($orversion) > 0 || strlen($orid) > 0 || strlen($oros) > 0
49 || strlen($orjava) > 0 || strlen($orcountry) > 0
50 || strlen($orcores) > 0 || strlen($orlocale) > 0) &&
51 (strlen($orversion) < 20 && strlen($orid) < 50 && strlen($oros) < 50
52 && strlen($orjava) < 50 && strlen($orcountry) < 50)
53 && strlen($orcores) < 10 && strlen($orlocale) < 20) {
55 $file = $logfiles . gmdate("Y-m");
56 $line = gmdate("Y-m-d H:i:s") . ";" . $orid . ";" . $orversion .
57 ";" . $oros . ";" . $orjava . ";" . $orcountry . ";" . $orcores .
58 ";" . $orlocale . "\n";
60 $fp = fopen($file, 'a');
68 // Set HTTP content-type header
69 // No charset allowed for 0.9.4
70 //header("Content-type: text/plain; charset=utf-8");
71 header("Content-type: text/plain");
74 * Currently all old versions are handled manually.
75 * Update checking was introduced in OpenRocket 0.9.4
77 * We ignore "pre" versions, they are handled exacly like
78 * their non-pre counterparts.
80 $version = $_GET["version"];
86 if (preg_match("/^12.03$/", $version)) {
87 $updates = "Version: " . $unstable . "\n" .
88 "10: 3D design view\n" .
89 "9: Component presets\n" .
90 "5: Fractional inch unit\n" .
91 "4: Printing centering rings\n" .
92 "4: Translations to Czech and Polish\n" .
94 } else if (preg_match("/^1\.1\.9$/", $version)) {
95 $updates = "Version: " . $unstable . "\n" .
96 "10: 3D design view\n" .
97 "9: Component presets\n" .
98 "8: Writing RKT files\n" .
99 "5: Configurable stage separation\n" .
100 "4: Freeform fin import from images\n" .
101 "4: Translations to Italian and Russian\n" .
103 } else if (preg_match("/^1\.1\.8$/", $version)) {
104 $updates = "Version: " . $unstable . "\n" .
105 "10: 3D design view\n" .
106 "9: Component presets\n" .
107 "8: Writing RKT files\n" .
108 "6: Additional template printing\n" .
109 "5: Geodetic computations\n" .
110 "5: Configurable stage separation\n" .
111 "5: Guided tours\n" .
112 "4: Freeform fin import from images\n" .
113 "4: Translations to Italian and Russian\n" .
116 } else if (preg_match("/^1\.1\.7$/", $version)) {
117 $updates = "Version: " . $unstable . "\n" .
118 "8: Writing RKT files\n" .
119 "6: Additional template printing\n" .
120 "5: Geodetic computations\n" .
121 "5: Configurable stage separation\n" .
122 "5: Guided tours\n" .
123 "4: Freeform fin import from images\n" .
124 "4: Translations to Italian and Russian\n" .
127 } else if (preg_match("/^1\.1\.6$/", $version)) {
128 $updates = "Version: " . $unstable . "\n" .
129 "10: 3D design view\n" .
130 "9: Component presets\n" .
131 "8: Writing RKT files\n" .
132 "8: Automatic rocket design optimization\n" .
133 "6: Additional template printing\n" .
134 "5: Geodetic computations\n" .
136 } else if (preg_match("/^1\.1\.5$/", $version)) {
137 $updates = "Version: " . $unstable . "\n" .
138 "10: 3D design view\n" .
139 "9: Component presets\n" .
140 "8: Writing RKT files\n" .
141 "8: Automatic rocket design optimization\n" .
142 "6: Initial localization support\n" .
143 "6: Additional template printing\n" .
144 "5: Geodetic computations\n" .
145 "5: Scaling support\n" .
148 } else if (preg_match("/^1\.1\.4$/", $version)) {
149 $updates = "Version: " . $unstable . "\n" .
150 "10: 3D design view\n" .
151 "9: Component presets\n" .
152 "8: Writing RKT files\n" .
153 "8: Automatic rocket design optimization\n" .
154 "6: Initial localization support\n" .
155 "5: Fixes to printing system\n" .
156 "5: Scaling support\n" .
158 } else if (preg_match("/^1\.1\.3$/", $version)) {
159 $updates = "Version: " . $unstable . "\n" .
160 "10: 3D design view\n" .
161 "9: Component presets\n" .
162 "8: Writing RKT files\n" .
163 "8: Automatic rocket design optimization\n" .
164 "7: Initial printing support\n" .
165 "6: Initial localization support\n" .
166 "5: Scaling support\n" .
169 } else if (preg_match("/^1\.1\.[12]$/", $version)) {
170 $updates = "Version: " . $unstable . "\n" .
171 "10: 3D design view\n" .
172 "9: Component presets\n" .
173 "8: Writing RKT files\n" .
174 "8: Automatic rocket design optimization\n" .
175 "6: Initial printing support\n" .
176 "5: Initial drag-and-drop support\n" .
177 "5: Initial localization support\n" .
178 "5: Scaling support\n" .
181 } else if (preg_match("/^1\.1\.0$/", $version)) {
182 $updates = "Version: " . $unstable . "\n" .
183 "10: 3D design view\n" .
184 "9: Component presets\n" .
185 "8: Writing RKT files\n" .
186 "8: Automatic rocket design optimization\n" .
187 "6: Initial printing support\n" .
188 "6: Initial localization support\n" .
189 "6: Enhanced motor selection\n" .
190 "5: Rewritten simulation code\n" .
191 "5: Drag-and-drop support\n" .
194 } else if (preg_match("/^0\.9\.6/", $version)) {
195 $updates = "Version: " . $stable . "\n" .
196 "10: 3D design view\n" .
197 "9: Component presets\n" .
198 "8: Writing RKT files\n" .
199 "6: Hundreds of new thrustcurves\n" .
202 } else if (preg_match("/^0\.9\.[45]/", $version)) {
203 $updates = "Version: " . $stable . "\n" .
204 "10: 3D design view\n" .
205 "9: Component presets\n" .
206 "8: Writing RKT files\n" .
207 "7: Hundreds of new thrustcurves\n" .
208 "6: Aerodynamic computation updates\n" .
209 "5: Numerous bug fixes" .
214 if (strlen($updates) == 0) {
216 // No updates available
217 header("HTTP/1.0 204 No Content");
221 header("HTTP/1.0 200 OK");