File: Rest_api.php

package info (click to toggle)
kalkun 0.8.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 7,340 kB
  • sloc: php: 30,659; javascript: 30,443; sql: 961; sh: 766; xml: 105; makefile: 40
file content (55 lines) | stat: -rw-r--r-- 1,262 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
<?php
/**
 * Kalkun
 * An open source web based SMS Management
 *
 * @package		Kalkun
 * @author		Kalkun Dev Team
 * @license		https://spdx.org/licenses/GPL-2.0-or-later.html
 * @link		https://kalkun.sourceforge.io/
 */

// ------------------------------------------------------------------------

/**
 * REST API Class
 *
 * @package		Kalkun
 * @subpackage	Plugin
 * @category	Controllers
 */
include_once(APPPATH.'plugins/rest_api/libraries/RestController.php');

class Rest_api extends RestController {

	function __construct()
	{
		parent::__construct();
	}

	/**
	* Send SMS using GET method
	*
	* Sample call:
	* http://kalkun-url/index.php/plugin/rest_api/send_sms?phoneNumber=%2B123456&message=testing
	*
	*/
	function send_sms_get()
	{
		$this->load->model(array('Kalkun_model', 'Message_model'));

		$data['class'] = '1';
		$data['dest'] = $this->get('phoneNumber');
		$data['date'] = date('Y-m-d H:i:s');
		$data['message'] = $this->get('message');
		$data['delivery_report'] = 'default';
		$data['SenderID'] = ($this->get('SenderID')) ? $this->get('SenderID') : NULL;
		$data['uid'] = 1;

		$sms = $this->Message_model->send_messages($data);
		$sms['phoneNumber'] = $data['dest'];
		$sms['message'] = $data['message'];

		$this->response($sms);
	}
}