forked from munkireport/applications
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplications_controller.php
More file actions
70 lines (57 loc) · 1.62 KB
/
applications_controller.php
File metadata and controls
70 lines (57 loc) · 1.62 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Applicatoins module class
*
* @package munkireport
* @author tuxudo
**/
class Applications_controller extends Module_controller
{
/*** Protect methods with auth! ****/
function __construct()
{
// Store module path
$this->module_path = dirname(__FILE__);
}
/**
* Default method
* @author tuxudo
*
**/
function index()
{
echo "You've loaded the applications module!";
}
/**
* Retrieve data in json format
*
**/
public function get_data($serial_number = '')
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => 'Not authorized'));
}
$queryobj = new Applications_model();
$sql = "SELECT name, path, lastModified, obtained_from, runtime_environment, version, info, signed_by, has64BitIntelCode
FROM applications
WHERE serial_number = '$serial_number'";
$applications_tab = $queryobj->query($sql);
$applications = new Applications_model;
$obj->view('json', array('msg' => current(array('msg' => $applications_tab))));
}
/**
* Retrieve data in json format for widget
*
**/
public function get_32_bit_apps()
{
$obj = new View();
if (! $this->authorized()) {
$obj->view('json', array('msg' => array('error' => 'Not authenticated')));
return;
}
$apps_32 = new Applications_model;
$obj->view('json', array('msg' => $apps_32->get_32_bit_apps()));
}
} // END class Applications_controller