akaaafk commited on
Commit
129c10e
·
verified ·
1 Parent(s): 93cf4a7

Add/update benchmark/NYU_CTF_Bench (part 2)

Browse files
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/.gitignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *~
2
+ *.bak
3
+ Thumbs.db
4
+ desktop.ini
5
+ .DS_Store
6
+ .buildpath
7
+ .project
8
+ .settings
9
+ fuel/app/logs/*/*/*
10
+ fuel/app/cache/*/*
11
+ nbproject/
12
+ .idea
13
+ *.tmproj
14
+ *.sublime-project
15
+ *.sublime-workspace
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/base.php ADDED
@@ -0,0 +1,497 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ /**
14
+ * Loads in a core class and optionally an app class override if it exists.
15
+ *
16
+ * @param string $path
17
+ * @param string $folder
18
+ * @return void
19
+ */
20
+ if ( ! function_exists('import'))
21
+ {
22
+ function import($path, $folder = 'classes')
23
+ {
24
+ $path = str_replace('/', DIRECTORY_SEPARATOR, $path);
25
+ require_once COREPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php';
26
+
27
+ if (is_file(APPPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php'))
28
+ {
29
+ require_once APPPATH.$folder.DIRECTORY_SEPARATOR.$path.'.php';
30
+ }
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Shortcut for writing to the Log
36
+ *
37
+ * @param int|string the error level
38
+ * @param string the error message
39
+ * @param string information about the method
40
+ * @return bool
41
+ */
42
+ if ( ! function_exists('logger'))
43
+ {
44
+ function logger($level, $msg, $method = null)
45
+ {
46
+ static $labels = array(
47
+ 100 => 'DEBUG',
48
+ 200 => 'INFO',
49
+ 250 => 'NOTICE',
50
+ 300 => 'WARNING',
51
+ 400 => 'ERROR',
52
+ 500 => 'CRITICAL',
53
+ 550 => 'ALERT',
54
+ 600 => 'EMERGENCY',
55
+ 700 => 'ALL',
56
+ );
57
+
58
+ // make sure $level has the correct value
59
+ if ((is_int($level) and ! isset($labels[$level])) or (is_string($level) and ! array_search(strtoupper($level), $labels)))
60
+ {
61
+ throw new \FuelException('Invalid level "'.$level.'" passed to logger()');
62
+ }
63
+
64
+ if(is_string($level)) $level = array_search(strtoupper($level), $labels);
65
+
66
+ // get the levels defined to be logged
67
+ $loglabels = \Config::get('log_threshold');
68
+
69
+ // bail out if we don't need logging at all
70
+ if ($loglabels == \Fuel::L_NONE)
71
+ {
72
+ return false;
73
+ }
74
+
75
+ // if profiling is active log the message to the profile
76
+ if (\Config::get('profiling'))
77
+ {
78
+ \Console::log($method.' - '.$msg);
79
+ }
80
+
81
+ // if it's not an array, assume it's an "up to" level
82
+ if ( ! is_array($loglabels))
83
+ {
84
+ $a = array();
85
+ foreach ($labels as $l => $label)
86
+ {
87
+ $l >= $loglabels and $a[] = $l;
88
+ }
89
+ $loglabels = $a;
90
+ }
91
+
92
+ // do we need to log the message with this level?
93
+ if ( ! in_array($level, $loglabels))
94
+ {
95
+ return false;
96
+ }
97
+
98
+ return \Log::instance()->log($level, (empty($method) ? '' : $method.' - ').$msg);
99
+ }
100
+ }
101
+
102
+
103
+ /**
104
+ * Takes an array of attributes and turns it into a string for an html tag
105
+ *
106
+ * @param array $attr
107
+ * @return string
108
+ */
109
+ if ( ! function_exists('array_to_attr'))
110
+ {
111
+ function array_to_attr($attr)
112
+ {
113
+ $attr_str = '';
114
+
115
+ foreach ((array) $attr as $property => $value)
116
+ {
117
+ // Ignore null/false
118
+ if ($value === null or $value === false)
119
+ {
120
+ continue;
121
+ }
122
+
123
+ // If the key is numeric then it must be something like selected="selected"
124
+ if (is_numeric($property))
125
+ {
126
+ $property = $value;
127
+ }
128
+
129
+ $attr_str .= $property.'="'.$value.'" ';
130
+ }
131
+
132
+ // We strip off the last space for return
133
+ return trim($attr_str);
134
+ }
135
+ }
136
+
137
+ /**
138
+ * Create a XHTML tag
139
+ *
140
+ * @param string The tag name
141
+ * @param array|string The tag attributes
142
+ * @param string|bool The content to place in the tag, or false for no closing tag
143
+ * @return string
144
+ */
145
+ if ( ! function_exists('html_tag'))
146
+ {
147
+ function html_tag($tag, $attr = array(), $content = false)
148
+ {
149
+ $has_content = (bool) ($content !== false and $content !== null);
150
+ $html = '<'.$tag;
151
+
152
+ $html .= ( ! empty($attr)) ? ' '.(is_array($attr) ? array_to_attr($attr) : $attr) : '';
153
+ $html .= $has_content ? '>' : ' />';
154
+ $html .= $has_content ? $content.'</'.$tag.'>' : '';
155
+
156
+ return $html;
157
+ }
158
+ }
159
+
160
+ /**
161
+ * A case-insensitive version of in_array.
162
+ *
163
+ * @param mixed $needle
164
+ * @param array $haystack
165
+ * @return bool
166
+ */
167
+ if ( ! function_exists('in_arrayi'))
168
+ {
169
+ function in_arrayi($needle, $haystack)
170
+ {
171
+ return in_array(strtolower($needle), array_map('strtolower', $haystack));
172
+ }
173
+ }
174
+
175
+ /**
176
+ * Gets all the public vars for an object. Use this if you need to get all the
177
+ * public vars of $this inside an object.
178
+ *
179
+ * @return array
180
+ */
181
+ if ( ! function_exists('get_object_public_vars'))
182
+ {
183
+ function get_object_public_vars($obj)
184
+ {
185
+ return get_object_vars($obj);
186
+ }
187
+ }
188
+
189
+ /**
190
+ * Renders a view and returns the output.
191
+ *
192
+ * @param string The view name/path
193
+ * @param array The data for the view
194
+ * @param bool Auto filter override
195
+ * @return string
196
+ */
197
+ if ( ! function_exists('render'))
198
+ {
199
+ function render($view, $data = null, $auto_filter = null)
200
+ {
201
+ return \View::forge($view, $data, $auto_filter)->render();
202
+ }
203
+ }
204
+
205
+ /**
206
+ * A wrapper function for Lang::get()
207
+ *
208
+ * @param mixed The string to translate
209
+ * @param array The parameters
210
+ * @return string
211
+ */
212
+ if ( ! function_exists('__'))
213
+ {
214
+ function __($string, $params = array(), $default = null, $language = null)
215
+ {
216
+ return \Lang::get($string, $params, $default, $language);
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Encodes the given string. This is just a wrapper function for Security::htmlentities()
222
+ *
223
+ * @param mixed The string to encode
224
+ * @return string
225
+ */
226
+ if ( ! function_exists('e'))
227
+ {
228
+ function e($string)
229
+ {
230
+ return Security::htmlentities($string);
231
+ }
232
+ }
233
+
234
+ /**
235
+ * Takes a classname and returns the actual classname for an alias or just the classname
236
+ * if it's a normal class.
237
+ *
238
+ * @param string classname to check
239
+ * @return string real classname
240
+ */
241
+ if ( ! function_exists('get_real_class'))
242
+ {
243
+ function get_real_class($class)
244
+ {
245
+ static $classes = array();
246
+
247
+ if ( ! array_key_exists($class, $classes))
248
+ {
249
+ $reflect = new ReflectionClass($class);
250
+ $classes[$class] = $reflect->getName();
251
+ }
252
+
253
+ return $classes[$class];
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Takes an associative array in the layout of parse_url, and constructs a URL from it
259
+ *
260
+ * see http://www.php.net/manual/en/function.http-build-url.php#96335
261
+ *
262
+ * @param mixed (Part(s) of) an URL in form of a string or associative array like parse_url() returns
263
+ * @param mixed Same as the first argument
264
+ * @param int A bitmask of binary or'ed HTTP_URL constants (Optional)HTTP_URL_REPLACE is the default
265
+ * @param array If set, it will be filled with the parts of the composed url like parse_url() would return
266
+ *
267
+ * @return string constructed URL
268
+ */
269
+ if (!function_exists('http_build_url'))
270
+ {
271
+ define('HTTP_URL_REPLACE', 1); // Replace every part of the first URL when there's one of the second URL
272
+ define('HTTP_URL_JOIN_PATH', 2); // Join relative paths
273
+ define('HTTP_URL_JOIN_QUERY', 4); // Join query strings
274
+ define('HTTP_URL_STRIP_USER', 8); // Strip any user authentication information
275
+ define('HTTP_URL_STRIP_PASS', 16); // Strip any password authentication information
276
+ define('HTTP_URL_STRIP_AUTH', 32); // Strip any authentication information
277
+ define('HTTP_URL_STRIP_PORT', 64); // Strip explicit port numbers
278
+ define('HTTP_URL_STRIP_PATH', 128); // Strip complete path
279
+ define('HTTP_URL_STRIP_QUERY', 256); // Strip query string
280
+ define('HTTP_URL_STRIP_FRAGMENT', 512); // Strip any fragments (#identifier)
281
+ define('HTTP_URL_STRIP_ALL', 1024); // Strip anything but scheme and host
282
+
283
+ function http_build_url($url, $parts = array(), $flags = HTTP_URL_REPLACE, &$new_url = false)
284
+ {
285
+ $keys = array('user','pass','port','path','query','fragment');
286
+
287
+ // HTTP_URL_STRIP_ALL becomes all the HTTP_URL_STRIP_Xs
288
+ if ($flags & HTTP_URL_STRIP_ALL)
289
+ {
290
+ $flags |= HTTP_URL_STRIP_USER;
291
+ $flags |= HTTP_URL_STRIP_PASS;
292
+ $flags |= HTTP_URL_STRIP_PORT;
293
+ $flags |= HTTP_URL_STRIP_PATH;
294
+ $flags |= HTTP_URL_STRIP_QUERY;
295
+ $flags |= HTTP_URL_STRIP_FRAGMENT;
296
+ }
297
+ // HTTP_URL_STRIP_AUTH becomes HTTP_URL_STRIP_USER and HTTP_URL_STRIP_PASS
298
+ else if ($flags & HTTP_URL_STRIP_AUTH)
299
+ {
300
+ $flags |= HTTP_URL_STRIP_USER;
301
+ $flags |= HTTP_URL_STRIP_PASS;
302
+ }
303
+
304
+ // parse the original URL
305
+ $parse_url = is_array($url) ? $url : parse_url($url);
306
+
307
+ // make sure we always have a scheme, host and path
308
+ empty($parse_url['scheme']) and $parse_url['scheme'] = 'http';
309
+ empty($parse_url['host']) and $parse_url['host'] = \Input::server('http_host');
310
+ isset($parse_url['path']) or $parse_url['path'] = '';
311
+
312
+ // make the path absolute if needed
313
+ if ( ! empty($parse_url['path']) and substr($parse_url['path'], 0, 1) != '/')
314
+ {
315
+ $parse_url['path'] = '/'.$parse_url['path'];
316
+ }
317
+
318
+ // scheme and host are always replaced
319
+ isset($parts['scheme']) and $parse_url['scheme'] = $parts['scheme'];
320
+ isset($parts['host']) and $parse_url['host'] = $parts['host'];
321
+
322
+ // replace the original URL with it's new parts (if applicable)
323
+ if ($flags & HTTP_URL_REPLACE)
324
+ {
325
+ foreach ($keys as $key)
326
+ {
327
+ if (isset($parts[$key]))
328
+ $parse_url[$key] = $parts[$key];
329
+ }
330
+ }
331
+ else
332
+ {
333
+ // join the original URL path with the new path
334
+ if (isset($parts['path']) && ($flags & HTTP_URL_JOIN_PATH))
335
+ {
336
+ if (isset($parse_url['path']))
337
+ $parse_url['path'] = rtrim(str_replace(basename($parse_url['path']), '', $parse_url['path']), '/') . '/' . ltrim($parts['path'], '/');
338
+ else
339
+ $parse_url['path'] = $parts['path'];
340
+ }
341
+
342
+ // join the original query string with the new query string
343
+ if (isset($parts['query']) && ($flags & HTTP_URL_JOIN_QUERY))
344
+ {
345
+ if (isset($parse_url['query']))
346
+ $parse_url['query'] .= '&' . $parts['query'];
347
+ else
348
+ $parse_url['query'] = $parts['query'];
349
+ }
350
+ }
351
+
352
+ // strips all the applicable sections of the URL
353
+ // note: scheme and host are never stripped
354
+ foreach ($keys as $key)
355
+ {
356
+ if ($flags & (int)constant('HTTP_URL_STRIP_' . strtoupper($key)))
357
+ unset($parse_url[$key]);
358
+ }
359
+
360
+
361
+ $new_url = $parse_url;
362
+
363
+ return
364
+ ((isset($parse_url['scheme'])) ? $parse_url['scheme'] . '://' : '')
365
+ .((isset($parse_url['user'])) ? $parse_url['user'] . ((isset($parse_url['pass'])) ? ':' . $parse_url['pass'] : '') .'@' : '')
366
+ .((isset($parse_url['host'])) ? $parse_url['host'] : '')
367
+ .((isset($parse_url['port'])) ? ':' . $parse_url['port'] : '')
368
+ .((isset($parse_url['path'])) ? $parse_url['path'] : '')
369
+ .((isset($parse_url['query'])) ? '?' . $parse_url['query'] : '')
370
+ .((isset($parse_url['fragment'])) ? '#' . $parse_url['fragment'] : '')
371
+ ;
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Find the common "root" path of two given paths or FQFN's
377
+ *
378
+ * @param array array with the paths to compare
379
+ *
380
+ * @return string the determined common path section
381
+ */
382
+ if ( ! function_exists('get_common_path'))
383
+ {
384
+ function get_common_path($paths)
385
+ {
386
+ $lastOffset = 1;
387
+ $common = '/';
388
+ while (($index = strpos($paths[0], '/', $lastOffset)) !== false)
389
+ {
390
+ $dirLen = $index - $lastOffset + 1; // include /
391
+ $dir = substr($paths[0], $lastOffset, $dirLen);
392
+ foreach ($paths as $path)
393
+ {
394
+ if (substr($path, $lastOffset, $dirLen) != $dir)
395
+ {
396
+ return $common;
397
+ }
398
+ }
399
+ $common .= $dir;
400
+ $lastOffset = $index + 1;
401
+ }
402
+ return $common;
403
+ }
404
+ }
405
+
406
+ /**
407
+ * Faster equivalent of call_user_func_array
408
+ */
409
+ if ( ! function_exists('call_fuel_func_array'))
410
+ {
411
+ function call_fuel_func_array($callback , array $args)
412
+ {
413
+ // deal with "class::method" syntax
414
+ if (is_string($callback) and strpos($callback, '::') !== false)
415
+ {
416
+ $callback = explode('::', $callback);
417
+ }
418
+
419
+ // if an array is passed, extract the object and method to call
420
+ if (is_array($callback) and isset($callback[1]) and is_object($callback[0]))
421
+ {
422
+ list($instance, $method) = $callback;
423
+
424
+ // calling the method directly is faster then call_user_func_array() !
425
+ switch (count($args))
426
+ {
427
+ case 0:
428
+ return $instance->$method();
429
+
430
+ case 1:
431
+ return $instance->$method($args[0]);
432
+
433
+ case 2:
434
+ return $instance->$method($args[0], $args[1]);
435
+
436
+ case 3:
437
+ return $instance->$method($args[0], $args[1], $args[2]);
438
+
439
+ case 4:
440
+ return $instance->$method($args[0], $args[1], $args[2], $args[3]);
441
+ }
442
+ }
443
+
444
+ elseif (is_array($callback) and isset($callback[1]) and is_string($callback[0]))
445
+ {
446
+ list($class, $method) = $callback;
447
+ $class = '\\'.ltrim($class, '\\');
448
+
449
+ // calling the method directly is faster then call_user_func_array() !
450
+ switch (count($args))
451
+ {
452
+ case 0:
453
+ return $class::$method();
454
+
455
+ case 1:
456
+ return $class::$method($args[0]);
457
+
458
+ case 2:
459
+ return $class::$method($args[0], $args[1]);
460
+
461
+ case 3:
462
+ return $class::$method($args[0], $args[1], $args[2]);
463
+
464
+ case 4:
465
+ return $class::$method($args[0], $args[1], $args[2], $args[3]);
466
+ }
467
+ }
468
+
469
+ // if it's a string, it's a native function or a static method call
470
+ elseif (is_string($callback) or $callback instanceOf \Closure)
471
+ {
472
+ is_string($callback) and $callback = ltrim($callback, '\\');
473
+
474
+ // calling the method directly is faster then call_user_func_array() !
475
+ switch (count($args))
476
+ {
477
+ case 0:
478
+ return $callback();
479
+
480
+ case 1:
481
+ return $callback($args[0]);
482
+
483
+ case 2:
484
+ return $callback($args[0], $args[1]);
485
+
486
+ case 3:
487
+ return $callback($args[0], $args[1], $args[2]);
488
+
489
+ case 4:
490
+ return $callback($args[0], $args[1], $args[2], $args[3]);
491
+ }
492
+ }
493
+
494
+ // fallback, handle the old way
495
+ return call_user_func_array($callback, $args);
496
+ }
497
+ }
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/bootstrap.php ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Part of the Fuel framework.
4
+ *
5
+ * @package Fuel
6
+ * @version 1.7
7
+ * @author Fuel Development Team
8
+ * @license MIT License
9
+ * @copyright 2010 - 2013 Fuel Development Team
10
+ * @link http://fuelphp.com
11
+ */
12
+
13
+ define('DS', DIRECTORY_SEPARATOR);
14
+ define('CRLF', chr(13).chr(10));
15
+
16
+ setup_autoloader();
17
+
18
+ // Load the base functions
19
+ require COREPATH.'base.php';
20
+
21
+ /**
22
+ * Do we have access to mbstring?
23
+ * We need this in order to work with UTF-8 strings
24
+ */
25
+ define('MBSTRING', function_exists('mb_get_info'));
26
+
27
+ /**
28
+ * Load the Composer autoloader if present
29
+ */
30
+ defined('VENDORPATH') or define('VENDORPATH', realpath(COREPATH.'..'.DS.'vendor').DS);
31
+ if ( ! is_file(VENDORPATH.'autoload.php'))
32
+ {
33
+ die('Composer is not installed. Please run "php composer.phar update" in the root to install Composer');
34
+ }
35
+ require VENDORPATH.'autoload.php';
36
+
37
+ /**
38
+ * Register all the error/shutdown handlers
39
+ */
40
+ register_shutdown_function(function ()
41
+ {
42
+ // reset the autoloader
43
+ \Autoloader::_reset();
44
+
45
+ // make sure we're having an output filter so we can display errors
46
+ // occuring before the main config file is loaded
47
+ \Config::get('security.output_filter', null) or \Config::set('security.output_filter', 'Security::htmlentities');
48
+
49
+ try
50
+ {
51
+ // fire any app shutdown events
52
+ \Event::instance()->trigger('shutdown', '', 'none', true);
53
+
54
+ // fire any framework shutdown events
55
+ \Event::instance()->trigger('fuel-shutdown', '', 'none', true);
56
+ }
57
+ catch (\Exception $e)
58
+ {
59
+ if (\Fuel::$is_cli)
60
+ {
61
+ \Cli::error("Error: ".$e->getMessage()." in ".$e->getFile()." on ".$e->getLine());
62
+ \Cli::beep();
63
+ exit(1);
64
+ }
65
+ }
66
+ return \Error::shutdown_handler();
67
+ });
68
+
69
+ set_exception_handler(function (\Exception $e)
70
+ {
71
+ // reset the autoloader
72
+ \Autoloader::_reset();
73
+
74
+ // deal with PHP bugs #42098/#54054
75
+ if ( ! class_exists('Error'))
76
+ {
77
+ include COREPATH.'classes/error.php';
78
+ class_alias('\Fuel\Core\Error', 'Error');
79
+ class_alias('\Fuel\Core\PhpErrorException', 'PhpErrorException');
80
+ }
81
+
82
+ return \Error::exception_handler($e);
83
+ });
84
+
85
+ set_error_handler(function ($severity, $message, $filepath, $line)
86
+ {
87
+ // reset the autoloader
88
+ \Autoloader::_reset();
89
+
90
+ // deal with PHP bugs #42098/#54054
91
+ if ( ! class_exists('Error'))
92
+ {
93
+ include COREPATH.'classes/error.php';
94
+ class_alias('\Fuel\Core\Error', 'Error');
95
+ class_alias('\Fuel\Core\PhpErrorException', 'PhpErrorException');
96
+ }
97
+
98
+ return \Error::error_handler($severity, $message, $filepath, $line);
99
+ });
100
+
101
+ function setup_autoloader()
102
+ {
103
+ Autoloader::add_namespace('Fuel\\Core', COREPATH.'classes/');
104
+
105
+ Autoloader::add_namespace('PHPSecLib', COREPATH.'vendor'.DS.'phpseclib'.DS, true);
106
+
107
+ Autoloader::add_classes(array(
108
+ 'Fuel\\Core\\Agent' => COREPATH.'classes/agent.php',
109
+
110
+ 'Fuel\\Core\\Arr' => COREPATH.'classes/arr.php',
111
+
112
+ 'Fuel\\Core\\Asset' => COREPATH.'classes/asset.php',
113
+ 'Fuel\\Core\\Asset_Instance' => COREPATH.'classes/asset/instance.php',
114
+
115
+ 'Fuel\\Core\\Cache' => COREPATH.'classes/cache.php',
116
+ 'Fuel\\Core\\CacheNotFoundException' => COREPATH.'classes/cache/notfound.php',
117
+ 'Fuel\\Core\\CacheExpiredException' => COREPATH.'classes/cache.php',
118
+ 'Fuel\\Core\\Cache_Handler_Driver' => COREPATH.'classes/cache/handler/driver.php',
119
+ 'Fuel\\Core\\Cache_Handler_Json' => COREPATH.'classes/cache/handler/json.php',
120
+ 'Fuel\\Core\\Cache_Handler_Serialized' => COREPATH.'classes/cache/handler/serialized.php',
121
+ 'Fuel\\Core\\Cache_Handler_String' => COREPATH.'classes/cache/handler/string.php',
122
+ 'Fuel\\Core\\Cache_Storage_Driver' => COREPATH.'classes/cache/storage/driver.php',
123
+ 'Fuel\\Core\\Cache_Storage_Apc' => COREPATH.'classes/cache/storage/apc.php',
124
+ 'Fuel\\Core\\Cache_Storage_File' => COREPATH.'classes/cache/storage/file.php',
125
+ 'Fuel\\Core\\Cache_Storage_Memcached' => COREPATH.'classes/cache/storage/memcached.php',
126
+ 'Fuel\\Core\\Cache_Storage_Redis' => COREPATH.'classes/cache/storage/redis.php',
127
+
128
+ 'Fuel\\Core\\Config' => COREPATH.'classes/config.php',
129
+ 'Fuel\\Core\\ConfigException' => COREPATH.'classes/config.php',
130
+ 'Fuel\\Core\\Config_Db' => COREPATH.'classes/config/db.php',
131
+ 'Fuel\\Core\\Config_File' => COREPATH.'classes/config/file.php',
132
+ 'Fuel\\Core\\Config_Ini' => COREPATH.'classes/config/ini.php',
133
+ 'Fuel\\Core\\Config_Json' => COREPATH.'classes/config/json.php',
134
+ 'Fuel\\Core\\Config_Interface' => COREPATH.'classes/config/interface.php',
135
+ 'Fuel\\Core\\Config_Php' => COREPATH.'classes/config/php.php',
136
+ 'Fuel\\Core\\Config_Yml' => COREPATH.'classes/config/yml.php',
137
+
138
+ 'Fuel\\Core\\Controller' => COREPATH.'classes/controller.php',
139
+ 'Fuel\\Core\\Controller_Rest' => COREPATH.'classes/controller/rest.php',
140
+ 'Fuel\\Core\\Controller_Template' => COREPATH.'classes/controller/template.php',
141
+ 'Fuel\\Core\\Controller_Hybrid' => COREPATH.'classes/controller/hybrid.php',
142
+
143
+ 'Fuel\\Core\\Cookie' => COREPATH.'classes/cookie.php',
144
+
145
+ 'Fuel\\Core\\DB' => COREPATH.'classes/db.php',
146
+ 'Fuel\\Core\\DBUtil' => COREPATH.'classes/dbutil.php',
147
+
148
+ 'Fuel\\Core\\Database_Connection' => COREPATH.'classes/database/connection.php',
149
+ 'Fuel\\Core\\Database_Exception' => COREPATH.'classes/database/exception.php',
150
+ 'Fuel\\Core\\Database_Expression' => COREPATH.'classes/database/expression.php',
151
+ 'Fuel\\Core\\Database_Pdo_Connection' => COREPATH.'classes/database/pdo/connection.php',
152
+ 'Fuel\\Core\\Database_Query' => COREPATH.'classes/database/query.php',
153
+ 'Fuel\\Core\\Database_Query_Builder' => COREPATH.'classes/database/query/builder.php',
154
+ 'Fuel\\Core\\Database_Query_Builder_Insert' => COREPATH.'classes/database/query/builder/insert.php',
155
+ 'Fuel\\Core\\Database_Query_Builder_Delete' => COREPATH.'classes/database/query/builder/delete.php',
156
+ 'Fuel\\Core\\Database_Query_Builder_Update' => COREPATH.'classes/database/query/builder/update.php',
157
+ 'Fuel\\Core\\Database_Query_Builder_Select' => COREPATH.'classes/database/query/builder/select.php',
158
+ 'Fuel\\Core\\Database_Query_Builder_Where' => COREPATH.'classes/database/query/builder/where.php',
159
+ 'Fuel\\Core\\Database_Query_Builder_Join' => COREPATH.'classes/database/query/builder/join.php',
160
+ 'Fuel\\Core\\Database_Result' => COREPATH.'classes/database/result.php',
161
+ 'Fuel\\Core\\Database_Result_Cached' => COREPATH.'classes/database/result/cached.php',
162
+ 'Fuel\\Core\\Database_Mysql_Connection' => COREPATH.'classes/database/mysql/connection.php',
163
+ 'Fuel\\Core\\Database_MySQL_Result' => COREPATH.'classes/database/mysql/result.php',
164
+ 'Fuel\\Core\\Database_Mysqli_Connection' => COREPATH.'classes/database/mysqli/connection.php',
165
+ 'Fuel\\Core\\Database_MySQLi_Result' => COREPATH.'classes/database/mysqli/result.php',
166
+
167
+ 'Fuel\\Core\\Fuel' => COREPATH.'classes/fuel.php',
168
+ 'Fuel\\Core\\FuelException' => COREPATH.'classes/fuel.php',
169
+
170
+ 'Fuel\\Core\\Finder' => COREPATH.'classes/finder.php',
171
+
172
+ 'Fuel\\Core\\Date' => COREPATH.'classes/date.php',
173
+
174
+ 'Fuel\\Core\\Debug' => COREPATH.'classes/debug.php',
175
+
176
+ 'Fuel\\Core\\Cli' => COREPATH.'classes/cli.php',
177
+
178
+ 'Fuel\\Core\\Crypt' => COREPATH.'classes/crypt.php',
179
+
180
+ 'Fuel\\Core\\Event' => COREPATH.'classes/event.php',
181
+ 'Fuel\\Core\\Event_Instance' => COREPATH.'classes/event/instance.php',
182
+
183
+ 'Fuel\\Core\\Error' => COREPATH.'classes/error.php',
184
+ 'Fuel\\Core\\PhpErrorException' => COREPATH.'classes/error.php',
185
+
186
+ 'Fuel\\Core\\Format' => COREPATH.'classes/format.php',
187
+
188
+ 'Fuel\\Core\\Fieldset' => COREPATH.'classes/fieldset.php',
189
+ 'Fuel\\Core\\Fieldset_Field' => COREPATH.'classes/fieldset/field.php',
190
+
191
+ 'Fuel\\Core\\File' => COREPATH.'classes/file.php',
192
+ 'Fuel\\Core\\FileAccessException' => COREPATH.'classes/file.php',
193
+ 'Fuel\\Core\\OutsideAreaException' => COREPATH.'classes/file.php',
194
+ 'Fuel\\Core\\InvalidPathException' => COREPATH.'classes/file.php',
195
+ 'Fuel\\Core\\File_Area' => COREPATH.'classes/file/area.php',
196
+ 'Fuel\\Core\\File_Handler_File' => COREPATH.'classes/file/handler/file.php',
197
+ 'Fuel\\Core\\File_Handler_Directory' => COREPATH.'classes/file/handler/directory.php',
198
+
199
+ 'Fuel\\Core\\Form' => COREPATH.'classes/form.php',
200
+ 'Fuel\\Core\\Form_Instance' => COREPATH.'classes/form/instance.php',
201
+
202
+ 'Fuel\\Core\\Ftp' => COREPATH.'classes/ftp.php',
203
+ 'Fuel\\Core\\FtpConnectionException' => COREPATH.'classes/ftp.php',
204
+ 'Fuel\\Core\\FtpFileAccessException' => COREPATH.'classes/ftp.php',
205
+
206
+ 'Fuel\\Core\\HttpException' => COREPATH.'classes/httpexception.php',
207
+ 'Fuel\\Core\\HttpNotFoundException' => COREPATH.'classes/httpexceptions.php',
208
+ 'Fuel\\Core\\HttpServerErrorException' => COREPATH.'classes/httpexceptions.php',
209
+
210
+ 'Fuel\\Core\\Html' => COREPATH.'classes/html.php',
211
+
212
+ 'Fuel\\Core\\Image' => COREPATH.'classes/image.php',
213
+ 'Fuel\\Core\\Image_Driver' => COREPATH.'classes/image/driver.php',
214
+ 'Fuel\\Core\\Image_Gd' => COREPATH.'classes/image/gd.php',
215
+ 'Fuel\\Core\\Image_Imagemagick' => COREPATH.'classes/image/imagemagick.php',
216
+ 'Fuel\\Core\\Image_Imagick' => COREPATH.'classes/image/imagick.php',
217
+
218
+ 'Fuel\\Core\\Inflector' => COREPATH.'classes/inflector.php',
219
+
220
+ 'Fuel\\Core\\Input' => COREPATH.'classes/input.php',
221
+
222
+ 'Fuel\\Core\\Lang' => COREPATH.'classes/lang.php',
223
+ 'Fuel\\Core\\LangException' => COREPATH.'classes/lang.php',
224
+ 'Fuel\\Core\\Lang_Db' => COREPATH.'classes/lang/db.php',
225
+ 'Fuel\\Core\\Lang_File' => COREPATH.'classes/lang/file.php',
226
+ 'Fuel\\Core\\Lang_Ini' => COREPATH.'classes/lang/ini.php',
227
+ 'Fuel\\Core\\Lang_Json' => COREPATH.'classes/lang/json.php',
228
+ 'Fuel\\Core\\Lang_Interface' => COREPATH.'classes/lang/interface.php',
229
+ 'Fuel\\Core\\Lang_Php' => COREPATH.'classes/lang/php.php',
230
+ 'Fuel\\Core\\Lang_Yml' => COREPATH.'classes/lang/yml.php',
231
+
232
+ 'Fuel\\Core\\Log' => COREPATH.'classes/log.php',
233
+
234
+ 'Fuel\\Core\\Markdown' => COREPATH.'classes/markdown.php',
235
+
236
+ 'Fuel\\Core\\Migrate' => COREPATH.'classes/migrate.php',
237
+
238
+ 'Fuel\\Core\\Model' => COREPATH.'classes/model.php',
239
+ 'Fuel\\Core\\Model_Crud' => COREPATH.'classes/model/crud.php',
240
+
241
+ 'Fuel\\Core\\Module' => COREPATH.'classes/module.php',
242
+ 'Fuel\\Core\\ModuleNotFoundException' => COREPATH.'classes/module.php',
243
+
244
+ 'Fuel\\Core\\Mongo_Db' => COREPATH.'classes/mongo/db.php',
245
+ 'Fuel\\Core\\Mongo_DbException' => COREPATH.'classes/mongo/db.php',
246
+
247
+ 'Fuel\\Core\\Output' => COREPATH.'classes/output.php',
248
+
249
+ 'Fuel\\Core\\Package' => COREPATH.'classes/package.php',
250
+ 'Fuel\\Core\\PackageNotFoundException' => COREPATH.'classes/package.php',
251
+
252
+ 'Fuel\\Core\\Pagination' => COREPATH.'classes/pagination.php',
253
+
254
+ 'Fuel\\Core\\Profiler' => COREPATH.'classes/profiler.php',
255
+
256
+ 'Fuel\\Core\\Request' => COREPATH.'classes/request.php',
257
+ 'Fuel\\Core\\Request_Driver' => COREPATH.'classes/request/driver.php',
258
+ 'Fuel\\Core\\RequestException' => COREPATH.'classes/request/driver.php',
259
+ 'Fuel\\Core\\RequestStatusException' => COREPATH.'classes/request/driver.php',
260
+ 'Fuel\\Core\\Request_Curl' => COREPATH.'classes/request/curl.php',
261
+ 'Fuel\\Core\\Request_Soap' => COREPATH.'classes/request/soap.php',
262
+
263
+ 'Fuel\\Core\\Redis_Db' => COREPATH.'classes/redis/db.php',
264
+ 'Fuel\\Core\\RedisException' => COREPATH.'classes/redis/db.php',
265
+
266
+ 'Fuel\\Core\\Response' => COREPATH.'classes/response.php',
267
+
268
+ 'Fuel\\Core\\Route' => COREPATH.'classes/route.php',
269
+ 'Fuel\\Core\\Router' => COREPATH.'classes/router.php',
270
+
271
+ 'Fuel\\Core\\Security' => COREPATH.'classes/security.php',
272
+ 'Fuel\\Core\\SecurityException' => COREPATH.'classes/security.php',
273
+
274
+ 'Fuel\\Core\\Session' => COREPATH.'classes/session.php',
275
+ 'Fuel\\Core\\Session_Driver' => COREPATH.'classes/session/driver.php',
276
+ 'Fuel\\Core\\Session_Db' => COREPATH.'classes/session/db.php',
277
+ 'Fuel\\Core\\Session_Cookie' => COREPATH.'classes/session/cookie.php',
278
+ 'Fuel\\Core\\Session_File' => COREPATH.'classes/session/file.php',
279
+ 'Fuel\\Core\\Session_Memcached' => COREPATH.'classes/session/memcached.php',
280
+ 'Fuel\\Core\\Session_Redis' => COREPATH.'classes/session/redis.php',
281
+ 'Fuel\\Core\\Session_Exception' => COREPATH.'classes/session/exception.php',
282
+
283
+ 'Fuel\\Core\\Num' => COREPATH.'classes/num.php',
284
+
285
+ 'Fuel\\Core\\Str' => COREPATH.'classes/str.php',
286
+
287
+ 'Fuel\\Core\\TestCase' => COREPATH.'classes/testcase.php',
288
+
289
+ 'Fuel\\Core\\Theme' => COREPATH.'classes/theme.php',
290
+ 'Fuel\\Core\\ThemeException' => COREPATH.'classes/theme.php',
291
+
292
+ 'Fuel\\Core\\Uri' => COREPATH.'classes/uri.php',
293
+
294
+ 'Fuel\\Core\\Unzip' => COREPATH.'classes/unzip.php',
295
+
296
+ 'Fuel\\Core\\Upload' => COREPATH.'classes/upload.php',
297
+
298
+ 'Fuel\\Core\\Validation' => COREPATH.'classes/validation.php',
299
+ 'Fuel\\Core\\Validation_Error' => COREPATH.'classes/validation/error.php',
300
+
301
+ 'Fuel\\Core\\View' => COREPATH.'classes/view.php',
302
+ 'Fuel\\Core\\ViewModel' => COREPATH.'classes/viewmodel.php',
303
+ ));
304
+ };
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/bootstrap_phpunit.php ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Set error reporting and display errors settings. You will want to change these when in production.
5
+ */
6
+ error_reporting(E_ALL);
7
+ ini_set('display_errors', 1);
8
+
9
+ $app_path = rtrim($_SERVER['app_path'], '/').'/';
10
+ $package_path = rtrim($_SERVER['package_path'], '/').'/';
11
+ $vendor_path = rtrim($_SERVER['vendor_path'], '/').'/';
12
+ $core_path = rtrim($_SERVER['core_path'], '/').'/';
13
+
14
+ /**
15
+ * Website docroot
16
+ */
17
+ define('DOCROOT', realpath(__DIR__.DIRECTORY_SEPARATOR.$_SERVER['doc_root']).DIRECTORY_SEPARATOR);
18
+
19
+ ( ! is_dir($app_path) and is_dir(DOCROOT.$app_path)) and $app_path = DOCROOT.$app_path;
20
+ ( ! is_dir($core_path) and is_dir(DOCROOT.$core_path)) and $core_path = DOCROOT.$core_path;
21
+ ( ! is_dir($vendor_path) and is_dir(DOCROOT.$vendor_path)) and $vendor_path = DOCROOT.$vendor_path;
22
+ ( ! is_dir($package_path) and is_dir(DOCROOT.$package_path)) and $package_path = DOCROOT.$package_path;
23
+
24
+ define('APPPATH', realpath($app_path).DIRECTORY_SEPARATOR);
25
+ define('PKGPATH', realpath($package_path).DIRECTORY_SEPARATOR);
26
+ define('VENDORPATH', realpath($vendor_path).DIRECTORY_SEPARATOR);
27
+ define('COREPATH', realpath($core_path).DIRECTORY_SEPARATOR);
28
+
29
+ unset($app_path, $core_path, $package_path, $_SERVER['app_path'], $_SERVER['core_path'], $_SERVER['package_path']);
30
+
31
+ // Get the start time and memory for use later
32
+ defined('FUEL_START_TIME') or define('FUEL_START_TIME', microtime(true));
33
+ defined('FUEL_START_MEM') or define('FUEL_START_MEM', memory_get_usage());
34
+
35
+ // Boot the app
36
+ require_once APPPATH.'bootstrap.php';
37
+
38
+ // Set test mode
39
+ Fuel::$is_test = true;
40
+
41
+ // Import the TestCase class
42
+ import('testcase');
benchmark/NYU_CTF_Bench/development/2013/CSAW-Finals/web/historypeats/csaw/fuel/core/phpunit.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+
3
+ <phpunit colors="true" stopOnFailure="false" bootstrap="../core/bootstrap_phpunit.php">
4
+ <php>
5
+ <server name="doc_root" value="../../"/>
6
+ <server name="app_path" value="fuel/app"/>
7
+ <server name="core_path" value="fuel/core"/>
8
+ <server name="package_path" value="fuel/packages"/>
9
+ <server name="vendor_path" value="fuel/vendor"/>
10
+ <server name="FUEL_ENV" value="test"/>
11
+ </php>
12
+ <testsuites>
13
+ <testsuite name="core">
14
+ <directory suffix=".php">../core/tests</directory>
15
+ </testsuite>
16
+ <testsuite name="packages">
17
+ <directory suffix=".php">../packages/*/tests</directory>
18
+ </testsuite>
19
+ <testsuite name="app">
20
+ <directory suffix=".php">../app/tests</directory>
21
+ </testsuite>
22
+ </testsuites>
23
+ </phpunit>