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