-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase_api_controller.php
executable file
·50 lines (44 loc) · 1.06 KB
/
base_api_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
<?
class base_api_controller
{
public $controller;
public $action;
public function __construct()
{
}
public function __call($action, $no_args_will_be_here)
{
// If we get to this point, the controller either doesn't exist or this method didn't exist within the controller
// So, now we are just calling model w/ the same name as the controller...
// and the method as the name of the action
$model = $this->controller;
$params = globals::POSTGET();
foreach($params as $var => $val)
{
if($var[0] == "_")
{
unset($params[$var]);
}
}
$this->data = $model::$action($params);
if($this->data === FALSE)
{
$this->error = $model::get_errors();
if(is_array($this->error))
{
$this->error = array_shift($this->error);
}
}
else
{
$this->success = 1;
}
}
public function _error()
{
}
public function _auth()
{
}
}
?>