-
Notifications
You must be signed in to change notification settings - Fork 316
/
index.php
executable file
·46 lines (39 loc) · 1.07 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/**
* This is the main loader and controller init script for the Anemometer project
* It just loads the config, creates a controller and invokes it. See
* lib/Anemometer.php for the main project code.
* @author Gavin Towey <gavin@box.com>, Geoffrey Anderson <ganderson@box.com>
* @created 2012-01-01
* @license Apache 2.0 license. See LICENSE document for more info
**/
// Ensure we're on php 5.3 or newer
if (strnatcmp(phpversion(), '5.3') < 0) {
print "Anemometer requires PHP 5.3 or newer. You have ".phpversion();
die();
}
if (!function_exists('bcadd')) {
print "Anemometer requires the BCMath extension";
die();
}
set_include_path( get_include_path() . PATH_SEPARATOR . "./lib");
require "Helpers.php";
require "Anemometer.php";
error_reporting(E_ALL);
$action = isset($_GET['action']) ? $_GET['action'] : 'index';
$conf = array();
@include "conf/config.inc.php";
if (empty($conf))
{
$action = 'noconfig';
}
$controller = new Anemometer($conf);
if (is_callable(array($controller, $action )))
{
$controller->$action();
}
else
{
print "Invalid action ($action)";
}
?>