source: trunk/expressoMail1_2/controller.php @ 1036

Revision 1036, 1.8 KB checked in by amuller, 15 years ago (diff)

Ticket #559 - Atualização de segurança

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        $GLOBALS['phpgw_info']['flags'] = array(
3                'currentapp' => 'expressoMail1_2',
4                'nonavbar'   => true,
5                'noheader'   => true
6        );
7
8        require_once $_SERVER[ 'DOCUMENT_ROOT' ] . '/header.inc.php';
9
10        //      Explode action from cExecuteForm function
11        $cExecuteFormReturn = false;
12        if($_POST['_action']) {                 
13                if($_FILES) {
14                        $count_files = $_POST['countFiles'];
15                        $array_files = array();                 
16                        for($idx = 1; $idx <= $count_files; $idx++) {           
17                                if($_FILES['file_'.$idx] && !$_FILES['file_'.$idx]['error'])
18                                        $array_files[] = $_FILES['file_'.$idx];                                         
19                        }
20                        $_POST['FILES'] = $array_files;
21                }                               
22                list($app,$class,$method) = explode('.',@$_POST['_action']);
23                $cExecuteFormReturn = true;
24        }
25        //      Explode action from cExecute function
26        else if($_GET['action'])
27                list($app,$class,$method) = explode('.',@$_GET['action']);
28        // NO ACTION
29        else
30                return $_SESSION['response'] = 'Post-Content-Length';
31       
32        // Load dinamically class file.
33        if($app == '$this')
34                $filename = 'inc/class.'.$class.'.inc.php';
35        else
36                $filename = '../'.$app.'/inc/class.'.$class.'.inc.php';
37               
38        include_once($filename);       
39       
40        // Create new Object  (class loaded).   
41        $obj = new $class;
42       
43        // Prepare parameters for execution.   
44        $params = array();
45       
46        // If array $_POST is not null , the submit method is POST.
47        if($_POST) {
48                $params = $_POST;
49        }
50        // If array $_POST is null , and the array $_GET > 1, the submit method is GET.
51        else if(count($_GET) > 1)       {               
52                array_shift($_GET);
53                $params = $_GET;
54        }
55
56        $result = array();
57       
58       
59        // if params is not empty, then class method with parameters.   
60        if($params)
61                $result = $obj -> $method($params);
62        else           
63                $result = $obj -> $method();
64               
65        // Return result serialized.   
66       
67
68        if(!$cExecuteFormReturn)
69                echo serialize($result);
70        else
71                $_SESSION['response'] = $result;
72?>
Note: See TracBrowser for help on using the repository browser.