1 | <?php |
---|
2 | if(!isset($GLOBALS['phpgw_info'])){ |
---|
3 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
4 | 'currentapp' => 'expressoAdmin1_2', |
---|
5 | 'nonavbar' => true, |
---|
6 | 'noheader' => true |
---|
7 | ); |
---|
8 | } |
---|
9 | require_once '../header.session.inc.php'; |
---|
10 | require_once '../services/class.servicelocator.php'; |
---|
11 | |
---|
12 | // Explode action from cExecuteForm function |
---|
13 | $cExecuteFormReturn = false; |
---|
14 | if($_POST['_action']) { |
---|
15 | if($_FILES) { |
---|
16 | $count_files = $_POST['countFiles']; |
---|
17 | $array_files = array(); |
---|
18 | for($idx = 1; $idx <= $count_files; $idx++) { |
---|
19 | if($_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error']) |
---|
20 | $array_files[] = $_FILES['file_'.$idx]; |
---|
21 | } |
---|
22 | $_POST['FILES'] = $array_files; |
---|
23 | } |
---|
24 | list($app,$class,$method) = explode('.',@$_POST['_action']); |
---|
25 | $cExecuteFormReturn = true; |
---|
26 | } |
---|
27 | // Explode action from cExecute function |
---|
28 | else if($_GET['action']) |
---|
29 | list($app,$class,$method) = explode('.',@$_GET['action']); |
---|
30 | // NO ACTION |
---|
31 | else |
---|
32 | return $_SESSION['response'] = 'false'; |
---|
33 | |
---|
34 | // Load dinamically class file. |
---|
35 | if($app == '$this') |
---|
36 | $filename = 'inc/class.'.$class.'.inc.php'; |
---|
37 | else if( strpos($app, '$this/') !== false) |
---|
38 | { |
---|
39 | $filename = str_replace('$this/','',$app) . '.php'; |
---|
40 | include_once($filename); |
---|
41 | exit; |
---|
42 | } |
---|
43 | else |
---|
44 | $filename = '../'.$app.'/inc/class.'.$class.'.inc.php'; |
---|
45 | |
---|
46 | include_once($filename); |
---|
47 | |
---|
48 | // Create new Object (class loaded). |
---|
49 | $obj = new $class; |
---|
50 | |
---|
51 | // Prepare parameters for execution. |
---|
52 | $params = array(); |
---|
53 | |
---|
54 | // If array $_POST is not null , the submit method is POST. |
---|
55 | if($_POST) { |
---|
56 | $params = $_POST; |
---|
57 | } |
---|
58 | // If array $_POST is null , and the array $_GET > 1, the submit method is GET. |
---|
59 | else if(count($_GET) > 1) { |
---|
60 | array_shift($_GET); |
---|
61 | $params = $_GET; |
---|
62 | } |
---|
63 | |
---|
64 | $result = array(); |
---|
65 | |
---|
66 | |
---|
67 | // if params is not empty, then class method with parameters. |
---|
68 | if($params) |
---|
69 | $result = $obj -> $method($params); |
---|
70 | else |
---|
71 | $result = $obj -> $method(); |
---|
72 | |
---|
73 | // Return result serialized. |
---|
74 | |
---|
75 | |
---|
76 | if(!$cExecuteFormReturn) |
---|
77 | echo serialize($result); |
---|
78 | else |
---|
79 | $_SESSION['response'] = $result; |
---|
80 | ?> |
---|