-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstallhistory_controller.php
42 lines (38 loc) · 1.31 KB
/
installhistory_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
<?php
class Installhistory_controller extends Module_controller
{
// Require authentication
public function __construct()
{
// Store module path
$this->module_path = dirname(__FILE__) .'/';
$this->view_path = $this->module_path . 'views/';
if (! $this->authorized()) {
redirect('auth/login');
}
}
public function get_apple_data($serial_number = '')
{
$obj = new View();
$obj->view('json', array('msg' => $this->_get_data($serial_number, 'apple')));
}
public function get_third_party_data($serial_number = '')
{
$obj = new View();
$obj->view('json', array('msg' => $this->_get_data($serial_number, 'third_party')));
}
private function _get_data($serial_number = '', $what = 'apple')
{
$where = [['installhistory.serial_number', $serial_number]];
if($what == 'apple'){
$where[] = ['installhistory.packageIdentifiers', 'LIKE', 'com.apple.%'];
}else{
$where[] = ['installhistory.packageIdentifiers', 'NOT LIKE', 'com.apple.%'];
}
return Installhistory_model::select('displayName', 'displayVersion', 'packageIdentifiers', 'date', 'processName')
->where($where)
->filter()
->get()
->toArray();
}
}