forked from trunet/emoncms2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
50 lines (38 loc) · 1.3 KB
/
index.php
File metadata and controls
50 lines (38 loc) · 1.3 KB
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
47
48
49
50
<?php
/*
All Emoncms code is released under the GNU General Public License v3.
See COPYRIGHT.txt and LICENSE.txt.
---------------------------------------------------------------------
Emoncms - open source energy visualisation
Part of the OpenEnergyMonitor project:
http://openenergymonitor.org
Author: Trystan Lea: trystan.lea@googlemail.com
If you have any questions please get in touch, try the forums here:
http://openenergymonitor.org/emon/forum
*/
session_start();
//error_reporting(E_ALL);
ini_set('display_errors','on');
$path = dirname("http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'])."/";
require "Includes/core.inc.php";
require "Includes/db.php";
require "Models/user_model.php";
$args = explode('/', $_GET['q']);
if (!$args[0]) $args[0] = "home";
$e = db_connect();
if ($e == 2) {echo "no settings.php"; die;}
if ($e == 3) {echo "db settings error"; die;}
if ($e == 4) require "Includes/setup.php";
if ($args[0]=='api')
{
print controller('api');
}
else
{
$user = controller('user_block');
$menu = controller('menu_block');
$content = controller($args[0]);
if (!$content) $content = "no content";
print view("theme/theme.php", array('menu' => $menu, 'user' => $user, 'content' => $content));
}
?>