File: Soap_model.php

package info (click to toggle)
kalkun 0.8.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,340 kB
  • sloc: php: 30,659; javascript: 30,443; sql: 961; sh: 766; xml: 105; makefile: 41
file content (58 lines) | stat: -rw-r--r-- 1,447 bytes parent folder | download | duplicates (2)
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
<?php
Class Soap_model extends CI_Model {

	function getRemoteAccess($option = NULL, $limit = NULL, $offset = NULL)
	{
		switch ($option)
		{
			case 'active':
				$this->db->where('status', 'true');
				return $this->db->get('plugin_remote_access');
			break;

			case 'paginate':
				return $this->db->get('plugin_remote_access', $limit, $offset);
			break;

			case 'count':
				$this->db->select('count(*) as count');
				return $this->db->get('plugin_remote_access')->row('count');
			break;
		}
	}

	function addRemoteAccess()
	{
		$data = array (
			'access_name' => $this->input->post('access_name'),
			'ip_address' => $this->input->post('ip_address'),
			'token' => bin2hex(random_bytes(32)),
		);
		$this->db->insert('plugin_remote_access', $data);
	}

	function updateRemoteAccess()
	{
		$status = ($this->input->post('editstatus') === 'on') ? 'true' : 'false';
		$data = array (
			'access_name' => $this->input->post('editaccess_name'),
			'ip_address' => $this->input->post('editip_address'),
			'status' => $status
		);
		$this->db->where('id_remote_access', $this->input->post('editid_remote_access'));
		$this->db->update('plugin_remote_access', $data);
	}

	function delRemoteAccess($id)
	{
		$this->db->delete('plugin_remote_access', array('id_remote_access' => $id));
	}

	function addNotification()
	{
		$nr = ($this->input->post('notifynumber'));
		$value = ($this->input->post('notifyvalue'));

		//TODO - save notify
	}
}