-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathnotify_controller.php
More file actions
41 lines (29 loc) · 1.06 KB
/
notify_controller.php
File metadata and controls
41 lines (29 loc) · 1.06 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
<?php
/*
All Emoncms code is released under the GNU Affero General Public License.
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 notify_controller()
{
global $route, $session, $mysqli;
$result = false;
include "Modules/notify/notify_model.php";
$notify = new Notify($mysqli);
if ($route->format == 'html')
{
if ($session['write']) $result = view("Modules/notify/notify_view.php",array());
}
if ($route->format == 'json')
{
if ($session['write'] && $route->action=='status') $result = $notify->status($session['userid']);
if ($session['write'] && $route->action=='enable') $result = $notify->enable($session['userid'],get('email'));
if ($session['write'] && $route->action=='disable') $result = $notify->disable($session['userid']);
}
return array('content'=>$result);
}