forked from openenergymonitor/emoncms3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multigraph_controller.php
39 lines (30 loc) · 956 Bytes
/
multigraph_controller.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
<?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
*/
// no direct access
defined('EMONCMS_EXEC') or die('Restricted access');
function multigraph_controller()
{
require "Models/multigraph_model.php";
global $action, $format, $session;
$output['content'] = "";
$output['message'] = "";
if ($action == "save" && $session['write'])
{
$output['message'] = "saving";
$json = preg_replace('/[^\w\s-.?@%&:[]{},]/','',$_POST['data']);
set_multigraph($session['userid'], $json);
}
elseif ($action == "get" && $session['read'])
{
$output['content'] = get_multigraph($session['userid']);
}
return $output;
}
?>