-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathextensions_controller.php
95 lines (78 loc) · 2.24 KB
/
extensions_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* extensions module class
*
* @package munkireport
* @author tuxudo
**/
class Extensions_controller extends Module_controller
{
/*** Protect methods with auth! ****/
function __construct()
{
// Store module path
$this->module_path = dirname(__FILE__);
}
/**
* Default method
*
**/
function index()
{
echo "You've loaded the extensions module!";
}
/**
* Get extension bundle ID for widget
*
* @return void
* @author tuxudo
**/
public function get_bundle_ids()
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => array('error' => 'Not authenticated')));
return;
}
$extension = new Extensions_model;
$obj->view('json', array('msg' => $extension->get_bundle_ids()));
}
public function get_developer()
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => array('error' => 'Not authenticated')));
return;
}
$extension = new Extensions_model;
$obj->view('json', array('msg' => $extension->get_developer()));
}
public function get_teamid()
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => array('error' => 'Not authenticated')));
return;
}
$extension = new Extensions_model;
$obj->view('json', array('msg' => $extension->get_teamid()));
}
/**
* Retrieve data in json format
*
**/
public function get_data($serial_number = '')
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => 'Not authorized'));
return;
}
$queryobj = new Extensions_model();
$sql = "SELECT name, bundle_id, version, path, developer, teamid, executable
FROM extensions
WHERE serial_number = '$serial_number'";
$extensions_tab = $queryobj->query($sql);
$obj->view('json', array('msg' => current(array('msg' => $extensions_tab))));
}
} // END class Extensions_controller